Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1833511rwd; Tue, 13 Jun 2023 15:10:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Y3W8rqv6z6B2595Knkg8VWKrSKznuZiuaSbyuWLEmpty0HzpFq5zY5N95ycHGbS0lmHv8 X-Received: by 2002:a05:6a00:1311:b0:64d:1185:241a with SMTP id j17-20020a056a00131100b0064d1185241amr170661pfu.5.1686694207078; Tue, 13 Jun 2023 15:10:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686694207; cv=pass; d=google.com; s=arc-20160816; b=Ug+lELIRaziLaiA5lNvqatT0GZLTuBvJn5/EnN/VUX3SUexn1h6yOwpsA7soV1BM0u 8A3ozaJ6ddbY1KF4PThzmZjK4UrhLWzwetC5oYXA48ivkdJCZvux8NlSkF9HeCdEbIw0 67CbTwlS6/22D3y6hpNEeb8xnzyerb5croW9MVJMQDLgOjagDKoWujbIz2QjTCz10RLs oifAcPAZ1DxJxyWN0sJfp8Jr7M4JXQ7xxmVtFQRw2BjbXiObkQHUWbemoEyBHgvsaeZB W7mVK8+S28ku2QY6ZmUIoWZ0KTDJDjmRMRdvssX3lq9P1HSbspeSFCxluNJcuAZq+Tnt ZWnw== 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=NkgevA1g4+u4PjuFAmT0IroGZ7q5zm3YQuPKnu6OQYM=; b=LAfbcjIE0VDKY0WJGknlmPreGoNT/J16aaQRNMB2k8MXmuJiXSWv6zVQQNUNNbY86G MIbqDy2bHGQchE99xf9OJtDu5fHuZSgi1EM/tkKNIz3qYRrrbzLhIu4H3eGkhxsxh5NQ QzwReyEa/qTNb1zsnkEdsQ+zeRa/LSbxCUagXfSKzOUjCRIepKt1oqM0/eqa+7C+CnXm NPiKI+kQkwbZWFhIkfOnFEWkw17kWPL+B38ptmRvF9idFFcKd3R8tBGU3GsLbqPhGrSJ Wis8QkrvqR9gmMFdQDUxjbsLPhuQx9tn53EGWhPREjdXBZNTATh1vRZ9Xz1wzmawZu97 Dusw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=X6iEPbpD; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y37-20020a056a001ca500b0064f78c32b89si9740242pfw.95.2023.06.13.15.09.53; Tue, 13 Jun 2023 15:10:07 -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=X6iEPbpD; 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 S239782AbjFMVzN (ORCPT + 99 others); Tue, 13 Jun 2023 17:55:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240388AbjFMVzD (ORCPT ); Tue, 13 Jun 2023 17:55:03 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2057.outbound.protection.outlook.com [40.107.21.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D5AF1BD2; Tue, 13 Jun 2023 14:54:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oVFesdFlWl9LLn8mlWNz5ZlZKRMMBbH6UKhrIuPQAysIoiPdMfXplbw/vjUd9fATSNdm1eraxOPeyKzBarIl5ElfFtRq2zEXl6KhKDNkDqf2IknJTvZ8rulVVQa7JShuSLmdZA9y9ikYxkGyaonndkrwt2Sr9ulq6BwpYySbnIULyhQKyivwmajBnAttRZsBEMKSLX2IzL9xm4x/2bwLzZbVxpEf38Wn1qJpQhUZl63/VQpgDishd3fXVk3bqE9GuuI99eYL2N2Rdu7xvzxTAgl+NSvB/gCUDIpqV/KpQ7+h46b9STbXRFhZaoe9aNKBzDbCxEdInrFnVuVySzWS7w== 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=NkgevA1g4+u4PjuFAmT0IroGZ7q5zm3YQuPKnu6OQYM=; b=F1mjRcCbhQSSVfceqpNjdvFSEvT69PudMrEXPoz8ldDmVNCk7MGt2eVnTCF4Up5nSVn9dG4E+XQAXy/K3Z9tz5/J/BwucY/X5oLQp4OACR8MVtwGyiMNvsSEGjRtfOHgirKzrVAlq88ceFWSOiaTuwYuyXlpZfIxDVll4XtBlISAvdECvydPYoTeEhZoQ1UXQtVJhJ4m18GRYuyUTnVUHBWKX3ltQIjepKNFXHgyFk6pK1ZYtDApnNqlFccFpqwjnWpwPGYreLWjayXKP5aKa++F+Z0KH8CZ9V5IIwBCpc0UpYec5aQibMSVBQ/MMgOBOSbFa5cteNRwbJ+GpGaO6Q== 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=NkgevA1g4+u4PjuFAmT0IroGZ7q5zm3YQuPKnu6OQYM=; b=X6iEPbpDlZuSG+dVSXqt7gWSuEVTRd4UTwLnXlGkppHn8xBWBKI46FpWMlqCQ6vuu4tbCGOGPe5fzEIw+OW/k6wZazutTNGDIfgw6mSoR3XnbIHMcrEG+IQmHpqOXnZB8OnULbFCaFw2NE5IdYG8qErblA8M5F575lyKdHSp+RQ= 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:52 +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:52 +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 1/9] net/sched: taprio: don't access q->qdiscs[] in unoffloaded mode during attach() Date: Wed, 14 Jun 2023 00:54:32 +0300 Message-Id: <20230613215440.2465708-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613215440.2465708-1-vladimir.oltean@nxp.com> References: <20230613215440.2465708-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: 54e67235-69dc-4355-ba78-08db6c58d0b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QR/leZdl7hEiJRPqSfwCdwllNlhuqUDkUAxAKoUMyHmHtHhUfUwkwcSTMkr8iHrk2y8TvlYrBUey28pC7DlJYhAk4h918yhU37SWZPdpeJUV+GTMV2fkesFhqFUMXiAb0YBkZi7jEsUpap6ezyTOUURSsPumg6HzR/eN/+2eUGfxMynP5nnTwO/mzMisRzJndu7Gs2CKlDbs46rxolX+tzXZ0Fd/3QZnJTxtI+uRgxHzoX3pzTaexHMYmYElKUt9dEd2vELdjDy5JiNDxfl6BVXrHVJrSGoZfqKq6S6EuQvz79nzWhs6hoR1MYb72Z+lRJNy/pGtrdTNshXHVzqb7Gm4ugj3uC7vXvdXdpjQfueaH6E0irII66x3/177B6Si24A2IWKFwuS6rPbflB2zRGvyHGEhFq6CXGSoKU9TE3JmckeOKhrkp25atxx/EkAddLSkt5EYQQTiAz8Uw35LCNGWeFa91Dvy4TL5AMRLJaK6sFtaTxMQ9AiK6tk1rRbPSMMgY8HYbWeTH3Mrd/+rTlgJ8zj6wDccHYGBoj9CqAFG4ROuj0PI6o2zurWTP3dsiVPOWU6MdbU1IzePTc6PySxHkS3A0hr6kmj4gkuPSwNajh3WJRXLZS9KE2FqdYhg 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)(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: =?us-ascii?Q?2L/vo6S0ff/1rrwNORA5UEP0tRMkC+sgID88/nstO46gb2HGJ0Me0+daaXnI?= =?us-ascii?Q?2g68jM5dADcUwagHUVAazNOh+6927xA4kKHuSWt2tyHndnQ2YfrtovUuv1o7?= =?us-ascii?Q?5YoPMjI3Y3hkuz2XzevlD7r5GtAc9uDErtNamwBJIXeSH2dWL58aaRnU2tDj?= =?us-ascii?Q?VObbanCqMUeRifUGaejUNSMC4p9jUt8EMVzBOJ040xSbiJ90m6QIbNBF6VHk?= =?us-ascii?Q?0udb8119KXi7mEMvt+BumaENyCO1i3BG35918IMwJOIe0bWxzYgYg3ZuQzdJ?= =?us-ascii?Q?yaiPuYNckm7enyY3YMAyAP1B7YB5A5M0GuMI7bE9FhbotJs++MG+1HMTa+Y8?= =?us-ascii?Q?+dP0YNmOFeKyP9CYvtVGRGXKXhxp+cH09ReDs6CGomhEyd9u3RjS2b5l/bF5?= =?us-ascii?Q?WyGKqUAEznvquDvk+YydFNem8UBs9/rhz8ocsi52mWnwoeLTkxJiCY+vFD5f?= =?us-ascii?Q?PDboAj/H/36tfCoBA4b0qlZRPtq1klV4CBUEZtAEczDF7oEbBh1rxgt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AJ33UaaSFMj/S7+jIy4TlpYhvEU?= =?us-ascii?Q?s8eYusiR8ChWLSvpSrrqLyZLS+OgQiXHkXVH02PO6buXEF9oqHp6Y0bjd9Np?= =?us-ascii?Q?YI64kSTW1TefRI/WQwegqSEtJOqsYobB1ExDVUVdOkdJSfvxHj33mSXrhtvw?= =?us-ascii?Q?O8z5oR8rmd/b/jSHd3Z/AQIPMMT+B95MIrP6iRYUrv3UfJgyw/mfsB2m/P25?= =?us-ascii?Q?Aw=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54e67235-69dc-4355-ba78-08db6c58d0b7 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:52.0093 (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: uQeVilbYZuSLAjXLfah3x5Zy4psHsJSHP2UKvWyqLVF0oTG3ujTdIIKSdn3TqMieM/uyGILqUYo8wL9+QsiACg== 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 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->v2: 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 c6627f5abdfa..3ee8a7cca786 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2131,14 +2131,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) -- 2.34.1