From patchwork Tue Aug 1 18:24:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1815592 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=y4+76MVb; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFk6k6KXHz1yZl for ; Wed, 2 Aug 2023 04:25:02 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 22275600C9; Tue, 1 Aug 2023 18:25:01 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 22275600C9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1690914301; bh=otgN76LlpNfgm6bSGpu/AIx0kj9fogpzGU1+rpu2Mnk=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=y4+76MVbPjs+S7qx2lAEE7BRrTRIaS2TXB5NPAsT14DrKOQEBLIaMuxpJcKyYdAfG fniBcZbhVsdAonPSG9YlErUNQpe4JE6ha4AXTl7lm6bflcJ57Px+L5dsd/8sQKDapg fOOn1tzVss8GKGXBb9q6RSsibdKV9ixcRXD+8n85Zy65myazvEsa8lI9SdvOM/BNCs N0WeRs/oE15H93JlE4/W/uUElXEXeartO7/bZjRvEe+VqX+VuHSjWjwXgJC3tGt6TF yKOpJIFliGqIbipp8U1s+Ht/adsTb7BOyS9dPHN+QPSRBvNnrQDSzUGtyHbvEUYR5R 5VT0RXkeHG2SQ== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PDd465vvwIui; Tue, 1 Aug 2023 18:25:00 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 3269860BA0; Tue, 1 Aug 2023 18:25:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3269860BA0 X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 669591BF3C4 for ; Tue, 1 Aug 2023 18:24:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 83A7A41781 for ; Tue, 1 Aug 2023 18:24:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 83A7A41781 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t-rAfe84i5Kw for ; Tue, 1 Aug 2023 18:24:48 +0000 (UTC) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2081.outbound.protection.outlook.com [40.107.241.81]) by smtp4.osuosl.org (Postfix) with ESMTPS id 66D75400AA for ; Tue, 1 Aug 2023 18:24:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 66D75400AA ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JzGdMoMRl59keW6NE22HoHgrsXKkw1a9ykZErJA01QqbuU4zEqS06IYw2IIsuFvg6cD30ZXf0INB/QHPSGrjajMWNwhlJKHVF8oh+2YZQA+K+g2VgJSJDGEw8oU4VDjoQlt1AkMquDO2eDPwC5CqS24/iGSrtcnD43Fsk7sBR9LcqnSfNXosOH/gn1XE6TAjGUG1d6mi6c4lLDBHn1tBn6ofcNTFckXo3olQHojRXwX/ct9DLE47q8Oq9DJfOMK16N0BsyXJgLnulH3IULAWrSFsyiyxiYP/K9nPbwiw/jQeql/crsuJMLR0ytUQy/Si22u3QT1srUjUHLrxLWAZ3w== 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=Bs+sLqxOuc2c0eRxmI9BMIlFXQRoVWDODlJ4WFUuy7A=; b=fWtxOuS3Grj/txPtzQN5WV++CEb+USG3vziGxn5BOIStJfQJI7bta4CFNd4Ac2U1pHqxgcUspR/flUJVOOtGD8ypplpM6qvc50o+N3AB9d/6REOenQbFEz0tEYiiVK3izaglF6GfAsUi+99sQzGq7LmS9kmGbwz7W2hXiQRMVJvtNPACg0XAq/I4UxzwH5uBtux5LypWKFqFyuDpIwhnrisrSNUbp77UuPpdAFblevhOgL9FihGElFdD0NXiavFWkVGYdH4GyFR06LHAi8TQ8dDuhcFjxGy71/i97RPyoqNoALDhHR/A5MTCOgSllCT6Y4mVkfY5QmBZbYX47rhG6A== 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 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6839.eurprd04.prod.outlook.com (2603:10a6:20b:103::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.45; Tue, 1 Aug 2023 18:24:45 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194%4]) with mapi id 15.20.6631.045; Tue, 1 Aug 2023 18:24:45 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Date: Tue, 1 Aug 2023 21:24:12 +0300 Message-Id: <20230801182421.1997560-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801182421.1997560-1-vladimir.oltean@nxp.com> References: <20230801182421.1997560-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0030.eurprd03.prod.outlook.com (2603:10a6:208:14::43) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6839:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f122ed6-3f1a-47da-6af2-08db92bc94f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4hfMjEw1kaNqzfL9SUTb71RQgwnWPsznItD7P6CYdMB3QyFKq8xav/rnJmRFtNxA3oJXTbe4zTWAs4Yp6Idrfr1mKquPcrtr1IEmtaxKzj3L5ajElTmxMRi7mWWD/0RymYRuIPdai7hqUSP1isO98hvrKap5+64Z1C5zDMi+VEbuyQ7umfrMAKsZx5reQT1XqUoW3UwxsMIw43HxwHTBEKmbUhYxkgk70y5osCEiosLpknKLioMCM2sgVfbl1YNfIIp014IFcvFpeI/W2Vr43fCcVM/lbbvLJsaEFH1a7m3t4vsJ8y2dwb1HYec4H6LVjahDcr+OG+uF0+jJ6doa6ENCZ4M0hD+btPoqmDiyruc9Wbj4eAVGTNqeoSuydgvzThJnfuS4wi+qXPGN0XwvM3ziBhkXvOn4XEQk04EKqVCdb1y3PTTZPvHEMv8Iuvanv6fuGen+VHEMsox2qRiFXAGnCxdAb+6H8EnGLH9tcAYoZID4o0NODxf0Ig87rsDvsEnK9KSwoy0C+ZCrS+jlAFboJxAMsdpH7e5Fdka6IHDk32GShZjSvZT7uhrysUBXNO5efJSrFFThtDnXpUDfS2y4rRIc8hsnVso3UC4Laj7r/pylIqjHpUuQ8dmQ4XHQ 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)(346002)(366004)(39860400002)(136003)(376002)(451199021)(6486002)(52116002)(8936002)(8676002)(478600001)(6666004)(54906003)(6916009)(316002)(66946007)(66476007)(66556008)(4326008)(83380400001)(6512007)(38350700002)(38100700002)(41300700001)(44832011)(186003)(7416002)(26005)(6506007)(5660300002)(36756003)(1076003)(2906002)(86362001)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: V7ZqxpvWFMJ1ybQhn7emnJ1Cq9sgMOZKkKoMeQy6IlsnjHtEJ1CwF/mt4B76S7cN0zmNZy+XnHM13yeUI+woj4Z5ViACJjihIM7BtFLCo2Szg6sTIege+Kcpy6tk3ENaQBCrd+fku+e9jMl2YLdHaC7qJIzgH6N7Qw/uSDQ50C4c0KUn0BPTFgzCoP9pW1ow6kU4JBVaQmnByJel5NUzb56COp0Xuzr4KHBATDXz4Zks5D71haqNbuEeoDuqe3Tdj4dKiJkvzdXTieVBvn/OHYNX/hdNKGXSrnJnF4VHmJ9coe8NPFYgDpv33/pCqi3swdulDArxc0FyxRm3LkG1yjOKT1/dqwuDPZmhuNVf5og2OkRzZMpnxxTCbc3qGcNTTQb36URD1xfMYNIM6XmyQrChPkTVDkcLE76PtZNGrpaGqlRhPYUPsFmI87NCabswOnrVN2Dt/EZ6/vUt877GEW74AOp5oMB8s+3dCW0BtU05AaSbGLkx7U6dHFuv1HWJhYqKKAoL+R0tA+SGjgNy8AEL87EFYqKN5l2O2UxdVdBr/NwwePr+OWOr7MTI3oWgZdSUqAKwggn8lp34GrMwiVXHytz1v1l1QusNFgYcjVWixp3oQ8YSybHi5JsbXIr1DOc8/Ztd7mT/RTPSCavp6s5DqbMNeNfK6q87bAinfQAA9iTi5UwU6JfCXZB1Um6tthxhREuSlbc6dHt+0ThYCYr0HGn7E8NtbjhhPQC99uT7gty2xODJTc04VHj6rGG+eozzlKkDST+F0B5+vetOI2ohafbs1gqsMf4QA+FJkj3Pvmdrjx4cspTcbxOhD0j7Y3pAeFYm0zjj0QPDjybhg+vJwvupNQ8dx8E/SMyYKkuJHAk9QZwzUf3CkAH6MTl4tFbeOIjNLHUBEU+I4Cmkrd7OhGwkRNGsIO01Tpz99s1KzxCbnRD70TLu1Jbum7AxdESBXFccd5jloYCfR8tcPDlDsZlxNkJqWsa27DUqMibSiOOunfN0dqoKN2hGUQ8s+RUHToNZrTbTdWVEPb+vzVCsJ9BF5vuyDNWi2O+qUZ5o+FFQMmQgjAeCW3UC/gR0sn52ujuzEgWf51X9sjEaya5qwdGdQTnApv7UsnY8q/3u30ylY4beI0tz2YrkCra90u5N3QKjvPggOHYaEDRt3XuTrkq5xic76rhhgLxvugklYw4SrJb3Ul+/8tpSDM2hUR+FRQrizQtcfyDGpjdGO5nOYNdZrjUIiga/N57wawpih8qOQUbr8zjVw2CYafZp4cAfDqKH5iETzIHxkPdn6UeSq02syic79mwOMQ/Pl5bk2J4WXZmPChLeMfZXprD+c+5bsWTaCG5MNanIb0xgLFBH0SD+IZTW55xCP9U4ZggIpWEgq5aOlgldj2T7CBznHDJzMDdTVKTt0ra2xbx4iFzpSsAjnVkrogNFPPI+CHIb2ipMC4H16Dm/z69BgrLuWLsrKaQzBtXfAhNYn8747iXObUuF6jzEU23lh/xCSxbWh5E/8iB8kQBxOJSv/HuORCnKfL1wonk3fHmwAKLb+9Swk7Py6JecrcK2Y1LHgF6BSntrPjUQB+Z1aQYnqHjNrN1wcaE3eiBgN6O+4/gT2w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f122ed6-3f1a-47da-6af2-08db92bc94f4 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 18:24:45.5362 (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: tqOqtK8bPRiD/Y+PcGCw6pRPQccFiQ3j8IbTntx8xU01TCkNMkFXir9zKPPyWqIeocqe3bjdCwdC8IVFh8NX9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6839 X-Mailman-Original-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=Bs+sLqxOuc2c0eRxmI9BMIlFXQRoVWDODlJ4WFUuy7A=; b=gAE5ebNMvclQfSUrVpOxsr+SQm3uM24bnF/zf/FNPICxrF+Is3djY2BtpxgvRqoqg5f0+RZmk+q+3SYXUNr6kdNVKJCBIXlYCd3sAsZbWO3g1jDZGui6lT+hms783BFjE91koQjdkak5EU5OwgAFw6O2U1g3vpWcIJPn0OUn81Q= X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=gAE5ebNM X-Mailman-Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Subject: [Intel-wired-lan] [PATCH v3 net-next 01/10] net/sched: taprio: don't access q->qdiscs[] in unoffloaded mode during attach() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiri Pirko , Pedro Tammela , Richard Cochran , Jamal Hadi Salim , linux-kernel@vger.kernel.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, Maxim Georgiev , Cong Wang , Peilin Ye , Jakub Kicinski , Zhengchao Shao , Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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->v3: 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 717ae51d94a0..d9ff75a08e12 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2134,14 +2134,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) From patchwork Tue Aug 1 18:24:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1815593 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=oJGrEp1o; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFk6r1TYXz1yYC for ; Wed, 2 Aug 2023 04:25:08 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 1620860E0D; Tue, 1 Aug 2023 18:25:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 1620860E0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1690914306; bh=KlFGE54zAyvVnZRthVy0ep27cqVJ9AVsTsR2WORqrZM=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=oJGrEp1oG3lNcN9uEBoL/BkWI/KMHVsOO89iYl8WxTVaQCvyTRkKXE/DhRWGKduQd 6YXbfXKPKEPbMWuL3lHw5AlF04qHOLrAjTTodwFWnAYyul3ewioSJKpFzFtTL07tJ2 41MwzDcUT0cdio2Uzct5/AQuQkLM39+nK2V3aHtVihPtdm5xc0Q39YITGSqhDBBEq9 /bCAXzvGvNEerF4EhcXj+BhTaYGPtxSWj6kJE0g325Wk6bJjeZwNWcld8TaMvIUmiq nZF7cIJarvuHIHdsNmwqjoVnYPHbCD8nsBLBXUjRaTpOq24wSaSedoyPdn2N0ZBNAJ l7qpvko5h3ntg== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GKbqaSbQca0c; Tue, 1 Aug 2023 18:25:04 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 5C84760E38; Tue, 1 Aug 2023 18:25:04 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 5C84760E38 X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 0B7AF1BF360 for ; Tue, 1 Aug 2023 18:24:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 62A2E417AE for ; Tue, 1 Aug 2023 18:24:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 62A2E417AE X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6ApTGqN4CBbF for ; Tue, 1 Aug 2023 18:24:49 +0000 (UTC) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2081.outbound.protection.outlook.com [40.107.241.81]) by smtp4.osuosl.org (Postfix) with ESMTPS id 00D664090D for ; Tue, 1 Aug 2023 18:24:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 00D664090D ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O42baUgw7VgAFqBgVbXA2jXd/mBt4HoHaC0raHKgV5luQ5XU9cV65nJXIS7wKF5LC9jviwJN7txzGnJOBJH0SmXe9vMKD10gLudC9PD9rdbNCnUqe76w3QOHqr5WqYbh8adZ+NXkh5HbglWvclVujfiDdl2uRfS+yTy8IuKrPbMURaUGvdfOi727UXwjgquAh8mgDVboCIal+PoClUvWOiqEDnghYdxmsGCTwOBmSrVrX4yWEX2t9vw1zI3Gc/KI0Fvui8CXP1wlxDAxtPniNMXxzijPMcLKFdz+IXYiIAVatjm7yojEEr6LdQgFsZpVVyfb4Fs6muJ2sTBJ95+kvg== 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=KFZ6mGQKixAu5FPLwqzf+DqPUKqwfxELlJHcSmh9gZI=; b=R/Ndt/WqxPRS9JSJixE0RhhO7UeFliW8Zk+jGYOQiMQluF6kSFodSqzXKhK+ZsHAjlXTyj7YDU1BY8tT44uNDoIFs1rdfiFEow29u6HsXG034Wa9sHuASFquBmRofwKbhxjD7NECbWD+h/iPSB17i//67mPl36Oa88mtDju0Mj4b2Hie7Jfvb1zoeoJ+6614buwgzPXIrBBFqCw86eVJl6xIV7BoJ2JRibXC8HmOwLWwv+oG+PnEeiW7z9P5TgV1PQNF2JVeBmmxA+MiA6VLcKr/gGIwKYkduRZTRJ7bPs6zB2CNOXTdhpLlXgrLW7fdaVX4L5P4YFLGNj6Oepv28Q== 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 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6839.eurprd04.prod.outlook.com (2603:10a6:20b:103::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.45; Tue, 1 Aug 2023 18:24:46 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194%4]) with mapi id 15.20.6631.045; Tue, 1 Aug 2023 18:24:46 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Date: Tue, 1 Aug 2023 21:24:13 +0300 Message-Id: <20230801182421.1997560-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801182421.1997560-1-vladimir.oltean@nxp.com> References: <20230801182421.1997560-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0030.eurprd03.prod.outlook.com (2603:10a6:208:14::43) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6839:EE_ X-MS-Office365-Filtering-Correlation-Id: b807432e-4a75-47ca-746f-08db92bc95a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ie78BxTC4kUo8N7dleRfeGNWmC+iVlaXUyM2K89Ok3S1FTwE1HXrqA5Lp9CWQGVWYtmOm7AdWibRXDMknVHl87MuD5GVxXhpUvVzh8qp+Oq/5GRt0TMHZnvEewkWVkS2NVBPXo/T05DNb1JcoPHNJd1G3fZvbdoe3MoZzq7aWEPEGsMUZRLr+BPpMGE+r+TEapp4CEA705V60Ie6c6NommW9oiU9x60xGA14hZH/WBEoxws0QQCiv2y3P5V4yZ4GG/pGEcmYteRQbraM7Njtsdtj/tE9KDMDouZfIhnwYRvMhsTlQ7bibswrw7nGvukWH3JC41k9buD/5+JYr9f4VdHEHbtEnK9ivMEHzmVbIL9PJE40qePZjc3TH6cK3pKHhF6VFUX0NGJrd/KqbUVD62NH7tgea/WDDWCflDz4A/02NDa/wmndnQMnQ+nboE7R1kzo9GvvtqKk2Yoh8I2hvcmuWBoAguBd0MMBZNFaFJWhsFpdZw0J72xdzIBvsdSlgbPUMLhnvXlShQoLagV8txVuZUZdFXrDZL/YeNzbTc7qfgnrs3zvPwIEd+73kZxkiaIEeBsNvkJjmd8eC1RhT7b7U/JntpmSq2BEWRs6EkOGiug604jxB11jLQ9eaSNd 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)(346002)(366004)(39860400002)(136003)(376002)(451199021)(6486002)(52116002)(8936002)(8676002)(478600001)(6666004)(54906003)(6916009)(316002)(66946007)(66476007)(66556008)(4326008)(83380400001)(6512007)(38350700002)(38100700002)(41300700001)(44832011)(186003)(7416002)(26005)(6506007)(5660300002)(36756003)(1076003)(2906002)(86362001)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1taYLr+/0dt39e5v3Uk98ItStQQWI1iZxZCwqMWkGFB9Aifh9MMYKG5bXQYNbqt7VYygb5eotwhAxJnY8w8g6za1uDC8PjLZBZoVwhXheKUwkin10ScErLVr7HEh7sQZLdrwB4+E4NcedlX2azuJcsypijaA8kLYISeqHsaoAxbGAgtdnM/3Kuw0WTgu1TtyVeDqAu1UQsYeDSEiKl2alZWMrJauYKJzIPNUHz/rE75jL9aEt4z/x4TPU1G3HJLUgm2oD2YkIIB7bQm4waPR52b+tmcnwyuzlo2kIarNxSwOllTZtNO+DoGenrVfxFk3ulnNXwZSoG14HoXnw4fy5YqI3X4l5+E9OmsiPWZCSQHC2ZQSUnfPqQMz07RLSQUmhoPf9Ri6xgPjrdb43naznT7sGPOZj7tMRHXzgxSu9ShX/+dM9RIBDwiYeo8edjC0iWhbBqOI/sBVBtNssBdcOqD/bCKvoKvwII97U1/Er23jkP+YGbHn/0UoAuBAgtYrqISVLRmaMLzQJSPk1y5GTwG+h9QdHn83dQZ632JhGHIt3qarlSGu1QAox4sYA9H7NirryDURbbBuMHu1eptvQQFuom08FyDwAcktVYi8fzMfSIeALYnd9gjGj+ZEMazxbpaR8ryo1zJcsFp1I9RES7YdtSIUQ2B44t0AVvSS7VS7FTC6xT+MR0cmwgqDlW5gbWfwAhm4yOs6vJsJn/xsQy4SbVeN2abSMknJh2yceZpuskbAK4dPfctfO/4qLLt16Y0VyOQc5h+uuZty4+0qv6rXTcu9cie3bYnmXkGBmiMIXSwKsIckuRIi8K14jXBszLqKrmvaqsz83JzaZbUteHRlH0YUZctG8ntEraep6U1BeK+Eu7LHa1+XXto+zdfNbj2JcMFUgLDkNoLthWxW1BAriUHqopkOzSLhLKoQrd3u5AS3yfrng231rj9nELXRNS4qCdPq/cpenpfzRgJrKOKcJQNJ/DljoZoT81pbCv70VV3Ykohm2YT/K7D5nuWGAKMICam8PJ26+IV1Xt6wkEMrEzgFW/S+rS0F9mZPIt0yOmAdLZTe5irR6elVs4/aCU+xBv9dCwQ8QU4I/05r9g9PkbrMuFzOGnZ/QnxGYjRoKTqpdtg+fCbvlrLhKuEbxC4JmdCGrS+i8yLT9Okr9F4wEXmiidoA9tUD39k0PnGKSmhQUPQqUA8ehBuPJ3oiS5cJ87XrZwtlP/Jjr/OriMiPEDU5PLKsZnoZ/qvrlJwfnrU7mFygvrdHr8DAxx+H25jMB4K5dp+0kWIJg491XFRwvSuHsczAIfCc/g7AkeiajPdVNpw3ODfFBwI8sL97xRMIbcSSxVwWgycw9BEuL2qs+gHRWPEqFGkQKNNqDcue40RbhtxGFx/Pbnv1NBTdxk4MdZrYFs5kggrYPCcdh4zlQEN2WrY4SS0T1Ct+9vzQATfBpK60imu8sPM/z7G7p4RSqW2/k9ivPOM3SrVDDW7wixNSJBzge/4EkJ4ZFSjGRHRwyDWZoPr4hUCLO6bfSMlaaitFUCwqWG1BZb5utWzCZZ3cqTyhmuQSl6qx78k9lM6ZNfPlqPbVLt4KAWKZRHhtUk9Q7QMZeg10MoWvPg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b807432e-4a75-47ca-746f-08db92bc95a2 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 18:24:46.6619 (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: XBzlEzhdG0KJmpwfNV+GSRi+CqZTC7xzUGjYy0ySgkS7hcBdztCSHCXbzbv0CNoMscgloaQUhQfYy6Fn5jTmDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6839 X-Mailman-Original-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=KFZ6mGQKixAu5FPLwqzf+DqPUKqwfxELlJHcSmh9gZI=; b=OeUICsX0ohmV2YyrxB8mbk4gHs5lceIqHjcjvbvonnfAUXCrr6OVgNuPEg6KmuA84Cxu4trYKFhTMvoNTmoXHIcyVQgVSVnKicHwhV+uJC1Nyc689YMvBKZ7VoHAwC/pghdZtqMgqCoIMqEyXyvz7f0ofwEmkrh+JpDR+Q/DrT0= X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=OeUICsX0 X-Mailman-Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Subject: [Intel-wired-lan] [PATCH v3 net-next 02/10] net/sched: taprio: keep child Qdisc refcount elevated at 2 in offload mode X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiri Pirko , Pedro Tammela , Richard Cochran , Jamal Hadi Salim , linux-kernel@vger.kernel.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, Maxim Georgiev , Cong Wang , Peilin Ye , Jakub Kicinski , Zhengchao Shao , Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Normally, Qdiscs have one reference on them held by their owner and one held for each TXQ to which they are attached, however this is not the case with the children of an offloaded taprio. Instead, the taprio qdisc currently lives in the following fragile equilibrium. In the software scheduling case, taprio attaches itself (the root Qdisc) to all TXQs, thus having a refcount of 1 + the number of TX queues. In this mode, the q->qdiscs[] children are not visible directly to the Qdisc API. The lifetime of the Qdiscs from this private array lasts until qdisc_destroy() -> taprio_destroy(). In the fully offloaded case, the root taprio has a refcount of 1, and all child q->qdiscs[] also have a refcount of 1. The child q->qdiscs[] are attached to the netdev TXQs directly and thus are visible to the Qdisc API, however taprio loses a reference to them very early - during qdisc_graft(parent==NULL) -> taprio_attach(). At that time, taprio frees the q->qdiscs[] array to not leak memory, but interestingly, it does not release a reference on these qdiscs because it doesn't effectively own them - they are created by taprio but owned by the Qdisc core, and will be freed by qdisc_graft(parent==NULL, new==NULL) -> qdisc_put(old) when the Qdisc is deleted or when the child Qdisc is replaced with something else. My interest is to change this equilibrium such that taprio also owns a reference on the q->qdiscs[] child Qdiscs for the lifetime of the root Qdisc, including in full offload mode. I want this because I would like taprio_leaf(), taprio_dump_class(), taprio_dump_class_stats() to have insight into q->qdiscs[] for the software scheduling mode - currently they look at dev_queue->qdisc_sleeping, which is, as mentioned, the same as the root taprio. The following set of changes is necessary: - don't free q->qdiscs[] early in taprio_attach(), free it late in taprio_destroy() for consistency with software mode. But: - currently that's not possible, because taprio doesn't own a reference on q->qdiscs[]. So hold that reference - once during the initial attach() and once during subsequent graft() calls when the child is changed. - always keep track of the current child in q->qdiscs[], even for full offload mode, so that we free in taprio_destroy() what we should, and not something stale. Signed-off-by: Vladimir Oltean --- v2->v3: none v1->v2: - fix refcount not dropping to 0 after a graft operation - spotted by Paolo - slightly reword commit message and comments net/sched/sch_taprio.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index d9ff75a08e12..41944197876a 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2135,30 +2135,31 @@ static void taprio_attach(struct Qdisc *sch) /* Attach underlying qdisc */ for (ntx = 0; ntx < dev->num_tx_queues; ntx++) { struct netdev_queue *dev_queue = netdev_get_tx_queue(dev, ntx); - struct Qdisc *old; + struct Qdisc *old, *dev_queue_qdisc; if (FULL_OFFLOAD_IS_ENABLED(q->flags)) { struct Qdisc *qdisc = q->qdiscs[ntx]; + /* In offload mode, the root taprio qdisc is bypassed + * and the netdev TX queues see the children directly + */ qdisc->flags |= TCQ_F_ONETXQUEUE | TCQ_F_NOPARENT; - old = dev_graft_qdisc(dev_queue, qdisc); + dev_queue_qdisc = qdisc; } else { /* 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); + dev_queue_qdisc = sch; } + old = dev_graft_qdisc(dev_queue, dev_queue_qdisc); + /* The qdisc's refcount requires to be elevated once + * for each netdev TX queue it is grafted onto + */ + qdisc_refcount_inc(dev_queue_qdisc); if (old) qdisc_put(old); } - - /* access to the child qdiscs is not needed in offload mode */ - if (FULL_OFFLOAD_IS_ENABLED(q->flags)) { - kfree(q->qdiscs); - q->qdiscs = NULL; - } } static struct netdev_queue *taprio_queue_get(struct Qdisc *sch, @@ -2187,13 +2188,23 @@ static int taprio_graft(struct Qdisc *sch, unsigned long cl, if (dev->flags & IFF_UP) dev_deactivate(dev); + /* In offload mode, the child Qdisc is directly attached to the netdev + * TX queue, and thus, we need to keep its refcount elevated in order + * to counteract qdisc_graft()'s call to qdisc_put() once per TX queue. + * However, save the reference to the new qdisc in the private array in + * both software and offload cases, to have an up-to-date reference to + * our children. + */ + *old = q->qdiscs[cl - 1]; if (FULL_OFFLOAD_IS_ENABLED(q->flags)) { - *old = dev_graft_qdisc(dev_queue, new); - } else { - *old = q->qdiscs[cl - 1]; - q->qdiscs[cl - 1] = new; + WARN_ON_ONCE(dev_graft_qdisc(dev_queue, new) != *old); + if (new) + qdisc_refcount_inc(new); + if (*old) + qdisc_put(*old); } + q->qdiscs[cl - 1] = new; if (new) new->flags |= TCQ_F_ONETXQUEUE | TCQ_F_NOPARENT; From patchwork Tue Aug 1 18:24:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1815594 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=gOhjtVMi; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFk6w239zz1yfC for ; Wed, 2 Aug 2023 04:25:12 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2B7A060E3F; Tue, 1 Aug 2023 18:25:10 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 2B7A060E3F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1690914310; bh=Pqi3yzPYpx4DFgzdmJS5aN6tDUMkyry9nFBWE4BVrUw=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=gOhjtVMi6S1/erQG7XjM9TRBrLEF963m2ueoiBz02IR8ZBnL9/Jfy8ljcYOECjFaU dVODJQUOKug3LaX4dzvgSVZZIcPHeywVUlMlw7SS6znuNQNf2UaMDsjghPvZqlyAkF XTpZBr7Zr8wKLd08jc2zTFKcFQt/1Ysddjq0ZYHxeX+LoCfxaCgC5oDO7GYKDL+wTC I5N5K2yOrHPezqtgr4ZMr60V/awIHo/+8a3CzBWf2s4aB7k4Dq2eYa1jld7x6r9cej N6iYnK/z8shf9IM5vnVy7RBwEWjgN9iFVY4rqaJpk4D2G+b9Q+LnbsvZGZf2sOTMfD /h3uJ8ME/8Juw== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JbHBm0vm0YNG; Tue, 1 Aug 2023 18:25:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 2F33860E63; Tue, 1 Aug 2023 18:25:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 2F33860E63 X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 7335C1BF360 for ; Tue, 1 Aug 2023 18:24:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8A55340950 for ; Tue, 1 Aug 2023 18:24:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 8A55340950 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AeMKxcE0raJl for ; Tue, 1 Aug 2023 18:24:49 +0000 (UTC) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2081.outbound.protection.outlook.com [40.107.241.81]) by smtp4.osuosl.org (Postfix) with ESMTPS id 9A00C40894 for ; Tue, 1 Aug 2023 18:24:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9A00C40894 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JTgT6ZvxTXuinJvM1QIb72enW40Qo4tRz8lz3NCCGlA3E2/l1PHFzPfutrEcSAbDPklTCyZZsD4eDOe+FwAYmi8HynFTF1EtnypwMr1O2iB1XPDpyHNoIqidRSD/8uJR2B+yy2n12rKB7zk4fTddpJ2CwzFnZhFVhnQDODXPBKUuxp/FKSM/rYbseUTr4ahiVraPTBgrjtnRFz06Y2AVaOP+7w9Blp3Wyfq7PCesNUVjJzyFOkNZB2933GuBGWDgCwWQt5YoVGD0BxR0Bpfj6Nm4BdzTP7ct51RprRuoT5obu+f1bA8hBBdgklhUYSRatovC6RS9zQ6JgsKLSty7sA== 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=xSREhkN8If43NRaMXkjqD1mJ8ouZMXM3qQX6xJmoQOI=; b=g/i15qz8ZKS0kZMoqzE8haDeSypOybquv9yfOtMGOWa0zuRW+V4nFhMklBThkrIt0qrkDzvwIbn8aVtOAsBsU30Ufnx8jN2oJQivnDstMWmTmV9MoxG/+OpaLoEX8BGDHtRz+w3AcmSwkd9N4LffqyygWS/eje/FOcS1mYFO4Kvbbh62CtU06F5VhfHHNb+ogBHJa/ATtGg9NNOrwlDd0dleT/SHB1X1wQc/kddUeZ05NvnmyR4sH0QFzQteQHNCw5KvNgSVYnGOH2y8FS9FcCCV0Stv4P5fP6gQijqbICEaNWrVoMzjmTKrHKYSkgOv/tl9dwN+8KYXutMmL8eu8Q== 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 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6839.eurprd04.prod.outlook.com (2603:10a6:20b:103::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.45; Tue, 1 Aug 2023 18:24:47 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194%4]) with mapi id 15.20.6631.045; Tue, 1 Aug 2023 18:24:47 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Date: Tue, 1 Aug 2023 21:24:14 +0300 Message-Id: <20230801182421.1997560-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801182421.1997560-1-vladimir.oltean@nxp.com> References: <20230801182421.1997560-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0030.eurprd03.prod.outlook.com (2603:10a6:208:14::43) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6839:EE_ X-MS-Office365-Filtering-Correlation-Id: d9a5c17e-6ffa-4f9d-1b91-08db92bc964e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kk3ItbxRH6Nnhmy7BP7tvxHrzuQ0ate42kI+1UEzknoA53Np5JpEyEib0Se2bhHItm0O+0yi34AkAVIbphRH2JOS2HAH85miFvfz7GuPGGo6qrEnw6BJUbMfTAx2kDSt3nCH/rvNV4BdPgsaue5S05cAT0ghAaGdLPKMqkDKSu7pV/U30bptVToMZIG03nnJLyvAtgpt6ihtxUEL4ZeL+20b7ljeGB+8MZ5mU0fIrhq6KX54oEBE9amPktxrQZmv4QDTSXCniZDempS3ZtkjgKtKhXnljWKBnlJuzMScfLokbjd8KmmeI9OAvvXkSKlk++bXFhHkRLwtabX3t/aMZl381CwHZcVAdsQkno/zLGV19516XQXo8Fwcy1zunmrR25Jz34SEAI+tFEhnF+/xeyfcHgg9BPRNTiTdtBu18sjBe/0SIQ1Mdf4Q6mMWwSVF2QNbRnsI9e2ATgXKDUxWwyyLrfC9hfFu1LAUK+aaW9X8QT4sDRCf2NolPa7ZlhFYu18C+HBuRlFGnVddKO9CtiMo9UsQRrL3vhzZs9FQ03gEREoh0pf4QuMJuZLipMrmGSrBsiu4HMszXIPieyuWrAAali3kzzw+oCydbxjKTVL1uv8pwLWZ++BctWqlYk5E 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)(346002)(366004)(39860400002)(136003)(376002)(451199021)(6486002)(52116002)(8936002)(8676002)(478600001)(6666004)(54906003)(6916009)(316002)(66946007)(66476007)(66556008)(4326008)(83380400001)(6512007)(38350700002)(38100700002)(41300700001)(44832011)(186003)(7416002)(26005)(6506007)(5660300002)(36756003)(1076003)(2906002)(86362001)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ek5dZHSzCGAMEVTHurvpKR34Yc0y81UoSAaxhgAvOr4ac4bznnSn5tzJnXNm8X3feCRiiyJ9r5SpsQbi8ey41RcbY9lNLgpymJfxsdQNdLcPxFH5HoQsJtZhBsBOfAZPJNkoiqInhdDAtceygBqFfZuzPuQqs4NVcL15zk4smRcepGKo0Ad8y8ukus2Lt4TCZMKT2jBNE18HQq6M7ckKypfZM7IlqE3xWC9wZ3tFsTLIKzsY2+Of0Oq1W7iVjDOYaeqGPNiYtA1UQz6ypR9bN2Hkeqjjh1/VfblIT1vXJH7uu6VSXN5euORK4rMbMUd7F5Q3yR6VG24+Gbss8ImTILDPhFBCZS7Fq9HXKwMpFm/Xt/6EP9UN69gl2CKpf0xI0JIqJ8ueP7Wh20eklJYI10WL7dX4hwuN3c9EZOkcNksY+WqV+B7NldbgC98ZXA87IgsFrh0CKL+cikU6fdISPePuxuQaWF0/6S++oCq99QdsoxhTcOsj45lKrKYmxj56r1MNsQHzwBwf24wi9m7Kt5IY+6bKLteA0o1oUZaa4oCaDQEb8N56HuZqHDjdcxZny4ImUV9InKtFc0ul6cphCQd9lAigSh3+R+zokJyA6hf1d1YMHAP0pZ9pLvv8Zld8fa+3N/+fWRNpK3D+Q3hSPqVr2OkwW66i/ROelpxEIeBwdH/RleL87lROFlQWRlv8oStE2bqScNHSoMRzn1cdfnM4To4e6ztA55FEDJX4Uh0FRNy8K0EeYONp2LoDLzWqPQcS38vfIkwHsGEIV2xXekg/5NFH6RrseF5ptHwh6hkJeHakgUbM7pWnAYbKW+AKfi+6guuFh1y+DiFSMSw7w21JG3kqt0PQ05GF9ATWQpUbPhIkWXppJ2j5nuYoI4jDOG+Dyue4jvn8bB/1J7AbXbBZNcYJojlkTh+6xDrwhvudgW32TCTVbOhE30ye+KHsXuTM/6F4ED0Dl6sAPzbvaXoQMwnLE6n50g/9lFhkx1TEpjt0zr2BYfHtRn6bSetHwMOylLGKRYwLioYT8v+AXoUmCWgxf73WuOgO4ey4FyfR3zdVIcz6bW8rYAG7Rq+Vl8DJHnmF5ALV/sxaOKdTyNxen3MHfW8IBzDp1ln+4qN17DWlCEsD3Oes7XPcL6QNreM4Z1Qxps6qt+Nc4MLh2zkdjBv29YRtAtjDWb7hEsIiA50CjWxLxdXL9A2iiPnbHXkUniPm9DYzxyeZ+UXIWJM83pbco2YHueyJXTi6CTOskv6Xp/2WvanBBQVl9u27hzsId9y1diBlWhaMYblYc4OViQO4AZ2+IdCTWfFQbGi7/piEYYzDgU0OcYN5exaOrwTN0SRosc4nrmNm6pCluIyCsVGfQehyqO0d5Xqr4MLIa1IoV3f8lrrrcvTXehYihJ6KU9t/Y/Rh3oqw1Oj4ZwjgqMyTDE3Rh2YbwNdnpRfMxEB2gOatdAq7gPVBQYRtGYhQGmZ8LxnrLrei7vkq1ZD3qaz7Smv6kuBRWHzBdH0+F+33gUtc54W8Kg0iIYdjG3d/UWA3QFshCDQ/EnT8rqy2h5kxkjc0BqacEEp7wzKwETq1AfDNWbQeAfLgV2GGL2kNFH/FpgdnxUUIH/k5gA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9a5c17e-6ffa-4f9d-1b91-08db92bc964e X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 18:24:47.7826 (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: qDm08WgwXSYUqV5wn4ENE11lonhlzm2FxHYOEprGtvTmWu3hdL0azuCP86ExXeB163oy2oojj0wCRTGmtYSZ4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6839 X-Mailman-Original-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=xSREhkN8If43NRaMXkjqD1mJ8ouZMXM3qQX6xJmoQOI=; b=hnpc+jlKQhj4oo7DCysEIAq2xffUpujm7JlVPKK9htMfcHCDDE/5dFA/FZaFZ2PAF5Yac/7U2aQp3sfNl6OQcUMGlWNMoi/TFC6mKYwoJAQSHihruXDjgtNY2LqhVPdj2p9Pq2jOTGUxtf8F1w92vnNNRKGSzGIt3/8H4c6GBwc= X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=hnpc+jlK X-Mailman-Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Subject: [Intel-wired-lan] [PATCH v3 net-next 03/10] net/sched: taprio: try again to report q->qdiscs[] to qdisc_leaf() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiri Pirko , Pedro Tammela , Richard Cochran , Jamal Hadi Salim , linux-kernel@vger.kernel.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, Maxim Georgiev , Cong Wang , Peilin Ye , Jakub Kicinski , Zhengchao Shao , Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 --- v2->v3: none 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 41944197876a..c9ad585b5dc7 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2442,12 +2442,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) From patchwork Tue Aug 1 18:24:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1815595 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=ahpjmybM; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFk701Qbtz1yYC for ; Wed, 2 Aug 2023 04:25:16 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 5382F60F03; Tue, 1 Aug 2023 18:25:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 5382F60F03 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1690914314; bh=Kz++FuOcVdDH8Oef2jqVYj+MfEYTXJ6Vo1iDg/a268Y=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=ahpjmybMqMFSE7OIiMrNBa5KU+PVufIhKWIiT849SaJjSVpIuNqvRvOejKzWma69Q o4LaqAMVs6ipOIY2ROjPVGncvHwUPokCSOvIsJj8aLoIlP/YzLqhYYRHuN8V+qpDnA l37bqzgclTUf8VB6OsvePfnoeNalKaFB3vrtGuGNM5vkxZrmtl5SeGV1M8v83ekNfm 7E9ewwh2ZxuDlW7Q7qTPZSzjuqZpgATHGgngTwSU5H2iaLn6Bg2zj5viPDWaqORiDs b5+F4HRqnRKyGOSaatiO+kFv9zdEbHQ9emj04YOwn9DGTNkWkrKLS8kZAgq3WSMly8 u3LawwnsTOrQw== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sP84RvvyJt1a; Tue, 1 Aug 2023 18:25:13 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 57F4460E63; Tue, 1 Aug 2023 18:25:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 57F4460E63 X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 39FFE1BF3C4 for ; Tue, 1 Aug 2023 18:24:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0D77640894 for ; Tue, 1 Aug 2023 18:24:51 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0D77640894 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eS6fcpRaL3zB for ; Tue, 1 Aug 2023 18:24:50 +0000 (UTC) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2081.outbound.protection.outlook.com [40.107.241.81]) by smtp4.osuosl.org (Postfix) with ESMTPS id 21BAE400AA for ; Tue, 1 Aug 2023 18:24:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 21BAE400AA ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KtlWqnnuP/sQ25x5N9Ad47EtRomq4og5NCT8ZPCUYl4dPXG7IdJfG5KtFAS85LX29MfDNplCLaGO7K8c5A0y+bbgKeBH3MlleqRHh7dbFL3471OY+KdL12g772I5xmxlfYIYMsNqwrBeaO5hnQwK65qZIonVRTVjADzL+kO6t/22cuvC4aQ4K+jI0Oq2NrhtmqU8GZoiFhKBvD5JEZ6FpgxheRHn7FuEUddS0H3rRDlufXgZQQn7odxw9OPr6w6DK9uIZEK/CTWScgSm7aIT91i/uB0L1nZ4F91m28HYq+fxbgWeF+EMvOeXIVFIvRyGySYHB2EBryuX09jXP+QJGA== 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=t04J+PnhrMeedST7ETnsj6KGwBzM/nxBIR3qjm9z+dk=; b=dxDdk9aYCzJp88E6Y986Z0wvk3Sk5CVFbYdEoEzs1DUL1/J9/081h6PHMP2cjwTGDkdknQeU3G70brO32OOH8/0hX9N8omCoATTaNyuU55bn3T3TXYkMiilKiR7c4B7N99Kw4EFIC92BmiN7Za9OLRxF0szIuJT4i8aKsSSaDwbr10A5W+L0hBtczHnpYx26thMOB1qhy7G9hSy06WF9OcZB2d3txT5NqWut8CCscaR9HSFOQ36CaQY96NwMg/q+jvw540XUwrjBPtRJxUmqFagZ0k/oEqi9IrqAmhNIXP95iQKNqiIQRsHa41RPKtgHfIKH1B7SIP9CEQ3b8V+zLA== 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 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6839.eurprd04.prod.outlook.com (2603:10a6:20b:103::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.45; Tue, 1 Aug 2023 18:24:49 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194%4]) with mapi id 15.20.6631.045; Tue, 1 Aug 2023 18:24:48 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Date: Tue, 1 Aug 2023 21:24:15 +0300 Message-Id: <20230801182421.1997560-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801182421.1997560-1-vladimir.oltean@nxp.com> References: <20230801182421.1997560-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0030.eurprd03.prod.outlook.com (2603:10a6:208:14::43) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6839:EE_ X-MS-Office365-Filtering-Correlation-Id: 22557206-a4f5-44ea-c2bf-08db92bc96f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oRmZ4VQle2hIc61cAqpq6kNpadh/XVlKoyeZRu/cdAkHzMNQQhAb2kR1y2D9ScUceH/NIuz/PNU7j416P+X8NCkHgpkpaKyb3a0hIrS3ZleFh4XTclLMShv1HuSCapwidY6yOALCdzGUWEQWVfkyuUUU8iCs8b7km9A6sNxZeFoD2ATTnmJwqqXaYInS04ykhIBSuLL/jgtHSCidisJLVvymBh0qtkdCtp2t0YPlcTs3oApJebSnQxHrz7gPX9zqUgD846QmS8c/H35Sls9Loo3qarjF+gGyOHj4GBdZSwKISA4HPp2VeOxap/pqw0xWFQXXwqo/qqNwUCTcNmmCTK+Ma7A2jOhstnD245grfaZb+kxL/RX7UaU++uDATLMVvOsnlMBzYV64qpR5opzN2n15KhFcCjJPQLEVLMIFT18SEnzeGNQ610agPSH4xtgdbHap9p0GzWGnKA11er9RhAeWeHXwu4rfMq1FCwVrZvYryUv1HKH29KZESDCBoEp9f51DeFD4aHBxtKmXdifKzCqoE3F1NIEE/Smcvsd/odNor1FdDLwtZ57e2DQb7PLOGjmI81qXWe3c1dvfxQ+sLNm8mExmki5LsjOnzKqcxYZo/Aaez0ejkgf/h+WcWTfk 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)(346002)(366004)(39860400002)(136003)(376002)(451199021)(6486002)(52116002)(8936002)(8676002)(478600001)(6666004)(54906003)(6916009)(316002)(66946007)(66476007)(66556008)(4326008)(83380400001)(6512007)(38350700002)(38100700002)(41300700001)(44832011)(186003)(7416002)(26005)(6506007)(5660300002)(36756003)(1076003)(2906002)(86362001)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 91+Wh0SroYw752px8ThXk98RiPsZzwb2J+xz/6WAx3Mq/YiRi8pLZFmw9gKrw/1DYhnbJ948QbsMudfCo37gYLSmTIuCjYBuCTKRAvhYeDE5o58f/OKvhxARlx66ZAG85VrRh6thQX1y1qIJ9i7NcgNiDCOEi3aoE5YIwaQVH0hZN+bEjDk9Crz4CiAyPy1nyahP850NJlat4q1nJtkP1Pjbk8fqGSPBh0CvzVvoXQu9EyWaPHEKgOn2mqAHIR6zBVOsCMPlFP6GMaKdh9jumbH/mtXGhBhCJWUAWKPgtLmV93b0PzRH5OZOdJv92Gc1e82bajxOZqZvU//ibY8ywUUyNQHQ7+O5wR72Srnd8qzjE5QK7uQ54CyyGKIjHqkltJ6edphsdDKRzIAeujCc/OMYBKwoafWcUhzY6esJRja8f9c4w/H6bRMWvOxIiDKOFTiaUuf7NmlxU5x8IOLYV6woJFykixAjcniRXIECSMjW3zBSkxzvhIofOKF36Kjih1Q1QSfy26ISPSi4pDuAmrO35hZ/HqCi4HjpkXB1p1+/0OVwOegDQKoxGB5l6SvS7t+/FZwn5JkPELt+2drtaCfSjk9cman5CV9t63fgOtpRgzD6Ym/nDeDwDD6FIv6dhy8JFs7w2MTnBaYTc/4DqXI1gRQfbbtEZySN+cqgzTSzaI0DottChkslLgCMeVkmV61YbBhcuRadKlNw/h/lquZVzPAGDjmGk6OEJsEPqeCIi7B3qgS2Sav6WwM65V+ZqFWPKy/sYbLMER8r4ezyllcjcUytMnwuDnILe6M+BsQtQRstPKjBbiCvszlC5P7yFudcve40DlWc//Xsvb+opbOvZzBzviENvT7A559nBaDRT+VJ5/xm0p7EIB8wNn2N9jlr2ERRWt+TsSStO8mNmrl8l4ReBpN+vPlUaPzfaV4yXAe5JLqScvndjnTevoynm5msiANC+mdjW5XlSs8q+FT6Xh5RrJSWiAkCDQEvYt9GhNszyiDC0G8ozJuszZhU+kghJ9aHTx2zZxU7xraeOi7CchkUIAHGi7VMuxPBY2iOSoOE7h40059/lOwjvz3iHD4dw3chzpGBHG0D6/o+1guXIrToOFfg3+aAanSB9pFM9C53RcHXLrlEyu1q98/jCYox0PAahuhGDVD9rq095aJ3+j+roSmUauYKkVjTxO70qLYMN7QjnDlQO3PqMaTTI9/LQsnQ60Sq+ZPPbwzoJF0kBDRWQHY9KDCXHLQFtfpx1LhpfiEmD9XxD9+I53bLTS5n/Kf3yBBfks4nEyR3dv/PrkUgPpOkuP011TnE7z7wyHUiUcmUV4dmHAw9iHyfMvlI9kH7ItcxDPefKfl/VQysOobZplTDe7HuElaoSO1SbdWiNcckPpmg/eesd8udPkqOwcDuO9oGrPiRPAt7L0g/eWzWyJZ4MZwMG9ypSQ/m/ZqSXP0FA91tCYFVYAA9pSVcG3uih7Ef/fi5uMmWwNKFRzRob763d6OMUnh4nyfTUkP7patFTggBr9lORrPX5J8b7wvrD8XKxBRoTzdPmlBTq4AVGqAZZ8FyAVIwqDnGF0FWTXoAuLn7amSZMYsMB28XocgPKXTo5EKja5P3pQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22557206-a4f5-44ea-c2bf-08db92bc96f9 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 18:24:48.9019 (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: kYO3GYIXL9MctvIr8ToFHs9wHWQUOWzadawLMUTrjGNhkF9pH9i1iKJxEfprgLHWF/epxymuVLeeAdm7x0wQPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6839 X-Mailman-Original-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=t04J+PnhrMeedST7ETnsj6KGwBzM/nxBIR3qjm9z+dk=; b=bTB2i3Zv+QB4Bq+rt7FqlCEHdJLeGOwqhMaZdw8lbkkt6ZmmU4ohEajjvUOPra0+KjRUN63XGKge3yqvS22CetuEIWFGZHMrdWOQMeB4qullNBfZBSJRvUA7Xg8wm1/AJRA1gH/hx3/Yd1leTwp3NG/SG30rOjoGP4N3TWktMc0= X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=bTB2i3Zv X-Mailman-Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Subject: [Intel-wired-lan] [PATCH v3 net-next 04/10] net/sched: taprio: delete misleading comment about preallocating child qdiscs X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiri Pirko , Pedro Tammela , Richard Cochran , Jamal Hadi Salim , linux-kernel@vger.kernel.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, Maxim Georgiev , Cong Wang , Peilin Ye , Jakub Kicinski , Zhengchao Shao , Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" As mentioned in commit af7b29b1deaa ("Revert "net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs"") - unlike mqprio, taprio doesn't use q->qdiscs[] only as a temporary transport between Qdisc_ops :: init() and Qdisc_ops :: attach(). Delete the comment, which is just stolen from mqprio, but there, the usage patterns are a lot different, and this is nothing but confusing. Signed-off-by: Vladimir Oltean --- v1->v3: none net/sched/sch_taprio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index c9ad585b5dc7..06397300b40e 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2088,11 +2088,8 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt, return -EOPNOTSUPP; } - /* pre-allocate qdisc, attachment can't fail */ - q->qdiscs = kcalloc(dev->num_tx_queues, - sizeof(q->qdiscs[0]), + q->qdiscs = kcalloc(dev->num_tx_queues, sizeof(q->qdiscs[0]), GFP_KERNEL); - if (!q->qdiscs) return -ENOMEM; From patchwork Tue Aug 1 18:24:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1815596 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=EWMZL64R; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFk765g1hz1yYC for ; Wed, 2 Aug 2023 04:25:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 1E5C9600C9; Tue, 1 Aug 2023 18:25:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 1E5C9600C9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1690914321; bh=LLTalbDLLGKIkRQrY1CrCwSOpEz2bFG+shWO5F2cyLU=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=EWMZL64Ri31LHqHdFt01mIMo93ivAe3NKyO/rOXr3u3w/D+n/uMFD3H+2MqIWCUAV C+XqF8Vu20Kqccz73FYrPmkYiRaVCaRqpRiOcV4zZPvY3jZOeby3laszbxjS1aqu+g Z0PODDUa9+FfvJGVPTxxBp4XekHFVNeUF3Fqem1vJUVlcU1eQCWlv57qK82MdSaC23 Jd6khgrfAZjzZ11d3Nkr7eF9ZoCWa63vfykuhUMN4xQGwUJ6IWGxnMp0iv27A0wGp5 PYQhPsRr3Y7np5jdeY59ytwkWCMzlZIhi5eK65LL2rj7fnMj6smeuI08IkKw9NKFdG ZIWIrhK6dTzUQ== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IL2NPn_bu5Tt; Tue, 1 Aug 2023 18:25:20 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 0FF1560EC4; Tue, 1 Aug 2023 18:25:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0FF1560EC4 X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 6FB9B1BF3C4 for ; Tue, 1 Aug 2023 18:25:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 47359405D9 for ; Tue, 1 Aug 2023 18:24:55 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 47359405D9 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pR-griXsEPWn for ; Tue, 1 Aug 2023 18:24:54 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2088.outbound.protection.outlook.com [40.107.104.88]) by smtp2.osuosl.org (Postfix) with ESMTPS id 0BEA4400C5 for ; Tue, 1 Aug 2023 18:24:53 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 0BEA4400C5 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ndRBzVgbS7MdTk/xQS96WfbdqJY7FcWlZprZspWa5uv4TFHtKa5iF/nEUnWnUr2q0ha6FH8JRhzE4Noul1fBihVVLV2PrOMdvkIPoC3h3NNkdkSNpquidFxQq2Jts+whLsnF3ebciqElrrvghAYXUdBVQbZ/WK3aWYPHehrWhmdjPwHMBp3o2MwxxYFEeHOmvJQdouKzwhd2MbUZ9K55fvdNiEh8LSCpgBLqV61psEWBbWH8x/rmIE3hdi0SjPbOFuoo/98wKjGuzgpKN1pPreolLB9wPhbYtNRKAt+VFaGdsCzi8u8cWPvIIvMDroPrMNWk12EFE5t5m815N1A1bA== 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=ZeDFvsIdN/7QAcJlUBNojMuSKMlZ7MhoQMa+oJSHRgQ=; b=HjffND+Qum9htlEMP3pnxIwjjmPubP0IhE7lt5b46/XAerFgtdtBt8G35EXk94C1yKyYyaCF0380ifHXy8tNYO5PkHqUPzEtXO3XuzXDl+kNv9B8vnnazLpdwI/aae1/3Pt69Vv35YGj7pXXEWLL3SksMHA0v2N9bmwKIEyHO61uoevR6A1kWg2cIpCllf7SC+9wPUmcF+EzEEDit7h7RYppeEVcsZbEpalN63uRJO9+8BTnGf/ZqOuy34p5B7zQ8kqEktPLrrNJG8TgZVk1VGVWN7VqHoKdfGVHjUVRmKJ4LBVEGaPR1KewKm2aFdfHTchwv4OMdMmraoO5gxuRmg== 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 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM9PR04MB8796.eurprd04.prod.outlook.com (2603:10a6:20b:40b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Tue, 1 Aug 2023 18:24:50 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194%4]) with mapi id 15.20.6631.045; Tue, 1 Aug 2023 18:24:50 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Date: Tue, 1 Aug 2023 21:24:16 +0300 Message-Id: <20230801182421.1997560-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801182421.1997560-1-vladimir.oltean@nxp.com> References: <20230801182421.1997560-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0030.eurprd03.prod.outlook.com (2603:10a6:208:14::43) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM9PR04MB8796:EE_ X-MS-Office365-Filtering-Correlation-Id: b8b44127-5a31-47dd-0798-08db92bc97a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2apVDXP6R5nNZz3GFO/Hglb9x71pSA8HSbTj2JohrM+1fO3yP6icvG/fMDBkzVkPwsukQvJz0JCUEGT2wBu3l8iP8mU0bsbVMp7m+BjQJM8v215czB/IVR+1a3EQSAXEi42WaE06KQoFNQRaS3DV24dbvzN5FWwsK2nc8PZzydIoolrexqZ+9i8us7Pbsr/T3whNbiezk3vsxT7kZay0tXpuawKRLIYUTzRDYY0qJTAjFK2vEWFowmWK2R+NIoH2dTOpO9SL6oS9O2Ivp5GBnMVk2GVNtbUasKJYMVKXCJmvGeWMBSwUQUlf/W2eZT9Ycr2kYpALBTZlP4d/KD0NNA7K8w6ynUYWzNGbLOWma9UoCeiKOCp4JjhvsfJyZxxcwnjMPLLq+hSS+IsNBBuQ5b7OeC5AMhVPpkmP3hfn2B3Kdt4HPXqaPzcG3AkP8UDNRsW/Bv86r6FnBU7bJPCK5AZdaq0o3/pW/hk/iReCTSDSE8JqDnsWkQC4aBTnqeod1QY2Bcc2UBJ9TwIsHhFwD4q2wNcRdliBgkt0vTBno9CRUICqRqgIiyqbdjLYNdqIZ/MyfjYKY9Xb0jCs8E431k+x4vdi68aGr0Xay33pMhA= 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)(136003)(346002)(39860400002)(396003)(376002)(451199021)(38350700002)(2906002)(1076003)(6506007)(26005)(186003)(38100700002)(52116002)(316002)(83380400001)(2616005)(5660300002)(66946007)(44832011)(8676002)(36756003)(8936002)(6916009)(7416002)(54906003)(41300700001)(478600001)(6512007)(6666004)(6486002)(4326008)(66556008)(66476007)(86362001)(966005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WenMWEn/tR3b8/nZWgudleHKai08EFUCsDA5+tV42HDTqDccpMcuSEPmVvHgyEret8KvVsVkokZVN2/57aSk8yN5OvngkYZQ7VEK11mflQDgMjOy1pvXHe+YBRnZVm438gLPLFf/TEPwMxH9mm/h/my5CisvTA1deEcmNTkZP3/kgAEUeyk2zWTZ4izWBuEwB+K7fnjyp6+xHghROD0a65ucheNtustzvxUZs1QWHWlC/ooG1J41xay+VEosBxl/62ks+5t1+kHUPB7mL67NLdkxk/ew9wzu5a3Cvj0MFgAeWo3kHsFkMB7MwhymocGbi0WOPx09Z9BxxHPcCw/Bb6Lc9x0JixiQwZD3dFXyFsPNf1myqyEq0P4BQ9JHLqjI3Q5r2BqmPvOEiTnsj8wuwhReKlqQRsByniLUR9qIwK2gVpRKvuwZDY0u1NodUo50f6MwKi5DCm5kHdrltrpZ4sGd2QpIemgt+6tSzwLSJy6EYmPrR5iGmL69y90d2KnzKpPmulvJclw3muf4ETcIlaELfKCc68Op4+rZeCE8QTQARpxG9nD4YGxAGS9kd4QkglJ1PsSvFvyd8nH7p160M9m/tBAblwWH6c6hqyzT8D+B17IoI/u+Mrq8WEnn8SSOPut9CFS3yBJm2GQ3kg//z8VNp5ti0u3Lssc9IVB5rB0aPon4yQ1x6wxNhIUdb0PQMmvfGOaLOwYWkhpoYqIB45FbNSPRi+GhDO8WYTS50tr42U4D0lUxXRN/mPaXQuYXHwhYoztdIAfrbDFy7PLiarXihVQ6O6ZlrQ06DoWjUWJEANxY117lvXU1klRPonOSWPzIRs3k4ZI0N51DqpVKwdHpRRMkqSVXL8FD/jONx2Z9QftoXQnYuZwCF2HSwGEASADEPRwT8OEd6UZbUSJv0U2L+GnLsgpZRkrBne+Ak9mbQQcf8p9+KfX7HtoQqhFrIPgxGY/fzQMKWD546luIA5uLESjPiylWJyzI1qHwHatiC9GDs4V37jMG93ckwYKt4n/EUcAfjJ9cLB9kyjVnpijLiTaEkE0AyZ7IJlsXDcTFo2kogGKsFfHsfMlbqgwHKUlgybjkNm/2ibJ9mabBriqVWLOYP2Z71tpw3G6i42V7zPI18Om9ovnfBTMri33egv2pwBXb5Msx6ORokLI1WMBGDK8eClCGiEjogQuGrv9Y5pi7mF5deJ6vFrJ+Bb09F3f+m3P+X2VrMIoFs1mGS0PkRPteW9dO3OAwMMQ+qbc+igRzeuQgvjUV1GC5eWOu+mihh7qxh8R2cxzh/DKSgOzfb+WvJz1XAXzqxEf4FEsSWt7vNc1HbTIIG7+7SrhQ8vn//x9VGWb/9RD0qplekcaJjKWee1+uewBFA/Z07mdKrJ7UYcPFCoimgsq9lJWeGad/6PXBBVivJ7wLFgwlzxFsZxW0ZcK9K6IUM6FKo4hO1FVPCNLs/aXSFspxPxkJ6IEVhk/YCW5mFO/fh06LDP2eE5tdzcVg5bUjrThOukJYbQWX3lFjLFCr3NdDS4e9NMzMcL8V0lsgFTGYKfTCO0poUZWoBs2sDCP96tmvcKNyW7fGEBQtUaePgrCfHFyc9RI3d2sJdjS9fuxwcWGY4A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8b44127-5a31-47dd-0798-08db92bc97a3 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 18:24:50.0165 (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: DCAa79hnqij4GN5DH4JJ/VXfEvzO+VGDjVwDuDAKdrYwXFV64iLh4KOyruDxRBgNQfbZMg2yYht6XKN24FgzFQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8796 X-Mailman-Original-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=ZeDFvsIdN/7QAcJlUBNojMuSKMlZ7MhoQMa+oJSHRgQ=; b=XPMAh6SgWOAJlCjrVA6/gHo/JsEef6U4q6RmDK2Hvr1O/IyazZiK+G6Phn/RWP6pjhR4UOOe3iD6PTchQNHypGs7SLAO5G57InxSJt9I1Y0SPGHqozT9XVkO7oBezgrNx9NLdByFwzoSBHijJ4uzoEFnYjiW3wsyms9chD6MXCc= X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=XPMAh6Sg X-Mailman-Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Subject: [Intel-wired-lan] [PATCH v3 net-next 05/10] net/sched: taprio: dump class stats for the actual q->qdiscs[] X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiri Pirko , Pedro Tammela , Richard Cochran , Jamal Hadi Salim , linux-kernel@vger.kernel.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, Maxim Georgiev , Cong Wang , Peilin Ye , Jakub Kicinski , Zhengchao Shao , Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" This makes a difference for the software scheduling mode, where dev_queue->qdisc_sleeping is the same as the taprio root Qdisc itself, but when we're talking about what Qdisc and stats get reported for a traffic class, the root taprio isn't what comes to mind, but q->qdiscs[] is. To understand the difference, I've attempted to send 100 packets in software mode through class 8001:5, and recorded the stats before and after the change. Here is before: $ tc -s class show dev eth0 class taprio 8001:1 root leaf 8001: Sent 9400 bytes 100 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:2 root leaf 8001: Sent 9400 bytes 100 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:3 root leaf 8001: Sent 9400 bytes 100 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:4 root leaf 8001: Sent 9400 bytes 100 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:5 root leaf 8001: Sent 9400 bytes 100 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:6 root leaf 8001: Sent 9400 bytes 100 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:7 root leaf 8001: Sent 9400 bytes 100 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:8 root leaf 8001: Sent 9400 bytes 100 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 and here is after: class taprio 8001:1 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:2 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:3 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:4 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:5 root Sent 9400 bytes 100 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:6 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:7 root Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 class taprio 8001:8 root leaf 800d: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 window_drops 0 The most glaring (and expected) difference is that before, all class stats reported the global stats, whereas now, they really report just the counters for that traffic class. Finally, Pedro Tammela points out that there is a tc selftest which checks specifically which handle do the child Qdiscs corresponding to each class have. That's changing here - taprio no longer reports tcm->tcm_info as the same handle "1:" as itself (the root Qdisc), but 0 (the handle of the default pfifo child Qdiscs). Since iproute2 does not print a child Qdisc handle of 0, adjust the test's expected output. Link: https://lore.kernel.org/netdev/3b83fcf6-a5e8-26fb-8c8a-ec34ec4c3342@mojatatu.com/ Signed-off-by: Vladimir Oltean --- v2->v3: fix selftest broken by the change v1->v2: - reword commit message - rebase on top of the TAPRIO_CMD_TC_STATS -> TAPRIO_CMD_QUEUE_STATS change net/sched/sch_taprio.c | 8 +++----- .../selftests/tc-testing/tc-tests/qdiscs/taprio.json | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 06397300b40e..7f275f9f5793 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2461,11 +2461,11 @@ static unsigned long taprio_find(struct Qdisc *sch, u32 classid) static int taprio_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff *skb, struct tcmsg *tcm) { - struct netdev_queue *dev_queue = taprio_queue_get(sch, cl); + struct Qdisc *child = taprio_leaf(sch, cl); tcm->tcm_parent = TC_H_ROOT; tcm->tcm_handle |= TC_H_MIN(cl); - tcm->tcm_info = rtnl_dereference(dev_queue->qdisc_sleeping)->handle; + tcm->tcm_info = child->handle; return 0; } @@ -2475,16 +2475,14 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, __releases(d->lock) __acquires(d->lock) { - struct netdev_queue *dev_queue = taprio_queue_get(sch, cl); + struct Qdisc *child = taprio_leaf(sch, cl); struct tc_taprio_qopt_offload offload = { .cmd = TAPRIO_CMD_QUEUE_STATS, .queue_stats = { .queue = cl - 1, }, }; - struct Qdisc *child; - child = rtnl_dereference(dev_queue->qdisc_sleeping); if (gnet_stats_copy_basic(d, NULL, &child->bstats, true) < 0 || qdisc_qstats_copy(d, child) < 0) return -1; diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json index a44455372646..68a7264e083d 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json @@ -104,7 +104,7 @@ "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: taprio num_tc 3 map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 queues 1@0 1@0 1@0 base-time 1000000000 sched-entry S 01 300000 flags 0x1 clockid CLOCK_TAI", "expExitCode": "0", "verifyCmd": "$TC class show dev $ETH", - "matchPattern": "class taprio 1:[0-9]+ root leaf 1:", + "matchPattern": "class taprio 1:[0-9]+ root", "matchCount": "8", "teardown": [ "echo \"1\" > /sys/bus/netdevsim/del_device" From patchwork Tue Aug 1 18:24:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1815597 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=TKxTk0Zf; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFk7C2Pf3z1yYC for ; Wed, 2 Aug 2023 04:25:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9190A60E3F; Tue, 1 Aug 2023 18:25:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 9190A60E3F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1690914325; bh=GUTl4KfhgCQziPxOjGI6CVzYNouvJU4znEv5Ftlny68=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=TKxTk0ZfPlClM1vYTxsxgR06nKr2PTxcJ+PhbfgWDnCUaLuxnN84/5flAzETLVvgN gspMkNHWDsP36jYqfi2i9BdTw0H5rW059KjGuKlbYV9U24YppkMCcQPKEQ7g+ftayQ Esl+KS+STFDrtBodWAsKA5YK1/7Q74SYELycttxAlVtMU9K7OuASGwyuIu+mFi+7s1 aNIGIfSUKOkFE2UbIpXvs7jFFjHJGx+IgFAnXNxKT8VB+Ntt0UDyqBWm8kEgz1IEz/ 9RBTTAX28hInWXo6lkj9gYOiOhiWn+cOf5WLIE3CUSh3CCq/5mMIGnnorY3jhEOmSn 3+AyvdRxDfijg== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vRU5drsQrv80; Tue, 1 Aug 2023 18:25:24 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 3476360701; Tue, 1 Aug 2023 18:25:24 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3476360701 X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 587681BF3C4 for ; Tue, 1 Aug 2023 18:25:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 92AC040BDD for ; Tue, 1 Aug 2023 18:24:55 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 92AC040BDD X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XQEcLTxpWJkn for ; Tue, 1 Aug 2023 18:24:54 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2088.outbound.protection.outlook.com [40.107.104.88]) by smtp2.osuosl.org (Postfix) with ESMTPS id 8231540540 for ; Tue, 1 Aug 2023 18:24:54 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 8231540540 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kYH76s5SJLqCB6k+sXQ5R+MdPh1rVBmdy+9BeMtrUHjyrzXKGiPuCpQwICYNrR3QBIgklg6eoKqJkd/FsEejYCiqGIIvQlNuBiZjA3Dr1146SQpiLwAVDaPJnFc/e7mkUDN2XTn5b78tUPKcchHC/YUVZmMwVuWnkprgXSzN6z9HVqVfsRBIEHB9VZBUPFRiHxNo7QPp8O5eb4Mgik4rdRmRlJIWX7yT27OPuzQ6QC/R2g/APhZuk2jvOS6syXz9OhVTKsGIUqpS+6yMSOQcqy5qMneVNXgD1M2I3XhTL2C+x4TAAeBCojdRl4tJ/ja5Xh+Le9ZN/flVayciSY0ojw== 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=Ut4OKsw5avDvlwLhWrkm02UHTnbV1chMQ8vNswD502U=; b=c4tfRx491PPLqj2t/XD7o0oP3Nkd2PiMuwP5vtcTXosfOozN8TNp+ak2AnBMOI4Lal3PoyH03htUL8P3dib/InBqM2AhABWDeFr96t1dbva0p8SbHyk07yqiS8Wkrim0yWnwrBN2h3g2AOHTCkYgDYcISk61uopkYM8xEE3KdghMqGokcM9TNP9lw8mv9o69tNkim6CTFxFKIVPA2Jy47pEge799XYVR/UgWBoxe62rful3ytI2zlIQE3ROzLte4qDi3X1Umny1cfSP5EkY4zziTuQ6GQbdEfX312++seAoncIMsKy2KrtRdTzsm800gU+CRkknwjAC55XTsFueBKg== 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 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM9PR04MB8796.eurprd04.prod.outlook.com (2603:10a6:20b:40b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Tue, 1 Aug 2023 18:24:51 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194%4]) with mapi id 15.20.6631.045; Tue, 1 Aug 2023 18:24:51 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Date: Tue, 1 Aug 2023 21:24:17 +0300 Message-Id: <20230801182421.1997560-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801182421.1997560-1-vladimir.oltean@nxp.com> References: <20230801182421.1997560-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0030.eurprd03.prod.outlook.com (2603:10a6:208:14::43) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM9PR04MB8796:EE_ X-MS-Office365-Filtering-Correlation-Id: 65a587cd-f50e-47c4-aecd-08db92bc984e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ftbv6QLkB92l5cnx2v+wG367/YSm5kae3K+wYsi1oQCk8e8GSunCzaPTdypnhjgtRdzQddt+XKEKfE1s6cRteB/fa3aIEzQIFNHmixXfGuIoA0puy+hnurnKKUPHi0LGKyxwExgNNNU4H5dA5eVdnt68g6nRMaOKE6OQCMFf/Bl7mSsYlG+bVBrkDFhuUTDjJOewzhqqcCpFFxTnfEllxsnkfIC4O8z0Fch+i2XbQGKUJGROHc6MMhSol6FrZHPFM14wt/kAPIWX2zar1ONmcFEuE9jv4slYkvC///cRAdb4swASDqgVIlaxOjSvnR+guDMDsDXQ4fmPGdqfP0l6rEwYMKKo43XdozpMRgoYc/v9+SrtkQh4EVgnPA35xIiYM8ZH3JOs6xPCgIT0AqqwzFDmUvle+V8fLbYuY72rdPjNf0enouQM/QfkniX0BV7tWKIy2jy5BD7inVfap5wtjOYwyTAAPGQpVBprAiJp7HaCwFxqcEC0Ys9xubQHke00d8yyByzLJxJZIa/UynRb7oLQQDsIXLKVUNhiR+oORwKCiz2ELm8AYXXrTkP5KIZYRymLrTtOgxquJ/qAm3NCx7LZGl92AufVexJNTaefso8= 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)(136003)(346002)(39860400002)(396003)(376002)(451199021)(38350700002)(2906002)(1076003)(6506007)(26005)(186003)(38100700002)(52116002)(316002)(83380400001)(2616005)(5660300002)(66946007)(44832011)(8676002)(36756003)(8936002)(6916009)(7416002)(54906003)(41300700001)(478600001)(6512007)(6666004)(6486002)(4326008)(66556008)(66476007)(86362001)(66899021); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nwlTDwlNjajcJDp4fsbJwwvVyqWn7wzXt9l4AOOgPjvl4ShFe0KzBQ8WF99oXwTchVZpTmi8C5zkWsi8AtfoEL+eMGk0vwL5gRU4Y8ox/4ClCQqRnkticzVNcGtmlPC9FAQop2T/4ntdI8ubDmbUOoAAqxIJQZbtWu1lQQxqTBdjCYcG6qraLOCw5ZRGwLl6W9eumrgRK4D9KyQA/XIBOP0HbG7i2jvAHPT/nJmqhNzVsuvjX2ZDtVGwWFINNs6QwVGTAMO4tty9b/vm3AOAFbikMhBbCIiDXWZnTlpvUK6EXkedxN1w2nKVWfkGVbqycQBwt8uGjBAR5I2jnfWvWWae0D/3XgFGfqzbZZ0JwX/51DctfpqrPXAqhVj6qfLLyH03BxpVHlCCq8AiVpcSUqgvwB5pVltXWbbc+PzP3NZXlaAf8VrbvlgQuGC684aKMGaIdKRfziuhd9HAWzZGtIyMnIVfiOAUWgVCFORJAp/BnVVeAEJnhlli5kLeiRm2uZbbY3ynwVtWP1ylIloEgb+6AvHbDnuL13qUn/JOiOjMjqPy54rWrilGuvQAMfCVylIwSvgYPotYo6Ikcx5rTLLKUHluoF5uL7d9N+xh7UDdpSJmbDk0UuK5SmFtB/+TCtheTGdTL9YVbYe/wR+Eyd68Dw+bRzrcTgxghvsu9KaQ4s2Hj2sqwfaQRsCMEtttvsTAZgEayeswdJomB1eNU3t43tmhdaJA3Evcitj9ychyFhmtns8Mti9bqqSEw8lDrKhQcF7P9WqcW3MwQIhN2j7RRyMrPyE7Q10Nxm2wsYioyYNJUsBBp/sBGXs+kpe28VQ0vg5dLUX96JVFBbVSy7EU2XsJGc3YqTNKPI6Ve9P6/IkAKA1Q/gOGOEJ54Wt57jp5xwXzHF2ZHSFXtrXpdDZWNRYGvaPT8H+477KVoIKyQxK+YcP8vNNXFa5NS2zvVssUNMRxvvzHHH13Ta9KxNaX1dZ+oRVx+qZ53I9ij0PZ2y8jgl1razGhM5p9Q8eIw+LxKKNh8GpINCleOKlIJkiv9EvN+SmCW06xkTcPkwf4xT/NZWCF7CbMK8g3xbfSwlyDF1MfiV6AC4O1DTIoeFisAc8kQ0GUdr+m4kzWR1bRJIfw70p89szs7PhkqX647fVlXrGpEVWoH/46Pn2neNqJa+ebh//W8ka15FI23m+8B6I7QpIHvm3+6FliNpDpl7IVloqI0F3wA+bFWSnR6Y9c5q2kolzYKEtEOhGjJGNzMBdiWG27DPpRRCQ31mPqGpqnt4wYw2SFu/hnE5mlTKnrMsXv9iz/tFMAEwxCzcfTvjX3SwR0pys3GsWSRw893LH+B/qIQIosY87p3cmOgimGum0FpTQ8IuHF7Vnl1bgPKBVNP/SG+t6zvnEzLAk0ptGdbmwrr22eg9Esc8/CHuNJ8ipfL26fAE7SLdMsUWoWI3YzBcGjjHo4HW77EjKIjtNPNGLv/WYHoo7MTXg7+Zp9eaT9ib6EDtZXyhVDme/VYl5Vg6U7DZWmdiAj2pRxBWs42af20qT8Yv+EzTkllHJKodI25XROucEGy9UozeEmFPiIiLEQpchwZSkrOpDQOk+vNXN3ZauAdPhwyo0dDw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65a587cd-f50e-47c4-aecd-08db92bc984e X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 18:24:51.1577 (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: aWN5avut4tTuL6sRNOJoxTHRD7ubOq4irq7/3b6fIF3qJS66U5RuMczhE/7FbGp3baw+gT4KdVcqke4OL8XeYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8796 X-Mailman-Original-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=Ut4OKsw5avDvlwLhWrkm02UHTnbV1chMQ8vNswD502U=; b=gqM1xefkC2MSr2dtBmdnwITb16n4l6+Ls+3VIPXO4GNUYRSsff9zgECZHFrenzu8Oa+HdtbugUlNeCQ9PXlCa80fjnVIAUhwunyTfRdf7ETqdkaaUuXYr/r8e5k6dY1VxFCyupITF2xATn2yCDLKfsHX32mV0feeIf4WorzQ2Mk= X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=gqM1xefk X-Mailman-Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Subject: [Intel-wired-lan] [PATCH v3 net-next 06/10] net: ptp: create a mock-up PTP Hardware Clock driver X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiri Pirko , Pedro Tammela , Richard Cochran , Jamal Hadi Salim , linux-kernel@vger.kernel.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, Maxim Georgiev , Cong Wang , Peilin Ye , Jakub Kicinski , Zhengchao Shao , Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" There are several cases where virtual net devices may benefit from having a PTP clock, and these have to do with testing. I can see at least netdevsim and veth as potential users of a common mock-up PTP hardware clock driver. The proposed idea is to create an object which emulates PTP clock operations on top of the unadjustable CLOCK_MONOTONIC_RAW plus a software-controlled time domain via a timecounter/cyclecounter and then link that PHC to the netdevsim device. The driver is fully functional for its intended purpose, and it successfully passes the PTP selftests. $ cd tools/testing/selftests/ptp/ $ ./phc.sh /dev/ptp2 TEST: settime [ OK ] TEST: adjtime [ OK ] TEST: adjfreq [ OK ] Signed-off-by: Vladimir Oltean --- v2->v3: - split off ptp_mock into separate patch - fix ptp_mock compilation as a module - turn phc->lock into a global spinlock - drop bogus support for ptp_clock_register() ever returning NULL - add MAINTAINERS entry v1->v2: patch is new MAINTAINERS | 7 ++ drivers/ptp/Kconfig | 11 +++ drivers/ptp/Makefile | 1 + drivers/ptp/ptp_mock.c | 175 +++++++++++++++++++++++++++++++++++++++ include/linux/ptp_mock.h | 38 +++++++++ 5 files changed, 232 insertions(+) create mode 100644 drivers/ptp/ptp_mock.c create mode 100644 include/linux/ptp_mock.h diff --git a/MAINTAINERS b/MAINTAINERS index c4f95a9d03b9..164b7930f5d0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17175,6 +17175,13 @@ F: drivers/ptp/* F: include/linux/ptp_cl* K: (?:\b|_)ptp(?:\b|_) +PTP MOCKUP CLOCK SUPPORT +M: Vladimir Oltean +L: netdev@vger.kernel.org +S: Maintained +F: drivers/ptp/ptp_mock.c +F: include/linux/ptp_mock.h + PTP VIRTUAL CLOCK SUPPORT M: Yangbo Lu L: netdev@vger.kernel.org diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig index 32dff1b4f891..ed9d97a032f1 100644 --- a/drivers/ptp/Kconfig +++ b/drivers/ptp/Kconfig @@ -155,6 +155,17 @@ config PTP_1588_CLOCK_IDTCM To compile this driver as a module, choose M here: the module will be called ptp_clockmatrix. +config PTP_1588_CLOCK_MOCK + tristate "Mock-up PTP clock" + depends on PTP_1588_CLOCK + help + This driver offers a set of PTP clock manipulation operations over + the system monotonic time. It can be used by virtual network device + drivers to emulate PTP capabilities. + + To compile this driver as a module, choose M here: the module + will be called ptp_mock. + config PTP_1588_CLOCK_VMW tristate "VMware virtual PTP clock" depends on ACPI && HYPERVISOR_GUEST && X86 diff --git a/drivers/ptp/Makefile b/drivers/ptp/Makefile index 553f18bf3c83..dea0cebd2303 100644 --- a/drivers/ptp/Makefile +++ b/drivers/ptp/Makefile @@ -16,6 +16,7 @@ ptp-qoriq-y += ptp_qoriq.o ptp-qoriq-$(CONFIG_DEBUG_FS) += ptp_qoriq_debugfs.o obj-$(CONFIG_PTP_1588_CLOCK_IDTCM) += ptp_clockmatrix.o obj-$(CONFIG_PTP_1588_CLOCK_IDT82P33) += ptp_idt82p33.o +obj-$(CONFIG_PTP_1588_CLOCK_MOCK) += ptp_mock.o obj-$(CONFIG_PTP_1588_CLOCK_VMW) += ptp_vmw.o obj-$(CONFIG_PTP_1588_CLOCK_OCP) += ptp_ocp.o obj-$(CONFIG_PTP_DFL_TOD) += ptp_dfl_tod.o diff --git a/drivers/ptp/ptp_mock.c b/drivers/ptp/ptp_mock.c new file mode 100644 index 000000000000..1525aafca752 --- /dev/null +++ b/drivers/ptp/ptp_mock.c @@ -0,0 +1,175 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2023 NXP + * + * Mock-up PTP Hardware Clock driver for virtual network devices + * + * Create a PTP clock which offers PTP time manipulation operations + * using a timecounter/cyclecounter on top of CLOCK_MONOTONIC_RAW. + */ + +#include +#include +#include + +/* Clamp scaled_ppm between -2,097,152,000 and 2,097,152,000, + * and thus "adj" between -68,719,476 and 68,719,476 + */ +#define MOCK_PHC_MAX_ADJ_PPB 32000000 +/* Timestamps from ktime_get_raw() have 1 ns resolution, so the scale factor + * (MULT >> SHIFT) needs to be 1. Pick SHIFT as 31 bits, which translates + * MULT(freq 0) into 0x80000000. + */ +#define MOCK_PHC_CC_SHIFT 31 +#define MOCK_PHC_CC_MULT (1 << MOCK_PHC_CC_SHIFT) +#define MOCK_PHC_FADJ_SHIFT 9 +#define MOCK_PHC_FADJ_DENOMINATOR 15625ULL + +/* The largest cycle_delta that timecounter_read_delta() can handle without a + * 64-bit overflow during the multiplication with cc->mult, given the max "adj" + * we permit, is ~8.3 seconds. Make sure readouts are more frequent than that. + */ +#define MOCK_PHC_REFRESH_INTERVAL (HZ * 5) + +#define info_to_phc(d) container_of((d), struct mock_phc, info) + +static DEFINE_SPINLOCK(mock_phc_lock); + +struct mock_phc { + struct ptp_clock_info info; + struct ptp_clock *clock; + struct timecounter tc; + struct cyclecounter cc; +}; + +static u64 mock_phc_cc_read(const struct cyclecounter *cc) +{ + return ktime_to_ns(ktime_get_raw()); +} + +static int mock_phc_adjfine(struct ptp_clock_info *info, long scaled_ppm) +{ + struct mock_phc *phc = info_to_phc(info); + s64 adj; + + adj = (s64)scaled_ppm << MOCK_PHC_FADJ_SHIFT; + adj = div_s64(adj, MOCK_PHC_FADJ_DENOMINATOR); + + spin_lock_bh(&mock_phc_lock); + timecounter_read(&phc->tc); + phc->cc.mult = MOCK_PHC_CC_MULT + adj; + spin_unlock_bh(&mock_phc_lock); + + return 0; +} + +static int mock_phc_adjtime(struct ptp_clock_info *info, s64 delta) +{ + struct mock_phc *phc = info_to_phc(info); + + spin_lock_bh(&mock_phc_lock); + timecounter_adjtime(&phc->tc, delta); + spin_unlock_bh(&mock_phc_lock); + + return 0; +} + +static int mock_phc_settime64(struct ptp_clock_info *info, + const struct timespec64 *ts) +{ + struct mock_phc *phc = info_to_phc(info); + u64 ns = timespec64_to_ns(ts); + + spin_lock_bh(&mock_phc_lock); + timecounter_init(&phc->tc, &phc->cc, ns); + spin_unlock_bh(&mock_phc_lock); + + return 0; +} + +static int mock_phc_gettime64(struct ptp_clock_info *info, struct timespec64 *ts) +{ + struct mock_phc *phc = info_to_phc(info); + u64 ns; + + spin_lock_bh(&mock_phc_lock); + ns = timecounter_read(&phc->tc); + spin_unlock_bh(&mock_phc_lock); + + *ts = ns_to_timespec64(ns); + + return 0; +} + +static long mock_phc_refresh(struct ptp_clock_info *info) +{ + struct timespec64 ts; + + mock_phc_gettime64(info, &ts); + + return MOCK_PHC_REFRESH_INTERVAL; +} + +int mock_phc_index(struct mock_phc *phc) +{ + return ptp_clock_index(phc->clock); +} +EXPORT_SYMBOL_GPL(mock_phc_index); + +struct mock_phc *mock_phc_create(struct device *dev) +{ + struct mock_phc *phc; + int err; + + phc = kzalloc(sizeof(*phc), GFP_KERNEL); + if (!phc) { + err = -ENOMEM; + goto out; + } + + phc->info = (struct ptp_clock_info) { + .owner = THIS_MODULE, + .name = "Mock-up PTP clock", + .max_adj = MOCK_PHC_MAX_ADJ_PPB, + .adjfine = mock_phc_adjfine, + .adjtime = mock_phc_adjtime, + .gettime64 = mock_phc_gettime64, + .settime64 = mock_phc_settime64, + .do_aux_work = mock_phc_refresh, + }; + + phc->cc = (struct cyclecounter) { + .read = mock_phc_cc_read, + .mask = CYCLECOUNTER_MASK(64), + .mult = MOCK_PHC_CC_MULT, + .shift = MOCK_PHC_CC_SHIFT, + }; + + timecounter_init(&phc->tc, &phc->cc, 0); + + phc->clock = ptp_clock_register(&phc->info, dev); + if (IS_ERR(phc->clock)) { + err = PTR_ERR(phc->clock); + goto out_free_phc; + } + + ptp_schedule_worker(phc->clock, MOCK_PHC_REFRESH_INTERVAL); + + return phc; + +out_free_phc: + kfree(phc); +out: + return ERR_PTR(err); +} +EXPORT_SYMBOL_GPL(mock_phc_create); + +void mock_phc_destroy(struct mock_phc *phc) +{ + ptp_clock_unregister(phc->clock); + kfree(phc); +} +EXPORT_SYMBOL_GPL(mock_phc_destroy); + +MODULE_DESCRIPTION("Mock-up PTP Hardware Clock driver"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/ptp_mock.h b/include/linux/ptp_mock.h new file mode 100644 index 000000000000..72eb401034d9 --- /dev/null +++ b/include/linux/ptp_mock.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Mock-up PTP Hardware Clock driver for virtual network devices + * + * Copyright 2023 NXP + */ + +#ifndef _PTP_MOCK_H_ +#define _PTP_MOCK_H_ + +struct device; +struct mock_phc; + +#if IS_ENABLED(CONFIG_PTP_1588_CLOCK_MOCK) + +struct mock_phc *mock_phc_create(struct device *dev); +void mock_phc_destroy(struct mock_phc *phc); +int mock_phc_index(struct mock_phc *phc); + +#else + +static inline struct mock_phc *mock_phc_create(struct device *dev) +{ + return NULL; +} + +static inline void mock_phc_destroy(struct mock_phc *phc) +{ +} + +static inline int mock_phc_index(struct mock_phc *phc) +{ + return -1; +} + +#endif + +#endif /* _PTP_MOCK_H_ */ From patchwork Tue Aug 1 18:24:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1815598 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=fIWPcLgP; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFk7H4gwpz1yYC for ; Wed, 2 Aug 2023 04:25:31 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id EF8246114B; Tue, 1 Aug 2023 18:25:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org EF8246114B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1690914330; bh=ZtYCHC5pGQ+ZJ91TZynvAsB7Nj+113rCENWKYvznBjQ=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=fIWPcLgPhIkVqET2SuRYH8AfR7Cr3CJ59DQfX/stDhGXRXNJVwRxA3uQCKQQI6sNb G4Yiqc2cdLmXyFREBpqnf7hiLENakwhPzzEx5sunqFLigndmDI6i8tfFL6EsQLq4Me S4sKoeJJCWOvt5LTVWx5hnPdZQN8qfoNVSlnoHAY1t+fKuHJsMwWmmCg85ZnUmQye8 eMQre7cKfxE9RzGC9UnI4PpbfBRH+vHXK5D6rka8LQXJm0gM/GdADJ/JDwDtnRxOa6 EKCLUsIwvLmEpz5nkXNIcDx+wUtF9Z8EbnghNtw2pjBvCsDaMY1KUQhq45HjQ1n2QU Ys22DJrUgm7FA== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pL7VhgtYY7NJ; Tue, 1 Aug 2023 18:25:29 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id A36F060EB8; Tue, 1 Aug 2023 18:25:28 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org A36F060EB8 X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id B5AD21BF3C4 for ; Tue, 1 Aug 2023 18:25:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id D170D40C1D for ; Tue, 1 Aug 2023 18:24:55 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D170D40C1D X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fxEvKByeW8cD for ; Tue, 1 Aug 2023 18:24:55 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2088.outbound.protection.outlook.com [40.107.104.88]) by smtp2.osuosl.org (Postfix) with ESMTPS id E8C2A40ABE for ; Tue, 1 Aug 2023 18:24:54 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E8C2A40ABE ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B2fBZpbgsydlYtemAGgAlKC+8MRVNutWKBh33baEhBpC6wrKAuP60B1XASgvUrnnB25TKI/g0eKRSTkGV3DwUXOwGN7zV/PwOVhXXYUnP+2ZGMb29DkvxvK685onSQlpWsRUMxchhY00+i59DXTMe7tNWAl6nGI61cNIwmAsZ5mxLEdQUSOzSyVGjH9CXJPWMBn4u4vJpjIaEZW9ZJfMuWHBsmGYducywk+T+PCLEIQrLLeVPFnVMH3U8eeQJ35+wpF8DqYlXYjeyE3yCM6wFKvNrO6N4qzxImWn9XmtI5e0EhIpjjBmjpvz8O6cXt6LG+HjVfXgW9MXvP2kKsw+Uw== 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=jb6YYObRRKn19OUN2BCcwSodsdYT0N+nUrwxHMRW3/Q=; b=eEjdLB1siuN6AeeRRAgA75UYRGhTDVLYBjzFtXaXZNxyr/giV1JTdJlj6+ejvW3X/wJByEmsMGT1K+fTNr4BopFoDt0vzHNeK/RJ6psEkmgUFZFBoQwoSrc4bYKaoG9heOYh4bR+vYNYDC2vvWS7/caO/i8KwS1VMBx3zMfG+vodkMHxfWVYnw/iGOr8nhi2I1qosC4ul29c2UWMeJzP68pX6YubISpiCkQpyN5+jjfonLiOJP5XmnWrKzZ6Zs68+/hsK9ker4HuWUiH/2wr7ffYGmDqNex2utuBUmC5MR65F/CrlNx+I4tINnZhX/S0zmEOmrnEAw3lw6+1UvAAUg== 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 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM9PR04MB8796.eurprd04.prod.outlook.com (2603:10a6:20b:40b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Tue, 1 Aug 2023 18:24:52 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194%4]) with mapi id 15.20.6631.045; Tue, 1 Aug 2023 18:24:52 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Date: Tue, 1 Aug 2023 21:24:18 +0300 Message-Id: <20230801182421.1997560-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801182421.1997560-1-vladimir.oltean@nxp.com> References: <20230801182421.1997560-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0030.eurprd03.prod.outlook.com (2603:10a6:208:14::43) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM9PR04MB8796:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f3480c7-d04f-4705-1aac-08db92bc98ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ek54nCvBYx/+NbAreLjZou67o2qeDJm301MeGjcVHXXj5DUxNGuP7zWtTNjIhv6YeKFTeRelnL/CrbA6B82pgzpxdV+OyQAD1C47hvR6x0h1ssY/P35C5hKLueDEEnKBn+rvicqIe/nOqPRuAsYKK9fy0lMek6Ntws2qBuiGWQToCIjNC3YLv5DFA1IJ++tah1W3bdf7Uu59XX7WRhaHyMQztwubvIFtJX/uQ7ipKe+/dsuvlNcHlSus4e9HUJnd2EzuQ2KOJM1uQHIG4XgeUDEb2TmphIc76af951XzfivCsIt4crVXo7rdh/UAo2FVJoUy2HUm0++nOGltQH6d0vKT5hgUGzCiNCXnfQbMZ6Qpv6rccPeGc9zKJr+uoPa3tsONek+il9MR4CZnhBYQgPFbw6JgalDTV34GDwFzC4OLyi8K7ZUFxaXxWICpklaQZC5XryFGOd1GU8JTl6btMNosTkKgerkQaKbPIWj/uCtShGZc2DD4FxzkyBBGrr8gEqZRhDH8sCR7t2DDPx35wx9sx7XR+eY2hdlR3d5dilAKSDrr25SQ0Hl5aL37348Z7XXcPobpZEWkbDtTzCx+OcnGyeVCLN9vmA2/QPnd0eAsYpSa+1OFUgxrrId/c/Eq 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)(136003)(346002)(39860400002)(396003)(376002)(451199021)(38350700002)(2906002)(1076003)(6506007)(26005)(186003)(38100700002)(52116002)(316002)(83380400001)(2616005)(5660300002)(66946007)(44832011)(8676002)(36756003)(8936002)(6916009)(7416002)(54906003)(41300700001)(478600001)(6512007)(6666004)(6486002)(4326008)(66556008)(66476007)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iNSwUsYoM/G4TZ4gNNDnYEtZaZWAryNx+4rrglMhgd1aT6s+1AyTNi2xmLMO5CK21hbEPV11wqMkeV0yw1Uo0J1gvcTpYh7Pjl1Wk3FFZyLigaIuhMo9ryUhqFfqIHu9Mrj1/7qlAXvnijZ8Gh3rWJzHWngE3HKxAk23WzbGW1181f9LJHVrVyv6myygoI9SPvueWQ7T0xvSJIUTb8iRH8UtVv5eB7YZ2G7wO/pnqA89gKBC3sPGByZyQSBJmhp7ki/GejFDedlSxYeoaqXSo11Dux8t2FXHo+1deK5zj9/intIEAnyDr3e2VUacELyP5pKy8tLd62MUtn1OyvBJNKjdO22I827vJtRgeJ8De7WscOUQWtKnqTTLimOGeyERHlpOBM4/uQYn2kQwQkf5QghKive/6ayHe6qvqtHdh+4fJQhvlgEZVmzp1V2sPb43GiNXaNW7T3TGaLm6s17DiQ2ipc42Bpb4v93I6zChIcsCX2oOXo6lQTSfpRbRPJl9ubsOGjljC4M8mSbnCrDlDOmQccjK+CC/rm5UevNbgZTT6R6dzC6ue5xWqLRhJVOkK5z3Yy7Fa0LsOLwXYm8FnLHwD25FBBOAFClGxcvgNNmDs3LON2ARh99P3wSeBWLHaYLRvZsUxWkEmXOqVE92aFSbLEKd4YHlYDvYWr621jfU12qTszAIefG0Xv7Vy9lrafs6N/vV56gglar4XMzUpw6nP/dGt9yIM6nQbfzi/1SLZn48ipMR+f1Q/wlqDbWrgyAzriOYFQtrAmYxQrwljEbLpx3PjV0IZnmQbFoyLr3M09Gfk3R/Ig+mm90dw5ZYIbTBtO9AJxOBnI3jnp8EiWyIvLdSM4l7/SXHY3S7aSWbMrBlvqia9iXYcIGItyXz/NIx1VOb0vvTM2xkquIWSw7YhhFFI87GfnmPdNWCDuyPUTDtt3LwaoslflCyVP2tWj3BCVuLwnEUpfM7sm9yUys/RXxHGjB4y00ovQG6W/MR4RLRZuWJZ6AWS0i2vKi46nkc3asEq1XgeydZHDbcK1Fd41n7Z3ZWdemLAX5rN3HtNf2UojNgbJ8jjJ/YtrskQ+GGwu7aOgWTiPQcxrp2E34Tlga9hRJJUbXRz2qshJ6Y7gfWla3s2aUOonyfQwRjLkqh0lo71DhPoge9uqc2j4c5n1KI6dZIo9uZAwWd3rtJl22rmQ1a1Iag3sHNVEwCjTt38hChfUQel8+pwxXPtHFET/FLLXedDQPuF+CjSawdQI7eyaGjoxZ3jd4tkGiY5elllgZW77oW2cEBXCUjhwnDNU1/vy76MTZGtYl09AlxfWcmbqVWJR2dhxsFGBcJXBI4UtflNqp7w7Gz2B+caVUwd49PPsl61pf34zw09T/3izqUwFcNd/bW6iu0ULT0vVTspHCmlW3nqkvSNZPRS/4QRB6jdJwfCM6d3WZUIMBHmrUnM0PASwNJDqCA/AZfr+ip/FTykgTRjYm0pWefgTnU5M8SuTZU6+Sliupq0cZG4aqppGl5fNgfcHul4Z7fsdtN215v7jXhTR4eJ+RGkp4gdM+nf6suhSyR8mJ32qhHG7q05E70x6G9YX5CGncL8iyqLa6VzSi/+bVjfELlDw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f3480c7-d04f-4705-1aac-08db92bc98ff X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 18:24:52.3062 (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: vzszChd2bFIBDo+SmpH/CFO37gd6eyIST4GGBuHv72HoekJHcAAur7MWa50xPB98LrYtcfKbhdoHMFvkdO1Mwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8796 X-Mailman-Original-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=jb6YYObRRKn19OUN2BCcwSodsdYT0N+nUrwxHMRW3/Q=; b=dn1j+pBzXU3KYzSh1IEaky14fkOGvzUxOSV+RU6DWGRiLDB6juIlSyoV3ezR8/OeakIQ00nv4hsordwcmDrFG1FmNwKq/7x9xbyj9SsbGegmKEYZWQzDim2EXQUdWVZKqv+L7ALWR6twQyJgQfkcQ7jWVqoJJCI29+y2rjGulMw= X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=dn1j+pBz X-Mailman-Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Subject: [Intel-wired-lan] [PATCH v3 net-next 07/10] net: netdevsim: use mock PHC driver X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiri Pirko , Pedro Tammela , Richard Cochran , Jamal Hadi Salim , linux-kernel@vger.kernel.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, Maxim Georgiev , Cong Wang , Peilin Ye , Jakub Kicinski , Zhengchao Shao , Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" I'd like to make netdevsim offload tc-taprio, but currently, this Qdisc emits a ETHTOOL_GET_TS_INFO call to the driver to make sure that it has a PTP clock, so that it is reasonably capable of offloading the schedule. By using the mock PHC driver, that becomes possible. Hardware timestamping is not necessary, and netdevsim does not support packet I/O anyway. Signed-off-by: Vladimir Oltean --- v2->v3: split off from common patch with ptp_mock introduction v1->v2: patch is new drivers/net/Kconfig | 1 + drivers/net/netdevsim/ethtool.c | 11 +++++++++++ drivers/net/netdevsim/netdev.c | 11 ++++++++++- drivers/net/netdevsim/netdevsim.h | 2 ++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 368c6f5b327e..4953c1494723 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -592,6 +592,7 @@ config NETDEVSIM depends on INET depends on IPV6 || IPV6=n depends on PSAMPLE || PSAMPLE=n + depends on PTP_1588_CLOCK_MOCK || PTP_1588_CLOCK_MOCK=n select NET_DEVLINK help This driver is a developer testing tool and software model that can diff --git a/drivers/net/netdevsim/ethtool.c b/drivers/net/netdevsim/ethtool.c index ffd9f84b6644..bd546d4d26c6 100644 --- a/drivers/net/netdevsim/ethtool.c +++ b/drivers/net/netdevsim/ethtool.c @@ -140,6 +140,16 @@ nsim_set_fecparam(struct net_device *dev, struct ethtool_fecparam *fecparam) return 0; } +static int nsim_get_ts_info(struct net_device *dev, + struct ethtool_ts_info *info) +{ + struct netdevsim *ns = netdev_priv(dev); + + info->phc_index = mock_phc_index(ns->phc); + + return 0; +} + static const struct ethtool_ops nsim_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_ALL_PARAMS, .get_pause_stats = nsim_get_pause_stats, @@ -153,6 +163,7 @@ static const struct ethtool_ops nsim_ethtool_ops = { .set_channels = nsim_set_channels, .get_fecparam = nsim_get_fecparam, .set_fecparam = nsim_set_fecparam, + .get_ts_info = nsim_get_ts_info, }; static void nsim_ethtool_ring_init(struct netdevsim *ns) diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 0c8daeb0d62b..2a4a0c4065cf 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -291,13 +291,19 @@ static void nsim_setup(struct net_device *dev) static int nsim_init_netdevsim(struct netdevsim *ns) { + struct mock_phc *phc; int err; + phc = mock_phc_create(&ns->nsim_bus_dev->dev); + if (IS_ERR(phc)) + return PTR_ERR(phc); + + ns->phc = phc; ns->netdev->netdev_ops = &nsim_netdev_ops; err = nsim_udp_tunnels_info_create(ns->nsim_dev, ns->netdev); if (err) - return err; + goto err_phc_destroy; rtnl_lock(); err = nsim_bpf_init(ns); @@ -320,6 +326,8 @@ static int nsim_init_netdevsim(struct netdevsim *ns) err_utn_destroy: rtnl_unlock(); nsim_udp_tunnels_info_destroy(ns->netdev); +err_phc_destroy: + mock_phc_destroy(ns->phc); return err; } @@ -383,6 +391,7 @@ void nsim_destroy(struct netdevsim *ns) rtnl_unlock(); if (nsim_dev_port_is_pf(ns->nsim_dev_port)) nsim_udp_tunnels_info_destroy(dev); + mock_phc_destroy(ns->phc); free_netdev(dev); } diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h index 7be98b7dcca9..028c825b86db 100644 --- a/drivers/net/netdevsim/netdevsim.h +++ b/drivers/net/netdevsim/netdevsim.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -93,6 +94,7 @@ struct netdevsim { struct net_device *netdev; struct nsim_dev *nsim_dev; struct nsim_dev_port *nsim_dev_port; + struct mock_phc *phc; u64 tx_packets; u64 tx_bytes; From patchwork Tue Aug 1 18:24:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1815599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=dyR2kIU8; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFk7N0pYLz1yYC for ; Wed, 2 Aug 2023 04:25:36 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6FE0D60E63; Tue, 1 Aug 2023 18:25:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6FE0D60E63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1690914334; bh=O96aN5vZB+in3JBLLA62cni4Sk/J7aMXO0+ai/m0zeI=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=dyR2kIU8AA6yytQfAn33EE46ZEpT7dserIJqXBj6fDRrN7wrxKZXV27mrbj29R346 riGoDOvNAHLDqqshCwd/YexwPVUvj7DuNM1rVtAG3pzh3aTGTRHGHk/AneLN4qZCSi rAoIN1KhwtcUMIq1QXMQNWgWWFNl/z4rIUh0AnWtT57NNSYF/lhJrxhu5cYQXa+yCU 4pcW3UkszdPiyyo6zmgAqI6Qkrg9nSGqU/6Y9JsoLvRoaearTzEdgZ50r8kFF4Tvf4 oqMfI98pBABO9YBL3Vlmae4e4SqDUSh9StsELMtUNpgB6mxwxynk0Jwk5ucewWLefJ s/aofHokM11/g== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Nj_mPHgvBnor; Tue, 1 Aug 2023 18:25:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 835D0600C9; Tue, 1 Aug 2023 18:25:33 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 835D0600C9 X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 288A51BF3C4 for ; Tue, 1 Aug 2023 18:25:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 21E03403AC for ; Tue, 1 Aug 2023 18:24:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 21E03403AC X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y6W0sKjKBzTo for ; Tue, 1 Aug 2023 18:24:55 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2088.outbound.protection.outlook.com [40.107.104.88]) by smtp2.osuosl.org (Postfix) with ESMTPS id 5157C400FB for ; Tue, 1 Aug 2023 18:24:55 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5157C400FB ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ValAV+BmyovPeslh4uGeZuoPjNcR87+iPeOSfP1vLzN2cx1vPFd57Ut0DItkjOgC+IY7U/ljodOqRuroCyZxWFMKcudt8b7HJgECCqGWpa/NOQOLQ+s5U3PnKm8cooomw/hBj0oMd6SVcAZJ/SwfqGgXs+1hY2o3jcRrog3JCiqY4x82CXtLBC7sRumLiSwu8/wT0WTy60U9pFCHskJrd/nzgocxzj4DfD/VdFbRONBWJ89bgHty9yjBhF8+9FPM5QkTG6a21bF6zXqPrQ/5yK29cffMisSkmKblZHf+JW41QpSYMFGxqvYrcW9/eVQsv7M9zr1fymzwTFHVuyIMgA== 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=dQ1biz+GMDeevePHIYlGl98eWqf1lm3CJlwz5nPFALo=; b=nQ69he8G/dWANHCHbmwrFFMe7JYndovUA1HNlHVCgNJoF34b+Xd/9BHZy4T0xPQ6NiJAuGCuJMJ2RVCyYtW1jfuTE2vFxb4BamjGRJaTu2LAuccUiOfxn4oISq004Q/okwaxm0OEqhxkbCQzKCPkY3V7D6Cz7ThZs1R0XbINLdHZbjesRlLaIcxjaG/m2RWaIKhxHAn1Ua+StWDpvQW2y0+92uVU0pk9hSwdZ+z1coi1r/OlbFnZuEX/y3B3FXd48gzIsEk3aAtR0KkZEvrGUWHwP94vN8DGs0Qv5xW4/PgKqxfa4ONinjHJr6/DQ2Lx/WBjuaAHGFnv7Zc+XXAR6w== 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 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM9PR04MB8796.eurprd04.prod.outlook.com (2603:10a6:20b:40b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Tue, 1 Aug 2023 18:24:53 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194%4]) with mapi id 15.20.6631.045; Tue, 1 Aug 2023 18:24:53 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Date: Tue, 1 Aug 2023 21:24:19 +0300 Message-Id: <20230801182421.1997560-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801182421.1997560-1-vladimir.oltean@nxp.com> References: <20230801182421.1997560-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0030.eurprd03.prod.outlook.com (2603:10a6:208:14::43) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM9PR04MB8796:EE_ X-MS-Office365-Filtering-Correlation-Id: 55e73af8-532f-4bc8-2422-08db92bc99ad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z3QiaRFZjbFFx4CpEGKOEOoA6ASQTIFAOAMUWzX3W3yTJpmgS+ZgWYBmj8ItMCAoA+U2v99FJi1zK6wjVKOV6ZNZtSRZdKBtzHToOsYbyh4Pv3bqR/IN2QsOixWpyth778lAeeQ9sEnDlVqfIcabixgENoGzGFfwlp7OF8pbKrrKmRPuF1j29S6iBsvPnbmrekDffY+bVOtP08tI21vz0bT9a7aiyGC2UQjN5bq2bfzThJ/bS42p1B5W6t5yKm879//gS4WvjW40qfpZPJm33g51TMqEpnegADs6idKOIczDMT12AiJuHq6Ry74fP1j95Ks0x+7GDoCl4bGNX+zYr9Bef2DqNXaulCxxW7WbknRVnTWglZThyky1ES5PJv7eFe1a1DuZAJCZZOjvNr+I+7vzYz7nIOCsTjmTjGI9FcabQqe4EpXNvv8OgA9Np9T4DaCnaFZ2mBuzlH+8v7G+pPFLelssF4Xc7PsYcIKuc2PRvboCO6kVQceYL0TA9rWHascYaL307MD+eJrewo7rajQPh5uIiIf41kyMzHtg3CQZ3X2GP8gNMbGvFT1MtvjR6Mje4BBQDOGndc9qvxQbQlQFM53ZdlK7HCWsFL4mAKRYGDyQS10rczmtUjgUYXeG 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)(136003)(346002)(39860400002)(396003)(376002)(451199021)(38350700002)(2906002)(1076003)(6506007)(26005)(186003)(38100700002)(52116002)(316002)(83380400001)(2616005)(5660300002)(66946007)(44832011)(8676002)(36756003)(8936002)(6916009)(7416002)(54906003)(41300700001)(478600001)(6512007)(6666004)(6486002)(4326008)(66556008)(66476007)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /wJYYtb1dzVRjZybq1pCqQqktCca0PEr8ciSlK9jJ8ef6a8cfa0mUXTXeDZ79sltutnWbVXza/A03cDCwXgvBo68C3Z31UE5AjXDvKzNE5SDV1HJa8rwt7NdtA5yzGGp0LmHWkzzVLCg/EXE83w/rhp6T7Tz3G4LzcGmsaGdrIIOhXpurNv3WDB4i17Ld7hieTnvZsFtdgKRXBQ0bOnABjoOnjQWDJm67Ro8vbJ23gkd6pvnqt0InIpsw87XR/LUxHLKmNs6LMHvk2ZI8zWZyn+BdLgL+BoeRbp95IgyVyQBE/R+xU3UtucnY0xsBfJbYbGSm3p+YnC4FDwRtVUT92bZtMy/eAvR+xD4MFFMvXdy8q5NYD60HfBYTEipm6zwo+Cnoycn81TXdEu+ujT03n8GtuKwKsalFE0Z1RMFJMwMFCzV0mERPt5erJxbd6P/Di1u9HPmRnY7mNxcERwYV3DfY/yWX+4qOTdwbvy47zB4CET6CsUn02pBtWAdkeNS7VtzRaJtJVeWKT+3jcRcgFQoeLI9EDUm0ZaBs9+Qx9wUNcK4hq0Pw9XYLFMmChdLLq5pr3Bg60XBJM8adc0o6xZIi52DL7VnDJ1CFh/+8WspDeiLijb7KRSvQKoivIL+cbLYRrH9hTYB0JqgsnHJYIcjGgMMGLlUXJOLkvqsBsyildfUu7GPpvR7cLArAefUQeDHuFEXMrRWwrcfhG65BwlVJW/zIiwPg0va3+woH6+btku8Pe3mjHGzZLZh4bSqVD40myeIxq8/OSyegJzAqCY0ps6hafqGo3vdSBWMXw5ZINzSR6nR3oZQczPYbaPAj6TbYGPp8gYvdgzah61ZO8WyhCL0YuMSeh0/WcbmJbECbCmHUnyn26fml91lxSaVWjTsNJUd+yM2xmzrZUiFiI+I82p/RCJKN3bCPMBd61EniJMdBeAcnYXDYNgYXCDFEW+/CrsYpa1WuTnxJqyAhfNXK3vkBMVwLp0ow4VOFqR2YuI4UxqG4dyGJ4zF3ZH0NItzktbfQg7xo5Bsdc2m7iIuvzEnHD4BSlpOixywghjfX0mZSHKSDOPnt/WY/E6cgOd3qLMsmiInR6xXZ7bmfqn8TBIQN414AmtKmsRRf4o9aDYLveyK96V3w6xS/1GBq/0TfE9v+Wwt1XKoK8zYzVE3eu+7JBWAgaqfXk77KKajCwchD5LHudMyh9eDVyKEoOfy5CSPP3OgTarx3OMGEerBCyY7SOnWYxHXUxWi6RihhN3rcIrrxzL2/bqUfIxig9CxdRUMqonUF0dzl6gYlZkDvGk0He5/7BW14TX6s6entBU8T2/aXSDPmTMSsl00mfwauUv3GjYiwfI6C6qprvT0rosy+RaacdE8Cw3K27Hsh+uLNi/4Lc8YdybqP5qa14g+PxN6FO7Sc4iy67DpGsltcokF9sCtIflOB/aLNoKzFqCAO3sJx5ecsLjDWMHeNqc9UbrtSpjPmRTWqczsyKd9fkmyAOFGfMxwt7Z1G0MgSsUPHiIulqBFRYfP/Xxzs0NEdajKdSXeUiC9n4KRg0BPEkU0AlWp779kIcaul+GP87RWE+ZVwP8kvBx9ihmihpGR8Jkm/B5/2PM76tzUDw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55e73af8-532f-4bc8-2422-08db92bc99ad X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 18:24:53.4178 (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: 5RfbXuPphe7RNyV3UVGUEfRxF63QsaE4X4nQeIU+lebZN0HWXNR+mUFuA3OQHol2VtfVUesA8Z7lx74X79EN0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8796 X-Mailman-Original-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=dQ1biz+GMDeevePHIYlGl98eWqf1lm3CJlwz5nPFALo=; b=GRPXsQfPew1vwJD0Kk2wCmfvXcm3ui4slyC0Q9XfjVumg11ZpGH8F7whrXuKtz2lwvniQm0luoIYf+0GhvFdfd31fmbgIJjCyHTXg67psF2r1SYf2ImDi9OIPKr7efDxlNkwP8is3MoRfY7NBuKknja9J/sDdwyYVeJ2vy80tUM= X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=GRPXsQfP X-Mailman-Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Subject: [Intel-wired-lan] [PATCH v3 net-next 08/10] net: netdevsim: mimic tc-taprio offload X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiri Pirko , Pedro Tammela , Richard Cochran , Jamal Hadi Salim , linux-kernel@vger.kernel.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, Maxim Georgiev , Cong Wang , Peilin Ye , Jakub Kicinski , Zhengchao Shao , Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" To be able to use netdevsim for tc-testing with an offloaded tc-taprio schedule, it needs to report a PTP clock (which it now does), and to accept ndo_setup_tc(TC_SETUP_QDISC_TAPRIO) calls. Since netdevsim has no packet I/O, this doesn't do anything intelligent, it only allows taprio offload code paths to go through some level of automated testing. Signed-off-by: Vladimir Oltean --- v2->v3: none v1->v2: patch is new drivers/net/netdevsim/netdev.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 2a4a0c4065cf..2eac92f49631 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -209,6 +209,31 @@ static int nsim_set_vf_link_state(struct net_device *dev, int vf, int state) return 0; } +static void nsim_taprio_stats(struct tc_taprio_qopt_stats *stats) +{ + stats->window_drops = 0; + stats->tx_overruns = 0; +} + +static int nsim_setup_tc_taprio(struct net_device *dev, + struct tc_taprio_qopt_offload *offload) +{ + int err = 0; + + switch (offload->cmd) { + case TAPRIO_CMD_REPLACE: + case TAPRIO_CMD_DESTROY: + break; + case TAPRIO_CMD_STATS: + nsim_taprio_stats(&offload->stats); + break; + default: + err = -EOPNOTSUPP; + } + + return err; +} + static LIST_HEAD(nsim_block_cb_list); static int @@ -217,6 +242,8 @@ nsim_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data) struct netdevsim *ns = netdev_priv(dev); switch (type) { + case TC_SETUP_QDISC_TAPRIO: + return nsim_setup_tc_taprio(dev, type_data); case TC_SETUP_BLOCK: return flow_block_cb_setup_simple(type_data, &nsim_block_cb_list, From patchwork Tue Aug 1 18:24:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1815600 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=hLafiJvY; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFk7S2Yw2z1yYC for ; Wed, 2 Aug 2023 04:25:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id B095460E38; Tue, 1 Aug 2023 18:25:38 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org B095460E38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1690914338; bh=fvFuvDszdQSy5XAMwQCBurpK+xZ0j77u4Pt6tL02t00=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=hLafiJvYcaMh4vnibmxe0a+C4iJo6ZO1npispgfvO6jplIOXxMVxwbrEux2TX2N6I 3G4F/tzhh7JjDSrHg3Mb+l0jGYRW0B1guR/rqs9cqsQ6pPxavYe4WY9ZXv5mxXUDgv NaYs8YMwgvJqQ/CdXz03uSCwiIrhN/K8ok92Cz/VXVVGxluHNsJt10MrOn+6lzzE3z gRWIzqpxCHL7NmyEHakCoL8wBw1FwdckGssn59iF2MUrnh9sAOxmKwBJWNcifYH8bK EYZQtS/E0isrt5IXOJt1NHflqM3U2w1Lw3BUA6C3rsUUlKHr8jvnPEgviB7DheMNcZ AYIHOecNbdJWg== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PbCM8a1-BkL0; Tue, 1 Aug 2023 18:25:37 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 9D7EE60F6B; Tue, 1 Aug 2023 18:25:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 9D7EE60F6B X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 549B21BF360 for ; Tue, 1 Aug 2023 18:25:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 989B140438 for ; Tue, 1 Aug 2023 18:24:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 989B140438 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6-1LUBLvhhKI for ; Tue, 1 Aug 2023 18:24:55 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2088.outbound.protection.outlook.com [40.107.104.88]) by smtp2.osuosl.org (Postfix) with ESMTPS id BC7CD40540 for ; Tue, 1 Aug 2023 18:24:55 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org BC7CD40540 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UaiEYWQZl1jnTfb9YIBE3sswllBDDjuqr6F73Nukp46M9fz0ThI3afa4z/ZfoCGrg6MONFwNrmVND6r1cyLHulhXsyhXAKu9bDXsa5355snOz2bh+o2QpyCtuM9+11sMGGDFd3QUm2A9YK6gl79QPzgKT2Kf/i+QwNSDWdM0fFZHPj9gBfqnWMUhl65FD6gv4gy1FFJA85D8hVpna6knZldCpQkTR6sglaPnbbxlQMKxm7VvxAUHCiCUUkjxZShPAS5fYvAW5HOyc6YMgX44BvfG4JwM9we2FXEVpeWcU6AnW9g6tGd0uN80j0mhHSTTthjKhcSFr0JAzAHvqpXoUQ== 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=PT2LhXAb7Qa81tvY13DJXGaa97oNVj+kSBsXvh0ysFA=; b=BR/zNIdKJOd5eXmggcBWvu3YXrz9XpG3EuHRuInxZzdHW+ap+ickPaqDMgPaxG4+M7AA9fsYPf3zbL2wBqUq5JZxWahzGF5UJP3lXGgdKCkBTmy0HhoinvK/XnOZT7Hu+FFlhCtkt/IQKzxUsHXUm8qO+24jyPv1uIBXE6TL/HWCJFna2lX6xBWvyclZrRFgeKPSw0QNKg6OcQMbtZJegrbZcrqFUB4rss3aYxr1XZ/UVhTk9KbuvcPI6gmd1aEcSGiWT2C6lyBV725vBYayOMmrZ0lvc8y4/sh5eZ3fekvpRv6eQ2fnZsaZI5myt/GepkL+tZhdHPWjmHCT+3Ek4Q== 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 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM9PR04MB8796.eurprd04.prod.outlook.com (2603:10a6:20b:40b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Tue, 1 Aug 2023 18:24:54 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194%4]) with mapi id 15.20.6631.045; Tue, 1 Aug 2023 18:24:54 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Date: Tue, 1 Aug 2023 21:24:20 +0300 Message-Id: <20230801182421.1997560-10-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801182421.1997560-1-vladimir.oltean@nxp.com> References: <20230801182421.1997560-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0030.eurprd03.prod.outlook.com (2603:10a6:208:14::43) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM9PR04MB8796:EE_ X-MS-Office365-Filtering-Correlation-Id: 36c8ef80-3968-490f-68f0-08db92bc9a56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aGEytpl4HeQmpDSiuBvnTXvwxfjw8fPC9WR4cqjHso5g8vFjTzSqGlbd0PiuxZknNLf8+agpFdTN6jzGGnTwP6qvkGFsMsK8RyqOXzBhafLmRc2XCDpGwI/dW4u+ZZMsNjKP1dHo1NQV2munetvAV+JpWJ/IK+ijYR7P+fBuH/4/FRZg+lud+nxPh72AfyDZvMTzAZD66Z3mira3m3Sv9SeWRznrFSiPKHpfJLaEMrRITMUTrKr0X9HKb9VPGgwwpjzhYqRYr/Uw1NcBtSk3Tkh5YyMPm8c6WjrfbY3UvJlFMIXG7sUwNiNfjIPAn+X/KFdBFL5Pixq8He4OmP/5mF6gYuUAe+IGMUzuNw8o9Gw+xgmg05jlO0LhbFZYm7DNPJYiGPdHdnnuVyvCoXgp+/WR1PYPmTu8sH3hs7PyJBTgDLDEgD8kJKw1nLqp6gJT/noTelCghlKCT1zs3Ihi6cRHc6ncsQV3blIvzDLWyebnDThryEivaEZzw6YX6tR0GbiPHoUKzVo320s66bW/2EHKCfbdhkzLTq4dqJJYtdLUaDTTxpZeFH/KWqQbe6NHGYrgMtqRQUYwtIXSTEhdYoZl3z/H3Yu5gJF1T57UvWSx0SJC/ro8RyYfhLX51bhr 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)(136003)(346002)(39860400002)(396003)(376002)(451199021)(38350700002)(2906002)(1076003)(6506007)(26005)(186003)(38100700002)(52116002)(316002)(83380400001)(2616005)(5660300002)(66946007)(44832011)(8676002)(36756003)(8936002)(6916009)(7416002)(54906003)(41300700001)(478600001)(6512007)(6666004)(6486002)(4326008)(66556008)(66476007)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rZqPEqP1j0rQYnFqTg6QdRgobxHJGKIndg0VtJ7Mby5cj9yLU3YBv4P5O/WJCt+UImR16JdHhuQVll3bfyTvqcUFWPrt4uup2e9fRBWghxsZMh8h0rf1uzp+DcezEHp5f1ErXBotl08M7KH0eR3XArWyqcWAQJX2hBG7qCmkan1ZID6QLdmZtFkSKsKoAFwkrMN0Wdl/8++J2VIwKqozlcKQocFvJOWvwmC2+7DtLsi9/S+KGoFCsh5Sd/1cc4pIdVhw6kNdXLYaeML27v6TXD9LBYolvtVq/jnTwI844sQqH+oGcaODqRiXDcKPABpKEf4PdGjV2liwOI9xDVJ0Aw2FbpVZmVvnLAPKxz264m9mgoeNFI9dP6ORNP7Z6YtA+Z3FdQO5cu5cnlolrBzdHTPhou9lB6BrqPLb+tuMzhuZwF+7qvoP3pEDMqN9aB/A74Cu96/0IeovCVPEU2PxqyDSmP0qOqdEKz557I4Y2mWDjAqgt6CWPBSlUIOuIPi1HuIF9udfnRWpoIToXaNeUYf1kRSFTkJUVsyeoV2ICNTI1hH2oPMWgZHg5gw1CXdFuYrs4eibrqM+wzc0ZlDPGleSWLmk97lz8obMnYEjYYjCG6FNEWnwrztO1EE9EO6frJ6UKdYPZNJbqLYGPFBN53UUoKiDcfPgdUeeDVs5V3cg0f6hCVbn/kvC60XwqTlZrivL/E5da4fqEmbp1yMQW8n0+0pP9aihUBFrDQ0TNw5gkyJysgZAtHHp47SBZyj0zSSgOtVrAgo+8KRFF7o3uR/glw2AU5qJDKAHlx+U18ZApzIkJw0K0u+2YkhtPSQC3BJKvwghwxE4PQIvOiBkUBMuG63ar+2HPNUBJfEkk91ur18vWS0k4Gw9uTF9QApM9epYz+P7MPI448LU8ydpnvwSVVN82rle//L3yhKD2ytwVr7l74hbzUGCHUJW0FjUhl9cjVmSzS328CjXjOMs+BY1W5ammj6B4e9you9ndveKTy0vmJUNLuO/0SgirDTRraybwZGKiiHTGxjZ86xLi18Szs3JYVM70Y5mBrL9FsMV+bqW+TMW6WZM1LF8IxhUq3421xZMkoyovdUOjBoIV5EeXctVyJZarrF1x35F+6jVPrpxWWUgafmvywirg+GerG+qN6Ujo3JaN0+BqpYDiooBnUJMZKrIkcGJCrAjvMD3HV2nNY1zNfgH54UYVIl9KYpKzd90JJhwtVy52cB9dEvui5R2okmr/TVsPwYGvGIY5aEPx6H0HiYVN36cdUilDT8SuY7EhDdaPTN2a56a6IMBqdIFn637NgLiqvjAUjRpLdsu+kSs6hqJTKrHdst9I6I3dlDyBXszXhkWkKE9VfrOvWZqgVC/Exgg6feEYYlRZmBJ6TUFFqgWFr4qD4Hn15ZC70OhIh4XPCNdjDO0X7Y3HE4ZSeMv42Arkvk2P2HkuxgOO7Bxk+CHvDqs2e+sD/OMA/gDOe2B+NDidWgZnYY5eu7XubtfY/mihF1lX9cL/eQRLptlFz/aEHZAcA82P/tbWXI464VgT8PhnUFYtzk1gO7chMikiw2cNSeerkiiOCK1X3FUobEm40iwG553RuzNBi36XEJRdanWQMt7LA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36c8ef80-3968-490f-68f0-08db92bc9a56 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 18:24:54.5442 (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: 9/EdROLb1rDcyCM96qe2HYF7Y/GzVNW18Nljnurz+KyFRWjvwoD8urDhGQaQLpaYpNStCaMAMPMYE7CGdhj0QQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8796 X-Mailman-Original-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=PT2LhXAb7Qa81tvY13DJXGaa97oNVj+kSBsXvh0ysFA=; b=STMdJaQLAk0klLoSBczp3GUpUIG0g2XN92eZVE/hh1Rm9QxpeXzUPFstUUAonyM4KnElWg+2xY7bfoz7HvRIisWXB9RBAytDdh7oR/UjmnCu2iMXY2ftEcFhke4jjwTGJnBGNrNqAudStPC7ammSAokeIhSC7evCAhUYzF+dma8= X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=STMdJaQL X-Mailman-Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Subject: [Intel-wired-lan] [PATCH v3 net-next 09/10] selftests/tc-testing: test that taprio can only be attached as root X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiri Pirko , Pedro Tammela , Richard Cochran , Jamal Hadi Salim , linux-kernel@vger.kernel.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, Maxim Georgiev , Cong Wang , Peilin Ye , Jakub Kicinski , Zhengchao Shao , Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Check that the "Can only be attached as root qdisc" error message from taprio is effective by attempting to attach it to a class of another taprio qdisc. That operation should fail. In the bug that was squashed by change "net/sched: taprio: try again to report q->qdiscs[] to qdisc_leaf()", grafting a child taprio to a root software taprio would be misinterpreted as a change() to the root taprio. Catch this by looking at whether the base-time of the root taprio has changed to follow the base-time of the child taprio, something which should have absolutely never happened assuming correct semantics. Signed-off-by: Vladimir Oltean Reviewed-by: Pedro Tammela --- v2->v3: none v1->v2: patch is new .../tc-testing/tc-tests/qdiscs/taprio.json | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json index 68a7264e083d..8dbed66a9acc 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json @@ -131,5 +131,53 @@ "teardown": [ "echo \"1\" > /sys/bus/netdevsim/del_device" ] + }, + { + "id": "39b4", + "name": "Reject grafting taprio as child qdisc of software taprio", + "category": [ + "qdisc", + "taprio" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "echo \"1 1 8\" > /sys/bus/netdevsim/new_device", + "$TC qdisc replace dev $ETH handle 8001: parent root stab overhead 24 taprio num_tc 8 map 0 1 2 3 4 5 6 7 queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 base-time 0 sched-entry S ff 20000000 clockid CLOCK_TAI" + ], + "cmdUnderTest": "$TC qdisc replace dev $ETH parent 8001:7 taprio num_tc 8 map 0 1 2 3 4 5 6 7 queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 base-time 200 sched-entry S ff 20000000 clockid CLOCK_TAI", + "expExitCode": "2", + "verifyCmd": "$TC -j qdisc show dev $ETH root | jq '.[].options.base_time'", + "matchPattern": "0", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $ETH root", + "echo \"1\" > /sys/bus/netdevsim/del_device" + ] + }, + { + "id": "e8a1", + "name": "Reject grafting taprio as child qdisc of offloaded taprio", + "category": [ + "qdisc", + "taprio" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "echo \"1 1 8\" > /sys/bus/netdevsim/new_device", + "$TC qdisc replace dev $ETH handle 8001: parent root stab overhead 24 taprio num_tc 8 map 0 1 2 3 4 5 6 7 queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 base-time 0 sched-entry S ff 20000000 flags 0x2" + ], + "cmdUnderTest": "$TC qdisc replace dev $ETH parent 8001:7 taprio num_tc 8 map 0 1 2 3 4 5 6 7 queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 base-time 200 sched-entry S ff 20000000 flags 0x2", + "expExitCode": "2", + "verifyCmd": "$TC -j qdisc show dev $ETH root | jq '.[].options.base_time'", + "matchPattern": "0", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $ETH root", + "echo \"1\" > /sys/bus/netdevsim/del_device" + ] } ] From patchwork Tue Aug 1 18:24:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1815601 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=dieHnbF2; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFk7X3hxsz1yYC for ; Wed, 2 Aug 2023 04:25:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D98D661173; Tue, 1 Aug 2023 18:25:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D98D661173 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1690914342; bh=INZsQc5YWDWHWri+qLvLg/X4jwt0SdivYr56YIIY66s=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=dieHnbF2ROtOdk53QbLsbs41XZignBX6C5tpyDmRwwUN9u5UpCDtRFP0CTOfJANaw ONnv481onJ1VGoztbgdGufCayORBlICv3ZeRYBshQl3w5Ft831SzmaZhlXvxCexs2U 120yJz06eWyJO7MubrrSUUftmzC4t63OMkApzOr5hHaLAaPHDnNqi8F5qxmwlPGdER SBWfV0LRM2LuHxTVukWne4EU4aFNJopPmmLeW0BWJx/KhUKVzdnBbSmYxMjNkxqiaj F5Bd/oRNIJ/UC9cFvP2F0vEeoB3M6UA8K/1UkVgPEPakio0z1NY7MKUEgEHHhv8fwe LypG4kD+TKy1A== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YqtR9tUtnDhF; Tue, 1 Aug 2023 18:25:42 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id C0A7360EB8; Tue, 1 Aug 2023 18:25:41 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org C0A7360EB8 X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 2EE0B1BF360 for ; Tue, 1 Aug 2023 18:25:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 0FDDB40524 for ; Tue, 1 Aug 2023 18:24:59 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 0FDDB40524 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DraFA8R6iYCy for ; Tue, 1 Aug 2023 18:24:58 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2048.outbound.protection.outlook.com [40.107.104.48]) by smtp2.osuosl.org (Postfix) with ESMTPS id 2BADB400C5 for ; Tue, 1 Aug 2023 18:24:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 2BADB400C5 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nTl0D2YE40DKwCxyx0cNKcBdTUshdX9fy47eQzLdIq1pBSf5Lel9og8W0HflrmjoASQJBn0OJ1D7w3G71LX55lreh3oOZEzYol7C1KspzzCXyReCt7O/TlK/y2p46HSX+EOzl0mOGyujJG2vby/m2jY6VAal8GiKNUK0V8Gl2RjVja/0DvdRbAqxu/i1KkyjtWUpa734ObcFFJXNkBMlgiqPSf/hwCItFaU2hKSgv+aCQONAo51KUkkGjb6O3415G9wM3ZtalDSbnTR2LpoJlsXE1bmAEHHInp5qjoOSc1Du1+EoCzKuSRsRQLlPubta6OBuF0F67pYZZ3gggv55EA== 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=FJOJWLJJSzjR9MCfwYjq0sWsA+KZ3LomuYdZ+8LGZeA=; b=H9jBv1gy+fZwddNfSKECAG6IVKaFXHHJ7R6y59rUMo4KJBeIMSo2uv/r/yvf9tyyRPI8uifRYplQolfUqaSjmxFyM02hyCtpIBQtdT3fuIIRwOqDiBM4EUTodh57C75aSM6r8S+RulyayrNyhdJ+vDfM4Teg/a4BI1ftuSCKv0dmuYw/eNaTyRs9mp2C53frwgDHS8YoS7fdiCFtYbA4YXwBuEBTlF/tHmcr6C5jBFfnaumoTrUV6MMR55pmBdJN/vEqt+6cTCls93Buag5TJWvnEgbs5nxi8rG27fJOWI02N2sNk8DVsr2757Z/McyugbPP2FWQia3VoWLKwOnCCg== 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 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM9PR04MB8796.eurprd04.prod.outlook.com (2603:10a6:20b:40b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Tue, 1 Aug 2023 18:24:55 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194%4]) with mapi id 15.20.6631.045; Tue, 1 Aug 2023 18:24:55 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Date: Tue, 1 Aug 2023 21:24:21 +0300 Message-Id: <20230801182421.1997560-11-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801182421.1997560-1-vladimir.oltean@nxp.com> References: <20230801182421.1997560-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0030.eurprd03.prod.outlook.com (2603:10a6:208:14::43) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM9PR04MB8796:EE_ X-MS-Office365-Filtering-Correlation-Id: 9bebd2f7-5672-4c3a-add3-08db92bc9aff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +fBg7O92Ub3d9UCAoLNyrZ+GRLPsrdw4Kxv13Kp+IOx3aR8LuJGtC+p95Ac3vQ/rYHfPHYZXe17Evs2riHh0sNWBVhebtOl+cq4NG0f3EWfTZS/bhB4vB9yCSp9NTWMQdqAAcs3Ch/9jcvCQll9UU198fmZ3BVR7TgsYeg00Ufcg6b+qbAcnMPTuek//WJysvhwICm2yuZsuMfXzs7dCqTAyiZpXKeYox95usF2TkpHfzwes+XImrScufuF1c8qoZITgNqdn5Cu7VxFxl/WRydA2lHgQoCShnQ+aHHC6QjEzSa4X1Wwb4T+EGa6qvrXlr/n3pdaB6CuLDahUUZ9B3wtht7+vTFcWPOJfXdFt0nSLt/v8Umr6zCt8rn820qrQQYKOR4sao0WZSqybEyARNWDFHy8xpl5O3KEiHS9DPua1WZ1LSpsCDatChKNyZCQFvQhhnWmh+AUCRe18KBHGPid7JTg4SDP/mFn4YbV7XA3OE/HB0pIbFD3xoLim5WnnicoshzX4m2YU97+G1XVQ7qfj+D/ij8u+V46ZlWnJzLEIwdKvsnzYVBNdrnkNi4oGM8XUaguruJU22EXnRkheB1JjG0qdw8kNx6WnWdA3NiPg4hjU1nZDeA3tOsCNgSJl 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)(136003)(346002)(39860400002)(396003)(376002)(451199021)(15650500001)(38350700002)(2906002)(1076003)(6506007)(26005)(186003)(38100700002)(52116002)(316002)(83380400001)(2616005)(5660300002)(66946007)(44832011)(8676002)(36756003)(8936002)(6916009)(7416002)(54906003)(41300700001)(478600001)(6512007)(6666004)(6486002)(4326008)(66556008)(66476007)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dk/9s3mSknKxrk5ZvFdry+eUpiA2JRh4XNJBbNoXADImJGzpczMGJUrxriESPL8b9R3Kd0siBcOHsjeHEJ/obLxIze/8qFTLqI6pLVL4VdhWKgFxEBUSLr3ruHRtSgji8+pF9RB6PA0EKPoC14IZ/HXZn+N2jWcI2y12Cdbe7s+QdKiah8v8Wvo+wAbcOX8rzbmFKo6mJ83+T86A9+Y4yH5gSny1nKip96W2Pq4IS3F3mKvodsZ5IwokZ3X9Pi6QF9Zwo1aqgtKzNlL1PBbG0poKH+mEWM5TuzH/DR6wkogUjKs8bkKEPAy8130nN3TfYxUcxEKOYZ3GhJl7XJ3VCMTDVx+XT1rRUbc8qhE1SF6OnXlznBbIRp7j8U8wYEDJv2+a2rQUOhHBN+TXNbuzoLJ4OFDcuIhK1IongBCk75RE8XgerNE3e9JGMBx31SOWyk0ll/iIh+gG0AosuJvHsldJB0FltDO4G4vAOP2XyFdB02YUF0wXmNnvF67mMQIub6fb9iXxWi/SgGs1ugp3itw/4jnpLhy+OIjNRf7A17OyeGB2hy6kL9lrIGAFbHx3kG/vTYDaG7RxdZn8jOe4g/DzNizsQPOaghSED+0+Pc5omGW/UznckO7LlxPATw7Jj96lnNeClT6RtOVn81/lVhhfuhkUtbP+20kd8RZkVGvH7E/jP2IgRp0hSuo8ctYZuxtCBMk8TbHcG/uSu5PTOJA7WPbmvcUVxDO8/SpoG2Q974gOVRuyuBCfLeimonu/X/Sm9zc2IruxUs6YaGFwSfGANW/wNbxKRIfrXOG69Gbr3SMec8a7JLC/EDnmdE2VDHwiO5HZMvWZLg9eIhZShXOjCuR9aSxzKFXUfqD9k6plCZXP2lzIPKdZwPJaJC5y/NAJVnxeF4PYp7NIAqSFC+YO3NJOB5fVEHS2OnwGTFGYNwgEOU1ly+Nfy8jpGVNePMIVmZ5G9XVnR3DuWrQNS8WeYRoRCvsWt0fsrNecLzvXycj/LhBO7ZM7FWwOOiOcvMVRSQ6GlvsdzKphMp7dMYt5wQY1X/anv3VAQFXhLSDG1/ik1azpJX+jlj2Utcaympr4fXXQBqKmjjqZyzl7pwK7UvAqzRxbDIJsq9wI/kK2uDqgmsko1BJRSutct26Sbr0n+pO4YkNi58iX86JzBdsQ7Fb+/UiIrbuzJWePeO22QEnU/+VNY1tzApbUqtUhEH404PTW0rGK3zfDFW3AtN1Z9W2JZWDMPo/ww0pHhXZWZriZp05DmSripRghkD9WMIF3TyXh/qqWCjzhhKmbvhpYkzvM9croIDSnDBWOh3wazUFc960W2qwYRFmSt/gkj7V9NUD34Tpr/KPVoW0T3ceINxHrJrejmfUFSUDD14sb/UpTo/iIzUqSRUG0Kw7k2boxgQx8bGczgM/kajSvmAv4p5Fj9cKnyfYgfmQ7JXWAwNim5Wt/MwK8/2nu+Ye0d4hvsZrwXB8PbVs018aMpgw1S0atq/0I0X6nhZMpPyy9brjDUrkIPH8EbQkTdurb5O1OUVUmG+LfS32BW/EWXx7IWb0KdRoMuggEnVXHp0CD+5knpLdbHcCpjSeESYBjvRvzTRZ0MyYf/H/9hdAGFw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9bebd2f7-5672-4c3a-add3-08db92bc9aff X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 18:24:55.6351 (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: /ME5Wx9E2vOwpyiQeidMeWV0TSaZWw+EayhVUD3IIUNY5MyAuw6pFwZ78Py4mWsftj386i0IVaEDiqz4ueousA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8796 X-Mailman-Original-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=FJOJWLJJSzjR9MCfwYjq0sWsA+KZ3LomuYdZ+8LGZeA=; b=DAKP4trvVx0QuK5BE/FC6bQJnWAYODbSmWHzVUgafXy+ZEVB4qtjrBG3LmmMMdKmGzLCZXpziQZn85ovvChb4sX2ZOutm4xas/zX8FNjuQfMrTZ1CM4MeGJ8/wVXTnOUqaTuo1wCDxPtY+E+fa9hwEgVJo8+5EUf2wR1gCk8rpw= X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=DAKP4trv X-Mailman-Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Subject: [Intel-wired-lan] [PATCH v3 net-next 10/10] selftests/tc-testing: verify that a qdisc can be grafted onto a taprio class X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiri Pirko , Pedro Tammela , Richard Cochran , Jamal Hadi Salim , linux-kernel@vger.kernel.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, Maxim Georgiev , Cong Wang , Peilin Ye , Jakub Kicinski , Zhengchao Shao , Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" The reason behind commit af7b29b1deaa ("Revert "net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs"") was that the patch it reverted caused a crash when attaching a CBS shaper to one of the taprio classes. Prevent that from happening again by adding a test case for it, which now passes correctly in both offload and software modes. Signed-off-by: Vladimir Oltean Reviewed-by: Pedro Tammela --- v2->v3: fix expected output for test 6a83 (missing "refcnt 2") v1->v2: patch is new .../tc-testing/tc-tests/qdiscs/taprio.json | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json index 8dbed66a9acc..de51408544e2 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json @@ -179,5 +179,55 @@ "$TC qdisc del dev $ETH root", "echo \"1\" > /sys/bus/netdevsim/del_device" ] + }, + { + "id": "a7bf", + "name": "Graft cbs as child of software taprio", + "category": [ + "qdisc", + "taprio", + "cbs" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "echo \"1 1 8\" > /sys/bus/netdevsim/new_device", + "$TC qdisc replace dev $ETH handle 8001: parent root stab overhead 24 taprio num_tc 8 map 0 1 2 3 4 5 6 7 queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 base-time 0 sched-entry S ff 20000000 clockid CLOCK_TAI" + ], + "cmdUnderTest": "$TC qdisc replace dev $ETH handle 8002: parent 8001:8 cbs idleslope 20000 sendslope -980000 hicredit 30 locredit -1470", + "expExitCode": "0", + "verifyCmd": "$TC -d qdisc show dev $ETH", + "matchPattern": "qdisc cbs 8002: parent 8001:8 hicredit 30 locredit -1470 sendslope -980000 idleslope 20000 offload 0", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $ETH root", + "echo \"1\" > /sys/bus/netdevsim/del_device" + ] + }, + { + "id": "6a83", + "name": "Graft cbs as child of offloaded taprio", + "category": [ + "qdisc", + "taprio", + "cbs" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "echo \"1 1 8\" > /sys/bus/netdevsim/new_device", + "$TC qdisc replace dev $ETH handle 8001: parent root stab overhead 24 taprio num_tc 8 map 0 1 2 3 4 5 6 7 queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 base-time 0 sched-entry S ff 20000000 flags 0x2" + ], + "cmdUnderTest": "$TC qdisc replace dev $ETH handle 8002: parent 8001:8 cbs idleslope 20000 sendslope -980000 hicredit 30 locredit -1470", + "expExitCode": "0", + "verifyCmd": "$TC -d qdisc show dev $ETH", + "matchPattern": "qdisc cbs 8002: parent 8001:8 refcnt 2 hicredit 30 locredit -1470 sendslope -980000 idleslope 20000 offload 0", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $ETH root", + "echo \"1\" > /sys/bus/netdevsim/del_device" + ] } ]