From patchwork Fri Jun 9 13:59: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: 105652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp970846vqr; Fri, 9 Jun 2023 07:04:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ44LPLe0zPrjcXuiMo1XBKLe2p1UlbxLBOVow1R1gvXbpNkH8pFip/6NkxcKhjKPZ3tGexG X-Received: by 2002:a05:6a20:9587:b0:103:d538:5ea6 with SMTP id iu7-20020a056a20958700b00103d5385ea6mr898195pzb.48.1686319473240; Fri, 09 Jun 2023 07:04:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686319473; cv=pass; d=google.com; s=arc-20160816; b=ct2kvnBVoO42cScCH6ZwhKe7Ls6aj/W559GTI2W/mD9xmFzom/pztd+3TcU7OzKZtt xUaRK507YtH7sXRH+meUSeX/yIvv6ms2hqSodTWMA4x8/bUW8COYz/MPwMqF3izclUZO /xRxR4/iANWVusFoqBqSHS9ddV5EblIwbXvjV1rnruTXGEGFkhkbie2qA/ayoeuI2ZVK NUs/Chgi1npSem1l138OjSB8TzmrtNsYrcOJTEzLaV2dY8HFo8a+OUWIbu4i8Dd48Ht/ UXrqXEA4riazoJOPo41ioluvRIaaqLeUnVbU+ZMQl2rQJsGskXeeLFC24J3vFDsFFsuF F0lw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+XsY/pxzJ3hK+6HEcOVvLyrXrI9dhimlwyin+AHipB4=; b=B2eauMkw5oc8YOrxzv2TjRm0/8QayjjeanQAgDIrPP5M5JO7ybfEou2c2slngxKMRp znYqFHoN2167fbXbnHwkH0zR3tq8j9NA4F9oIb8amACtg/pnWpVz6hFfcb4C3VkHbnFv Kz+z2xLGCAiDbFpy83pDBcfiQO88RWa9uekj/83OxjQQjP4lEthik1pJQCysBQfm6WZz SNyCCa34RKYV8i/avhKJWBCpUvuM/Jn/UHZJxIo1xAB0obJnoY8K9gsI3VJ+j3n2QyAO lo0kfocqAbt2KyGdXnZvoGXaovQJirS2yIlzoFtEyBHk6+aWXR8fiZfOUMTDlz9wa3ws 6kZw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=nZn02v1Y; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h62-20020a638341000000b0054aa3971f92si198909pge.212.2023.06.09.07.04.13; Fri, 09 Jun 2023 07:04:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=nZn02v1Y; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237763AbjFIN7m (ORCPT + 99 others); Fri, 9 Jun 2023 09:59:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232257AbjFIN7j (ORCPT ); Fri, 9 Jun 2023 09:59:39 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2074.outbound.protection.outlook.com [40.107.22.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EAB530FE; Fri, 9 Jun 2023 06:59:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fauk8yp8EzHMG9NtZqMdDIDX/queT4wAVZHwyqe3UHlVOytHX8EE/xnxRwOpXqjvVEIxEYLmZJ+8bqIkCDthFzLvkOKZW7tjE1v1WWeZ89ZSTtrjk5gn9oeFTs+7V7lpwprJH9ZroTIFMa7FeAyTsVOnC4cxcbEnVzX0udsCpsT6BqZPJwFz7B8BQERcNZGLRj5zkfGdQJc/qK30uR4IMHkpDj8YrLIx4PaXxdH/Ge5Vk3/f0aaGX73mMMFaruOO56n80TP1M4DKeR4eH8gbg14nempiRYTvPw8JQC+ucUXNolNH7GhlM7awRg8uXmu0Uz8FX875FjcvR3+ICq6iBw== 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=+XsY/pxzJ3hK+6HEcOVvLyrXrI9dhimlwyin+AHipB4=; b=R3ipTnI/43or90X13XwPD6KAgnjSa2tYFrPkMVZm3w7ZcZHBzHwAC0+YZHpzZD7yfN6BTP82T9xIo5D+8WU5lB5R/BDn8I30QY4VZ814qa2F+k5EGY5rBujijUbRYeRca6ncSMx244wWsjml+yVw+d2TZFTMaTWXBI3fnxA29ltPUQx1QfNiBEIrQ4maFZVoPfpHox65k3S/jeNvjZLgp4dTQCOGfQaVYA1Gl1xKjeceYow4B1ZsqCXVXSofkii7GkDio1c7ghPrNEX0BWOYl5wnHN2OVUlkPhK4XHVg/f3v44AXBN0CfKjpejgHUk8Eget21Cg5ztVuNgfGhiSSDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+XsY/pxzJ3hK+6HEcOVvLyrXrI9dhimlwyin+AHipB4=; b=nZn02v1YLql0KInUbpuIvZekfKAba82Had7W3xDnVeWzAwfiO2WNsy+bekVP1xCG5JDLp0I4Phue82/7AHt7eMofYnwnUA2+0p2s+rMbKixm/HU2aYIGBYeSxRJ8PUmG688OcDXTu9ew84t6FO/oj0eW2Flf3poeh6aoRKNqheY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM0PR04MB7139.eurprd04.prod.outlook.com (2603:10a6:208:19d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.41; Fri, 9 Jun 2023 13:59:32 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460%4]) with mapi id 15.20.6455.030; Fri, 9 Jun 2023 13:59:30 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , Kurt Kanzenbach , Xiaoliang Yang , Mohammad Athari Bin Ismail , linux-kernel@vger.kernel.org, Jesse Brandeburg , Tony Nguyen , intel-wired-lan@lists.osuosl.org, Muhammad Husaini Zulkifli Subject: [PATCH net-next 1/2] net/sched: taprio: report class offload stats per TXQ, not per TC Date: Fri, 9 Jun 2023 16:59:16 +0300 Message-Id: <20230609135917.1084327-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230609135917.1084327-1-vladimir.oltean@nxp.com> References: <20230609135917.1084327-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: FR0P281CA0091.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a9::11) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM0PR04MB7139:EE_ X-MS-Office365-Filtering-Correlation-Id: 48fd5983-bb72-4da3-2e2d-08db68f1bf2b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6wSS6sQ2ElYPlNtSFbQuqDhk57vQYuKOysXbN4SVKURwjrIE41BxOeucOowuQuEOfJ8nvZn2C5lcJzsaCl0PzeiRoB9mkd8+Xi2xZW9umJtweR0F21nakG+7lJsXPdZsqKM511DMnmSw3XTp9uQYNtyiEzrfgC+Iv58/pJ9CjgLbTW5FqoXlhHLpLY0bPjNJ/siyzZufzS28K/9w14zViTCmlsGXlLRIsYXiR31qoq5eNXmDapwtRH9z9E/LPFrlGtYeqcYvAAgm110ritjgk+D1Qfx0FflQt4ATH4rGk06zFTKxUqW2CsZFkwo7q8v1jvLijnWIx4Q7nc3Nx3OTiWIXt0beQ6OsVWXGFonQ402dsMcRHsbPxQPO34sr/wC/DzwxVh+sydE2b4OTgYwfN23KIjZxGAph69G5D4JVRyWBjZm+RSJqpE/Kpy7ktIgJO8X7iY83qQf3Zd768LYAvodPloRYOuPw9qj+kg2q2a9QtqSkbn8eQMgbrVJ4QUd7QWzCGWEjXrDmKP7yuWRePs9FuY9nN2lKqHQeWQHxxxE+TsFUPvp8sYvcwFMV51UscqgAPoVCCCcWGjD0KrealkcFH7MPAfhnZQRfLuzSDXa61aUzr0dxk0jeenXAH0/x 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)(376002)(346002)(39860400002)(396003)(136003)(366004)(451199021)(66946007)(66476007)(316002)(6666004)(66556008)(54906003)(6916009)(4326008)(478600001)(86362001)(36756003)(6506007)(1076003)(26005)(6512007)(186003)(83380400001)(41300700001)(8936002)(8676002)(7416002)(44832011)(2906002)(5660300002)(52116002)(6486002)(2616005)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MpXohYnWaz2HlHVy9jEftzSp1r1zj14hCa7BpNgsoFnz7aS6Ty9BkFmnq35TmYnPBiVlcNb+EDYQf4qDExFk8l2gWyMbBGvVvRpsNq4XfFXHW0jXVm67mwQY6vB81/p5caHrE0D2VH87Jd2+FAlDWFDXLqAe4N/vrKUHGuc/drA27CLbkE6O2PIbwb6GYqPEIKSb9F0susuJxJg6t2Pp3dM4wKp0nCFBe0r1XqbU3CkdGUgwTcsiTBydwVcg+bmOsgptMKDkst4qYRdYfkYSjWglvS6h9Sm8e+m1sVLV3guWJzIBn0feONbd87TgpvIzxg6WzBYbtQW9q1HRv+t3Mr9WulnbA4OHGtMw3AQSxg/7KBoNtc5V6khKPo2XokYVoRI31H3unJNKdHdzSEfaIbUanmzbOM/FA284qxtuvtHluubfWu2d4x3S3iCCz67qihygImAbgdqWv4jUQuwb4Q5pO6d+pBx+7B3aAGDwtAEDahXmkKdDJMJTwpNnAFRlJEW1EmVfKdGKy/IcEN86ALcuw9C8vpXQ6W0a9xc16w2W1pbTmLlRJCNs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ossTenant-Network-Message-Id: 48fd5983-bb72-4da3-2e2d-08db68f1bf2b X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2023 13:59:30.8157 (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: mzkL73o/FCn/boCeOQmOjvHzcqwAl8ten1W4EWmgcN6b54khmaXk3bWCGVqQB7EWfoD0Geqb3SDJDA/PXUlcuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7139 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768234128259082950?= X-GMAIL-MSGID: =?utf-8?q?1768234128259082950?= The taprio Qdisc creates child classes per netdev TX queue, but taprio_dump_class_stats() currently reports offload statistics per traffic class. Traffic classes are groups of TXQs sharing the same dequeue priority, so this is incorrect and we shouldn't be bundling up the TXQ stats when reporting them, as we currently do in enetc. Modify the API from taprio to drivers such that they report TXQ offload stats and not TC offload stats. There is no change in the UAPI or in the global Qdisc stats. Fixes: 6c1adb650c8d ("net/sched: taprio: add netlink reporting for offload statistics counters") Signed-off-by: Vladimir Oltean --- .../net/ethernet/freescale/enetc/enetc_qos.c | 20 +++++++------------ include/net/pkt_sched.h | 10 +++++----- net/sched/sch_taprio.c | 8 ++++---- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net/ethernet/freescale/enetc/enetc_qos.c index 71157eba1fbe..58cdd67bb573 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c @@ -160,20 +160,14 @@ static void enetc_taprio_stats(struct net_device *ndev, stats->window_drops = window_drops; } -static void enetc_taprio_tc_stats(struct net_device *ndev, - struct tc_taprio_qopt_tc_stats *tc_stats) +static void enetc_taprio_queue_stats(struct net_device *ndev, + struct tc_taprio_qopt_queue_stats *queue_stats) { - struct tc_taprio_qopt_stats *stats = &tc_stats->stats; + struct tc_taprio_qopt_stats *stats = &queue_stats->stats; struct enetc_ndev_priv *priv = netdev_priv(ndev); - int tc = tc_stats->tc; - u64 window_drops = 0; - int i; + int queue = queue_stats->queue; - for (i = 0; i < priv->num_tx_rings; i++) - if (priv->tx_ring[i]->prio == tc) - window_drops += priv->tx_ring[i]->stats.win_drop; - - stats->window_drops = window_drops; + stats->window_drops = priv->tx_ring[queue]->stats.win_drop; } static int enetc_taprio_replace(struct net_device *ndev, @@ -208,8 +202,8 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data) case TAPRIO_CMD_STATS: enetc_taprio_stats(ndev, &offload->stats); break; - case TAPRIO_CMD_TC_STATS: - enetc_taprio_tc_stats(ndev, &offload->tc_stats); + case TAPRIO_CMD_QUEUE_STATS: + enetc_taprio_queue_stats(ndev, &offload->queue_stats); break; default: err = -EOPNOTSUPP; diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 518febb91c9f..e98aac9d5ad5 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -191,7 +191,7 @@ enum tc_taprio_qopt_cmd { TAPRIO_CMD_REPLACE, TAPRIO_CMD_DESTROY, TAPRIO_CMD_STATS, - TAPRIO_CMD_TC_STATS, + TAPRIO_CMD_QUEUE_STATS, }; /** @@ -208,8 +208,8 @@ struct tc_taprio_qopt_stats { u64 tx_overruns; }; -struct tc_taprio_qopt_tc_stats { - int tc; +struct tc_taprio_qopt_queue_stats { + int queue; struct tc_taprio_qopt_stats stats; }; @@ -227,8 +227,8 @@ struct tc_taprio_qopt_offload { union { /* TAPRIO_CMD_STATS */ struct tc_taprio_qopt_stats stats; - /* TAPRIO_CMD_TC_STATS */ - struct tc_taprio_qopt_tc_stats tc_stats; + /* TAPRIO_CMD_QUEUE_STATS */ + struct tc_taprio_qopt_queue_stats queue_stats; /* TAPRIO_CMD_REPLACE */ struct { struct tc_mqprio_qopt_offload mqprio; diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 5076da103f63..20d2702f862e 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2457,9 +2457,9 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, { struct netdev_queue *dev_queue = taprio_queue_get(sch, cl); struct tc_taprio_qopt_offload offload = { - .cmd = TAPRIO_CMD_TC_STATS, - .tc_stats = { - .tc = cl - 1, + .cmd = TAPRIO_CMD_QUEUE_STATS, + .queue_stats = { + .queue = cl - 1, }, }; struct Qdisc *child; @@ -2469,7 +2469,7 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, qdisc_qstats_copy(d, child) < 0) return -1; - return taprio_dump_xstats(sch, d, &offload, &offload.tc_stats.stats); + return taprio_dump_xstats(sch, d, &offload, &offload.queue_stats.stats); } static void taprio_walk(struct Qdisc *sch, struct qdisc_walker *arg)