From patchwork Tue Jun 13 21:54:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 107573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp846656vqr; Tue, 13 Jun 2023 14:58:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6I3YWA3TL/+G6q+Q+fFSX9hSSB1cw5Lsbt9eARZsgkOq+gaABv82rYM4nKFiBW4NPoBxs2 X-Received: by 2002:aa7:c547:0:b0:50c:358:1eba with SMTP id s7-20020aa7c547000000b0050c03581ebamr6942398edr.35.1686693536228; Tue, 13 Jun 2023 14:58:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686693536; cv=pass; d=google.com; s=arc-20160816; b=O19xJGyyBXFvnrGSn+EWfkJ5TIfC4fFsoPHMODLU+JV45ROwd10XffC1ZdCoAEy7Qi mn+tLZfCMijwT+l1HR8oU9r9FLpjGB+nJNEJNdI3gvxiJwdhWDZ7te4uxc/NXsxaqUi+ 2daKBEOdjhlLMO8qVV6R1bsCJ+9OybLMd5oc6MjbqiPluBHyZYbFCSCkzXmZPitsVOMH BLdU/58K3sw0pVTyx6Ijfu7HAAs7w7Brc0mpxAViZRSKv01vUKCYvlX4ib6JaOJMpr2Z 5125J4azc9ff/kH25ZwiC+Gp/2WSrri/mgbYgXEPNv3rsD5u3lcOVjkQDj9J1Xuey4Yo zMbQ== 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=gXqsxyTcNdi0rJ3gF6pbv2TOSMGV5sZGMFTjQSS/6+s=; b=jKOs4Vy+do6p4ScYNMh+paCAoDwB1Sd51gKi6YCxxdxjxTHRfzwGgJdkP1ZdSVsN9q 5WFeg4xH/9x/M1d/s65AoX2guvZ6w2wFvtSpzhw8pMQkJchZM91clArsYYrtL3FozfI5 D13PQbSQtYhP2aydRp76/XbzvkKCpr3ZOLxIxgPfqcv+Sk9U8ilZbPxseG9fzomgN8aC KqSC+gczEsDMmADZwOq43I8MNCL+wEB4asERxrEcvGlRQPGfJsgbnxGxYgUVU7nB63cm 4J49zU0xocLPOJrVmLxJ8SMjIhuWrAOBOEQCjGk/Zgzgz6z9E7fA1fc7peYQVxOblulo MhSQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=EYU5zvne; 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 q21-20020a056402041500b004fd1ef9b95csi3647117edv.598.2023.06.13.14.58.31; Tue, 13 Jun 2023 14:58:56 -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=EYU5zvne; 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 S231732AbjFMVzy (ORCPT + 99 others); Tue, 13 Jun 2023 17:55:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240839AbjFMVzY (ORCPT ); Tue, 13 Jun 2023 17:55:24 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB44D1FFF; Tue, 13 Jun 2023 14:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c4orWfmbKD/99sp/B+qWfo7//cl0MMiMnEGicrwlw4fG8L2Ri0TlToz97yhUjE5PcjdfxQh+aMFerweD3MV7smsdCubcjA0j+9jXGprdPULuL7jixZMe7eWF95D7qYa0/ykXQxvqVDhX+M0xZtP+ocxtGPn5ITU1x2+WfH1tqBmwb4ZJlaOW2Lemx7Ubb3LbBJM2OHD7h7MdbaIEYo+8WE41Oes70jK2XzOK87/an5BjyETY/PIz1pRXDXxZRG9DlQA6bgHarzGULafhh6DelT42Y7L1tAxmlSlOA9aYZH/RVY3r5HaHtAO7VeNR5PysKuoJ6TTfdYIGj20KIqC8FQ== 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=gXqsxyTcNdi0rJ3gF6pbv2TOSMGV5sZGMFTjQSS/6+s=; b=eimiNss3pfyn78wVZZvHexGQyc1ihklh0c2jkTHug5+jkYs5FZLRKZisPU2OcTmd9/JNngloLRzHtVXn3/fPiDFHNzfNXEV7UbhqRXL5Pz85rzqQroIYWM4FYMf8nOcA8S/yzcvq0xop/pfLG1FNNEOYFCXrXJuGvoTH/7ODkog8yMX6UyLyfyjNtXiguKQw4nSqTz8RtzEi6EQGw1ycXE10aiDw3CngQLTZF/qAe69A7/Q4o81DfMSTIGzS6nIKWhfNf4v3WYz+59SWAfAgk/tDt+fzZyFKIk5jWzG9ToqX3ub6OYxH2CwovjqN+7kZl+3pEjTiyayWKDiX1yAstg== 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=gXqsxyTcNdi0rJ3gF6pbv2TOSMGV5sZGMFTjQSS/6+s=; b=EYU5zvnezGCbgKDy4nxmfswzHDNJeSG182E6wh119nI5uqri2/9ilP9CwJEUAeNzqzwTvdUDpi8V3m+4+1VZMQZ1Df4t+vCIsT54dHGx6AeieU5sR6SkwGKmylyipuAV2IbRwouOpju1Pw4osMXeMBSbq+KFguAD0SngzTlDKEc= 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:55 +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:55 +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 3/9] net/sched: taprio: try again to report q->qdiscs[] to qdisc_leaf() Date: Wed, 14 Jun 2023 00:54:34 +0300 Message-Id: <20230613215440.2465708-4-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> 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: 402fba01-dace-4e23-7666-08db6c58d2a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SUexz1rET30jwIYCf5nr0iCVDDX05Ov92ybz4pllw1OchIIMOBfuWpNp+C4B69N5eLuZQw+VDH/yWivBwqAO1zPBxJSaQphzZLmEBh91AbVtio2fhtcBeo9BUWODkxsIY8pfRDP1bNbcYD97rz1yf3HCo5CPcyxGn5NGT6PH36neQQIsdWpHV6EKSriPZd4z/tVKg3BkiD4KhJgxEegT4eTabGrCtk+VcbVJsWCmfHh1HRevuN9seA0Up1sDqzngqZrLUL/8LJkMbxvx+Z6Qh2GvEseaajxSTdInvf9tf+eqpPJA0QUjKX4Or2SiMBtMrd7pIvLI6iG4ARBdUDcFLQxWEUZQcCFCBeIS3HQqjtTiNDDG/Xw1UjRCbz1kQnWPDKD8/IRKU1OySrTjDwFfor8DcqC9JHUO829FWO9pM55RiXumB1G6KuVaNXqjmFvqbpkLsThFbiQgATNbzZzlhiQMx+1tJJ9YVu1q/1rKSM/Ii28D5t8L+R6CLEmx9hVfPCCzkHTj+TUSyrAFLF48b0ujsOYLRLlFy1X0nyETbERtqTbHkOQR6Nc6c0OeSCPqTOOmpypKUxTIwnZOObfChiOaJDCvra8Dd/EuF/wGGgdfdG8g4etNpM15N84CDSO1 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: HdfRJboseWcgx/8M/zLytk9HdfK1gfoDgu0B1SHDOxfjQT0ABl0j7N7MHPkNF1+pQvLoNh7o1y5D2WcDJldy1pwh71GdAmJLisJujzbUTvmgUYM1e5kLdWwYAqyxIO4sTleXl6ESORSgDCkBqN8hH4/E2HBw1NuIFfKy3YV3Ekl6RO/67IPi4/V0vtw/1jJMO53i7ideSysayrI6L4Tng7YQnEjTLuIL59sIIwAFQXCuSm5fejKQch2g8eNc7xv9eWHJQ//b11Z3oCC8eEChIvtNQ4XuW5XgiIVddlHQll9S9Tx25PFtAaJo2ianquIkwNJPyyljyxdl9vBCwhirU+HopAwdS64wqUHOrR4Cm/K/GENqWVssNhIRi/8df1Jmz0y8sbC6/Y9OpNCg2S7hmUh6vCcmhj6iMH99cmRTci2irUxVMAeRcYWy8r34P5QrYIIv8W/3e2cW1W85daHoDnYcFYPY0wH2pdonES/VuWsZKTONq3A/TJzNii5s7QlYI7wutyzz6uwNHvL2ng4/7mCyOgUI6PrPWP8FFdSr6wXCMC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MS-Exchange-CrossTenant-Network-Message-Id: 402fba01-dace-4e23-7666-08db6c58d2a0 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:55.1497 (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: J2+rR5t3sbS26AfIpoRB+C+5skYqmtQnfZOzsQTJ9b+mtK7svSyd20buyKZucd6SvL4SUWv/7ip20AXGFDtgAQ== 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768626361441282626?= X-GMAIL-MSGID: =?utf-8?q?1768626361441282626?= 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 --- v1->v2: rebase on top of rtnl_dereference() change for txq->qdisc_sleeping 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 b5f533914415..14d628926d61 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2439,12 +2439,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 rtnl_dereference(dev_queue->qdisc_sleeping); + return q->qdiscs[ntx]; } static unsigned long taprio_find(struct Qdisc *sch, u32 classid)