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: 102500 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp954090vqr; Fri, 2 Jun 2023 04:27:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5WKljEwCHjwemigv5iHqyo2QSEDrWNiLLdFomhpKPTcQQN1MWLdMKWMe7qmZql0imEraDS X-Received: by 2002:a17:90a:194e:b0:24e:2759:8dbe with SMTP id 14-20020a17090a194e00b0024e27598dbemr2199993pjh.7.1685705230510; Fri, 02 Jun 2023 04:27:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685705230; cv=pass; d=google.com; s=arc-20160816; b=UNbobHiq8lA1RdOKyGeYHxwJfv8S6+qPZQy9IrPTW/BKkQN5cUFgLXUE7ixXLl/Qs2 ZqiYG2p6UnlIJboR0ejoEjTvumGZIlyEoDeGMMElj0zRVYZGLLbfTE7QubW9+Pnrwzgr xjitlxXuOwO2gEf5BmuiLmwQm5xRAI6pB3i5TauFzvxbo3sqdKtv3VtbvKvLcDzFmqpE iG5wRVKkWoBnHyL5iK/HCc86+ljKWcQL+nSScPdEQdkpiDUZVIkSl4IWk2xMEe0eQD0s jDataYJ/cnByomL9AZ4UVnDS1C+rupD1z01/4YvFliAjKY7xIrzvMK8d3c3zqvS7BPPo SAaA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ndLEqeL2b89Eb7F6s0vTT7jejVC7IkiJnJ7M56MCyXo=; b=vsoiJ96JXDahWWqDaRPKG3DBv0VzwfCfw9gmBzODOxCTOVAeAyGUq1noofZKc6AK9g UNGYCYGwo3csTWKB29+7EVYYddWKT7UV705ButfiR7AErBLFDVOJyAntPtYzRgHxAQft 9xlL/KLtciOda7pM3gOTG1mfVZEnhfpq4SLhn6Y5J9++2mU1AYvpxp/ClwYTJNm3KG2t SUgBji+LJbvTZnVo31Hj+m82Nv1C5aiTikW9Rkox5JlZttBw+PTNUuWmybLSSOr31GET 2wtDoeJS+uSx1p5OJU70L4kSi+pWcqzXK6Py8eJ0if3ArZyIoH0QOZCNDdmQQJm3iauj 1gIw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=GyBeqJQh; 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 d23-20020a17090ad3d700b00251e16303f2si877115pjw.86.2023.06.02.04.26.56; Fri, 02 Jun 2023 04:27:10 -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=GyBeqJQh; 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 S232921AbjFBKke (ORCPT + 99 others); Fri, 2 Jun 2023 06:40:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234947AbjFBKja (ORCPT ); Fri, 2 Jun 2023 06:39:30 -0400 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) 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+8V45jeNZPNqQqs6dE7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-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 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?1767590047940957552?= X-GMAIL-MSGID: =?utf-8?q?1767590047940957552?= 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)