From patchwork Sat May 13 08:51:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hariprasad Kelam X-Patchwork-Id: 93517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp5742545vqo; Sat, 13 May 2023 05:35:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6nCXpMCVSODcjJchV3PEBJ8BjtRBvDtgpbbePW2ZPZcb+aU2WhGfy/Qz40xXLeMzcIn2Qd X-Received: by 2002:a17:902:d4c9:b0:1ac:637d:589b with SMTP id o9-20020a170902d4c900b001ac637d589bmr27843759plg.26.1683981307593; Sat, 13 May 2023 05:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683981307; cv=none; d=google.com; s=arc-20160816; b=YYws742P2cuoePJTlrcypPaNdD8tVA4zvT6kH0oubbJbkacjBskRrcZPKxzqNuOJZP 2YmRvErBXxJ79PAK87D2pH2z8G4zbmQX+rs1n9VPa24Z0I8k3UsMFEvn+H1UzRxlOu97 tABBPbD83Hla89eVvcmqyP5KfbrLNd40T0zW0mAS4baFCLSx5hfUm0pr01Bhcp2a21ei nyaJ8NAYQz8Aq1ZbnqjLkISq2F6FJ8P0XQjn5tgWFEmzTZ4OBn/5QgHN/dM7IOUmbDn4 3px0yA72q69Qj8A++Xo4btRJ3WBPxVhbRTpJQxvpSoBR6ysnBfRkQg4wR+dGly3yx0bD 8vpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=syT/F4i0UTiSv1pXqwKX8DGCIcI+SGGzfmriqqhfSNY=; b=LdF0sILbu0EZ4C5RXkBMRMJ+n0wb74W6mB/FpTpUfT4o2X7Y6Pc/CR8IcF4jQq+Cb1 /2eYMUYlf0KwwWdqGx4WDs43j4I8tMdwtkHHd5G3BLJaujpH4QZfII0irBF93INEsVea E/AQVDrgYBknZ4e7xIMwgc687HWi/gEM7ckaVKcKOxIlR8bDvU88Rq1Dp3EUJ6KvBPK4 zEEnX6Fh46l3jlKfHzKZZjUJmbDTdYv9Hy4rL9vnk6K9Y6MVRWEVsoWW4Qoc0U4cLfm3 FNs5ChE8XXhnVpuNUtbtGxJaEWxXpErl8RA35OR2mq55V0bJYTBHAzL5e093HOTR7syR n1rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=aAv7eM4n; 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=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a170902b94600b001a531f29044si10774605pls.521.2023.05.13.05.34.20; Sat, 13 May 2023 05:35:07 -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=@marvell.com header.s=pfpt0220 header.b=aAv7eM4n; 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=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237462AbjEMMHS (ORCPT + 99 others); Sat, 13 May 2023 08:07:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbjEMMHR (ORCPT ); Sat, 13 May 2023 08:07:17 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A40361FEB; Sat, 13 May 2023 05:07:15 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34DBrIM2004545; Sat, 13 May 2023 05:06:57 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=syT/F4i0UTiSv1pXqwKX8DGCIcI+SGGzfmriqqhfSNY=; b=aAv7eM4nYmfUr+SW7dUf19XDo0ffggC//td8VRaYvKT8sQHwjxXGUg2FdKTiMd/LTFYD j/uuK6RA2NzSN6RvDTv68ILQQ0Qm0zBdRl/0eM60Hf5nmEyKyxBfMOFE2WXrSPS+CCql Hz3dlPanwyFTyu7Svi2QtN4T8waYKFEE41Z8YbveBCGZ7TpcQuNPQITnhsv3IaHXWoii G8/2V73j61MvdIDUqr1l+/Y+BbSBDzP+VG+Kij/RgHk8+1Ku1BHaQxXOhHg7hV4Tdb+g EGJ6p1MHuEp86m7ww8GaJdytQW5LvJ6xOTqn/WxkqLy0oxQSsxWfGBkG7pOz43dF7y/d LQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3qja2jg0uw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 13 May 2023 05:06:57 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sat, 13 May 2023 05:06:55 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sat, 13 May 2023 05:06:55 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 470CF5B77DF; Sat, 13 May 2023 01:52:36 -0700 (PDT) From: Hariprasad Kelam To: , CC: , , , , , , , , , , , , , , , , , , Subject: [net-next Patch v10 7/8] octeontx2-pf: ethtool expose qos stats Date: Sat, 13 May 2023 14:21:42 +0530 Message-ID: <20230513085143.3289-8-hkelam@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230513085143.3289-1-hkelam@marvell.com> References: <20230513085143.3289-1-hkelam@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 8ZHC1jwgFsTukrSkPy-0AkCUzETee2Lb X-Proofpoint-ORIG-GUID: 8ZHC1jwgFsTukrSkPy-0AkCUzETee2Lb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-13_08,2023-05-05_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,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?1765782383673067383?= X-GMAIL-MSGID: =?utf-8?q?1765782383673067383?= This patch extends ethtool stats support for QoS send queues as well. upon the number of transmit channels change request, Ensures the real number of transmit queues are equal to active QoS send queues plus configured transmit queues. ethtool -S eth0 txq_qos0: bytes: 3021391800 txq_qos0: frames: 1998275 txq_qos1: bytes: 4619766312 txq_qos1: frames: 3055401 ... ... Signed-off-by: Hariprasad Kelam Signed-off-by: Sunil Kovvuri Goutham --- .../marvell/octeontx2/nic/otx2_ethtool.c | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c index 0f8d1a69139f..c47d91da32dc 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c @@ -92,10 +92,16 @@ static void otx2_get_qset_strings(struct otx2_nic *pfvf, u8 **data, int qset) *data += ETH_GSTRING_LEN; } } - for (qidx = 0; qidx < pfvf->hw.tx_queues; qidx++) { + + for (qidx = 0; qidx < otx2_get_total_tx_queues(pfvf); qidx++) { for (stats = 0; stats < otx2_n_queue_stats; stats++) { - sprintf(*data, "txq%d: %s", qidx + start_qidx, - otx2_queue_stats[stats].name); + if (qidx >= pfvf->hw.non_qos_queues) + sprintf(*data, "txq_qos%d: %s", + qidx + start_qidx - pfvf->hw.non_qos_queues, + otx2_queue_stats[stats].name); + else + sprintf(*data, "txq%d: %s", qidx + start_qidx, + otx2_queue_stats[stats].name); *data += ETH_GSTRING_LEN; } } @@ -159,7 +165,7 @@ static void otx2_get_qset_stats(struct otx2_nic *pfvf, [otx2_queue_stats[stat].index]; } - for (qidx = 0; qidx < pfvf->hw.tx_queues; qidx++) { + for (qidx = 0; qidx < otx2_get_total_tx_queues(pfvf); qidx++) { if (!otx2_update_sq_stats(pfvf, qidx)) { for (stat = 0; stat < otx2_n_queue_stats; stat++) *((*data)++) = 0; @@ -254,7 +260,7 @@ static int otx2_get_sset_count(struct net_device *netdev, int sset) return -EINVAL; qstats_count = otx2_n_queue_stats * - (pfvf->hw.rx_queues + pfvf->hw.tx_queues); + (pfvf->hw.rx_queues + otx2_get_total_tx_queues(pfvf)); if (!test_bit(CN10K_RPM, &pfvf->hw.cap_flag)) mac_stats = CGX_RX_STATS_COUNT + CGX_TX_STATS_COUNT; otx2_update_lmac_fec_stats(pfvf); @@ -282,7 +288,7 @@ static int otx2_set_channels(struct net_device *dev, { struct otx2_nic *pfvf = netdev_priv(dev); bool if_up = netif_running(dev); - int err = 0; + int err, qos_txqs; if (!channel->rx_count || !channel->tx_count) return -EINVAL; @@ -296,14 +302,19 @@ static int otx2_set_channels(struct net_device *dev, if (if_up) dev->netdev_ops->ndo_stop(dev); - err = otx2_set_real_num_queues(dev, channel->tx_count, + qos_txqs = bitmap_weight(pfvf->qos.qos_sq_bmap, + OTX2_QOS_MAX_LEAF_NODES); + + err = otx2_set_real_num_queues(dev, channel->tx_count + qos_txqs, channel->rx_count); if (err) return err; pfvf->hw.rx_queues = channel->rx_count; pfvf->hw.tx_queues = channel->tx_count; - pfvf->qset.cq_cnt = pfvf->hw.tx_queues + pfvf->hw.rx_queues; + if (pfvf->xdp_prog) + pfvf->hw.xdp_queues = channel->rx_count; + pfvf->hw.non_qos_queues = pfvf->hw.tx_queues + pfvf->hw.xdp_queues; if (if_up) err = dev->netdev_ops->ndo_open(dev); @@ -1405,7 +1416,7 @@ static int otx2vf_get_sset_count(struct net_device *netdev, int sset) return -EINVAL; qstats_count = otx2_n_queue_stats * - (vf->hw.rx_queues + vf->hw.tx_queues); + (vf->hw.rx_queues + otx2_get_total_tx_queues(vf)); return otx2_n_dev_stats + otx2_n_drv_stats + qstats_count + 1; }