From patchwork Mon Aug 7 19:33:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13344841 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 AD4F416425 for ; Mon, 7 Aug 2023 19:38:02 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2074.outbound.protection.outlook.com [40.107.104.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA93C1726; Mon, 7 Aug 2023 12:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kc0WtwpI6/xuub7DATIUWnq+fCE1U9qULCwZTUrA+10gL37PduChPP+qWgAnv5ZoW91LCgjVvW2qcDYP2SWDFhiBLwRdc5WCOEq+hKN9gG3KmM2IioKPdjya7A2YU5ff5eA/zKdhObHjNO/wuUlLjY0KjEV0PUKjfusmamLxvV45zbwO2Z7NJjAXulxOBizDzWthqfsFifp3/MmKhrohxhgJus5MWEIkClDMy6eH8PqK3SmwBtavSRCV0QE9qaUefCU02ZKGyxQkef4McJfwC/kZf8aoDCiu7BTAazkSfaUZKceQsTnjA4t4Qs4GtDgvGtUu3y8axDCged+oFyj2pw== 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=y8ji/QFNFkYozc1uGEnu/Wm4/4KzmkqxPvEJ7tFXBd4=; b=BWGKPMSHVUr/14K9YPKS+ec9EZxnTymFjzCJ1QivVeFjgunSN2+q20dXTrOZXcT7z2Tpks/WOP8KLOQ1JhfKb2YmpXke17oJmtYEgmCHhBYWVtsMjN+05+ZSh6uWVx8R60fqBQW1j8vlo+3nyuGxIv3xYFd95U1Po7hnUDqEg7r8kIf5CwZ3c6PfNQsbSEQ6Z0RfacjQzHsIgPNawa02KcXB5eiNUD2Yo1GXWSHtcAvAeI9YSpmSGEqQctph2ctr0RBKkLWzBxFTgHIjaiBPLH8ApPKbXt1Q2qdig61E4Nh0+0Tgju9hNFEUxvOWdRhyZ48NycRTC1W2hl1We1WrMA== 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=y8ji/QFNFkYozc1uGEnu/Wm4/4KzmkqxPvEJ7tFXBd4=; b=ebcTyI6TNjTAA98sMU8MIa8SYRM4WRwAO7lBFNPIzShEBGSNA5EnsGV9ngvzBUM8XlUaeTfNSC3O6OV6cRFo0VM8NUI3mZ39MQljvYxWbgPxYwFip4FN08PHL5iNwfFqH10BwQ4k3frpoxQy4XBLhgh+Xu6lS7Jb9z4HCxBv/9I= 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 DB9PR04MB9451.eurprd04.prod.outlook.com (2603:10a6:10:368::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.26; Mon, 7 Aug 2023 19:37:33 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::d4ed:20a0:8c0a:d9cf]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::d4ed:20a0:8c0a:d9cf%6]) with mapi id 15.20.6652.026; Mon, 7 Aug 2023 19:37:33 +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 v4 net-next 01/11] net/sched: taprio: don't access q->qdiscs[] in unoffloaded mode during attach() Date: Mon, 7 Aug 2023 22:33:14 +0300 Message-Id: <20230807193324.4128292-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230807193324.4128292-1-vladimir.oltean@nxp.com> References: <20230807193324.4128292-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0136.eurprd01.prod.exchangelabs.com (2603:10a6:208:168::41) 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_|DB9PR04MB9451:EE_ X-MS-Office365-Filtering-Correlation-Id: d8dd46bb-250b-40c0-1ff0-08db977dbf1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iqWQJ0VxLTfuLjaQZayxo2Wthp6fj35ROpy5h3tG0pEFb0XkJpmyN0/dFP8uearywIgtv2JQ8J6mb0JWA2uNrVAlt3fMsbq558ZXhRm0IMM2OG5dbKunp1pnuo16DZVaJeHtcq1PyfwM3plWT50Npew/iPpENGrU8GUeyWlaEEfu+P0ns6GFMGjpfN7k9wBMrX4oA+heKZ2O+OxAmpcs8BKqeYsu1DdJ2yI/34gQkYMkUIc96eR5vDcDXlFBggMkpxoV6bhPAmerCzG1WjeOu5yFubIxaqkYLGEhHuaID8kxkz19zGOA/+0nFMt/IPULAq0ckwQVV7OE/ZNR5SNsrEK/wj5j1ggbYzC5/sZyGC83f6tFNhys4Xv97NgmTpLdoVwruVTFRvsXQByo8XiKs/rSlQ5zTCqSDuynjMHBb30CIcfJ+l06Icc9jHaFCD8DVI6QxF49DVS1NoA0RzTt4bHbEXGQAnfevYKM5mO+901mtwjPFU4fzjG3ClpKccrBNWS+47ZImJlajXp7AKoRQcTR5D39sLYb5QZYQR5n594fGikf8Kfbq5H8Un0l2Vanc3DE9TLNaBFQEC2XhAbvEHVplI9Q2bxeWJIFXk8lYI/2x1xi3TiXPPMyMG/eNHjN 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)(376002)(39860400002)(346002)(136003)(396003)(366004)(186006)(1800799003)(451199021)(1076003)(41300700001)(26005)(2906002)(5660300002)(44832011)(83380400001)(7416002)(8676002)(8936002)(2616005)(6916009)(86362001)(316002)(6506007)(54906003)(38350700002)(38100700002)(6486002)(66476007)(66556008)(478600001)(52116002)(66946007)(6666004)(6512007)(4326008)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DrFA0OOR62MxE7N71OdGFnw/q4OZgd1RW2MGAGCfq4Re7EvvGVL6GBSD8hyCVjJ3OnCFixb1BRpuY0+Fu2WHC7NIol66K2ypwsLway57WbvsClww2jedmV/fzO/9537VljXhTMObKJxMj15QAOTOTeqkYuBSEWEpc7bbvZB60ktG5+N3frxtzMwjXJ6nk13C0lwzNgjRpaz4jIIfyIfvQ6zN/9pwKCUj4C+8Qj3/oTCsxkW3riWZjL33k0SCbc4EfG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38AzJxTdUrYf1MdPpjqsW+3oH+gEna+3K9jkB4EuhyEYNS3BUgLAxQNBjSRQbrNDYbbN9F/UurlUaX50hifC2FgZZpjpyUWOROsCItZe5N+l8I/GTZ0HzYsGuMGE2v5s7alWiTA+r8SOaGZIdWu/MSOzXtYn1bi28kFfYkqCfK/TJFxFSFeSeaEtqfa00GGZIEBtWm5vCManOV0r9RhdbH+mpNXe07ZjHLjf3Gj8E6fvjzt7Df0TMr5CdsoIYRTuVzYzhIMlDRo6q2BV8eKMBjBOgvnVyg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8dd46bb-250b-40c0-1ff0-08db977dbf1a X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 19:37:33.7476 (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: JeZeFE8NCAuJggBnu5YNU5KujvjopoW8R/ovFBZikJUCZP4oSwJGCjSoMX/iJ2e4eoJYOUykBJW0aLvoqn822A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9451 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_NONE,SPF_PASS 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 --- v1->v4: none 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 8c9cfff7fd05..1cbc7fcd56c0 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2145,14 +2145,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)