From patchwork Fri Jun 2 10:37:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13265078 X-Patchwork-Delegate: kuba@kernel.org 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 40DAF7468 for ; Fri, 2 Jun 2023 10:39:28 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2046.outbound.protection.outlook.com [40.107.20.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B78CBE4D; Fri, 2 Jun 2023 03:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xx+d93cth1epYzcbFiNXZlbnnDMUoz1CI3GuJdsEqwte9ChcPiL3/ciSguDXbwjyyr/eu7SiVF9NOjAZDIrrDAu0JTL11auMHn+bHgyhs2pZKgOnjK7RJoHSmJ6WP7G1rNvUVSgGB+YfCmFXvv73yc1RqfZK3mnrb5IJTqmTY9btiMIlK48pLQpVSymonL0t9rcSv31q8TShc2BkMwSI7C05b4ECkSSq16vwk688+bU09qGTIPBzM39qU10kZwyTqcV12vcpr89gn0S99XKwY2CG89HaXGJYT/T7kr9CnIYcAGehsYyHuYtWlNy37IqVuAqYVgyeVrWfWNW7k6sNbA== 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=ndLEqeL2b89Eb7F6s0vTT7jejVC7IkiJnJ7M56MCyXo=; b=Sg6szO4MdNur83tq4yy7hEscOsv7Ecnp77m2Mnt8asLuff1/OduUm7xeS7oGsp+EC1OahZWI6NZ/BxcbduVpEoGBpQA3GrmWsFr3b/WKPM7WEbQEyaBNtqaLl20iEyULtphdbUmMErQrIc20bld2/zWO+8hHvV90OIYRsAOGwlyCaCo0FsfcKcrnTIgFXCKov0rSJswBeXeQgmEmcCwCpv+jc7fZQeUaUFwY4/7au1Fxemhp64yxH+XZ+yZ3WCWmQZdl7eYq5aRuyfIV8nCxz3Hp0USrieTtJyflLajypAAHC9tPf5mceq76QlnPuhir5JKGGsDY+uGyvNUcRRA31Q== 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=ndLEqeL2b89Eb7F6s0vTT7jejVC7IkiJnJ7M56MCyXo=; b=GyBeqJQhBVofsEodDT60PO+xCK64hy2KwoJ7Ty4V5CKnUjUvwz43kwQY6ptlzHyOsyjUwOwF+r/9KvzytO55LhvSobjICBlfVCsz/10B1hU/yqhZuasIl/qVvOX6tIZuWF0Y4Lp2+F4dNOk0DlhLHOaKyUnf3HN7TsO1hsDylAI= 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 PAXPR04MB8926.eurprd04.prod.outlook.com (2603:10a6:102:20d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.24; Fri, 2 Jun 2023 10:38:18 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::47e4:eb1:e83c:fa4a]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::47e4:eb1:e83c:fa4a%4]) with mapi id 15.20.6455.020; Fri, 2 Jun 2023 10:38:18 +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 Subject: [PATCH RESEND net-next 1/5] net/sched: taprio: don't access q->qdiscs[] in unoffloaded mode during attach() Date: Fri, 2 Jun 2023 13:37:46 +0300 Message-Id: <20230602103750.2290132-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230602103750.2290132-1-vladimir.oltean@nxp.com> References: <20230602103750.2290132-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0095.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:79::10) 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_|PAXPR04MB8926:EE_ X-MS-Office365-Filtering-Correlation-Id: 376f037a-d8a0-4f3c-ea4f-08db63557a5d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6TJFWKx7dYWE8pvZKv5TyYjyK8uKB9MvRaxQdlde2L1w3BZ7l8LUAR7j9wfeRsvO6N9QVOdsv7VDwl67gVhfBRjY1m+J0T2S/wcRfs4u49qTcK0wCQ2ylsQa+yzJJmkLDnYZGtJw8dsdUOi4ovUFKUiLrpCQa5eNOn9AHD5y6vLsRN/VHvTJyTAKqkDdux6J/V8nVMSk+xyDZtZlIKYnI6Vr+agiNUTGMltEEtjIna+Wz/NO5EGIkxlY2jA8j402ZQnDsEebUnzyugysCRxC/PvuHrskSapwP7my+kCpmedf/XsMwRhCZPgv+11dpvYDlEcv/VIYe5cHDyaeD3liiJrW34lyJg1bimTSPCSjdDpcbhwDbsKddUBqBFtkjHMNkXc3yyQ21axRmoYUc3pzYQDLCVsrZdsUNGuw32CnnmTe4y+8IjyHK5WbXrTaViXI+l+d5b9bx9c1eYygKU/LDlnHym4ZVSfz69wptqNoP6XNZnLskc8+F05bOF+wIQnklFKhlzoU62cKC5STK0onNFJWRaheyG90xNnOTqN6juNPGDJwtXayDNipWz+X5O2GSSzxFhRUfrZqgahvXmHedr611boz4G16gT6hBnixzqAtS6A+cA7F4XRbOooCpm7L 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)(366004)(346002)(376002)(39860400002)(136003)(396003)(451199021)(8676002)(478600001)(6506007)(1076003)(26005)(186003)(6512007)(6666004)(52116002)(6486002)(2616005)(41300700001)(83380400001)(316002)(2906002)(44832011)(8936002)(5660300002)(7416002)(66476007)(66556008)(66946007)(6916009)(54906003)(86362001)(36756003)(4326008)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h+t4RU+yDSo9cNmd+rQcb3F+GYjZzRw4j0T3eoW7HbRWEqurZ0cJqV24g9N+NcTgQt627K94q6QsJ6rOcevYHmRNxCbMlIyOciOq3FYl5RkNCp7gSgsODrPzuS4pcn1wsxiS9a0rYAiJR3B9wdB0742XIJYuyAtA8gK847wAmvT2Hn9DT/pv8epAthe1V/JsIZGoRkg6XrIOS4Zx2N6fVa0hAtE637GyucxnV9dfGp0YVtT+RVLXyqR+PDbgLasP2SAytCylorfZ6bWKDcLsenp7L1PIp+fr9Tn5Ck71PJAXOVb7OJF9rhjjOSXGl+pGwVBHuOYD8uVcgkTb4atFsqA0vLAdMnRzyGnEUiPf4yqnK9zA37mth4+on6keSkhTG36gpNBDw04OUXYax6YiCox1s4e4Jn/mc+lGRDCpSCKHPQwIWjjVVn+riNnTcLwwPANGt0DsYKzeyedghQc9525B5x3ketn+wYLiUz6qATIgd8LEq0noJ6BylkM44RtO/mObTtNMn5eCkM6CEfIoWtZi/RUahaKQWVhuCepS+AG0NgubatuoWu1WoZt/Y/NNX/JPkl+P+8V45jeNZPNqQqs6dE7qaEfeCvLzh/7UV9LsIUVq2qw6mRjqeRGfsm407GuzhyfK3UrHfBVGXiLBx6S5xcri+Uxp5Cpif+ELrypz7EIZ3eX+p8fp8vcOCBkd4WEW6C7b97FtQYQQhsvMgOZ0buhdFwoPAwuWHW9f80bJ4tLUBaNyd0xNvana+mfazgKomKdLMn4MYSMJiroby/eA+0AXB/r94uCMeG32GrctD3ROJDFMh1rf6DJ+cr0Lo1Ab/5Ae3YvoOvB+jV6kfYZKUNTivTzbHawtEXsFwy+hSnAIf/ZfxPs7jVUswqOzVESvfP0dgJt0Qp1NERghN6sWBZw4n/2FLpTKW3aLW3daYjOHk9bawp+DblhUM/DvOsTAehPXEOnOgKQgvdY66BijaA6hpIf3ZElBw9acR6aLWL2S6CBcf4KuEtTJ7IeJCXkqHENYaL8PVArjIw2ijI9dWH1iwo4IZMpjMOZGsseWmVvc+hPZmRxy5SXWxa3+HyLP7AJwpLofBFECaMRWth5Q25cHkUcp6AwJofKX+C8/a9c5mhIV1XNMAAI0vYi2vjwFKNe1KEmuuGGAzkF8fUeN9RYjOFL0AfOYA77U7r96ppJLG3OC0HEIsBhkM22CL52Ju3tdaOOhv63vOrUvLQH0zYGtibPcPkWs2EMmxR5itvU/VpbYMCwo/YuPwIXd5BFP926ejfIkm79Fi6+tMHhkzS0nrAfEIrXhdCXSyzBtmtPpPQer4g1GzXjLk07yKJMz61gTSgvRz38lPCVaDCz2IGUgvoCv7SXP/CgdcV8fkF++B0lDHWw9YS/uFxvWc5NbKo6YXJGNCNtbL3limAHaH1FaMGIV0O6U/HvzOl1uRV5i7bSQGPEKhCOqWh9dCF4PnhKo+/Gupanek63aLse5AeToXIy+J0akL98fAb/X7dyaIfvQY3+mkVGUbi5rjd1F5k649HoRyiITcx5vk268S7lq88bh5xEm5aPF17RH46kaSQsa14xyaqvUFpXXE19H4cHo22J5PJQjPKHcfw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 376f037a-d8a0-4f3c-ea4f-08db63557a5d X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2023 10:38:18.1021 (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: ynfzbte0jiI4t1W918rTeoIDhjD2KxNeSz0GpxokvdkaeGGM9izeKVkcRMVVScUd8TTApIFmtcD+L9eJzBJJFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8926 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 X-Patchwork-Delegate: kuba@kernel.org This is a simple code transformation with no intended behavior change, just to make it absolutely clear that q->qdiscs[] is only attached to the child taprio classes in full offload mode. Right now we use the q->qdiscs[] variable in taprio_attach() for software mode too, but that is quite confusing and avoidable. We use it only to reach the netdev TX queue, but we could as well just use netdev_get_tx_queue() for that. Signed-off-by: Vladimir Oltean --- net/sched/sch_taprio.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 3c4c2c334878..b1c611c72aa4 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2130,14 +2130,20 @@ static void taprio_attach(struct Qdisc *sch) /* Attach underlying qdisc */ for (ntx = 0; ntx < dev->num_tx_queues; ntx++) { - struct Qdisc *qdisc = q->qdiscs[ntx]; + struct netdev_queue *dev_queue = netdev_get_tx_queue(dev, ntx); struct Qdisc *old; if (FULL_OFFLOAD_IS_ENABLED(q->flags)) { + struct Qdisc *qdisc = q->qdiscs[ntx]; + qdisc->flags |= TCQ_F_ONETXQUEUE | TCQ_F_NOPARENT; - old = dev_graft_qdisc(qdisc->dev_queue, qdisc); + old = dev_graft_qdisc(dev_queue, qdisc); } else { - old = dev_graft_qdisc(qdisc->dev_queue, sch); + /* In software mode, attach the root taprio qdisc + * to all netdev TX queues, so that dev_qdisc_enqueue() + * goes through taprio_enqueue(). + */ + old = dev_graft_qdisc(dev_queue, sch); qdisc_refcount_inc(sch); } if (old) From patchwork Fri Jun 2 10:37:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13265082 X-Patchwork-Delegate: kuba@kernel.org 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 10425C8C0 for ; Fri, 2 Jun 2023 10:39:57 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2065.outbound.protection.outlook.com [40.107.20.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D68810FC; Fri, 2 Jun 2023 03:39:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CgmH6u0uUjBokSHsByjs7y6pGjqPxRiXWssbEccsGjwZ1YZiV/QcNriDBvDCFpLkxYo6bdkaPITLSkwh2dNUJ7/+KEEezIW+e9lY/vNEHpFET8sFAxx+pgN4eR1K05XlPWwMCYXtFFOL5XS+YdPyZFWRapZrAzXPcb7z2KMzUDCiXBFME4iLkNsfylh/Qx4CbIDrnt19kzD3Z2/VKXmYCnAMZP0uxEFnk1H6vQ4AOWD9baiakpdcwoCS5DoBGnqBI89sRZnP31lTCfiVqyZPLpGQRvz/XthAiG2E+jMpNykAtaoI14b+SpExf+y4CW2IvZJItAvKbUDif5cSCo7UPA== 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=j2NIe3uM/y4O56qmrtdqLZ6MoKG1xfC+qdNDtgfdlP4=; b=ghMVejatq4rts8xpk6IBPQWKBdj8VMyZImeRxPqDX0LC8r6bSjOkvJsNDtywzYYjeVuupPnVk7kYLdvGs2vb7+buDKIgQxszAd8+nOpqvULhFS1dk8E+YYGytXbs+OIw2Cb4mY4osiRJvMF9W+eYhkXfILYaFrlfHS6ssAAsoS3zMY4O0mUdSnPIsLQSme47At1KGpXIQp8A/q6L2e4Fd0IY63ECQuYOi/V6YdSlzBBrmGPaUBL5yk9fmUZmk7Uw0nsmRIqRXB6dcrYypM0IWgwciMl7YyKw6p3R9ASH0hknCTMYNtOf33g1HU0dhKmaAz+8psqAa/HKS6m19O632A== 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=j2NIe3uM/y4O56qmrtdqLZ6MoKG1xfC+qdNDtgfdlP4=; b=afnN+efujdKY9hZky5jMDfRL2K99b4c+K9YbW+8cdWltu++DOwRo6SDW5DC17RkBcf/wUxaXQTQOpINPAAShIY2sbgwr1lWtFvFhVsM0+7ZOU5Db3P0SGVnFqXiqZFU6Jc0g5X95yaQO5jUXYS0fEV/PPQkNZgM+nEkhUQTUqY8= 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 PAXPR04MB8926.eurprd04.prod.outlook.com (2603:10a6:102:20d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.24; Fri, 2 Jun 2023 10:38:19 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::47e4:eb1:e83c:fa4a]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::47e4:eb1:e83c:fa4a%4]) with mapi id 15.20.6455.020; Fri, 2 Jun 2023 10:38:19 +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 Subject: [PATCH RESEND net-next 2/5] net/sched: taprio: keep child Qdisc refcount elevated at 2 in offload mode Date: Fri, 2 Jun 2023 13:37:47 +0300 Message-Id: <20230602103750.2290132-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230602103750.2290132-1-vladimir.oltean@nxp.com> References: <20230602103750.2290132-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0095.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:79::10) 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_|PAXPR04MB8926:EE_ X-MS-Office365-Filtering-Correlation-Id: 87f51ae4-859a-40ef-2f3e-08db63557b07 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3sY1wF1atYsj8VSPFiLvoVZtq5IZjsx+YiJ6JpHHLkd2tAYJnANQuEFhOz8cgGuAhKQ2sh2EOzzuEeoSm3rXTYk/JceAbRhOqDiI8gGoyEmDO6Axv8fD/3OxMBkD4rKIv1+1177Cy0snVqVhaWj22HvDwK8e7xO2Asqj03cE90+VIVUNXZqx/MWBiIzh3OckqT/D83GuLbmJab6vVZaeEMqXAjPFRW8zKR5A96fJ7Lj4KKEus7dvduuAQhHkcfVPEnZcnjkVYV0ynH8EPBcOQwSmWOPKgM54F/43vz1N0ZW67jNb7KqPFaAZK/AvsvMFkZ9RcOMPR4EULMTumB1xR2jrTI3GF/4+fb9PSV6qxY58hcPbq6YbcS4dh6Bvq5TTjOQa0CRpPSPu/ulrxBHXmu0ui2CYu1XYzSMmjlN8Hb4Tbm9YeLqN3jBonFQucoXbPRqJJVSXGK0TBTWFvkRWfBhAR2llKzFbeyqIrfg3H9LUHzEazpIR7VkuiGi2YDcvhqKl1FpE9KBTf/a57nSKCK+atNew3cSkDGELyFVTL/RWTiUGLDTSSnggy9fOFmACxV1nzE5FISr//cLfsl7df/cAxzzCNdnbWioLwdzP2FeyhH+lYJKNG9L1A6KZ//iC 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)(366004)(346002)(376002)(39860400002)(136003)(396003)(451199021)(8676002)(478600001)(6506007)(1076003)(26005)(186003)(6512007)(6666004)(52116002)(6486002)(2616005)(41300700001)(83380400001)(316002)(2906002)(44832011)(8936002)(5660300002)(7416002)(66476007)(66556008)(66946007)(6916009)(54906003)(86362001)(36756003)(4326008)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: E2o07uJ3jjTcrO7aaXiAN2HKJMB81o4JFHM4fVjC9KYSdi8rCYue6I2Y8dcVoKIF1b/AtAVJUSFx0EhUDaTY8eFXWXiWy7y7ThykVJOCQIVzGcVlzkfy5StuXxrxMp/tZbhpiw9zWSCuk39dnjHtEq6uNvNel9hLpHvM2cuR+KTfhKsuZEkRME/NNo24QI+wQXDFSoP81JnMxN2QqyrpkNkYrU+Wv2gFPJVHvV1n1y5KxPNqaLpY5+9LsnzgrIhbjtTXr+pY0Vwl8gEwH4L18VsgwYyc+tlBj2M8GBpnE8gVOQdxHiFQg9cRwwU+JMOnQZ+JnOq5wyL+AbD5/ZQ3inA5Dy+e72I768bvmajFTcPef3wvF8gmxfiCi1qht9Amd6wsXLKXWUXfDYQOwKjKX5QQsCpZwLSgLopQuhAKnLCw6v1yD2KWEWvlEGBWLhBzZZjH+xZIA3HK/f2H8BtvSnACv1Fxtyjb8EKhPgoxKmiCqtgQsjykJFHHS41VooNsXG5W1S9ke3r11BTqiVrc01XSfZ1nuKDkI6lF/0qYMjmN5TcCU/E1eiiHOAB92gP1DoR0/eWTb0DCWi71kRop38I4o7woSuouQDbjKXkgtas6a8Bha+809YW/Kw7POhherNU7ZlbFwJ4fGEQ0TT2Ju5PVALWtyH+yIISz09vy7KS9QVgXN1Z3oVqpvFJVzPtt/WmkkA8mLVXNvcPEJLUAplrNVoLTSIcFiKYJezmRwrS4LgVRX6qTwc7UYpkwWoLSYIUvcLOeuJez6Lfs8FUIJJbuICosoZMcfLINaILxKFjxg0fIKhiS6TjVhwJa5Qc0phe61O0gSToWM4o8hUU6GtUcOoY40QQyxSpr0Ig0RU06LzwvmYWoFuOfnxd6MXZkiBZIQ0N8Gw+GnCR7XGpTAFcNI9AGjmBGkEw0mEy8PFOrXqkQbznUR1dMLajDA1a9VT6L90A+AXKLKYmEyZDJNqEK/awWBA6+75LdsPjrJ3mF5U92qTKPYf2ktSKhmmdZPwpngKFmDXd8qI+H2V1xTTs1CqhC/ytihJVgo2nJKOGbiauLAXDBZ++r3L5bRFaUnc0UAhTs48NS0JoXXd29n05xKy3kVuuR2uwOjjsTDinL3xhgCXIkZBDjbpyZ/e3GDvOyBsCDxQwMhn+u6C7nEL7tZr507uYyyPnU4+s9NqNv3YI+74RjLh3AZ4F0iUVoQdiw6uNizroqhQ10FpLGGPWBjGBUjC+lOw1bY8Pnxt/2yLFuRaZJxmjTOLUdkA0YowtHh3gGYlzmtBI3CoFgCwfEhlSioHWu05l/I8dOA8zT8MO6Z9dHyaLWRdByjC5MUbMnJ4ree3GDaVa4Gny91T/KtWmoVNIA2CDIvuxJ83Y9vNXRK9leiesmvcGNVYtwg4rPqLO54XkGro0zJiRO7/FtY92A96Dt0PrL5mkK21+SHvA0ntbYbiYtSeHJZ8C3YmTQB7R46OCv48ZuWKr7QW87kVtFSrUPsgLEuNYbgtqAyiXG4/JZhgcN+m1cdoDbQ37dqmawBWcBlLCgAOgXq8K52eirbWQLzqP+3cavtZiZowtr+UXpEMqxVOBdcl/qQSp+jdxBx0moB5hoOstQhg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87f51ae4-859a-40ef-2f3e-08db63557b07 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2023 10:38:19.2286 (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: j9mRJ/NR9Nv6PmNBzCCKyjIBucSDlEFK3ktygSgSf4A4ndf1Dq8IhjhuXfcI2o4nFf4K6j1HlAR+O8hT8Bwxkw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8926 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 X-Patchwork-Delegate: kuba@kernel.org The taprio qdisc currently lives in the following equilibrium. In the software scheduling case, taprio attaches itself to all TXQs, thus having a refcount of 1 + the number of TX queues. In this mode, q->qdiscs[] is not visible directly to the Qdisc API. The lifetime of the Qdiscs from this private array lasts until qdisc_destroy() -> taprio_destroy(). In the fully offloaded case, the root taprio has a refcount of 1, and all child q->qdiscs[] also have a refcount of 1. The child q->qdiscs[] are visible to the Qdisc API (they are attached to the netdev TXQs directly), however taprio loses a reference to them very early - during qdisc_graft(parent==NULL) -> taprio_attach(). At that time, taprio frees the q->qdiscs[] array to not leak memory, but interestingly, it does not release a reference on these qdiscs because it doesn't effectively own them - they are created by taprio but owned by the Qdisc core, and will be freed by qdisc_graft(parent==NULL, new==NULL) -> qdisc_put(old) when the Qdisc is deleted or when the child Qdisc is replaced with something else. My interest is to change this equilibrium such that taprio also owns a reference on the q->qdiscs[] child Qdiscs for the lifetime of the root Qdisc, including in full offload mode. I want this because I would like taprio_leaf(), taprio_dump_class(), taprio_dump_class_stats() to have insight into q->qdiscs[] for the software scheduling mode - currently they look at dev_queue->qdisc_sleeping, which is, as mentioned, the same as the root taprio. The following set of changes is necessary: - don't free q->qdiscs[] early in taprio_attach(), free it late in taprio_destroy() for consistency with software mode. But: - currently that's not possible, because taprio doesn't own a reference on q->qdiscs[]. So hold that reference - once during the initial attach() and once during subsequent graft() calls when the child is changed. - always keep track of the current child in q->qdiscs[], even for full offload mode, so that we free in taprio_destroy() what we should, and not something stale. Signed-off-by: Vladimir Oltean --- net/sched/sch_taprio.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index b1c611c72aa4..8807fc915b79 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2138,23 +2138,20 @@ static void taprio_attach(struct Qdisc *sch) qdisc->flags |= TCQ_F_ONETXQUEUE | TCQ_F_NOPARENT; old = dev_graft_qdisc(dev_queue, qdisc); + /* Keep refcount of q->qdiscs[ntx] at 2 */ + qdisc_refcount_inc(qdisc); } else { /* In software mode, attach the root taprio qdisc * to all netdev TX queues, so that dev_qdisc_enqueue() * goes through taprio_enqueue(). */ old = dev_graft_qdisc(dev_queue, sch); + /* Keep root refcount at 1 + num_tx_queues */ qdisc_refcount_inc(sch); } if (old) qdisc_put(old); } - - /* access to the child qdiscs is not needed in offload mode */ - if (FULL_OFFLOAD_IS_ENABLED(q->flags)) { - kfree(q->qdiscs); - q->qdiscs = NULL; - } } static struct netdev_queue *taprio_queue_get(struct Qdisc *sch, @@ -2183,15 +2180,24 @@ static int taprio_graft(struct Qdisc *sch, unsigned long cl, if (dev->flags & IFF_UP) dev_deactivate(dev); - if (FULL_OFFLOAD_IS_ENABLED(q->flags)) { + /* In software mode, the root taprio qdisc is still the one attached to + * all netdev TX queues, and hence responsible for taprio_enqueue() to + * forward the skbs to the child qdiscs from the private q->qdiscs[] + * array. So only attach the new qdisc to the netdev queue in offload + * mode, where the enqueue must bypass taprio. However, save the + * reference to the new qdisc in the private array in both cases, to + * have an up-to-date reference to our children. + */ + if (FULL_OFFLOAD_IS_ENABLED(q->flags)) *old = dev_graft_qdisc(dev_queue, new); - } else { + else *old = q->qdiscs[cl - 1]; - q->qdiscs[cl - 1] = new; - } - if (new) + q->qdiscs[cl - 1] = new; + if (new) { + qdisc_refcount_inc(new); new->flags |= TCQ_F_ONETXQUEUE | TCQ_F_NOPARENT; + } if (dev->flags & IFF_UP) dev_activate(dev); From patchwork Fri Jun 2 10:37:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13265080 X-Patchwork-Delegate: kuba@kernel.org 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 0A673101FF for ; Fri, 2 Jun 2023 10:39:47 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2046.outbound.protection.outlook.com [40.107.20.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2D461A6; Fri, 2 Jun 2023 03:39:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z5SDzo/B3k0LcinO8ZGzjPCcQn3ZYW+O44C/acCd9k5/KuYbEDCvvjYltH1LFJ+HycIYfNjrsh97PqIEBvellcjxfgkB7wFY+26PL+G/BjJdHR7mezcMW9yWzHaKlUaUs3s2zCxMr6FwZmITGm1GdCJG3Fuzltcw0o0ETWtGCorDQ/coHDKQ8OFOpeZtcDZJd3s5k94kMQkHtEWT13JU3v25fb/YxGh8u4J4nT28+JCHHjnZ5mRVwygusdtAAa9Z9+6JYzp6IjMzivQSSYGLxIL8xO2i1/XrjoblY0B+2xlmtAwb6y7DVB7YSahc0V0BXJInuMI6DFjKLX3GrnKTyQ== 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=90aNbYjsFEH0b2vRKI+gD4P2mkOvRG3stxDnfBaWs+U=; b=exa0jmMrbSuilWB7at2RnXbv8ex7UN7vgFzP0Ga0O5OL+JNuF5K4Kv8403/17X61KTApGHPv7KTFc2nNvz8FR6l++PLfWLnhljFbzH6mJL12TkgU152Ob0qYP8YQ0GZdVH2Lhp2MCFzSAudEeGGFWkiEprsGHTAOVyp2UVTQ/+ANBIDfjD+68qXtOu/EqZ9oiQOdrHX/78M/kgYgLAGv92DCOuZsWszTXfuG87UwT0Btami140rMk+ZhtqX7PxZPTt3AgieTZifSkU8ZuptjaeIdtzC+nZ3rwZcGo2nAzRK/2xiCnOCKSKQ/S76jw3vqi1tR4sqFT766eHiWl77mqQ== 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=90aNbYjsFEH0b2vRKI+gD4P2mkOvRG3stxDnfBaWs+U=; b=pEVZs/rR4jbQTCSIMfVZiPZbHZysJLfXvDtQfHbSfL9oHZ5FcdFDigAtnfvkzqwA9lYUg54VgNkiSRql1zWpDojKjNwQlGnMAj7XNEX+bZ9u2jcEmyc+EhYvf5svhxzv9QB3gzIhimOlQ2j2++icUviGmYLYYk0D1fN2ipyFAaU= 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 PAXPR04MB8926.eurprd04.prod.outlook.com (2603:10a6:102:20d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.24; Fri, 2 Jun 2023 10:38:20 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::47e4:eb1:e83c:fa4a]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::47e4:eb1:e83c:fa4a%4]) with mapi id 15.20.6455.020; Fri, 2 Jun 2023 10:38:20 +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 Subject: [PATCH RESEND net-next 3/5] net/sched: taprio: try again to report q->qdiscs[] to qdisc_leaf() Date: Fri, 2 Jun 2023 13:37:48 +0300 Message-Id: <20230602103750.2290132-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230602103750.2290132-1-vladimir.oltean@nxp.com> References: <20230602103750.2290132-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0095.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:79::10) 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_|PAXPR04MB8926:EE_ X-MS-Office365-Filtering-Correlation-Id: de803088-807a-4dd3-38cd-08db63557bb5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cb9Zsz+qh1ZKRItWN1qNNi4q2uj7kgEwpaAENDV4j7YvLrNuGZD0IpbbznyoCUC9LmjO/HB3eBcwkXDufHAcyl+MYwf4511w1qUYL8RXPwnn6si4fyT4P8hBjjBQPK5uFBrmCmKi/1iegicWky3sZt+lT/WTHocZ31QiP+AxwahXx0I5aHiTPSmbHQhHeXXbvpqHD+664XR7ASUGboBgF21aCWKqZf+7c400l2SpynwrEwGW2y6+Jo0K+xjqDr4Q6RYYLWv7Zkog5z8eCGid8pqxKDr8e8/sr8zC/RCt6Wc9fA0bQYBobiAuFzkJ1n3wEiCk4t2XKQWRQhuU2TSgEV1UdnvcunALMqQCD2uzpnqkI4QMkKMroEVVG63WodrTn6HjflsNEbiJC4dMA5hWF4oHelOE12RwbZeED7GVqBtkCOovGHjvkhWRZySPmAQWrnBmXlmEhftMVqFxPBvggRvrniellv8R7byreKrneueAKRAyr+uuszxvtHDhlccY7wvzxK0vluYVsoeLED0C4mocv3L3S2Ygub3MlI001omd2CjpO2id4x+19H9MappsqIKu+NTx+oIOJN+5wviPqOg0rT2omTwBJCjrpAB5ruRsA/BvWd3HfGJkjR+pW3Z9 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)(366004)(346002)(376002)(39860400002)(136003)(396003)(451199021)(8676002)(478600001)(6506007)(1076003)(26005)(186003)(6512007)(6666004)(52116002)(6486002)(2616005)(41300700001)(83380400001)(316002)(2906002)(44832011)(8936002)(5660300002)(7416002)(66476007)(66556008)(66946007)(6916009)(54906003)(86362001)(36756003)(4326008)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: irPoHh5sN4Ff/dRLmXeKKEX5bn/K5ptcoH01sTqGWwuZWHftqrWIMe+Vr6VeNfULWcpvE+/O3aBxHyXKjSXFHEwV5X6Na5SFD1zAkF54tntksBa0gRA7XL5sWpR9zzKXvdpbUFE6m6e31Xu40/l0yHqvZk/bSN3pn2QOmDdRLv15LLmaAgWTpV/w7z5z4BXLkOxoqA86yFoHVq3MkOYSRdoQAjH+JYlk/XVppmpBiygUh9aNrX5uGiAG7Jlj9yzuYpekJaQspVLA+ZNJDwZM/PUTrOoFoCHTqEbArMsZIkkKk51SX9euhIGC91T/g4xFb9z4KspZ8QJMVq+5AnvDfYP+O+pCRv0Jubor8PqXyQXIamuRq+eN4LjCpJvATaVfpHq5DjVUak07Ja2o43bGHz4eEl3FqVCTUiJoDwX6LZc2w9T4uTqsVsPF279QR5KmWLYgkGjfZYphQvoHXT6iBiJklSmVyf0UUpt1PR+PEtASZjKMBRMXbRGfvuv1gvcTuh2PS8PUtD8LLlyGtpM0D+ijp3q7fS84pOFvEIyki2wKBqmxM73nLakBt7SYXkdSCPqFvEcWeGctyNz0HHUvcHeC6BAjkgKkduNSqYZ5xhVbQKgXAi33X+RNVsMrEheCL/KRhQw9bg67xtQwifAOKFwAyV3bYekcQjTUDfL1/GLGEDKN8k/DZ8BmEEY9WmiNOmtk9dd//+UErkDNPas2zS0S5+JPSC+dm02YkZlhPULriIiF2Fl8Mgd/uwFAbmZD71dajX3BKoxZ/XCm6P9BiSI6itawfC7T/N8Xoc9Ro/Z8mfo6+3CZTqtm4hVmRA1FvzrAww+ZI6I7mGIUZfCJoy973tfFIYEcPH8mJK+mLuT5DtxGpB+nnuTXIy6NDdsQDL6eUSXYA/7x7fb77U2+ujMcmgD0QWKXece/dtFh++OQS1xnLHAhzogQwy7hx5eqljjIaAo8qwwfxYe1F2zGMq5pN8NWXDOzJKlz8rR9BRYBvEvIHyxOyiT0DOWTcRFRTdwCqPNGym/JV4qZ07g/yDtST4kgY75gMu6AKvR592xkJ6Ev90gS2a6qXUyipJoJ78Sp+iIRZvThy141GXAYIyD4hWaSxrUph7pFwCStjbqNoZB4RR0ADxyBRS2cb71QxPS2SiCoOHmUYKiJELtjNvykjkwFh34CPsVABnuZ33KLipuPg+/pdNjT61ENn7gWtTZzngVdYbljJ/tSy8lmDYEFCd6Baf9JVl8mB6k9uXp0IvQ8opIG4W+PjmLLMGNKzr38KiaK/hPE5ig/vRyyattfJaef546sQ0i85lX+1H5ImKfyADa0Pn/brXnGHTgrf/nuH90EopmavbiUQRNgBzZ7pWO0B20O/4EQGMvYasbe7POTN33uKMM6WlgTk5sOOiT8zzq9grxLBejRjtj7a2oLYaRR7T6sC3kNSDQwEhozJwhmlUEhM/LFzgbbT9K+quJEdmzQ/F9zxr7fw69SP3PcRj9nIA5Tl63WL+XNOJsdw1qZ6aVrwCXLn6cenz1dnwEpUHCIa5A1uanJ/EaZIV5pfKYMcvLuBANK+WN29soHVSMPA5WkweB90vVj0g5rxLMqrZ9BlH258OKU3Q6NcA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: de803088-807a-4dd3-38cd-08db63557bb5 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2023 10:38:20.3559 (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: vsWKN8GEDeBS11iNDT0L0LxBZsyRMUyfnb8khdtrZE5qVDq9bmgpJ+s0bAJxdBMnYL0yUGLeOSiaFJGGrJyG2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8926 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 X-Patchwork-Delegate: kuba@kernel.org This is another stab at commit 1461d212ab27 ("net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs"), later reverted in commit af7b29b1deaa ("Revert "net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs""). I believe that the problems that caused the revert were fixed, and thus, this change is identical to the original patch. Its purpose is to properly reject attaching a software taprio child qdisc to a software taprio parent. Because unoffloaded taprio currently reports itself (the root Qdisc) as the return value from qdisc_leaf(), then the process of attaching another taprio as child to a Qdisc class of the root will just result in a Qdisc_ops :: change() call for the root. Whereas that's not we want. We want Qdisc_ops :: init() to be called for the taprio child, in order to give the taprio child a chance to check whether its sch->parent is TC_H_ROOT or not (and reject this configuration). Signed-off-by: Vladimir Oltean --- net/sched/sch_taprio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 8807fc915b79..263306fe38d8 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2433,12 +2433,14 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb) static struct Qdisc *taprio_leaf(struct Qdisc *sch, unsigned long cl) { - struct netdev_queue *dev_queue = taprio_queue_get(sch, cl); + struct taprio_sched *q = qdisc_priv(sch); + struct net_device *dev = qdisc_dev(sch); + unsigned int ntx = cl - 1; - if (!dev_queue) + if (ntx >= dev->num_tx_queues) return NULL; - return dev_queue->qdisc_sleeping; + return q->qdiscs[ntx]; } static unsigned long taprio_find(struct Qdisc *sch, u32 classid) From patchwork Fri Jun 2 10:37:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13265081 X-Patchwork-Delegate: kuba@kernel.org 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 AB555111A9 for ; Fri, 2 Jun 2023 10:39:50 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2044.outbound.protection.outlook.com [40.107.20.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EAF61B9; Fri, 2 Jun 2023 03:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YeWcpwZ6zv6Mi2sKZc7at9o5nPD1OUwtZ83tX0vRxsd5A6q49q7OYNwPwAVrRPn4bCmJ/Kvp5mNcge6QW2DGAQgKw61gwYNusj64E2RqFYyb06N/x7uG4uwbhiiw+m/BBBfpjQbHmAnvMgb+HIgzYBybZaB9oM7YbQxpuqRCiRfJSxx9WrHYpIw8PrxlFoRTkQNsXjYujOWBanoY9Sn/aw1SGFTl5pYSGINTbD09jWpI+NT2LiuBKsCRPwiebflFhToEn2lOSfeGbYetO0tOaJei5aps14xwhsppaQJm3mdEWa16zqrXFODoF3OsyecgnfPq41f5kzyoTP273hrzSg== 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=0+NnOWzbxJHD6HQCG3aosuF8S27pqBRZN6+CHoAK7RI=; b=njsJKAgcN0scK0G/mXMKmsHwokUUg1tbkRDEsVWQVbVBghbwfOJw8JlN5ASyFhQCI6I9FZUAbfPZvtWPL3cWKM5Q2nAQ8+QOEeVrFvKsPsHayO8CaHtrtCJksn0Yja7eQJK7/WR2PXp06/Lg9/VCyJ2K1nBhhx01NIIjaKYO7CZwZNZe+cRiUbDusjhAOSOs0NA53jUlS3gocMZglqZ6/UvHLiwo46hlaBM/aYSi3Z1uDdyS3DFpJQXywhzZjgEYUyVSvqCDCFSBKvzPrHyioo7HWAoZJNSDbAuZx7O0/O2OBc47SZWCUEHv8UUcoaxEQDolgv1VjUu1C8N44vnrHQ== 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=0+NnOWzbxJHD6HQCG3aosuF8S27pqBRZN6+CHoAK7RI=; b=Ue25/lEc6AevfYvmvt0MPEyDZdq/K1TOaPZKpCDdbvW3ttlZsqlf4SrUQbN0XZinuQiiGKQllAeeuA+6rtqcWgx3ZR6aYA255XcgMGv0nE0gLMC9Zod9ddOjrIYVUFawpu408VzziNX7DRGAHhU2nd2EXrJV/fMOTAtaTM62kl4= 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 PAXPR04MB8926.eurprd04.prod.outlook.com (2603:10a6:102:20d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.24; Fri, 2 Jun 2023 10:38:21 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::47e4:eb1:e83c:fa4a]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::47e4:eb1:e83c:fa4a%4]) with mapi id 15.20.6455.020; Fri, 2 Jun 2023 10:38:21 +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 Subject: [PATCH RESEND net-next 4/5] net/sched: taprio: delete misleading comment about preallocating child qdiscs Date: Fri, 2 Jun 2023 13:37:49 +0300 Message-Id: <20230602103750.2290132-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230602103750.2290132-1-vladimir.oltean@nxp.com> References: <20230602103750.2290132-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0095.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:79::10) 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_|PAXPR04MB8926:EE_ X-MS-Office365-Filtering-Correlation-Id: 1708cbfe-17bd-43fa-424f-08db63557c63 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZdmT4vFIWXX1pHaAF7t0pRdozQMMFEUpgDv2AbpMQ7EbUA6YApeyqMBeuNH+tNnQembLwXtrqEqr883XkAJ6zWG1hxxSAFizCMnrctb2EqBX6Ue+6g4zvpcik7DazSqEM30XOTZyTLtALP5BlCFEslG6kfeP4ILSMcdRh5dtJkPjPq69CSdodOOXp3eG72DoPdkrZfq/TMf6eyS/n+16cdsaXYjtr06GIrPO7OExmxITms9FtR2POt279j3eJiTr4fPEgxxXue0aFgJt6RtJ6QHa4jiLgnPZ1giPNYu+naGTvZq+OZO7ltCS5u24+Kfd6mLqCeAcSvVS8+aMtAUKmbH2vvss7dsOrmpaA4Y2ntnON4Y8XryKU+Ff31dX/e9O2KoHkaSl/8kQsYOcWO8xt0jufbVvT+HoCMAZgKmgjWtuBsnN0ItZO6IR13gMc5NqDjpvi8UXWhlbWI4UPxwhXpBZ41X8jSRd8VSAuPO7VkVI68bxQae9zMo+ENLcvsN3KfX/SYEwwujkKj327y6WzuvbHi4myOP3LhQ3m/HwJhY2MFiDk66XRBZTNPMw+OTA7zP9wHmS+3P0X3CDRT2x+Uyv5LuVIyiSfN8RfWAP3/S2T3bbnyD6r9P8IePiErRS 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)(366004)(346002)(376002)(39860400002)(136003)(396003)(451199021)(8676002)(478600001)(6506007)(1076003)(26005)(186003)(6512007)(6666004)(52116002)(6486002)(2616005)(41300700001)(83380400001)(316002)(2906002)(44832011)(8936002)(5660300002)(7416002)(66476007)(66556008)(66946007)(6916009)(54906003)(86362001)(36756003)(4326008)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5wUo5hx1WWbgsUAn3CrKvu47D37CnEp3BHq/AwL5YoB4YWNf3wtAyYwj57a1BBQAFjN+vnU53v55W8bdAJX7NjBJU/hl+Nc8cjg99qaATgqhVLB/4P6ysjS9394bP7cEY61y+81TvrrtZaY7GhronHsIDBiKdlh8v9DctvuTNaXJ2BHQ544YsjmFGBrWuzq7xLmXFt9t+LrcNcXkQS0sw3usHCIi+6D8872+q1HlR7br059CaOKKbF7IgyuwIeyAoBzmL6qzuiXuptCNsymFfk+MXIC6bD341hS+FPU0IjVjstkqf+vGF6hxcCE/4TfT6vZ8uEPRsUz+Fac/B/Whj4YNcxQe9O3kMcVtSRNSL7qHHiyDtZq+hOL9ieSbqZQ1AI5uUFEvlE/QLtvkpy/lBpRVV8XaGux8QaCF2i0AtfayM1gHcxdkPwNhcfUQsAtZdqfAAysNRWbbo05zNxFwCAoxX0o/V4Vd++BOMwIi08h74S3g2NrV6N0aWbALEXCnN/SF0rXcxCn5pVMhkRjChFfdMh291nBLy95Sc5xgXrudbVFtN3vjLZUQ4kq6L7ydOsu1Zy4C0qlP/21MZplbj+yupALNXyviD+rwk/MKq4CZwlEFzRLPMSnJZh1KCZpEjzcl+/z64kaYrUa+1xniBuIYFVHTQfC7cjQRSXwFz1leL5YsNo2B9CYw2j75NSv8Bx4s3iF/tdt82t7vKdHmwTghT6DCVTKW9G8ZttJ0tzlPp2m1h4Km5mAXpDtENKFc5XvJwsh6ZOIWFrUL1mat5a4bBOOQjuYkby1sva+PKVPajf4mW+sbGfPfJf5xf5w4sdXQ1EvkJL1KvBux0FSdBXF43jvljLJQLuoKm7p3Cz5X4LWj+uuKKBqyysk403yeWE5D309yMZheHUfKXIhe1iWSi9Q+G0Rs93tsYxj/wxy5I+YBZh92gDDtyee6DhWuEuI68H2lXG46/Q7Jo26gfNWYVzGO6Yn8aQpJ2gKIQuSV4GmbQEbpzmGZcFXRaMIZja0XHFTWyVYPsn018b6te1UxhufuPZK5jRDf4g8P/YsqmfECjms+L0GyCuOxQtHYVA78MlagBWD5/jVcZMk2XedhFdD78eOc1+j5tC0opQSCZvPfXrEBWJvZyNIVXE03lOXQUmp2is5XcSN3EpS1aomvQB14lVEd7iDI5C1EOtoX2FxILCM1MfXN9cjt0Yybh3cN/keqSYSKYPsuTdSjMAYcYbNsPkrWTZRruVmWRFQZ9XMTlgDWNqmkZ/psxOtIy2rg9kCtqfjXyCKr3wkpmb7N3LPgdsZRkq9snsO0BKk5kxXPiCQM4JMNm/9SNZZt6wEit9PRsMpy3oX/NPbMBP9BWkuSiigjsk0TX/jpK9qu2V0qz36tv7R3/7hj12ICRRJQGqVSAKnnw5EQYh4aTGrNxTAgZXXwgcGNfgw0MrlDG+309B2L/3UaTyI4PGfk05pJrFB+tiLIAhkPb0t2NcnPWlXw7dfyEh0zsIO51IKkQ/E4vDI17RYPqfClq2384aKscTPHQxuk+M2I6Xw/HHssUQztCwopNoTbJkJLu4WhQHn12hLQLY/ALV9UliUpJEWzcBIox7Ht2/mM+OjhtQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1708cbfe-17bd-43fa-424f-08db63557c63 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2023 10:38:21.5272 (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: Mmo6/kc9MWV/wvrbG4gprOQ4exyFZerVft5Q/jKhV2kP4HkYzJTMDYxNousPCxAkALzpDDxYpl4v9Bg32s71ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8926 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 X-Patchwork-Delegate: kuba@kernel.org As mentioned in commit af7b29b1deaa ("Revert "net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs"") - unlike mqprio, taprio doesn't use q->qdiscs[] only as a temporary transport between Qdisc_ops :: init() and Qdisc_ops :: attach(). Delete the comment, which is just stolen from mqprio, but there, the usage patterns are a lot different, and this is nothing but confusing. Signed-off-by: Vladimir Oltean --- net/sched/sch_taprio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 263306fe38d8..cc7ff98e5e86 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2084,11 +2084,8 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt, return -EOPNOTSUPP; } - /* pre-allocate qdisc, attachment can't fail */ - q->qdiscs = kcalloc(dev->num_tx_queues, - sizeof(q->qdiscs[0]), + q->qdiscs = kcalloc(dev->num_tx_queues, sizeof(q->qdiscs[0]), GFP_KERNEL); - if (!q->qdiscs) return -ENOMEM; From patchwork Fri Jun 2 10:37:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13265083 X-Patchwork-Delegate: kuba@kernel.org 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 0F93F156D7 for ; Fri, 2 Jun 2023 10:40:11 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2046.outbound.protection.outlook.com [40.107.20.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA20EE55; Fri, 2 Jun 2023 03:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CE4R6C1or3anRr8Q9ArEY3vbp59Agqkr7LorWhephfsnfKxrTP2zZKSvm1K+4cjvAe1tR+vMCFZysPPicl2YUmPlVPnUqQTuWtUQhxcU07bTTrmoZqMffLei1qNwLXnrbDjXXYLimnx5NT8yF0ezxEzZR/lwckvBNJdoQQruIGvVJHFG+nht9WVbBbHiVPKk/9+DE40oq3ImO5NGilS+7yo7Y1BAuADIPvTNEikvh6WDjm1DFPyHvhM8OBFpN0aGj9/Z5Zwet7oRRYLnlIAeDY7p2SYH5GkZ+ieV/tDOZ5Am3UyqAYrcH06auiVAluYQ/huJnSWSU5UtUYFfUjXGYQ== 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=GXbdk2K45vsjE10Ud3k19fgs/8bgShOPBxRnB3axMrA=; b=Zd55bgMm9mEVNyhCE75svQ6sHfcsDFuy/QY51VHpAaHtPl6DQsTnJLDZ8Prlx71jDRIkvdrrJKAYHwKMyjcW8QBBXdzJLM48akI40suzku5V9lNZgSnOrfrz9g+/C8SOjr9Lo4YuAkFCbGrvvIBeDw/E09mcmrv8g0YruU1SRquouJ6X90GgDTbvFxmREDeyrtNcrHdphFoYE3PmTAAeb2si70XlxK1suAF2ricKK+0rWig05UKPZOY+A6w+QKLN8rJ8WgS084mgjuKuWsoxvNSip9N974E+oYqE7fa7d8OhIiHQ3My4OvJCZu7BjcUrACrcZwAeZtoFbvalbbARMg== 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=GXbdk2K45vsjE10Ud3k19fgs/8bgShOPBxRnB3axMrA=; b=WYY+gta4xnQsAyJKQyUGjfUB0PlGgDzHyCvjpR2VoKEw5QhVzoJbgmeCjKLOZ/xRkh/dUjtRWR/S/wdHeEZI65h+uG7j3+SrgCxz3hEIdaGHeZfbjX629xCkas7n10VZ/cmBo7hlhwTibf89COeG1PM479MQyKFxDnA/nuwZl1Q= 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 PAXPR04MB8926.eurprd04.prod.outlook.com (2603:10a6:102:20d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.24; Fri, 2 Jun 2023 10:38:22 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::47e4:eb1:e83c:fa4a]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::47e4:eb1:e83c:fa4a%4]) with mapi id 15.20.6455.020; Fri, 2 Jun 2023 10:38:22 +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 Subject: [PATCH RESEND net-next 5/5] net/sched: taprio: dump class stats for the actual q->qdiscs[] Date: Fri, 2 Jun 2023 13:37:50 +0300 Message-Id: <20230602103750.2290132-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230602103750.2290132-1-vladimir.oltean@nxp.com> References: <20230602103750.2290132-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0095.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:79::10) 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_|PAXPR04MB8926:EE_ X-MS-Office365-Filtering-Correlation-Id: 11dd662d-114c-4e56-4bde-08db63557d11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i/EA/YngRemxgmilNbLISY7FYng1HF6O5BKknEQGVvMguISk0hXWxWipEj72dao3dw45j1cbqEhyRSi58ux5toetuHYa5Zj2YP2jJMGdtVAxl3FOWCE7Ei6T2NxsApe9yzJIjwhbCOJmBUg8jCk9mwL1eNoDgVJsKlR+CRa0mFcwdaUBkozJkEDKoFF+kQMdbaAq4IjzwVNMO6m8vVEifgTCc26NuyGrkXcokPrOJ0xLnDwqG8/mqrIF1axx2Cmn3yRCNm2VE14bACfvWD5PLR07VtS/x+PeV/93K5lZnCFxcFWVkRNl7mXnbEVxv92ctQTxXBV45IeXgOoA/5lq+qtEwniIGZepWfEbbo5Y26G6GCBIDCubBh7SLRqIvbk4Nvl1cFvoIqs5je/an0DcuzcZaIVere3Ykqr+uA/XU91Ryc3YK8kkaMqWYMRD18MPDnDixuQYTil17thm1AOfUayNPpqdAutitpNpuOv58KFrC8xsWcMdSH4i9diVRey1JaS+mei+BTXCMe4e0I7ESjEt3Q8HPJ/3Ev0ZzKZL7PurdkxPgrZU+4AoaydyetIbMwYwE3R0z1L21kjHQDmoPUHZ5F9MCvwEerJiSiEh/AlGWL1mYYuR2OOAd+wF+KoZ 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)(366004)(346002)(376002)(39860400002)(136003)(396003)(451199021)(8676002)(478600001)(6506007)(1076003)(26005)(186003)(6512007)(6666004)(52116002)(6486002)(2616005)(41300700001)(83380400001)(316002)(2906002)(44832011)(8936002)(5660300002)(7416002)(66476007)(66556008)(66946007)(6916009)(54906003)(86362001)(36756003)(4326008)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3xq34pNfi1VKmkqLT+lddgGRF6VNY88Vtk22Mgq4r2MX4U/jYlTYefYfaXvV9c2O8OrXOTvzpUZv1BUnpMPu4//a1CrlmeE5g0LHoHifL38Z7RK5pa8PoOkp57QXtz1cX23w79xsArCtYWDd7kPamwpBhAYBamL+HoeAnKikV0WYCKaMtriEgS0osFskW37OT7As2Xla0K+TYYqxVzDO7/g9QF5rF8MNljC5EmldMO2Hj2/vOT/NmU7rg20t/U3dNdDhmXjwohgUhWLG7G1YI1H6UZIPMtyCluFZr7vExpyibehAN62WPRrQ4GjCtZIzu72V2a/F2QNRmuIt9LvAnZCeL0GL3P4ERHdS5mHFn7aKbhkZxPnOFZnnuqCB9l8h/G3zP2ODR1yx3XQ2YM0iMfg5bLcurumORDed5GJYg6bJjTZGmtW7mNf+1gTgHf7B8hCA5B11m795BN3hAENm/UTGFM6ZRR8FGkKmGj7VAsNfNEN0deKJVVVWzjmXl0vVhxIAZ3H6QLNMB5StcrFYYKKoDtUP/NfcS7n9k9woUny0l/25IaTW88d96joEgpeLSD/zG6udn24nEgc6f+Lbmf5yKso7wcDcFM/8/sOONsI04x6DtRLHzsCHlTVvxyfD1NxjEExKzNpphAHxVL+0Z2jEPMUKv4h4ISdHHM75dS8A33o5R1Sh4HufAOeXDH4S71EifZwcwIjctO0k1HTEDNs+LaFpe9SPxZ3cZuv5fMBcrXHeMbSryOUpp5eXsU4vmjYfY2LD+3p0B4xinpldC8xuCBv37qea4qBzaNO1l7ixDsjdqyY/zbMVfQ/tkZqZYQG9+E91q7jHfcSg0elscHd8oYbYaMYb9Uz+0Lzh0EItbf2qo9KUzPn8poTwdwVduWXPCJhdiC9NAjbMs9dLbVaU8NXuvJ2xxSMT4zItcVqgiI4Qz/FDAV2W70tVZ9/LpNom3R7037vEFPmhz24onKBPgNiKSD8e+BBSwlNy1nKB6y5Iu0kJsZS+fhxzc1/eGM7SOLzsxyRiWCZWEwlb/7LUjXuAEPZTG2OoKAVqNTDLizAOoAYetC6fbBlAQcPe0cX+kONxVqTHuKfgbWK5XNlER0BmdL3zcIt7DwrC5F+9HBxkcWLc5gscCF5B/nz3CmGB+Fe+QrnKW+/U/b7Fz3HKWXSR0ubOSW0ZGyG+2WjdZN/qQQVjBSwsFCxKosLJJPZm68iI7ND4MgyFqY1ZrGvUZUDT+58v8UxyAwZ+/spyD7d+f0tToiV7ZgC8vv6PYAKFN8+vuplxGyv7xsmVOU6MNkOHzWSnIaY3i/1KdbKI0BcI7aqxlajURUv+CFc0jBK0muQ9XK9x+7RQSXxXCzU0y92TRZo72ldy9Xx/hNFzxkUcJ4urZjgGykLMlaEIvDBnkVdUxfi6nr+HNxJ4xdbYcrLwb+fh09OvrBQklA/DRwYdVr5iVtiOfLku1tHCZVr5b5KrsdHMc6zAe1k6KDp61PQhWkpT125MF9u8ftEDlMcjV1MErb2nViUJK6M56L0Ug4iDYAVdbbJlZuhNgZ2JuZYQjZJVsFZFts9u0nWOrrdnt68UnV4dRbt8UljktbRnYA/LWDET784Cg+zOLQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11dd662d-114c-4e56-4bde-08db63557d11 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2023 10:38:22.7460 (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: e164Z5SrPKEjdbMveHmgiKqXd+t0Rw+jVUAUN8ul24EJY8HeV3IGpYQMulVfoeNdQf3XXjO08qhxB0LpGN4RzQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8926 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 X-Patchwork-Delegate: kuba@kernel.org This makes a difference for the software scheduling mode, where dev_queue->qdisc_sleeping is the same as the taprio root Qdisc itself, but when we're talking about what Qdisc and stats get reported for a traffic class, the root taprio isn't what comes to mind, but q->qdiscs[] is. To understand the difference, I've attempted to send 100 packets in software mode through traffic class 0 (they are in the Qdisc's backlog), and recorded the stats before and after the change. Here is before: $ tc -s class show dev eth0 class taprio 8001:1 root leaf 8001: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 9400b 100p requeues 0 Window drops: 0 class taprio 8001:2 root leaf 8001: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 9400b 100p requeues 0 Window drops: 0 class taprio 8001:3 root leaf 8001: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 9400b 100p requeues 0 Window drops: 0 class taprio 8001:4 root leaf 8001: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 9400b 100p requeues 0 Window drops: 0 class taprio 8001:5 root leaf 8001: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 9400b 100p requeues 0 Window drops: 0 class taprio 8001:6 root leaf 8001: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 9400b 100p requeues 0 Window drops: 0 class taprio 8001:7 root leaf 8001: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 9400b 100p requeues 0 Window drops: 0 class taprio 8001:8 root leaf 8001: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 9400b 100p requeues 0 Window drops: 0 and here is after: class taprio 8001:1 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 9400b 100p requeues 0 Window drops: 0 class taprio 8001:2 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 Window drops: 0 class taprio 8001:3 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 Window drops: 0 class taprio 8001:4 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 Window drops: 0 class taprio 8001:5 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 Window drops: 0 class taprio 8001:6 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 Window drops: 0 class taprio 8001:7 root leaf 8010: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 Window drops: 0 class taprio 8001:8 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 Window drops: 0 The most glaring (and expected) difference is that before, all class stats reported the global stats, whereas now, they really report just the counters for that traffic class. Signed-off-by: Vladimir Oltean --- net/sched/sch_taprio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index cc7ff98e5e86..23b98c3af8b2 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2452,11 +2452,11 @@ static unsigned long taprio_find(struct Qdisc *sch, u32 classid) static int taprio_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff *skb, struct tcmsg *tcm) { - struct netdev_queue *dev_queue = taprio_queue_get(sch, cl); + struct Qdisc *child = taprio_leaf(sch, cl); tcm->tcm_parent = TC_H_ROOT; tcm->tcm_handle |= TC_H_MIN(cl); - tcm->tcm_info = dev_queue->qdisc_sleeping->handle; + tcm->tcm_info = child->handle; return 0; } @@ -2466,8 +2466,7 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, __releases(d->lock) __acquires(d->lock) { - struct netdev_queue *dev_queue = taprio_queue_get(sch, cl); - struct Qdisc *child = dev_queue->qdisc_sleeping; + struct Qdisc *child = taprio_leaf(sch, cl); struct tc_taprio_qopt_offload offload = { .cmd = TAPRIO_CMD_TC_STATS, .tc_stats = {