From patchwork Thu Sep 15 10:50:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12977234 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B72EAECAAA1 for ; Thu, 15 Sep 2022 10:51:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230022AbiIOKvD (ORCPT ); Thu, 15 Sep 2022 06:51:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiIOKvC (ORCPT ); Thu, 15 Sep 2022 06:51:02 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA5CC4DB05; Thu, 15 Sep 2022 03:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oMr5psWNVP4f0u5U6pvMFSRfECnJg7howY1eWe2botNJLV97ahfBvrtKTCi52qUonsr71EMW0KlzuKIsYO3b2l4fTpXo1dCyz3ptmjH11qVUWBYS6lZjhyymdTT1f5gaf1Nvux+t1qWz136K0ghn3XsZQ/wlQ5ooQpG4XAEz7ciYLgTkIYArcgxN2MHztsk5rTWVFwl6x+Ejk4dB1oljQCthoKfwIMXRCDq1BmE5vhlXcNpL8MiNu1/GSEBhg6FXTeFPgizst0meN+WqfVQYCbJjH4WSVtDlFmbKOPOAxfS4mMhY0NM+NyXPPUsSqFF7kt+HEuFwdds2Fi4W2d272A== 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=QPYr3gi02pCxjw7Cn4QkinU+FClOZUJSPxpxxITibUw=; b=jfmFF9d0T1NLQps5MfxYTTDEH5tYvlBf/TJxgpygeax8xSi9NELUKiAPlu0skBpWv3tomlLJS7oz2kgioFAjdIW++q4w0AOLTZDJt4leRR/jgEiVwEArcv7xf3RvqVlczdeYSXsUMNzIbF0MTsRKWr8EcBBGAnTH8sJVC5OqLz/7juvgsux2Mk7SCEMzsBPXE/rF/ycmIGWlCOzJdKkE66C58t9LEFBiApvavkM6vO5zVJ1MK34SJo6ByyQzjS2HdkpBvarPfeASCd9B6Amg4tFM2vkTVVzD5DM8wU9yHWFTjNlsXh4mXE/LIXtLVt4fjPhwC7oRNoXah779kE7mDg== 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=QPYr3gi02pCxjw7Cn4QkinU+FClOZUJSPxpxxITibUw=; b=qNoraUBLLQU8OvjwjCQuXPFV1Reojkras8wumIntNh2/C+WwcOAgpJZpp5pmLKuyKx3cjqoYwNMKLtAxqEDSKT1KHvZKV/OoW4fqR+kMrMMwdeM2WmtD3XQCgZHigQt7uvdVDFp3SRTOKMERQu6di83yPcWrFeS4z275oCzv9Z0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DB8PR04MB7163.eurprd04.prod.outlook.com (2603:10a6:10:fe::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Thu, 15 Sep 2022 10:50:57 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5612.022; Thu, 15 Sep 2022 10:50:57 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Vinicius Costa Gomes , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Voon Weifeng , Vladimir Oltean , Kurt Kanzenbach , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 1/7] net/sched: taprio: taprio_offload_config_changed() is protected by rtnl_mutex Date: Thu, 15 Sep 2022 13:50:40 +0300 Message-Id: <20220915105046.2404072-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915105046.2404072-1-vladimir.oltean@nxp.com> References: <20220915105046.2404072-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR09CA0052.eurprd09.prod.outlook.com (2603:10a6:802:28::20) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|DB8PR04MB7163:EE_ X-MS-Office365-Filtering-Correlation-Id: a2538350-0e1b-4865-41ea-08da97082b64 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LZuHa5FC0q4iU+6Y2XqfUfVgEKMV8fg9t7rz7Y6Aj4xFkgrsxWxWqXpsRn9Wxp3JYigHNUiDVZ+ZSIDUIacBpqOy1l6sM70GhDQXlCtbBBLzV/THEEawFH9x7mIu9nj4s4roK7O43RhjYM/dbRcYf05aqJE4VUF0hfdmW62cjEQcgrBVwdcj4vjxG/SIbQ/FjwRaYEljvylUqXWZAJoP62s0UKFSBpt+86k/vWOD8nHAVbGKSazNNhV23ax7ZdHyzvHKUkaxaeykZjEfdOEsFap46jK95HnNdOBEN08+xW4myJstdLh4JpjkcqHp9Ij64I+0cJ4JXf8PwmVWH92m9IheJfYHbaezS57b0xTD7GSq4pqleZpSNlfgP7nOKt6JM/+wSnHH28UVwYrODj/RsgkLAJtA9oVWsrqEP5wPZIjmGq2X7VEE9xBAcM7sR++0ni+jSXXgRQa9J9cGcvtwAd58D9FQWudHEsK9WKa0SqEUKCj79tRI8yzVzYaMJCqj0EpUmabzhOIiW+Zw3PZUbtmcFZ+6H5DqwUM+CkzksrMAEjFU7+D6dl+LCoIQcRAo1AXnXrd2tYQo76QWwzpdPdTK2K/JH5s9SXB/JClbMta75JNRof3rwa+gWzGX1Piv+kNNcsDATQSwFJuhOwy0Ek7XMkDnvP+nTZpv0QlSXT6fgruTYi06QN4mAalJeIDi+MAwek9E/wZioQ/JtWfgzkSFm8HkNe892JfyaZ1cwd70QFbfg8zSGrLmem7mLlwhIcgzpJfdoqyKoaxqXpYtrg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(346002)(396003)(39860400002)(366004)(136003)(451199015)(6916009)(5660300002)(6486002)(7416002)(2906002)(478600001)(66476007)(36756003)(54906003)(44832011)(38350700002)(8676002)(38100700002)(6666004)(316002)(2616005)(83380400001)(1076003)(186003)(66946007)(41300700001)(6512007)(86362001)(4326008)(6506007)(8936002)(66556008)(52116002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kvv1gZiJ5Hu/kBWb3tyhUqBGYCJQL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4SZbFjy/1dFtRfnQvu8/HN4mShRRjiP2ZGPmYNA24B0Bn8wXj6hBzaM2AqgTaPDNtXl4Q1jy/Z+Y7sizawGBiFv6CvRhMvuLVjMF4o498+uat9CQr9Kms6z3mld2GnYKWIEbk0MaY4GgxEfEZkEF1g+dpH9D9SZFkF7qeYhtLMuM9M7f3hE1oQibHNnRomAjntQlYfY8VaSG1NIGtZyX971I1rjHIExxNNTTNSTTeOs0ur+dNkqNrFxdqhaalQatyQSJ5MCQ5/8lZp+2R1F1uciEUku3ZdUV1uKduBd3xJ1rQOu5sxqfM4QyIFBFCr7g8AWm9BNtQTUzrL6y4VJ0o2hSZmb38PR82M7n9vmcyVz9Tg1vBcBnxsjYEpLT7QCq6TJswmymSCw4EKVbrZrdXPjQ3YqcW+qta77jPus431bwLHj3sL/nRR42zLSbGHPb4SP5rB3lUE7XkNCVoTAqajTuT1Mil6yjRA1ikl1F4NhyOndi1Usae3YA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2538350-0e1b-4865-41ea-08da97082b64 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2022 10:50:57.2213 (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: CbxlJoORD2UQ4ZefAcfCKPjCV8W0gA9/zBAb5ibyV//q8PsRVOfoziFVGMb3Apap8wuouOd0LjJXkRD26o88Cw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7163 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The locking in taprio_offload_config_changed() is wrong (but also inconsequentially so). The current_entry_lock does not serialize changes to the admin and oper schedules, only to the current entry. In fact, the rtnl_mutex does that, and that is taken at the time when taprio_change() is called. Replace the rcu_dereference_protected() method with the proper RCU annotation, and drop the unnecessary spin lock. Signed-off-by: Vladimir Oltean --- v1->v2: patch is new net/sched/sch_taprio.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 5bffc37022e0..550afbbae8bc 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -1194,16 +1194,10 @@ static void taprio_offload_config_changed(struct taprio_sched *q) { struct sched_gate_list *oper, *admin; - spin_lock(&q->current_entry_lock); - - oper = rcu_dereference_protected(q->oper_sched, - lockdep_is_held(&q->current_entry_lock)); - admin = rcu_dereference_protected(q->admin_sched, - lockdep_is_held(&q->current_entry_lock)); + oper = rtnl_dereference(q->oper_sched); + admin = rtnl_dereference(q->admin_sched); switch_schedules(q, &admin, &oper); - - spin_unlock(&q->current_entry_lock); } static u32 tc_map_to_queue_mask(struct net_device *dev, u32 tc_mask) From patchwork Thu Sep 15 10:50:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12977235 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 263A0ECAAA1 for ; Thu, 15 Sep 2022 10:51:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230076AbiIOKvG (ORCPT ); Thu, 15 Sep 2022 06:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230059AbiIOKvD (ORCPT ); Thu, 15 Sep 2022 06:51:03 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E55E6E2E1; Thu, 15 Sep 2022 03:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EBQxmG5+RfWg3SMyC2A4H5ndRL/WHD8wXjbkYcoeKO2i/VHGPriFSjTkISK9yjQ3J45uJQSwLaD3MS6eZcnK1CPeykXEtTGOptkCYZ5WA95QdJfmKS9xhUXkLvnSqwC80MtcljbQR6GlAeDXwaqKG6RioqPvWmKjA4J7/AiQSZFKO17OiYYqKB77LjWyifMsE8DxKP9vOs/ECavDX+uIXuyWUr1FIuXvLoP7rAX58VatzJa4LKAEdd/ym2msFhVFjbIQbzdiPzD5ubaCUwm6dlAqpkZRZBBC8qXBiO3a8ywR1yf6DjVpj63/b0QMrpa3ZZak8X2vylgxCz9KlaC4wg== 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=RQr7htZxbs9XrBwAIu1MKm2/7liV/D5w6P1xmCEZWLY=; b=FxHzOiSxzWF9oiHsf5OrnVQM0ER+HF6tfuFPKDvhQX746HRg3IdgG+7oEmESsGGoQ7wXRSCyFhI2x4b+LxqEU56pHiSm1mjJroFeM/E7cf2pkltK6AD0LI9NWkmMsy8LHcF83rq8MD7mlW6Bc5OfseUImJb15jAWGTE4YAVHF3+7Ol56zstvMhsMCiVCNQ+gBAOddXlYJmScj+3/ciKheDKkMYd9bNp74KbrxSyB68cdlukvsw4WlPtvzM7AM0P6PYP3EJy87mHfpPZMtjyOGfVqf8eh+laI8sxZ0yol4/mtb6PT4NHR5B+6DNLtCa8juUgtZCTjNmVs9nUWHi54KA== 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=RQr7htZxbs9XrBwAIu1MKm2/7liV/D5w6P1xmCEZWLY=; b=Sxpd98piiP0JwLXPPjy1AGz5fMBPm1EXDT3durKdJ8bj/YSVleR0n9nqkx4zH0Xty5XoYdTxHEJOZc0a2nFw/vi1rEjGVaQK2Z/9Q0oVzZcXpK9f+AwvJHQfQkMQh53ibCQEhBr3SulGHf6jgHK9k5A1SBtn/CMBNeqlHTK01Bg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DB8PR04MB7163.eurprd04.prod.outlook.com (2603:10a6:10:fe::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Thu, 15 Sep 2022 10:50:58 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5612.022; Thu, 15 Sep 2022 10:50:58 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Vinicius Costa Gomes , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Voon Weifeng , Vladimir Oltean , Kurt Kanzenbach , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 2/7] net/sched: taprio: taprio_dump and taprio_change are protected by rtnl_mutex Date: Thu, 15 Sep 2022 13:50:41 +0300 Message-Id: <20220915105046.2404072-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915105046.2404072-1-vladimir.oltean@nxp.com> References: <20220915105046.2404072-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR09CA0052.eurprd09.prod.outlook.com (2603:10a6:802:28::20) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|DB8PR04MB7163:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a1e846d-14fb-49b0-7366-08da97082bfa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aKDPg/KtB/mEyHJ3XRv8zBTeaKk8BugZ3H/NYRANXlc2/9KSqTQdGnNfQk9mj8akpxC/gj55bnxBQGG9EpJEA4VPFI482auZnZmw6M0y8VkadckgNDJnOqofArdN4oqTxxDrR4n7V7KCixKlrha/cg4r53mO4ZKov6ZZOAP2SPJojvls22w+wC0qksT5AXJ2BUtKjxQxfEFesArRjWPdJyKW7oPTB1Up9RGGTVT4tgo0HsXP73ATNf0MC3wSr7hrsus24kjzYOe3McENJl73Zrhj4yHGClOMSsctY/2fAoPKypjX5obXg0/jZVAgsnlhVBgXEL1+loVxppsaHp+LBUh82ZIELYuBh+kh+kJYenoBO5SHtHJ5Bu3yCRkAX/X/te7uc1epyIi2D6VGbn0VybNjX7GSBjwuXvcnCeohcNqcDLyyvhL1MrYrVmbznlIxiMn7conXrfmJLb0jOG0DLAJz+sVF7wSWCLH8BLJLZzxz4lmkVtf+lPLpEJW1Fm86li3gOs4IAQsAm0rgtqt6SrQYU0x7jy/N6XcgAtUjKnoZ7ab4efPPE6I3d/827UgN03EoTJOtAXfw4aiY+OX3Lc5Sv+UjkjXNfkaZIiR7n1AEhO5ClpeYeI6/2Hj8yfxk/8crBveusiXCfmZxvjvCQH0rrQMe3FlAjGrriaqWofpwJhuC1q224rDl5fwVb/3ZeuHk9BZYz4/9UjRVHWhkXJ+oC4FOxN3iIwG4h6RW5kRo9S6SFGfZILkBxk+bJ4MySt+f4B6aDc4AggECk1GK+w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(346002)(396003)(39860400002)(366004)(136003)(451199015)(6916009)(5660300002)(6486002)(7416002)(2906002)(478600001)(66476007)(36756003)(54906003)(44832011)(38350700002)(8676002)(38100700002)(6666004)(316002)(2616005)(83380400001)(1076003)(186003)(66946007)(41300700001)(6512007)(86362001)(4326008)(6506007)(8936002)(66556008)(52116002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: e+tPblQxeUUjEzzO8gpNuNssSPVZmW6JjC1grBhhjsZsbXfKiAAOVKzBDzTwmrwnjYqfue/J1nB3lX47MEYbbUMTZG/fy9oKZRaKqE9u0M9529GytHeCIlmkBdE5yDb41yWaYsxNS2f91fE5zc661LSapEVRs6Byqd4OBqNyX3Wiof/mu9qt7OyZVvxWoctiMC8MfABF2rqIpU4KwOchiC1ghXpTguCfuPYCfvjTWmNG1z/fkkTVxt4ABQ6tty/Ry+7NQaeyBE3G0JU41fQPHHovn/wPL59z8ll24lp/2MixyWAmkIRTsxvKMyk1VGLO+yDj5dQQ3DLIu4Xo9RiSb1cG5ZsKprfR6/faT3YvPVYmwXtryl27hSmNGLlBQSAJ2iPKndrA1U9+x40PCpMw6GQNkYGTlECswWtdofNR0RmmcWoeLAMdz/wHYQVyHqtUGTbB/n/3dbLfE4tAfNAPkQyNByZSpcHtqV01oD/SKrBsskbg1ReqCWUN0VBJNg94T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JiuJsXn+qVMqcnUZduV4LhdruSGXeuButWUj8T9A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a1e846d-14fb-49b0-7366-08da97082bfa X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2022 10:50:58.1743 (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: Z8hKyS9zZbTgk73Wyvb6F7+Pd2K2cvnmoy22Srues+TA8cHnhy69rJXBzVTb4du7Bl2t0vlf6bv/8i3I9HsfVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7163 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since the writer-side lock is taken here, we do not need to open an RCU read-side critical section, instead we can use rtnl_dereference() to tell lockdep we are serialized with concurrent writes. Signed-off-by: Vladimir Oltean --- v1->v2: patch is new net/sched/sch_taprio.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 550afbbae8bc..63cbf856894a 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -1486,10 +1486,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, } INIT_LIST_HEAD(&new_admin->entries); - rcu_read_lock(); - oper = rcu_dereference(q->oper_sched); - admin = rcu_dereference(q->admin_sched); - rcu_read_unlock(); + oper = rtnl_dereference(q->oper_sched); + admin = rtnl_dereference(q->admin_sched); /* no changes - no new mqprio settings */ if (!taprio_mqprio_cmp(dev, mqprio)) @@ -1880,9 +1878,8 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb) struct nlattr *nest, *sched_nest; unsigned int i; - rcu_read_lock(); - oper = rcu_dereference(q->oper_sched); - admin = rcu_dereference(q->admin_sched); + oper = rtnl_dereference(q->oper_sched); + admin = rtnl_dereference(q->admin_sched); opt.num_tc = netdev_get_num_tc(dev); memcpy(opt.prio_tc_map, dev->prio_tc_map, sizeof(opt.prio_tc_map)); @@ -1926,8 +1923,6 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb) nla_nest_end(skb, sched_nest); done: - rcu_read_unlock(); - return nla_nest_end(skb, nest); admin_error: @@ -1937,7 +1932,6 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb) nla_nest_cancel(skb, nest); start_error: - rcu_read_unlock(); return -ENOSPC; } From patchwork Thu Sep 15 10:50:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12977236 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26109ECAAA1 for ; Thu, 15 Sep 2022 10:51:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbiIOKvI (ORCPT ); Thu, 15 Sep 2022 06:51:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbiIOKvE (ORCPT ); Thu, 15 Sep 2022 06:51:04 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B10B80EA0; Thu, 15 Sep 2022 03:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NDbuMrLiSk5BKqqO3CoTMswFlh4oAZs80jeZ8W5EigQgwhrjhZkG2GszIeBjAMXLkIWJb+LGD7WVKULJ5lyeH8AR2Qoq/J+UrzEYmQX2janLAIqOA6zzp85agmrD0LPVxLA/SuXn81EomjNmAqk9FgLKPFAA5VjkL+ZY3VNmc9M48G53M3yQwhA/m76iP8D/nC+9+9bPHfw1awvCHFh/0BdfBQnRY2IpHWCWnlbHAmkaPl55CqCVygQTBeIM8VzdTT/dxZrzHOeY907IBRWE3tRFcLNgTuIrQjW/OGIh8Oxo2PVMCJ2A3MKlyJCJY4KB+HyQgxl60E8JJ5eixcb7Rw== 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=OVllrFQAyaq6mv4H0bPEc2mXWu0XjDAty9O/abvxXVE=; b=OLi9i6D3uMtKLwS5u3HmFC9zujsXfiImJMk9rNNRk5lwsGts37+lIJu9Jd7Gt0aEN9wT6m6fo910Td0m8rL8jF6iN+DEZU5Z14fmhkOOh/wKoU0kWWqAnThgWZmyH2GZgIoDWbttKFo5KaLgHvzN4Z7DuA6570AShW14b1JJIvC4xIqx8T2fe0tPQ4VV9Rt9YXtRP2gbHERBwPDknmaPdAKtN9LS3aoIvJqpirKwGriE04RPt2BVUm0D/5JogwmPhKNtNrYeSqCZ2PhDBG800RR+fW9TaKT5xLSW3qXBC5q+qu+Xj5XMyWmF8Y3XTBHaYjtKPyCbE22/ldmUJoyUKA== 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=OVllrFQAyaq6mv4H0bPEc2mXWu0XjDAty9O/abvxXVE=; b=WVAOSlpAMGp/dPiqXScXiIPuLu7wAABLWpfVq2r60k+ti5sOP4Uj8mbAIIPmni/h+HgcOkQUqi8xj2jJqQ8qUgKxbZ2XTv8hHwXaaugGN5HKbJC1NNXhhOfDNlN2FXpSvy+40C4Ipn0dE/kTWWXQ7eGq2jsB6HS6IAkGN0CNHSA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DB8PR04MB7163.eurprd04.prod.outlook.com (2603:10a6:10:fe::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Thu, 15 Sep 2022 10:50:59 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5612.022; Thu, 15 Sep 2022 10:50:59 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Vinicius Costa Gomes , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Voon Weifeng , Vladimir Oltean , Kurt Kanzenbach , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 3/7] net/sched: taprio: use rtnl_dereference for oper and admin sched in taprio_destroy() Date: Thu, 15 Sep 2022 13:50:42 +0300 Message-Id: <20220915105046.2404072-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915105046.2404072-1-vladimir.oltean@nxp.com> References: <20220915105046.2404072-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR09CA0052.eurprd09.prod.outlook.com (2603:10a6:802:28::20) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|DB8PR04MB7163:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e34fa99-9322-4db5-56f2-08da97082c82 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YLTxZMV6RpatO9q9paFbipVoGng/iXzUqu2HflWutbzGLpAHEGX5Ur9dHxyGQTxk1CPeFS2rnMB+7FHgWyQlZyz4GdxvW6B4fWgFyjcDvjJs0srDo/8ci98LGPe0gEEo+DriPoRNCQDbZnYuJRVGANFfFZiMY16mij+DqNcVK6sLlKGF40k7ZitpeJr7jlgfBoSQ89sOP4yQeSH85Agj4TC16s2w+GNpWL0TR3s4o2u8y4Xi8pcZv8LcOhklgh4Y81oHR4n+iAj0FOjiqhAB/J/txGpIkM/DKylLPJoAoj+J1owYeMNsDOoRnWv1V9prHHN+R9GJPMRImKzUE0tMiLnxyzY5s7Y8CXl4NTyC/l1CxzJAGE3GrtX3GNRWWdqPc5ZS+SGu3FxPAThNyXvE73pVRQ3Lm435pVS0ndVN3vyFEbEChWAHzbDdCDH+iIhBQtRJ1GiIX1s5j7k+Pq9KnyR0QhVJt8/LgPXX+SIHj3O8TJPgysdegXphTiknXuA/iEt2QS25RH6KMWZmC46e6NiWkuS9Wm9c+JLdy0e023rKg3htOUC02zECpFXC2IrozvPswQaDz80dMZTau2u0f86CzPs2iLaTbLzIluyZDBzgZCBLx9WNKVAfsO7uTQ2aTHrvF//14CNmg+4kujMWpBlcgsmMR8tkV9Iouyx2gLooB84YB6CiZRv4BZ+Wtem928EQGwlom3Qx/pqdJwyg5foWViTxpW/i1L204Dv99fnEhSeYHCqvWOCQijsvHzTKtP8v9K5EBhzZLvRF69srFQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(346002)(396003)(39860400002)(366004)(136003)(451199015)(6916009)(5660300002)(6486002)(7416002)(2906002)(478600001)(66476007)(36756003)(54906003)(44832011)(38350700002)(8676002)(38100700002)(6666004)(316002)(2616005)(83380400001)(1076003)(186003)(66946007)(41300700001)(6512007)(86362001)(4326008)(6506007)(8936002)(66556008)(52116002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aKklTgPfg8kkBc/Zt0SnmRWD15tinZiEP8l/NO4/4yA3ksHtO9EAHKcgMnvlWN72446osBcDG5EOetloIUiJRKuQEMPVTDo3yPi89GA8VY6BpqaRdjo2LoWJMztSRqXPdShfRLhABKYXKmuL1ln3frD2k1EBWc9z36vCNTCiZynHRqK6yZQ1cEJ09w0akAxXOfL7qsiD6lKsy/VCyy9AxLlMKr2z9OVRFTciuEZTOpi1f8rxahfYNL9G60FcUzpC/Zn02veH7zI98iVqYzkIYIUnajDktU6v6Hd8But1Hj5QFe//6VS1Ps0dSzOco/QLpzvuvY2RoOx//j7yskOJjd6RI1fcCFEgJUhHt6mmV6CYLzElVwY/sddwcxs8vTVCZgSFm+16F1knszsewCgxuHJSir7hHbf+KnfrURWgr/k7pt2r0YxVfuw+LlK+F5o6o719OKL1gugNiwv7DKdDCoQ2mfYeEjDjToGkh1DHrrF9Omy2ayDyDEry7fM5ZK1S/M5aosONuPzoPhr3Yaz8GSXaDsP5kqysEw9sxlG9GLbw3sYB4aOdVRpK4BIuZoaKUSkAG7eSdRDGC/P+jpKpm86LSzPLZWMEz0ymWl7ptbFaQ/D0yTqOAYkXiqjbaq2kE20SkZ/Jqd4t6vJcpHrfAPfeEIXvAiRD+wHNnCmwZwL7GfkXICllFw8l2jBu2gTnDf7orW5OF7q4xQV/8NaHjt+HnTn77e/OjHFKhSx5MXsrn13L1JkYIf5AxvCiDSAFeUATRqTZLyjzm6m9yG/67NX+yAsYsyD8en7gu1REpRkJlYQUtoRvQOlQi+2IA/0+XnwCb6wNzXM0wwBHyAxcPAd4sxbFBRq8GPpirOhsMqIwu2vf7kQRHISz7uJzJ1mGMmS6YvybkcV0ojICyIOswoGe3+aTuWMDFN/iuCy8h9oE/KL68FmnOxW0LyX/iW1RGgOi1EzGpZ/Wv/NWi4eWuGTCRG+i3rDC2HoBpXHHC/m4QGCMVzR+NvVWygITNfYn6hHPKzEdtcEjiKV4+PYc7KfMdGR+I10nDsdkvdSDXU+PQJo+8jvz/MWpM5kJKNl6R8Ed3+vOemvcBZEY9GcRT2FSxKasIjdPWKUQWh/pAAGUmNbrntq+iQyPPcrWBwdtXTfYv+5yiuvSEKWWgHoBP49Jyst0ARuTfRqFp0U7cyRPtky8NuSkf8I6E6ckjSL4jJ+YjikoZgI84ys49+9fAsHPhGnM6OSfU35ZbYdGjLiQbUVnRpG+RKZyZMpBaF0lTla4kS+PCnNALgYykiBAauErPorkdXD5rm0LX5DMsg7e0/ceQUwHDZwRF4SIO7sQxwJ64PIGrYHI6fomeLzV/Mqi3qGmG80OmxZ1vTSVp/rHU5wEi2H8J5gV4kS9qJI5VpB6IwN9m9SQkfKPC3bWCMpC3KR7G3X1I6OBXu8hO56yHimNRLx6HjVgh7gemQVDx5k6CLUAcZrIPLiHRdD85TunyNNbvR0DtCXpb2jBBopQjf7qGsW1OJT6txNooxs1ICXGksYUppjH3l8eOmm+iRG9Lir+Nw35oo+mq9wG/ECjazov/ybepjxbcWMIoWdF0+sFb4W4+CtzT9d+61OK8Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e34fa99-9322-4db5-56f2-08da97082c82 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2022 10:50:59.0649 (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: qUct/gTwpaZNAH4Oeh98AHl0oFXziYXbF0cpweKZ/eZeTY0/ou6wLeL6I42FpYQjhau9xmnjTjjXKkZanTYtHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7163 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Sparse complains that taprio_destroy() dereferences q->oper_sched and q->admin_sched without rcu_dereference(), since they are marked as __rcu in the taprio private structure. 1671:28: warning: incorrect type in argument 1 (different address spaces) 1671:28: expected struct callback_head *head 1671:28: got struct callback_head [noderef] __rcu * 1674:28: warning: incorrect type in argument 1 (different address spaces) 1674:28: expected struct callback_head *head 1674:28: got struct callback_head [noderef] __rcu * To silence that build warning, do actually use rtnl_dereference(), since we know the rtnl_mutex is held at the time of q->destroy(). Signed-off-by: Vladimir Oltean --- v1->v2: resend to net-next, use rtnl_dereference() instead of opening an rcu_read_lock() net/sched/sch_taprio.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 63cbf856894a..6113c6646559 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -1636,6 +1636,7 @@ static void taprio_destroy(struct Qdisc *sch) { struct taprio_sched *q = qdisc_priv(sch); struct net_device *dev = qdisc_dev(sch); + struct sched_gate_list *oper, *admin; unsigned int i; spin_lock(&taprio_list_lock); @@ -1659,11 +1660,14 @@ static void taprio_destroy(struct Qdisc *sch) netdev_reset_tc(dev); - if (q->oper_sched) - call_rcu(&q->oper_sched->rcu, taprio_free_sched_cb); + oper = rtnl_dereference(q->oper_sched); + admin = rtnl_dereference(q->admin_sched); + + if (oper) + call_rcu(&oper->rcu, taprio_free_sched_cb); - if (q->admin_sched) - call_rcu(&q->admin_sched->rcu, taprio_free_sched_cb); + if (admin) + call_rcu(&admin->rcu, taprio_free_sched_cb); } static int taprio_init(struct Qdisc *sch, struct nlattr *opt, From patchwork Thu Sep 15 10:50:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12977237 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EE24ECAAA1 for ; Thu, 15 Sep 2022 10:51:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbiIOKvL (ORCPT ); Thu, 15 Sep 2022 06:51:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbiIOKvG (ORCPT ); Thu, 15 Sep 2022 06:51:06 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E045184EF4; Thu, 15 Sep 2022 03:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UPgQCL2kkh2jlR4AYjPYEGnlvHL/foUUsPw40Y/pp4iiUpi/i4aoE/vyfJIjdX2hDVaFZOTSwEAQVSZW7xIFvgfd2xSEkRo7xzAGySwWC28O31Fc//5dkIhUR4Z24QMrgk0ztxUtorHzWVbNTr8P1pQfWx6Ny8Qcfmo0ZdGZN7BlVZYNOmrC+E/4Aj3Eg/VX11XJrBHxpO8Hdda37qvhIU8LdkUA4ZCgVOW4XHBDeUh3/NQRURUq0HOOBQFV/6LU5Y9x2rPmmY8Z2Nr+8/0teHns68rJvls0O5v3UhddDbnmhNr++9lfbTJsWnu3zyPrrrpRytnkFxIBy6gkR48rKA== 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=P7vWmqTyuHABdbHofeJRh9DDAJ9waMiZ4sTIJZGOujo=; b=L0xekYPo5N3+ZJ7EwtE3pon2tvcUaZ9rCrwb6ZaaMY0BmKIK8b0OumTS3Bz6UEKog9E6u7sNLrBdDw5lCcyBxH6/SV+PLVI8S7oEZDkgqtcQcXKFFItt3+dzz2AlSYLW3OA7A5jt0SVQWKZDPxg7iub4g9gScGfNnHtvp6l3iLIcueHdxE50WONdoBqeG3DBiBNY31+vSS2yE4L4iwqH56cDg0M+CcssCSCz6ID57KxFfF/v23tfCAGsBEtnIrerTGj6vYjaW+Lz1t3RcegF+Al6eBKIHvsoSwyukSJm7JoROoYRVSCqewOjLT2rcbnP69tXmjSOWXZpCpIeI6X5uA== 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=P7vWmqTyuHABdbHofeJRh9DDAJ9waMiZ4sTIJZGOujo=; b=a2XEisNE5cKqRcd/jY21dRQROAIXvyqWigRTFeBxqLTrYRVZYy5YpLa3NYtbEp+aAEcNNWC9Rj146yigrMjGYCh6MxSABd8oH29pQKv28wKsI29wfh6VnNWCv2cLJt8E3lzB6hnEw35T6Ds5nTDOzDd5o8YNCJFIYElFlcov3Dw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DB8PR04MB7163.eurprd04.prod.outlook.com (2603:10a6:10:fe::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Thu, 15 Sep 2022 10:51:00 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5612.022; Thu, 15 Sep 2022 10:51:00 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Vinicius Costa Gomes , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Voon Weifeng , Vladimir Oltean , Kurt Kanzenbach , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 4/7] net/sched: taprio: remove redundant FULL_OFFLOAD_IS_ENABLED check in taprio_enqueue Date: Thu, 15 Sep 2022 13:50:43 +0300 Message-Id: <20220915105046.2404072-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915105046.2404072-1-vladimir.oltean@nxp.com> References: <20220915105046.2404072-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR09CA0052.eurprd09.prod.outlook.com (2603:10a6:802:28::20) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|DB8PR04MB7163:EE_ X-MS-Office365-Filtering-Correlation-Id: e5c8a6c8-95b1-4c40-d837-08da97082d07 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MTA5ZiqueW6LtFN7mA8gpVvMbo9itloyMon6bN7GxhVTKS7cEP0IyEbDc/VP+oyDRnbz95wsgBCcluoPQXXQCRR/fNmPs1DZ64IqztKlmov5ey325anf6Vovs/TM6/W3eYIqHmAOmaleJaB9mWwIkYAJC3WEXTE8HAjDP4zDx77KUqu6T2M6iZIHwluVPy8M7jCEEYaXFahSzUU0SBM+oSz3cqY9ebwNxY0luivDQmJ5keh6NXBrzGRgnsG+J05yXirUV1DzOc6w9rB/iccLnlPJelV9R6rhCLTtBOIRZUgje+ZIUpiJrLa75jGjxrPhKR7hWv4xuoGUKRbxI0C+W0TXSl8a0sjoPN5tW/LS/BOC47pf/b1k83Ku1QG5PJOZfSxRM9wIxV13e625WgNKLkIlhxShHaw5gdCB7LMz0769Sp5YMqEHmlMb+gBtUbwoBv9G7mSNEddrPXVewdLEyBnvOMtir0/WfJlOI7qGpDuSdpligG0LZ0pz7iBkivmS7VZr2A4zP5zKsr1JnKGSJOLBmSzBVjZh8SxC9y6plIGRjydAWOwjB2+60tf4+yvNVUvNPPslR5cQY0ZUt19mkAgtWVxMLpEWQlF7U1IWxig60TAQts1qfL09vFdM7PF8A7hK0eLP4U9QdNDm7S6jzqVgHOGRUrwLlIicEwRdRwTNieaXjudlwGuvy+xt3+d6ko9exXHsPt+oVnOPWv7/Elgi6Zfe6Vu1EUQSAQQD0HfVvx7LyBvQu9DTsD+90jiGgu/zTNOl0BVSt+o1Eu41zQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(346002)(396003)(39860400002)(366004)(136003)(451199015)(6916009)(5660300002)(6486002)(7416002)(2906002)(478600001)(66476007)(36756003)(54906003)(44832011)(38350700002)(8676002)(38100700002)(6666004)(316002)(2616005)(83380400001)(1076003)(186003)(66946007)(41300700001)(6512007)(86362001)(4326008)(6506007)(8936002)(66556008)(52116002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j/Me1ms+c78cCjObURvKtwK4oOEOWUQYB4lIoFDrFtxdZx5TrPRTFgqKCEnmak2vATv9ZFNXsdpViMfqWK/VTvuYkxW1RwCDN20bU0vWU94GEjUVwx33x4bF7e8TIHY11fG8pR/mUgONkkHMi1Jqjgvt7sz/RRdRKMEe56Cqe21P0192S7PCz50QGMRrlPcf4boAXiLb2UIfr8vrzwFjTethigfVV7IUPoqr/pCgkQfc41wjwtQZx4U0mxUnYpF2LV0zfCjCUc2dP6+gF4rDuhbvlqqvqHNEMMgzrY8ulB/6SOGA4ci9D4tgR+nzkpyfpWy1Ynd6/DmWnrfARjevTbegfEP8O0tT+wHkbTTGEY3eAxN/NYb8hxWb4WbWgVyHF4yk+9rRxbuJU+HNLBG0Z9vsxoNfJOWRzccezb/5TrTrNsNs09rV+HHeVz/y0Y/eMlAmmIrHq/AQu8HvssRuAZ5DL/zg0/mwUGg6LvmJJ12/b8+gcHRDjOAY/fZwjbGMDG743fxHgOZd5oV+l181k8iNAvZNZ73UpdRG9fEhgAca8bYuliCNWqjR5mM4gY6yxa7zrf4NtrKLHpT99gEhAWvmdaopwiH00wWbMXszuw7IIokQzQv8WeITlHmdnW2a8bnXXSHCC1GIZRJ6x6vXbaN5K9a1ywzfsbUMH3My8TgoZwEZGRImXbKYQb+LG7+/xCeVahIu1Ir41VMWVnIhPm4Ungi/fnww/qMX/6GxmHLPo9UN1QDJMyJN7xcG5VHQcXqX6sM7jvNWuCjDxSkECEtAgPigWE6146AnxNwhIAaN3G75A1GLyFSik8OPbocT5APtu+q4w96olS37BYxrQmQrGyUjkW4Ps0kDM6dsLic8QXxzg0fEoZT91pzv58jlKhs40L+8js6vk5PKn/fnZzkBD+KRRA0Ky6ojr0+JWIz9+NNeg36gxDs6JhnOVoFH5J821ekzGFsbURFTfnIRh5RptKQLrayiLKsOvXeUVo2LCjZPsncKas85hQEAPoHYJjNCou+EJgskv+WvfOT7RJVQlel5ipdpJH2S37xms1rTNLb4SFupNgnlUKEbzvmRMuJTOY22mhLc4tEipIETNxobxnYFF1CyO8YVQbftgHcyhjNBHW1uAVvMWZ0D+Bj35pBIyEIWzkfGnxrs5kpVxZ7vNWMBdUOFOXzZJOSdvMtUZxbk8Sh6dyrm8NGPym64Clp5zL/bHNJ5u7t8IRY+MB7XCYovnZgFHzBmG/iuKG1qCVCsjZpMJb1WQrbH/tWS/0+Jtunvt2kX5M0K+VQ5n1pNbJzewlO+1E3DQaEFZ3xKWVTliF8P/Zlp5TSF4RxyrHs8RHIaH64fQBcBSzi8Jkxt4I6Wm3R/BRhIvrk3k/8azFLeDNjNplxykKuSrLC0nO+XHW6moMUTx/J2PDUpBt6UeENTWk8cDUFc0fw+/8o5QG2L/SEinbU+F79Jb0Zg7sx93dLydhchpWoMSgJc292dlsTtYjA5bmNCTdMdByoNoaKuaUA3NZEOb++WkX1QHFiKyMLacR3BAa9j+ocu1H03p95wfYH9qA8BoWGfP9czU8GPH7DgRnmrd97A7UwOI6YIlKE60qiF+BYpPwT+ew== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5c8a6c8-95b1-4c40-d837-08da97082d07 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2022 10:50:59.9086 (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: zFoROgOm6UjXggnW8ZWgUkWkfzZ4fVjFAUHayHDJPX4/fpIRv/e03oySmd8k7VYV1tEGVbb4xYrN4o44d9s6ow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7163 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since commit 13511704f8d7 ("net: taprio offload: enforce qdisc to netdev queue mapping"), __dev_queue_xmit() will select a txq->qdisc for the full offload case of taprio which isn't the root taprio qdisc, so qdisc enqueues will never pass through taprio_enqueue(). That commit already introduced one safety precaution check for FULL_OFFLOAD_IS_ENABLED(); a second one is really not needed, so simplify the conditional for entering into the GSO segmentation logic. Also reword the comment a little, to appear more natural after the code change. Signed-off-by: Vladimir Oltean --- v1->v2: none net/sched/sch_taprio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 6113c6646559..0781fc4a2789 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -455,10 +455,10 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, /* Large packets might not be transmitted when the transmission duration * exceeds any configured interval. Therefore, segment the skb into - * smaller chunks. Skip it for the full offload case, as the driver - * and/or the hardware is expected to handle this. + * smaller chunks. Drivers with full offload are expected to handle + * this in hardware. */ - if (skb_is_gso(skb) && !FULL_OFFLOAD_IS_ENABLED(q->flags)) { + if (skb_is_gso(skb)) { unsigned int slen = 0, numsegs = 0, len = qdisc_pkt_len(skb); netdev_features_t features = netif_skb_features(skb); struct sk_buff *segs, *nskb; From patchwork Thu Sep 15 10:50:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12977238 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48A75ECAAD3 for ; Thu, 15 Sep 2022 10:51:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229785AbiIOKvX (ORCPT ); Thu, 15 Sep 2022 06:51:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230104AbiIOKvK (ORCPT ); Thu, 15 Sep 2022 06:51:10 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A06D186C04; Thu, 15 Sep 2022 03:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bWxs2lukLHSP2UId74+e0W5kyHKCJ00SBLMxqYcPalCf0Zha4wy/sqJU2EXkLKi1nAsUsNZ3R71+ztOWulzPDRuzjntmU9EJBYsYzEK8d9cm8kO0vv7BWKqFYyxugdP8BRdQuILsLCxRPUcvU7c3Kienv3EuGYSqNoKAB2+id/sR3kKGCtFv8jQ53zwUDz73KAvd2YS4gmO4b0EztrCkDQh+6xJ0UivIg4EJkpXdCEiPZGR7Om4ZzUJH1/BDOAiNx2VbuRFgLDtTePaglVF3PtyfVLz3TDZ2i4XQeD9quULyWq4L3eHoGvrOdHu0ZhwIPIsb2eI+K7U8t3mlv7s5iw== 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=u+G6TwJq6ioGqqPHMsCklnww6HGHekjKkGFthnYt6AQ=; b=NpSMGf4XvxyzOhVP2VqiemjmyUW2gyGvt9Abh/vgaw4+U/qXlCQFs8dWA6TEZmLrr/WqlqrcvfqsBYjB6zwf6ivDUv4gB2vOj/iAY0LK+9ZJvKwQ8bpbiKwlJReRSS8uvW+J/eW2SMDJEQiBTCZD4VLDqz9OLcpW89wah2CsAYtpu7SIS3+O0xGvhZaw/dQZ2CzyXzidRo4Hdp/4TPhE96cBZbf05+nY+jSyxUgNcVgOfDmEgvyBZ4vuaKu0/p0T2/CbaQxDsx9BMBbHNXblSV+BwlDteC8gQgF5/oyZyeyJLYCI5pk2jq55eGXZNL6OX5DKdVhjXxICTBxVJtOumg== 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=u+G6TwJq6ioGqqPHMsCklnww6HGHekjKkGFthnYt6AQ=; b=LHFU1g8sT0eqG2PtjsUYHNuW1QmN2ARGEwhp7j19IwOpJaonmXwSdrUEFH0cKp+uSuDNo6NofIAQ4UmBnAbKyK8jxil/PhI9NOQWyX6jMWj+KRBu5r2oQpL9vgXjEBgaYp05JAALayiFKTy9X3YUSTOGDArYa+uWHIYQ2COxnb0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DB8PR04MB7163.eurprd04.prod.outlook.com (2603:10a6:10:fe::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Thu, 15 Sep 2022 10:51:01 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5612.022; Thu, 15 Sep 2022 10:51:01 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Vinicius Costa Gomes , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Voon Weifeng , Vladimir Oltean , Kurt Kanzenbach , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 5/7] net/sched: taprio: stop going through private ops for dequeue and peek Date: Thu, 15 Sep 2022 13:50:44 +0300 Message-Id: <20220915105046.2404072-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915105046.2404072-1-vladimir.oltean@nxp.com> References: <20220915105046.2404072-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR09CA0052.eurprd09.prod.outlook.com (2603:10a6:802:28::20) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|DB8PR04MB7163:EE_ X-MS-Office365-Filtering-Correlation-Id: dd2e048d-7595-44dd-bbc5-08da97082d8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E2BJymnjVv3IRsOcHOFTkCmSJ1jMXxP3IgK85EJWJ8wD8KQHWrujsCTxuuEz7ro8WR64yhFZV1yaT3ZfRMsWoGMlHsH3qN1WCIpJy5p4RKtvYmyTH+RKA/uCYyj/ZPe716qrs/F5I9cBqqoavH0+MON4htWOJmcOXBEOAXLowT/xbf3ttQ57AbQVpef+4BIt7xbQaeZEplLjOnznUAG2doW7yKzqcg8niic14AM2AuCeWQnUSeF0ZqZZPN9S5kAJfgo2KYZnQ7k+7ZB2UZBO0+KHhQA03oSTSXxXmuXAjAfiNC3WwHGiEhdQWYQZeET3TbrJ627V3RbwPw/oKPByY8JFa7RvdimnIYIRg/ko52hxy29MQoCc0Tpl9/DzN1rNibZBzPjY1lhmjbZGLa/08FloB7d5ONe9KqHilR0/wwVuyFW/IE+4y83vNNt82qUjIxX2/xhEnVcqbhQm3BvPenRLTuDwxr7LX3KT098Hovs5gfTEb8NNfrHgt9kI8RtHPYEQLreZopD/ijUQtdIHxzxuiCHuAG1wxhbCE7BK5PXIZ0urAiwJ2arvfVAoxw2c81BXQzIgDEGcQYIv8en5aPfLRfMG8kAQhn9siVj7tk8NDStRSpFHFq7VaSxBlFlKoWEeUP/XEFZQZEJ8nRQl8ku15ogdvXJih2Dgdk0dMbdttjvdNbQTNNnAheHE8zMT4yjUQzod3nhmwhK0tHbpoJBVvW6Zdn1rl/AUw+PmubaoZXn3Kf6ElhzgjdnBey0+oOSkIoakHJBpZnCUGD9oDw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(346002)(396003)(39860400002)(366004)(136003)(451199015)(6916009)(5660300002)(6486002)(7416002)(2906002)(478600001)(66476007)(36756003)(54906003)(44832011)(38350700002)(8676002)(38100700002)(6666004)(316002)(2616005)(83380400001)(1076003)(186003)(66946007)(41300700001)(6512007)(86362001)(4326008)(6506007)(8936002)(66556008)(52116002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gTC7jVQpd6J2in92rtJfi7xWZKi1OQDDevM/5D7TZm3doqofOYSXNpDQxyhMswWwPS0unkpqDz77BEyBVLCc/ui0I0tuIZ9z5KG8p1R2IfaU1Y6DxF+YNYQvqW7bOIshA5LhIe+WUpU+a9tfyrzpdALHMgCck2CCa/nMyJjzrG9nC43bWwFU5IpaXMCUqY33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HT+jXi4iJg5rAR+iPg1bacFcjWsnq68HOYIXnFqAC4Btw8Yoac0ScSk/VHCIu2wbCDF4kyqB0BsBtj46p/K4RbKeewVA0F9T2k3aBAHOSuVN8UvWSMUwPfyDFL14+uVTSCSz1N+2rNh605m80htqVtqYLsQHDkWQN4Ds3iYUT7ed21IXlMSt1+AfNfO549Aiyw3DI9chVd4//CWFfPEGGAkziZO5JD9eY30G4Ake8WrmN9o467mCRULXbIdMk3wxTN+344s9npd+D5ycKJrehXeGLyAHGmDgO07N1o7qQGXEdTnoBUvhoUNWMl96Cgb0ztpbFMjORvFuAAsBDB0NMNt736tuw+UbHl0OA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd2e048d-7595-44dd-bbc5-08da97082d8f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2022 10:51:00.9398 (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: UGaDQcjMqzYAXwuUFyIAGalUq0Kt15PAl/DScQHSP+ArRKPkcG1RjDFxEGzaJnYgTzGBosLROk/S1nTEik4m6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7163 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since commit 13511704f8d7 ("net: taprio offload: enforce qdisc to netdev queue mapping"), taprio_dequeue_soft() and taprio_peek_soft() are de facto the only implementations for Qdisc_ops :: dequeue and Qdisc_ops :: peek that taprio provides. This is because in full offload mode, __dev_queue_xmit() will select a txq->qdisc which is never root taprio qdisc. So if nothing is enqueued in the root qdisc, it will never be run and nothing will get dequeued from it. Therefore, we can remove the private indirection from taprio, and always point Qdisc_ops :: dequeue to taprio_dequeue_soft (now simply named taprio_dequeue) and Qdisc_ops :: peek to taprio_peek_soft (now simply named taprio_peek). Signed-off-by: Vladimir Oltean --- v1->v2: none net/sched/sch_taprio.c | 58 +++++++++--------------------------------- 1 file changed, 12 insertions(+), 46 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 0781fc4a2789..f3eadea101e1 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -79,8 +79,6 @@ struct taprio_sched { struct sched_gate_list __rcu *admin_sched; struct hrtimer advance_timer; struct list_head taprio_list; - struct sk_buff *(*dequeue)(struct Qdisc *sch); - struct sk_buff *(*peek)(struct Qdisc *sch); u32 txtime_delay; }; @@ -492,7 +490,7 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, return taprio_enqueue_one(skb, sch, child, to_free); } -static struct sk_buff *taprio_peek_soft(struct Qdisc *sch) +static struct sk_buff *taprio_peek(struct Qdisc *sch) { struct taprio_sched *q = qdisc_priv(sch); struct net_device *dev = qdisc_dev(sch); @@ -501,6 +499,11 @@ static struct sk_buff *taprio_peek_soft(struct Qdisc *sch) u32 gate_mask; int i; + if (unlikely(FULL_OFFLOAD_IS_ENABLED(q->flags))) { + WARN_ONCE(1, "Trying to peek into the root of a taprio qdisc configured with full offload\n"); + return NULL; + } + rcu_read_lock(); entry = rcu_dereference(q->current_entry); gate_mask = entry ? entry->gate_mask : TAPRIO_ALL_GATES_OPEN; @@ -536,20 +539,6 @@ static struct sk_buff *taprio_peek_soft(struct Qdisc *sch) return NULL; } -static struct sk_buff *taprio_peek_offload(struct Qdisc *sch) -{ - WARN_ONCE(1, "Trying to peek into the root of a taprio qdisc configured with full offload\n"); - - return NULL; -} - -static struct sk_buff *taprio_peek(struct Qdisc *sch) -{ - struct taprio_sched *q = qdisc_priv(sch); - - return q->peek(sch); -} - static void taprio_set_budget(struct taprio_sched *q, struct sched_entry *entry) { atomic_set(&entry->budget, @@ -557,7 +546,7 @@ static void taprio_set_budget(struct taprio_sched *q, struct sched_entry *entry) atomic64_read(&q->picos_per_byte))); } -static struct sk_buff *taprio_dequeue_soft(struct Qdisc *sch) +static struct sk_buff *taprio_dequeue(struct Qdisc *sch) { struct taprio_sched *q = qdisc_priv(sch); struct net_device *dev = qdisc_dev(sch); @@ -566,6 +555,11 @@ static struct sk_buff *taprio_dequeue_soft(struct Qdisc *sch) u32 gate_mask; int i; + if (unlikely(FULL_OFFLOAD_IS_ENABLED(q->flags))) { + WARN_ONCE(1, "Trying to dequeue from the root of a taprio qdisc configured with full offload\n"); + return NULL; + } + rcu_read_lock(); entry = rcu_dereference(q->current_entry); /* if there's no entry, it means that the schedule didn't @@ -645,20 +639,6 @@ static struct sk_buff *taprio_dequeue_soft(struct Qdisc *sch) return skb; } -static struct sk_buff *taprio_dequeue_offload(struct Qdisc *sch) -{ - WARN_ONCE(1, "Trying to dequeue from the root of a taprio qdisc configured with full offload\n"); - - return NULL; -} - -static struct sk_buff *taprio_dequeue(struct Qdisc *sch) -{ - struct taprio_sched *q = qdisc_priv(sch); - - return q->dequeue(sch); -} - static bool should_restart_cycle(const struct sched_gate_list *oper, const struct sched_entry *entry) { @@ -1557,17 +1537,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, q->advance_timer.function = advance_sched; } - if (FULL_OFFLOAD_IS_ENABLED(q->flags)) { - q->dequeue = taprio_dequeue_offload; - q->peek = taprio_peek_offload; - } else { - /* Be sure to always keep the function pointers - * in a consistent state. - */ - q->dequeue = taprio_dequeue_soft; - q->peek = taprio_peek_soft; - } - err = taprio_get_start_time(sch, new_admin, &start); if (err < 0) { NL_SET_ERR_MSG(extack, "Internal error: failed get start time"); @@ -1682,9 +1651,6 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt, hrtimer_init(&q->advance_timer, CLOCK_TAI, HRTIMER_MODE_ABS); q->advance_timer.function = advance_sched; - q->dequeue = taprio_dequeue_soft; - q->peek = taprio_peek_soft; - q->root = sch; /* We only support static clockids. Use an invalid value as default From patchwork Thu Sep 15 10:50:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12977239 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F004DECAAA1 for ; Thu, 15 Sep 2022 10:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230166AbiIOKwB (ORCPT ); Thu, 15 Sep 2022 06:52:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230155AbiIOKvW (ORCPT ); Thu, 15 Sep 2022 06:51:22 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E18589CDC; Thu, 15 Sep 2022 03:51:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J3Ns1mOIePaU4l/UKzoSL9kcw/z6NSeWVeLFA0iGW68q0QEilsXDtWO3jL+BK3NheVnQCNHQloqTQAwWDgfQHn36TcSpNL94evbX+NPL/LMKjHkqse+mUfrcdz5nzFkEhnFaP9F+wmIXLXfPgIVZS+4t8sa2z/H6pCt7rRITKBeW+t2toeXjqVYLjHciSV3HnzUQxP+mSHlIAwk5aZsez7VeUtModKTRN3NlAmIX9HjFmrJNTjU28SxMBgAuuh0osCHctisqSidd+4R7exaNlyFVjLJNwQuraLafhE0QHO/lBWRybwfWfbG7hGG+dXSk99H6gpYQb9q2Q7Dz4rbkaA== 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=ofug0xbIJchZHDQdZ3fIaHdqFMSpcbUXoQal4Hujn2o=; b=ORUL3y1BKEM9Q6hRCMnXV302zQ1Ec+boMKRNm5788QoZjXe7opE+1/nhaLk6xWClHX0EeJCrCG2Rw403Dq0neJ7IkUNt+bHauSFWqKXmw8Cz682oumk3rx5eglUrrIZ5oYxgWiQosdG5wmsSqvfncwf2Nd7Kd9iSn4N+AuLfxTuzeE1TBgrFaWzQajswXlgPL30SBRIZWptFSnpyL47/GKzbGvDvtIqqwdMtBMDxlaEhULU6YeTmfT5ugMsNKeYL0DE/E64QGEFCwYS2btSOa3ExMnGF6SGSHA1I4LjkGNe0tZaNqWQ2EELE96P+Y01WBlVJQjYJSbNj1PdPQm5LYQ== 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=ofug0xbIJchZHDQdZ3fIaHdqFMSpcbUXoQal4Hujn2o=; b=ImJf7YGeuP1VM1PppZtK6XaBvfE4ytqvtaNruVRexEPEdBGFY4MORpBhXYJvLeDrpWqRWJFX3QTX/+TFO/RnH457omp5tnPOeezBd/ThtahwwtBXSqHhKbqEn2a14tcQROZJsfvwx4bb/TmzmnHIYy0gDRuoS3pH2FR9wAJqAwg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DB8PR04MB7163.eurprd04.prod.outlook.com (2603:10a6:10:fe::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Thu, 15 Sep 2022 10:51:01 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5612.022; Thu, 15 Sep 2022 10:51:01 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Vinicius Costa Gomes , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Voon Weifeng , Vladimir Oltean , Kurt Kanzenbach , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 6/7] net/sched: taprio: add extack messages in taprio_init Date: Thu, 15 Sep 2022 13:50:45 +0300 Message-Id: <20220915105046.2404072-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915105046.2404072-1-vladimir.oltean@nxp.com> References: <20220915105046.2404072-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR09CA0052.eurprd09.prod.outlook.com (2603:10a6:802:28::20) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|DB8PR04MB7163:EE_ X-MS-Office365-Filtering-Correlation-Id: e4da418a-a40d-47a2-4f8a-08da97082e28 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ORlkeiOGGQpGCiwyMw+YjzKOKfcvD2pdmxZPbNeQ0IXVXZgh0K57uYr1DMULs10nj5rUtstzW6MjOrApkcIRu30CF2Yr6De5SxW75rniFF94PGvhP+zLag7FR8qUqq+BcfFhz+0wHJsXZE3RRLOMNdcqNpbzD8l4BcC3jEXwsr+wQrO8upkL3yzXf9TQ7G0EAOQkV6nXnfa808cMnpaJxEm/6tP6haKJqMP5WDYjRSBTC/fRozcoY5vlsA7MYCU2oiZXwqpMFjUzlJTjrTPnDRmLTWNl/yJJt1wwcbT5xN/ohjjvBNTHxva9dUtEoGeI3Y0n6gTvWPc5xjuVNRblRdaAL/od/3zy5yRdBgnX/ydnKgvL+Q6jxFRSZu3FcOkD9Z8Rb92sn47GgyG4q1xDjI97lv3C3UewI3HBuRCe92Z8v2zk0umcCYdNk6xRAH3Yol20QQraSm3iN6nKDcUZoxOnN/XgSIe577YqrOc7uDVKLVyrbBXABxKZn2Ih6x713PRlb1pcPIYLTspemEVVtQ3BmmLJZ4nPY2+E9K8eOAktT4TTtkrbyaad9mvN+wpwUchsffNY7PBYfm/kkoyOte2EPL4sSDaiPui6Asy5w227hDlHZAi+59Y0TarA9RZSVYmXzym1cZkiZnaABVP3dNFznptm5sQ8lw9x/9XB2oO0Oq/yPuLIqnnrMM7pO/wRLCAFrxd04sID3ozf1EA4ES/KwVysDEsufP4atXOctbagxfTZT0kql3g2MafpGYPCS37j9CrJdRN4cVQExO+2+Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(346002)(396003)(39860400002)(366004)(136003)(451199015)(6916009)(4744005)(5660300002)(6486002)(7416002)(2906002)(478600001)(66476007)(36756003)(54906003)(44832011)(38350700002)(8676002)(38100700002)(6666004)(316002)(2616005)(83380400001)(1076003)(186003)(66946007)(41300700001)(6512007)(86362001)(4326008)(6506007)(8936002)(66556008)(52116002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-Ant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2Vgf/NPfAI/RpGPLeRy0TeDSg868klV5Z0HKVGm5+xEQPFQ+oPLiCCvCDkZn5pC5ilMMYdZowfL9XfYfuy5gv2SJXqXxDyehFFGKRhBHE6tgweYAvLqOiwcBlZFaTetgJyB1LIM2NgqI8NtUY46OXZT5//CxFj1g6wpRLYg4QajrK6BzN/O1e6q5dQv61lHXAwmnlbj4okCTfsHsSzGwNATRvFGQDiNe16a2LsUtZVDDvi9vhM+11tqgqmC2ScM+ZQtZnuxfT2fKmh9I6nZcyDHUV4jPllolSQlCZLBO+Qul6/p+HIasch7Gp1UKwmFR5gUowDmEdA/FFLJEwhGRPBUpnBcBgy7WVAI1N7daAXu6yChgG46OPGd5WUeWvo3f2WSz1tohegbAymda+PUmpZUV1dl4qw3oRTNvuc0s94ae7tQg28+iF0RH62kUwtifO1QN1lpdNUKKJKgEOfex+wZpFOxwylTXDEgeWKgAi3lY8aMyCckB85m9NG9WjSY6Z0AnK1GnB0qpmIdhc2iRRY1vlr2LSDymvB95Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e4da418a-a40d-47a2-4f8a-08da97082e28 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2022 10:51:01.7835 (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: 4fQF5Ogg67B1VQUlycfimiw56+IwFuoK5/svh1vwJLUNomYVsx0DHvTY/2XFj6605yaKNlhrsD8r5OI3yLU67A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7163 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Stop contributing to the proverbial user unfriendliness of tc, and tell the user what is wrong wherever possible. Signed-off-by: Vladimir Oltean --- v1->v2: none net/sched/sch_taprio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index f3eadea101e1..bc93f709d354 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -1663,11 +1663,15 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt, list_add(&q->taprio_list, &taprio_list); spin_unlock(&taprio_list_lock); - if (sch->parent != TC_H_ROOT) + if (sch->parent != TC_H_ROOT) { + NL_SET_ERR_MSG_MOD(extack, "Can only be attached as root qdisc"); return -EOPNOTSUPP; + } - if (!netif_is_multiqueue(dev)) + if (!netif_is_multiqueue(dev)) { + NL_SET_ERR_MSG_MOD(extack, "Multi-queue device is required"); return -EOPNOTSUPP; + } /* pre-allocate qdisc, attachment can't fail */ q->qdiscs = kcalloc(dev->num_tx_queues, From patchwork Thu Sep 15 10:50:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12977244 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7210EECAAA1 for ; Thu, 15 Sep 2022 10:52:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbiIOKwG (ORCPT ); Thu, 15 Sep 2022 06:52:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbiIOKvv (ORCPT ); Thu, 15 Sep 2022 06:51:51 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B7C9910B7; Thu, 15 Sep 2022 03:51:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GSii4I9/Ck0OE3fm2fcI8pVPA5CUioRIh88Hr7LondvYrk5otrl1+sdrG2n8cC6M/apPEmwpC8fHMTXTPYrXooo1W/yLb0C/EyFCF7zQyfR7EkFAKgLpqvBuVkPmHjQV6TJ7RHEiKb/9MNOqAEMueOOd5t5jEbWvYucYf9jkD5Xt6YL3sciNhYQZOXL5OcK8JfJcAIL6gbuPRYKus1hvG62pXf0djhmI0/oKvXvG0C+SYjC5XkaeSuuv24UdR3IpyCAkKzNWY9QIRDYGyP/u0qCRwnL6UjXmcF6FwDktd77Wt2FLGObb2njdT/tVnHfEzLGQCrtIlBFddxnZaZMgOw== 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=MW9ktne2TZBssJRUu9LXBfJO23SUlEmnNozeqIhBq3s=; b=f/hoCfzJLSg2I1IWwxr9J+Kx4kDm/9fm90XcI9dRkB6w5Gj5r9j+9m8cMzvU0kA/uFivLIF0ySNZvA9EG6Q20gdC/j94ZRO9dwRL+ooOyf2m681ZEfcWdvaHc75R/pcmEuLpNI3pccpdwbStrRiKM6eBDRIRsWLJvN1OFHrF8SCyJzC+jaR5WtMgFoFe7If0PzmJ2mmaz0LzgnUGH8QfNhcKc3zdKFSfFhZEMF6hWtMFNN7ALy+PACd6T8UqNjLLsBvImDYuLnY9ZP1ftmQBiJYDjrz6yJRTN7ORXLLg/ggEbIo1CTkicW4fp0im0Tk8i5ci1+BAJ8guwJX5GGB96w== 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=MW9ktne2TZBssJRUu9LXBfJO23SUlEmnNozeqIhBq3s=; b=oWwppnwkFxYJUnV1d+r5PX7nUdhfsRWK1cRwXCvoDGWthElrldhau2jnDSd2BJg12bCHzR2eu+q51J51BEqVFSXLyu7QJDV9d1+wDT1KxMOidFm5paX/qOImQi2vuhU+DOd4XCdCeEBhaiaGputg/9fzUsMJGb48pq36ddeDVSM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DB8PR04MB7163.eurprd04.prod.outlook.com (2603:10a6:10:fe::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Thu, 15 Sep 2022 10:51:02 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5612.022; Thu, 15 Sep 2022 10:51:02 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Vinicius Costa Gomes , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Voon Weifeng , Vladimir Oltean , Kurt Kanzenbach , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 7/7] net/sched: taprio: replace safety precautions with comments Date: Thu, 15 Sep 2022 13:50:46 +0300 Message-Id: <20220915105046.2404072-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915105046.2404072-1-vladimir.oltean@nxp.com> References: <20220915105046.2404072-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR09CA0052.eurprd09.prod.outlook.com (2603:10a6:802:28::20) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|DB8PR04MB7163:EE_ X-MS-Office365-Filtering-Correlation-Id: d0cfe20c-a5b5-4897-d0f5-08da97082ead X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lfiWG5A4fsMD/Deeke+nwEtEmNZrnMz79V7zkilepT7ouCezMW0gbMhQ9GCf5sjY5qGS0ST0K83BtCkqvCMukAT61OJoJ+cOYuCscCCMaqm1/iMR+o7a4nFtPYMaz/ddBOfjNpAGwi2FLy8y9URun1OzQC+Yqt1gG+ZBmZ1Y5y/It3lTEtuCi0KJzN3ofb5t8KXlFC1WWyq/Q2UQOcVLJYCEOWZaGHq9oCgg5gcUm37XzYL2LA0a9W1HVm1GW1PbUOT0o4lkkjqInqzBkIF96KUScYPoNGpM3g0bAARZWtQVVnWKWltQ1UnRqikaygY6AfUE5kxjnn5bwPIXMb0XwYr7P8HXbLYUpx6m4VS2nSPmgBpc66Qs4yy46hA/kDnz65rzZiAfF1nduZFuw/Y+lc0wPbjBc/tqK5FvIcR6+jkO8s3R0t1dfHfMPUC2knl8qYH4MijJLgH6clapdvnFnuJWtu/IVI8CuCdBNH7QVPUDGZAlQx8swAGxv/vyyRSRBHaCtc6WVD3O1yV0AK58teovnPDvBzgqW8HoTDQ81tO6AXIzHJvuOE3SHEvyvHjsIBYWyAAHngVgIVBjmHiV7nqZ5UUm4+2nKMVQQfE/g+tCbXRbmv6FUUFYLFkz4pDpc4LAjws3jeygRiAZjPl/gN5ff+5sgEeWFfv2aS8HL3dhTDDzASLw8mtl6qxA8130d3be9WvvxX+u5wOrY+ESbdGmX01Knk1HD77rKsj3jxdzvJOVDPWJDWfrA6Vokuk0Fj78rLWVOoV/WCE8R6ci2A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(346002)(396003)(39860400002)(366004)(136003)(451199015)(6916009)(5660300002)(6486002)(7416002)(2906002)(478600001)(66476007)(36756003)(54906003)(44832011)(38350700002)(8676002)(38100700002)(6666004)(316002)(2616005)(83380400001)(1076003)(186003)(66946007)(41300700001)(6512007)(86362001)(4326008)(6506007)(8936002)(66556008)(52116002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZiIIunfDhheC4nEi6l+M1hqOmqmzNZmzVpI8Ej38+v2DN/sITgY6GJ8N8x1/MdkyAj93Sb+KmaEf2gONn9fQoy78cQlyBAqzQI2q6SI8VCGRZr+b5XsUbh9wJtO3VDID8Ctw6CwIHyS50d3M2EosCl+gW/+oJt9g7dG40S1q3bjS0Xd3ct5oq5y1lAnVMKrtcaurQblyYtlU4thFSrn8LIsgPXfCPFpBFRE8cj6CqANUnYAK2wdMXdge/XKyG+e0d3j7S6FFGAll/V6Owro0tFeiZo3E0jOTyw1ybwyM3XKsRrtb4wlhtF1jCJSP5nTq2DHdv6hn9rj0nlIHWx1Xxb0P6CV7G6EaR4nneAoqd9xNTEBDmhoS213uux+b6+SR6tDA20bd+2DITFB+UexwiOQI90/Yh3UotBEfr5LmRS+Uz2CqV2SaROBm2wseghTdZJZeLzWxYYHOeDYnff8SaJJufI/KIjKg5M1Qw41j6zs4AHCmQhbtuizx3R+v14ug7/ilHM1RO/rPyWk3zdgVyYSqlyfZqaY61b70vYg0RLOcswV9u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.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0cfe20c-a5b5-4897-d0f5-08da97082ead X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2022 10:51:02.7521 (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: 2CxonATBTueT+K2MVQdWosPMQJ+34bM3+V7qCapqzMCN3tAXBPRwTEFxeHHQKT+YmO7pTej1y5EXoWELBRAAsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7163 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The WARN_ON_ONCE() checks introduced in commit 13511704f8d7 ("net: taprio offload: enforce qdisc to netdev queue mapping") take a small toll on performance, but otherwise, the conditions are never expected to happen. Replace them with comments, such that the information is still conveyed to developers. Signed-off-by: Vladimir Oltean --- v1->v2: patch is new net/sched/sch_taprio.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index bc93f709d354..8ae454052201 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -433,6 +433,9 @@ static int taprio_enqueue_one(struct sk_buff *skb, struct Qdisc *sch, return qdisc_enqueue(skb, child, to_free); } +/* Will not be called in the full offload case, since the TX queues are + * attached to the Qdisc created using qdisc_create_dflt() + */ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) { @@ -440,11 +443,6 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct Qdisc *child; int queue; - if (unlikely(FULL_OFFLOAD_IS_ENABLED(q->flags))) { - WARN_ONCE(1, "Trying to enqueue skb into the root of a taprio qdisc configured with full offload\n"); - return qdisc_drop(skb, sch, to_free); - } - queue = skb_get_queue_mapping(skb); child = q->qdiscs[queue]; @@ -490,6 +488,9 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, return taprio_enqueue_one(skb, sch, child, to_free); } +/* Will not be called in the full offload case, since the TX queues are + * attached to the Qdisc created using qdisc_create_dflt() + */ static struct sk_buff *taprio_peek(struct Qdisc *sch) { struct taprio_sched *q = qdisc_priv(sch); @@ -499,11 +500,6 @@ static struct sk_buff *taprio_peek(struct Qdisc *sch) u32 gate_mask; int i; - if (unlikely(FULL_OFFLOAD_IS_ENABLED(q->flags))) { - WARN_ONCE(1, "Trying to peek into the root of a taprio qdisc configured with full offload\n"); - return NULL; - } - rcu_read_lock(); entry = rcu_dereference(q->current_entry); gate_mask = entry ? entry->gate_mask : TAPRIO_ALL_GATES_OPEN; @@ -546,6 +542,9 @@ static void taprio_set_budget(struct taprio_sched *q, struct sched_entry *entry) atomic64_read(&q->picos_per_byte))); } +/* Will not be called in the full offload case, since the TX queues are + * attached to the Qdisc created using qdisc_create_dflt() + */ static struct sk_buff *taprio_dequeue(struct Qdisc *sch) { struct taprio_sched *q = qdisc_priv(sch); @@ -555,11 +554,6 @@ static struct sk_buff *taprio_dequeue(struct Qdisc *sch) u32 gate_mask; int i; - if (unlikely(FULL_OFFLOAD_IS_ENABLED(q->flags))) { - WARN_ONCE(1, "Trying to dequeue from the root of a taprio qdisc configured with full offload\n"); - return NULL; - } - rcu_read_lock(); entry = rcu_dereference(q->current_entry); /* if there's no entry, it means that the schedule didn't