From patchwork Tue Aug 1 18:24:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13337145 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A23CD200AC for ; Tue, 1 Aug 2023 18:24:48 +0000 (UTC) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2066.outbound.protection.outlook.com [40.107.241.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43E9CB4; Tue, 1 Aug 2023 11:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BQL9it5otOD6LhCUEfXtZbu5M9J5nreCNy+qK0bblv46SueLiGxyWoYLWLBe65sip5+iU1fBB3+Cu7Wd2gjV2wTiU/ZHZeWcnhhKwHqDMQ7eMhmg6f5FUoDwDnxcRlUotHyaJwA6cD4cQXS/XwU6REY5xDoUcPY3yWRJlwHqhFcavhXEPzXOfwLPw2tnVK6azeKjjfpJKto7mj8lSylt+r6GIUNkASjEp1vq+VVJl1JGF4aJ16T8M6JJ14THNoTn1v9/0CMVZyrCPo7nHO0Mo92+ukLYi4/r+7wyuB+MKNLEyjg23G+fJRbhfc55nFzLMEkZiwZk5WGGk35qZvJ7Aw== 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=2GBJ+rbPRsp3X/RmV5aEbScW3UBRckMkVFnhXp+Ub3A=; b=NM9TawEzTfKl3+V3w3mMyGMGrnEG3QDuURS0IF/xdGoxtj6hMMnozBTpQeKE9TknmbaygSUys81k0M4hoOpMm7F+0CNzVwjzHKruZugJRo09ajI/omh72fusyFxSzaUHMclouVvqEoeCFlMvSYsng4RcKh2jw4gxUTwaoNwwKnnj8OvbptYDXp2CTJa7ePI49Kf1cbwsVvBF9/ckPBzmXixyskEewQqzVVnWcWgtcTFjBqdc0hrp0p/CiHWnmV+rMv/3qQa1Tube5r72O4mCoWOLNVRbQI16dev6qjX9DyuUyBI0V15tnnwWeBQ0j0Xjtipi9av4bsECA1Xc+khYBA== 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=2GBJ+rbPRsp3X/RmV5aEbScW3UBRckMkVFnhXp+Ub3A=; b=X24aenr5mrNMQTn5NtyQk+nJkpH3wde4TlU9mA+xElN6Ck2WpGMti5MU1TB+Ri7Lo+ntpuPCx5alDCUcOTfng8W4MZsSU+6pEeQ2K+KM5YzF6UnlRiXoXhT1RrH+M2DlLf5x483kfjuH7r0sVADkgZRkD0EfpQhxbvZ9PeHgRDY= 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 AM7PR04MB6839.eurprd04.prod.outlook.com (2603:10a6:20b:103::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.45; Tue, 1 Aug 2023 18:24:44 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194%4]) with mapi id 15.20.6631.045; Tue, 1 Aug 2023 18:24:44 +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 v3 net-next 00/10] Improve the taprio qdisc's relationship with its children Date: Tue, 1 Aug 2023 21:24:11 +0300 Message-Id: <20230801182421.1997560-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: AM0PR03CA0030.eurprd03.prod.outlook.com (2603:10a6:208:14::43) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6839:EE_ X-MS-Office365-Filtering-Correlation-Id: 1492fc26-3a30-4549-9cd0-08db92bc9441 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DJwOSXTBm8/28QXOlyjqdgOaLJE2OXJ+7+roRGSrj6IbNpKjUdvm3ZKpvsVzXpwFdkNGZoQgwjyyXk4of2Y/URsGdNZVmZXCfazHUZvNg+fguyyiVZLcreZ5R+L1GqGsgn9KHMAW7u1TDpWDjcBhcZKt1OrzA0mrkKAjI0m9VRcAhkz0yNOtnhIat9lEo5XwH+BJKHX6hsEuG2K+B6Xp1KM1gWqkbrQxn0lnELJF9z2QziDpL6+0E4ByPVhzsyqxPQvlMshgeZbczqNHFzHzLMX+NUH83xh6ouq9zVn5Z4JRFJW9AIH16xBi6Z6rbxxtHzIhFapm66MOnqaLEsfLQKdwNViYZlAfmRChF+TrZ3jCCX7C9PNRhGOwLTkSfb8aliqynYBcklHmp9W8ADYVx5S+fZzI0CVGsQavCtJ4+VR+koweo7ImQjjg4kX14s9LjLhTB6GDfMNeSUu9BrS8NAQrezt/dx87c/mRpn9YpGDVwNhLbDcxop48ee6h68mXXwNXz8OGwG7DCS2LgSaxVlK54HAP0VZB6aO7za9OVojU6sCO6IyBr3p9/7wCFKfHMmBtXFgkJvwWf4B6O7II5WW/3Ok6s8kDKHqq4HhWg7hG/elGGtFPdkRvz521geECy5hQS/Kxj2B0IGwfzaJb8Q== 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)(346002)(366004)(39860400002)(136003)(376002)(451199021)(6486002)(52116002)(8936002)(8676002)(478600001)(6666004)(54906003)(6916009)(316002)(66946007)(66476007)(66556008)(4326008)(83380400001)(6512007)(966005)(38350700002)(38100700002)(41300700001)(44832011)(186003)(7416002)(26005)(6506007)(5660300002)(36756003)(1076003)(2906002)(86362001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zLBLWeMFd37hgwcj00ZN9xy6QVBjB9x135z5vVyGtJEPHGZ/ygkwxbptLIcAOZ6JF7rF1e0UpX3z3T3H2oBCkXw7eh/C//ZVrJCZJ53t9k/YBEjggMHGmQXWisCxhapS34V56q1ba3ck+KrWuCFc4BXOD6AAewrev2wp8MAZxSaJlzjPj30keLlhG3V6n0nymbOV6wEsphT3Aa59G2nTWsaYRU2VUvL2TAQjmwzM6ReWfmEOhcSDwKDBOvLX//sjCcWNwslkNIMCb9Oy0R2FYoKGjtl6WeWqYrQBz0IJ/4ORGcYvdQA4B7D5aHA/Sq+NW3eovHVC8KGMTaEdZY4Kf7Bwp+j9XP/o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bjfzw+xOFL6eT21lE+3wl8UbLOxW7FQqFuPXGb6rgCwGeXhAdr7uSmgEl8e+RXTp54jLp5F01m9wAddHFu/SrZE3pYuHe5RPOfyWqX6NQqJLLvdrBTpEd1nINp1qz4+ySDFnFhn8Hw9g4EQ1Hu08VwhVYZmSUQOe4QHX0W9p6hCXaagRhy4/78vWqtKQMymRCZqvAEw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1492fc26-3a30-4549-9cd0-08db92bc9441 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 18:24:44.3770 (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: 6okMcVweiP5JTOQDLGMhx3viDurtj3zcKMTVouhyIL7n46Op3/btp4vLcwiY/ckZyECyp3ONq1/VNpIQtkjWaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6839 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_BLOCKED, 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 X-Patchwork-Delegate: kuba@kernel.org Changes in v3: Fix ptp_mock compilation as module, fix small mistakes in selftests. 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 (10): 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: ptp: create a mock-up PTP Hardware Clock driver net: netdevsim: use mock PHC 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 MAINTAINERS | 7 + 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 | 100 +++++++++- 11 files changed, 423 insertions(+), 29 deletions(-) create mode 100644 drivers/ptp/ptp_mock.c create mode 100644 include/linux/ptp_mock.h