patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Huisong Li <lihuisong@huawei.com>
To: <stable@dpdk.org>, <christian.ehrhardt@canonical.com>
Cc: <liudongdong3@huawei.com>, <fengchengwen@huawei.com>,
	<huangdaode@huawei.com>, <haijie1@huawei.com>,
	<lihuisong@huawei.com>
Subject: [PATCH 19.11 3/4] app/testpmd: fix supported RSS offload display
Date: Tue, 19 Jul 2022 10:49:18 +0800	[thread overview]
Message-ID: <20220719024919.16999-4-lihuisong@huawei.com> (raw)
In-Reply-To: <20220719024919.16999-1-lihuisong@huawei.com>

[ upstream commit 3c23ee6cdddf28641f52f31ced84d3feb867027c ]

The rte_eth_dev_info.flow_type_rss_offloads is populated in terms of
RTE_ETH_RSS_* bits. If PMD sets RTE_ETH_RSS_L3_SRC_ONLY to
dev_info->flow_type_rss_offloads. testpmd will display "user defined 63"
when run 'show port info 0'. Because testpmd use flowtype_to_str()
to display the supported RSS offload of PMD. In fact, the function is
used to display flow type in FDIR commands for i40e or ixgbe. This patch
uses the RTE_ETH_RSS_* bits to display supported RSS offload of PMD.

Fixes: b12964f621dc ("ethdev: unification of RSS offload types")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
---
 app/test-pmd/config.c  | 37 +++++++++++++++++++++++++------------
 app/test-pmd/testpmd.h |  2 ++
 2 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 7d826632dc..61c1716971 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -61,8 +61,6 @@
 
 #define NS_PER_SEC 1E9
 
-static char *flowtype_to_str(uint16_t flow_type);
-
 static const struct {
 	enum tx_pkt_split split;
 	const char *name;
@@ -555,6 +553,19 @@ device_infos_display(const char *identifier)
 	};
 }
 
+const char *
+rsstypes_to_str(uint64_t rss_type)
+{
+	uint16_t i;
+
+	for (i = 0; rss_type_table[i].str != NULL; i++) {
+		if (rss_type_table[i].rss_type == rss_type)
+			return rss_type_table[i].str;
+	}
+
+	return NULL;
+}
+
 void
 port_infos_display(portid_t port_id)
 {
@@ -649,19 +660,21 @@ port_infos_display(portid_t port_id)
 	if (!dev_info.flow_type_rss_offloads)
 		printf("No RSS offload flow type is supported.\n");
 	else {
+		uint64_t rss_offload_types = dev_info.flow_type_rss_offloads;
 		uint16_t i;
-		char *p;
 
 		printf("Supported RSS offload flow types:\n");
-		for (i = RTE_ETH_FLOW_UNKNOWN + 1;
-		     i < sizeof(dev_info.flow_type_rss_offloads) * CHAR_BIT; i++) {
-			if (!(dev_info.flow_type_rss_offloads & (1ULL << i)))
-				continue;
-			p = flowtype_to_str(i);
-			if (p)
-				printf("  %s\n", p);
-			else
-				printf("  user defined %d\n", i);
+		for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) {
+			uint64_t rss_offload = 1ULL << i;
+
+			if ((rss_offload_types & rss_offload) != 0) {
+				const char *p = rsstypes_to_str(rss_offload);
+				if (p)
+					printf("  %s\n", p);
+				else
+					printf("  user defined %u\n",
+					       i);
+			}
 		}
 	}
 
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index a3ae3f392a..0284538c50 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -823,6 +823,8 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
 void port_rss_hash_conf_show(portid_t port_id, int show_rss_key);
 void port_rss_hash_key_update(portid_t port_id, char rss_type[],
 			      uint8_t *hash_key, uint8_t hash_key_len);
+const char *rsstypes_to_str(uint64_t rss_type);
+
 int rx_queue_id_is_invalid(queueid_t rxq_id);
 int tx_queue_id_is_invalid(queueid_t txq_id);
 void setup_gro(const char *onoff, portid_t port_id);
-- 
2.22.0


  parent reply	other threads:[~2022-07-19  2:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19  2:49 [PATCH 19.11 0/4] backporting some bonding bugfix and RSS display Huisong Li
2022-07-19  2:49 ` [PATCH 19.11 1/4] app/testpmd: fix port status of bonding slave device Huisong Li
2022-07-19  2:49 ` [PATCH 19.11 2/4] app/testpmd: fix bonding slave devices not released Huisong Li
2022-07-19  2:49 ` Huisong Li [this message]
2022-07-19  2:49 ` [PATCH 19.11 4/4] net/bonding: fix stopping non-active slaves Huisong Li
2022-08-03  9:55 ` [PATCH 19.11 0/4] backporting some bonding bugfix and RSS display Christian Ehrhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220719024919.16999-4-lihuisong@huawei.com \
    --to=lihuisong@huawei.com \
    --cc=christian.ehrhardt@canonical.com \
    --cc=fengchengwen@huawei.com \
    --cc=haijie1@huawei.com \
    --cc=huangdaode@huawei.com \
    --cc=liudongdong3@huawei.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).