From patchwork Fri Jun 2 10:37:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 102499 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp953901vqr; Fri, 2 Jun 2023 04:26:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6E8HLIn05CZpM1di4kkf//bvIMtozd2kE1+d5906iPvKrRNnpUnwrofcc1JfdEtPI9m96R X-Received: by 2002:a17:90a:5982:b0:255:38ed:9dcd with SMTP id l2-20020a17090a598200b0025538ed9dcdmr2429202pji.0.1685705204284; Fri, 02 Jun 2023 04:26:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685705204; cv=pass; d=google.com; s=arc-20160816; b=Tb3Em30oPiPKAkr8XzNWeNX1dRm8BfevEWhqrnusRL+jlzyaTd9KgNymn1xpxIJ83D GCuIPh3IRe8/2DIwC9d2+zmEwZDXdgPpQkoffD4qZXmmkeldB87bJ6eRC8eQlqs0utng hCDyoOcVG3ohn8s8NHcllF004DdBzxvg6wnul61JB9flC7bTEA9wWKsv/8Hz0HGgLa4M poV1p26JDl/TBomHBpNTY4LZOriE5YfRlq8q5Tu8XMLmpaCeh4RRrpfeuuBp4OF6h9eI KSUUevgQ6qcw1C5zK+C0vDjhKFXVIISGGah9s/4wp8KtkJS/Tqiesuyj6bSa9hheGR60 L6lQ== 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=90aNbYjsFEH0b2vRKI+gD4P2mkOvRG3stxDnfBaWs+U=; b=fV6js2zjCGe7AwRSeX/FO3lUq6nDChBxv1zdXJaLGpPEplDyQQ+ZKa1UyBifR+OGkd iYXu5qf3dzYAvc30IOGdV9s3ZORduGGXtgazLkZLFtk/9fdIdqn+Qfl6QDQ8omQr/53l xwCcREdaTu3GGq5Gj19q+1lqtcsDL41poQiHyuuLdR4Wn7T3OrIDOwpOPDzG5UtWll/F BbdwNhJcsMbLfcTXe4HuzqRQlSf63jna0UqTxbHZRNlMPQ90On/glsZFUzEmUJycl5F3 YE4sFVTsNbTuQbpp40ZPUu/+0l4XKW3Rj5JT4rqgrsf6BYhC7s5DB/ouypr2H6/+EpLJ bYyQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="pEVZs/rR"; 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.30; Fri, 02 Jun 2023 04:26:44 -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="pEVZs/rR"; 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 S235233AbjFBKku (ORCPT + 99 others); Fri, 2 Jun 2023 06:40:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235792AbjFBKjq (ORCPT ); Fri, 2 Jun 2023 06:39:46 -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 F2D461A6; Fri, 2 Jun 2023 03:39:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z5SDzo/B3k0LcinO8ZGzjPCcQn3ZYW+O44C/acCd9k5/KuYbEDCvvjYltH1LFJ+HycIYfNjrsh97PqIEBvellcjxfgkB7wFY+26PL+G/BjJdHR7mezcMW9yWzHaKlUaUs3s2zCxMr6FwZmITGm1GdCJG3Fuzltcw0o0ETWtGCorDQ/coHDKQ8OFOpeZtcDZJd3s5k94kMQkHtEWT13JU3v25fb/YxGh8u4J4nT28+JCHHjnZ5mRVwygusdtAAa9Z9+6JYzp6IjMzivQSSYGLxIL8xO2i1/XrjoblY0B+2xlmtAwb6y7DVB7YSahc0V0BXJInuMI6DFjKLX3GrnKTyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=90aNbYjsFEH0b2vRKI+gD4P2mkOvRG3stxDnfBaWs+U=; b=exa0jmMrbSuilWB7at2RnXbv8ex7UN7vgFzP0Ga0O5OL+JNuF5K4Kv8403/17X61KTApGHPv7KTFc2nNvz8FR6l++PLfWLnhljFbzH6mJL12TkgU152Ob0qYP8YQ0GZdVH2Lhp2MCFzSAudEeGGFWkiEprsGHTAOVyp2UVTQ/+ANBIDfjD+68qXtOu/EqZ9oiQOdrHX/78M/kgYgLAGv92DCOuZsWszTXfuG87UwT0Btami140rMk+ZhtqX7PxZPTt3AgieTZifSkU8ZuptjaeIdtzC+nZ3rwZcGo2nAzRK/2xiCnOCKSKQ/S76jw3vqi1tR4sqFT766eHiWl77mqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=90aNbYjsFEH0b2vRKI+gD4P2mkOvRG3stxDnfBaWs+U=; b=pEVZs/rR4jbQTCSIMfVZiPZbHZysJLfXvDtQfHbSfL9oHZ5FcdFDigAtnfvkzqwA9lYUg54VgNkiSRql1zWpDojKjNwQlGnMAj7XNEX+bZ9u2jcEmyc+EhYvf5svhxzv9QB3gzIhimOlQ2j2++icUviGmYLYYk0D1fN2ipyFAaU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by PAXPR04MB8926.eurprd04.prod.outlook.com (2603:10a6:102:20d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.24; Fri, 2 Jun 2023 10:38:20 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::47e4:eb1:e83c:fa4a]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::47e4:eb1:e83c:fa4a%4]) with mapi id 15.20.6455.020; Fri, 2 Jun 2023 10:38:20 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Muhammad Husaini Zulkifli , Peilin Ye , Pedro Tammela Subject: [PATCH RESEND net-next 3/5] net/sched: taprio: try again to report q->qdiscs[] to qdisc_leaf() Date: Fri, 2 Jun 2023 13:37:48 +0300 Message-Id: <20230602103750.2290132-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230602103750.2290132-1-vladimir.oltean@nxp.com> References: <20230602103750.2290132-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0095.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:79::10) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|PAXPR04MB8926:EE_ X-MS-Office365-Filtering-Correlation-Id: de803088-807a-4dd3-38cd-08db63557bb5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cb9Zsz+qh1ZKRItWN1qNNi4q2uj7kgEwpaAENDV4j7YvLrNuGZD0IpbbznyoCUC9LmjO/HB3eBcwkXDufHAcyl+MYwf4511w1qUYL8RXPwnn6si4fyT4P8hBjjBQPK5uFBrmCmKi/1iegicWky3sZt+lT/WTHocZ31QiP+AxwahXx0I5aHiTPSmbHQhHeXXbvpqHD+664XR7ASUGboBgF21aCWKqZf+7c400l2SpynwrEwGW2y6+Jo0K+xjqDr4Q6RYYLWv7Zkog5z8eCGid8pqxKDr8e8/sr8zC/RCt6Wc9fA0bQYBobiAuFzkJ1n3wEiCk4t2XKQWRQhuU2TSgEV1UdnvcunALMqQCD2uzpnqkI4QMkKMroEVVG63WodrTn6HjflsNEbiJC4dMA5hWF4oHelOE12RwbZeED7GVqBtkCOovGHjvkhWRZySPmAQWrnBmXlmEhftMVqFxPBvggRvrniellv8R7byreKrneueAKRAyr+uuszxvtHDhlccY7wvzxK0vluYVsoeLED0C4mocv3L3S2Ygub3MlI001omd2CjpO2id4x+19H9MappsqIKu+NTx+oIOJN+5wviPqOg0rT2omTwBJCjrpAB5ruRsA/BvWd3HfGJkjR+pW3Z9 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(346002)(376002)(39860400002)(136003)(396003)(451199021)(8676002)(478600001)(6506007)(1076003)(26005)(186003)(6512007)(6666004)(52116002)(6486002)(2616005)(41300700001)(83380400001)(316002)(2906002)(44832011)(8936002)(5660300002)(7416002)(66476007)(66556008)(66946007)(6916009)(54906003)(86362001)(36756003)(4326008)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: irPoHh5sN4Ff/dRLmXeKKEX5bn/K5ptcoH01sTqGWwuZWHftqrWIMe+Vr6VeNfULWcpvE+/O3aBxHyXKjSXFHEwV5X6Na5SFD1zAkF54tntksBa0gRA7XL5sWpR9zzKXvdpbUFE6m6e31Xu40/l0yHqvZk/bSN3pn2QOmDdRLv15LLmaAgWTpV/w7z5z4BXLkOxoqA86yFoHVq3MkOYSRdoQAjH+JYlk/XVppmpBiygUh9aNrX5uGiAG7Jlj9yzuYpekJaQspVLA+ZNJDwZM/PUTrOoFoCHTqEbArMsZIkkKk51SX9euhIGC91T/g4xFb9z4KspZ8QJMVq+5AnvDfYP+O+pCRv0Jubor8PqXyQXIamuRq+eN4LjCpJvATaVfpHq5DjVUak07Ja2o43bGHz4eEl3FqVCTUiJoDwX6LZc2w9T4uTqsVsPF279QR5KmWLYgkGjfZYphQvoHXT6iBiJklSmVyf0UUpt1PR+PEtASZjKMBRMXbRGfvuv1gvcTuh2PS8PUtD8LLlyGtpM0D+ijp3q7fS84pOFvEIyki2wKBqmxM73nLakBt7SYXkdSCPqFvEcWeGctyN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807a-4dd3-38cd-08db63557bb5 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2023 10:38:20.3559 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vsWKN8GEDeBS11iNDT0L0LxBZsyRMUyfnb8khdtrZE5qVDq9bmgpJ+s0bAJxdBMnYL0yUGLeOSiaFJGGrJyG2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8926 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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?1767590020592392470?= X-GMAIL-MSGID: =?utf-8?q?1767590020592392470?= This is another stab at commit 1461d212ab27 ("net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs"), later reverted in commit af7b29b1deaa ("Revert "net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs""). I believe that the problems that caused the revert were fixed, and thus, this change is identical to the original patch. Its purpose is to properly reject attaching a software taprio child qdisc to a software taprio parent. Because unoffloaded taprio currently reports itself (the root Qdisc) as the return value from qdisc_leaf(), then the process of attaching another taprio as child to a Qdisc class of the root will just result in a Qdisc_ops :: change() call for the root. Whereas that's not we want. We want Qdisc_ops :: init() to be called for the taprio child, in order to give the taprio child a chance to check whether its sch->parent is TC_H_ROOT or not (and reject this configuration). Signed-off-by: Vladimir Oltean --- net/sched/sch_taprio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 8807fc915b79..263306fe38d8 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2433,12 +2433,14 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb) static struct Qdisc *taprio_leaf(struct Qdisc *sch, unsigned long cl) { - struct netdev_queue *dev_queue = taprio_queue_get(sch, cl); + struct taprio_sched *q = qdisc_priv(sch); + struct net_device *dev = qdisc_dev(sch); + unsigned int ntx = cl - 1; - if (!dev_queue) + if (ntx >= dev->num_tx_queues) return NULL; - return dev_queue->qdisc_sleeping; + return q->qdiscs[ntx]; } static unsigned long taprio_find(struct Qdisc *sch, u32 classid)