From patchwork Tue Jun 13 21:54:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 10729 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp846530vqr; Tue, 13 Jun 2023 14:58:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5HajEpNOKdeDHT3jqYLefvJm7zNC6oGP82mQi5N+fXTr7hs6Q/up9KupuvV/o9wl3c1f0W X-Received: by 2002:a17:907:928a:b0:973:940e:a01d with SMTP id bw10-20020a170907928a00b00973940ea01dmr15330108ejc.67.1686693513614; Tue, 13 Jun 2023 14:58:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686693513; cv=pass; d=google.com; s=arc-20160816; b=B7yEm7umZWId2n3YIVFW7Y8urOOd/HNqUX2XxXZdTIENACyu0UyX6ROdEQbx+3tUxb oKEKuhTLG0lCkxnoKJ4NW+7QwYea/t6aCf/bdqDqMLyhxGpk3c6wiqxT1OS68tvEcqsw m40CykeClhO3opvrBAWvO6FfKdQ0fr485r9f26hy/Avqwm3yJEIC1J//mhrydYNJ0GrZ IT8Ktw+G4I+J8DUB1zLb4xsqg+xoNDdu9CIEa4lbi7PVEwTUjrHUo1IBI1f/UkZ/WxI9 7GUvhWO+HYBld2vrhf1cHeq12A82wHjHBRO0KwqthAN83gEt+FOp9kkf+l+14SfvP6UO 2Tgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=1s3X56HaGVXHVNIT5AVnfdlfDvymYHNfKJ3qdeDdAUc=; b=XGCLnE2PDXB1ohpVJy1Ky92KFjeoKQ7qYFw2Yjv+vUU5e8SEtSOeqlLmevuWIWHUX4 bNC7VsOXAVmopOpSVoi7QK7RaHIeyKRuykqlgkXyJfgSH+4v9abOxSrR48RtZHSuq6ba ZxSXySaq9Yu4Wb7Pd5cKRlWoxujtpWLvZV8iShTUoU+wE45/mDbjmk8y6xlse5e/J9bU DpMgv6l1SKWlFy5+mbxAFgF5P4VjUSs5LJBtw7DJsp1H41UGeDQlxiaJ5rovAPI6hFbJ lmjAQdD38hMn6gjB2n+0ciWtvwTbUvVFbi2LyE+Bnlmvz+xTG/xWkA1xqSrbCGE6s8Gf KIYw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=fePOgM2b; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a17090655ca00b00977d77ce241si6964743ejp.265.2023.06.13.14.58.08; Tue, 13 Jun 2023 14:58:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=fePOgM2b; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240854AbjFMVzZ (ORCPT + 99 others); Tue, 13 Jun 2023 17:55:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240412AbjFMVzJ (ORCPT ); Tue, 13 Jun 2023 17:55:09 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EB131BF4; Tue, 13 Jun 2023 14:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E947hhT7t5i88vVy7F6nA7F5BRM/o2mXW4iFfEkmpzooxKoOXbkUwyq7cyPHgMgY4IG4c46nTmU6BrWZXQxbRVz2VDu8TxEIEzNPP+xfHtBwpHZFeidZL7s5/URMdzwDjN6kcMoDPEFXDVpmigc+QElJ1fpszonumsrlv7yyad35ocPYhElI69xpvs/iLtj6yDTDUidH8HHk+ijFIP4ei+YJrH8lTN4f/zFjNfArKAunGlEJwf9PX6L0fRvc8V+IklM9KnEGIuCwHmdojIjZLuuIdnUTPKcREPXfOfie38+1JQYdTu0SSLrjSYe4Ke2p/kEESQU8Tl5sKF8HtJuGPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1s3X56HaGVXHVNIT5AVnfdlfDvymYHNfKJ3qdeDdAUc=; b=l7MbfU8hqzyt8QAzynm62tQ1dF/UZkTHI5gbPfP3A0MQtq9WN4ndD5kUiLv85+kGV5UwFVE8+iL3kr1cIaJDtIAAtT3nqUcoCKiOFL7LPajlQU103xa+5TIZfaFX8a/wa7m/eIpmKcBTHSWDn3W72k2NBCRWnLMHLCQ7nqwkZVjcfqmutYTxA7d+DPTvmKSRwdsOMdDI6pjEF2/xy3V01DiS12Z9F9gHkdcSCVKQay9mQf1zkI132kpZci8PdfOPaGLhMgoNiH41CUl4h/COl9m/niWjIdEQxvaLwx4GBxU03iqfu5W9EKIJMtZrMXMjZI4btVWMgr19c5UEGa550w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1s3X56HaGVXHVNIT5AVnfdlfDvymYHNfKJ3qdeDdAUc=; b=fePOgM2bIbQtiGIIF20DzBH8Rfm6ZbQ8GlZbJFA7wIZfkZOxsU8sUXCRwtk1Iql9YVMJ/16kQYalAuZNCd5UR+Y/xHidsgjibGdEbbZktb41D82ytdLnI+dnBmhkK6N9Eqg+K3e1B8qQmGCduuEvPxY7u60bzSx/SrPCdOd58aU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM9PR04MB8081.eurprd04.prod.outlook.com (2603:10a6:20b:3e2::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Tue, 13 Jun 2023 21:54:51 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460%4]) with mapi id 15.20.6455.045; Tue, 13 Jun 2023 21:54:50 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Muhammad Husaini Zulkifli , Peilin Ye , Pedro Tammela , Richard Cochran , Zhengchao Shao , Maxim Georgiev Subject: [PATCH v2 net-next 0/9] Improve the taprio qdisc's relationship with its children Date: Wed, 14 Jun 2023 00:54:31 +0300 Message-Id: <20230613215440.2465708-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: AM0PR04CA0044.eurprd04.prod.outlook.com (2603:10a6:208:1::21) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM9PR04MB8081:EE_ X-MS-Office365-Filtering-Correlation-Id: 9755816b-6024-4c18-5063-08db6c58cfe8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5Nw9x2IDAosetVWkbgEFQ7eO3+uvLfBDWWFjs0RV7HGpSdgMvH69iypUwt/qSCjJ5xZ6IGrc7+Xc+2QT4cV8TrYG5fcmqz0h58MbDp/p3+ZQtSMxtYGyywHYsMKU6OlCz40p+tjGFUzlGL+wwiaLOcTLMok4R+8pGwB3UHnFqy6UfhQZ4IMWwv2eJxA7oHUa2969MeBbHPi86khRoMXt9fDL3wNPvrbt5VI0Czwao2ZLVr603/mfPvnOEjNeh+993ayoU4kLl2jVErdU5bdsntZUXUPzClybjJ4PHOtte8KFzuQ/UhaT5QtpZo9bxcbHMBCWNMxHmshDng1V//OAU2r17OXxmDDyYDjzqnEXFxhYQIl8KFYQhJPLNuxxpUC3eHCiJ51GGIXi0YK1D4OxFMixU2RDLrfZkuntCyJZoUYPQ6WLL8MoFAOMmLpUkLUpkYU3ktWACBTd5/bmo4P/9tXGftza4MYJjwkbdfzxNeaK6EL1IDKvwPw3CBcRWU3S7T1vvmruVCnI+YOIBCzsOBg9ZiDbr/0qkDLASCmKoB45IrRr07kyjsYdc9Qt/AqrBplDKIySRyOXSzGpJgaqEWih9/W+s9FwyOPn7MnvIfM8kOiUk4SjifGWd70PUlxyDYiIEiCLdWWpd+u/DYX3AQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(39860400002)(366004)(346002)(376002)(451199021)(6916009)(66946007)(4326008)(66556008)(36756003)(186003)(54906003)(478600001)(2616005)(2906002)(66476007)(8676002)(6666004)(316002)(966005)(41300700001)(86362001)(6486002)(7416002)(6506007)(1076003)(8936002)(44832011)(83380400001)(26005)(5660300002)(38100700002)(52116002)(38350700002)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dFCoxXf+Ma3E59fuYmYnk/mAdHtA25Tm5P+Kto1TiyEdPhkHcxoBlij3NeXH67yTzLoa7rV0cOEl7SZpv/mTnggAgRLsGNTRL6A7SfegLat9grk3CX2QaDXBX6ATGGsIWQ8nB5pdZE0hVPLJuHAJyXPHJiKYtDnnC7l93yn0/S52P5guIkX04L9uQUYLh6KTJkBzS1D9NFfEeJpcwkePucaufxmlAt8SaT9p7WDCHo0UkKPBDsCdFW4TxhGHk+K+7A/8KmXwPJA2TbFbxSYhWE61r2UjDrK073JJX4XHF+YiBWpENLvvwVIdXIkLaiBFzcERsW68Gn0QVYW7XOgcATSYiRhDWLRwGOT9dzuD6aAjRletUdX65jighmHU5+/xDMiOwPfuesYsfKzXLz2Jj/+zTn+F7VIYc5vO+yOIVjY81QNqIutexXlPmLiOfKwimwDgCMM+CCdLAzBJjWqVbYRKgDwjrDSqVIEqcXpUWVRSf2TDF9wjhokEaGO2uu3x7F4iWTecnnaZHoR9OJMQfWKK4Cejp0eqt52wTUBQ5QImlnbnLTgHKjTYRaBWX0JkVFGqhnKtgrzQ/68XrXNihTBLThW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-6024-4c18-5063-08db6c58cfe8 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 21:54:50.6709 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SjKWCsIo0WaTFD/ce5KUyiBacU90Pn4rjCZTL+GIbGf08CTak663UYZ3Ma/I7Txa+iX9MgVkrcsshGz/DHM5HQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8081 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768626337605179786?= X-GMAIL-MSGID: =?utf-8?q?1768626337605179786?= Changes in v2: It was requested to add test cases for the taprio software and offload modes. Those are patches 08 and 09. That implies adding taprio offload support to netdevsim, which is patch 07. In turn, that implies adding a PHC driver for netdevsim, which is patch 06. v1 at: https://lore.kernel.org/lkml/20230531173928.1942027-1-vladimir.oltean@nxp.com/ Original message: Prompted by Vinicius' request to consolidate some child Qdisc dereferences in taprio: https://lore.kernel.org/netdev/87edmxv7x2.fsf@intel.com/ I remembered that I had left some unfinished work in this Qdisc, namely commit af7b29b1deaa ("Revert "net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs""). This patch set represents another stab at, essentially, what's in the title. Not only does taprio not properly detect when it's grafted as a non-root qdisc, but it also returns incorrect per-class stats. Eventually, Vinicius' request is addressed too, although in a different form than the one he requested (which was purely cosmetic). Review from people more experienced with Qdiscs than me would be appreciated. I tried my best to explain what I consider to be problems. I am deliberately targeting net-next because the changes are too invasive for net - they were reverted from stable once already. Vladimir Oltean (9): net/sched: taprio: don't access q->qdiscs[] in unoffloaded mode during attach() net/sched: taprio: keep child Qdisc refcount elevated at 2 in offload mode net/sched: taprio: try again to report q->qdiscs[] to qdisc_leaf() net/sched: taprio: delete misleading comment about preallocating child qdiscs net/sched: taprio: dump class stats for the actual q->qdiscs[] net: netdevsim: create a mock-up PTP Hardware Clock driver net: netdevsim: mimic tc-taprio offload selftests/tc-testing: test that taprio can only be attached as root selftests/tc-testing: verify that a qdisc can be grafted onto a taprio class drivers/net/Kconfig | 1 + drivers/net/netdevsim/ethtool.c | 11 ++ drivers/net/netdevsim/netdev.c | 38 +++- drivers/net/netdevsim/netdevsim.h | 2 + drivers/ptp/Kconfig | 11 ++ drivers/ptp/Makefile | 1 + drivers/ptp/ptp_mock.c | 175 ++++++++++++++++++ include/linux/ptp_mock.h | 38 ++++ net/sched/sch_taprio.c | 68 ++++--- .../tc-testing/tc-tests/qdiscs/taprio.json | 98 ++++++++++ 10 files changed, 415 insertions(+), 28 deletions(-) create mode 100644 drivers/ptp/ptp_mock.c create mode 100644 include/linux/ptp_mock.h