From: Huisong Li <lihuisong@huawei.com>
To: <xiaoyun.li@intel.com>, <aman.deep.singh@intel.com>,
<yuying.zhang@intel.com>, <ferruh.yigit@xilinx.com>,
<andrew.rybchenko@oktetlabs.ru>
Cc: <dev@dpdk.org>, <thomas@monjalon.net>, <huangdaode@huawei.com>,
<lihuisong@huawei.com>
Subject: [PATCH V3 app/testpmd 2/4] app/testpmd: unify RSS types display and obtaination
Date: Tue, 7 Jun 2022 16:32:44 +0800 [thread overview]
Message-ID: <20220607083246.12259-3-lihuisong@huawei.com> (raw)
In-Reply-To: <20220607083246.12259-1-lihuisong@huawei.com>
The 'rss_type_table[]' maintains string name and value of RSS types. This
patch unifies a common interface to display or obtain RSS types.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
---
app/test-pmd/config.c | 59 +++++++++++++++++++++++++------------------
1 file changed, 35 insertions(+), 24 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index d290ca3a06..9cb1211f00 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -66,8 +66,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;
@@ -197,6 +195,36 @@ const struct rss_type_info rss_type_table[] = {
{ NULL, 0 },
};
+static void
+rss_types_display(uint64_t rss_types)
+{
+ uint16_t i;
+
+ if (rss_types == 0)
+ return;
+
+ for (i = 0; rss_type_table[i].str; i++) {
+ if (rss_type_table[i].rss_type == 0)
+ continue;
+ if ((rss_types & rss_type_table[i].rss_type) ==
+ rss_type_table[i].rss_type)
+ printf(" %s", rss_type_table[i].str);
+ }
+}
+
+static uint64_t
+str_to_rsstypes(const char *str)
+{
+ uint16_t i;
+
+ for (i = 0; rss_type_table[i].str != NULL; i++) {
+ if (strcmp(rss_type_table[i].str, str) == 0)
+ return rss_type_table[i].rss_type;
+ }
+
+ return 0;
+}
+
static const struct {
enum rte_eth_fec_mode mode;
const char *name;
@@ -1651,13 +1679,7 @@ rss_config_display(struct rte_flow_action_rss *rss_conf)
printf(" none\n");
return;
}
- for (i = 0; rss_type_table[i].str; i++) {
- if ((rss_conf->types &
- rss_type_table[i].rss_type) ==
- rss_type_table[i].rss_type &&
- rss_type_table[i].rss_type != 0)
- printf(" %s\n", rss_type_table[i].str);
- }
+ rss_types_display(rss_conf->types);
}
static struct port_indirect_action *
@@ -3887,13 +3909,8 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
printf("RSS disabled\n");
return;
}
- printf("RSS functions:\n ");
- for (i = 0; rss_type_table[i].str; i++) {
- if (rss_type_table[i].rss_type == 0)
- continue;
- if ((rss_hf & rss_type_table[i].rss_type) == rss_type_table[i].rss_type)
- printf("%s ", rss_type_table[i].str);
- }
+ printf("RSS functions:\n");
+ rss_types_display(rss_hf);
printf("\n");
if (!show_rss_key)
return;
@@ -3909,15 +3926,10 @@ port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key,
{
struct rte_eth_rss_conf rss_conf;
int diag;
- unsigned int i;
rss_conf.rss_key = NULL;
rss_conf.rss_key_len = 0;
- rss_conf.rss_hf = 0;
- for (i = 0; rss_type_table[i].str; i++) {
- if (!strcmp(rss_type_table[i].str, rss_type))
- rss_conf.rss_hf = rss_type_table[i].rss_type;
- }
+ rss_conf.rss_hf = str_to_rsstypes(rss_type);
diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
if (diag == 0) {
rss_conf.rss_key = hash_key;
@@ -5669,6 +5681,7 @@ set_record_burst_stats(uint8_t on_off)
record_burst_stats = on_off;
}
+#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
static char*
flowtype_to_str(uint16_t flow_type)
{
@@ -5712,8 +5725,6 @@ flowtype_to_str(uint16_t flow_type)
return NULL;
}
-#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
-
static inline void
print_fdir_mask(struct rte_eth_fdir_masks *mask)
{
--
2.33.0
next prev parent reply other threads:[~2022-06-07 8:34 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 10:24 [PATCH V2 0/2] fix RSS types display Huisong Li
2022-04-29 10:24 ` [PATCH V2 1/2] app/testpmd: fix supported RSS offload display Huisong Li
2022-04-29 10:24 ` [PATCH V2 2/2] app/testpmd: unify RSS types display Huisong Li
2022-06-07 8:32 ` [PATCH V3 app/testpmd 0/4] fix RSS types and flow type Huisong Li
2022-06-07 8:32 ` [PATCH V3 app/testpmd 1/4] app/testpmd: fix supported RSS offload display Huisong Li
2022-06-07 15:45 ` Ferruh Yigit
2022-06-09 3:25 ` lihuisong (C)
2022-06-17 1:38 ` lihuisong (C)
2022-06-20 12:35 ` Ferruh Yigit
2022-06-21 2:17 ` lihuisong (C)
2022-06-07 8:32 ` Huisong Li [this message]
2022-06-07 15:46 ` [PATCH V3 app/testpmd 2/4] app/testpmd: unify RSS types display and obtaination Ferruh Yigit
2022-06-09 3:25 ` lihuisong (C)
2022-06-07 8:32 ` [PATCH V3 app/testpmd 3/4] app/testpmd: compact RSS types output in some commands Huisong Li
2022-06-07 15:46 ` Ferruh Yigit
2022-06-09 3:41 ` lihuisong (C)
2022-06-20 12:37 ` Ferruh Yigit
2022-06-07 8:32 ` [PATCH V3 app/testpmd 4/4] app/testpmd: remove duplicated flow type to string table Huisong Li
2022-06-07 15:47 ` Ferruh Yigit
2022-06-09 3:26 ` lihuisong (C)
2022-06-20 12:38 ` Ferruh Yigit
2022-06-21 2:18 ` lihuisong (C)
2022-06-21 7:51 ` Ferruh Yigit
2022-06-21 12:21 ` lihuisong (C)
2022-06-24 4:12 ` [PATCH V4 0/7] app/testpmd: fix RSS and flow type Huisong Li
2022-06-24 4:12 ` [PATCH V4 1/7] app/testpmd: fix supported RSS offload display Huisong Li
2022-06-24 4:12 ` [PATCH V4 2/7] app/testpmd: unify the name of L2 payload offload Huisong Li
2022-06-24 4:12 ` [PATCH V4 3/7] app/testpmd: refactor config all RSS command Huisong Li
2022-06-24 4:12 ` [PATCH V4 4/7] app/testpmd: unify RSS types display Huisong Li
2022-06-24 4:12 ` [PATCH V4 5/7] app/testpmd: compact RSS types output in some commands Huisong Li
2022-06-24 4:12 ` [PATCH V4 6/7] app/testpmd: reorder elements in RSS type table array Huisong Li
2022-06-24 4:12 ` [PATCH V4 7/7] app/testpmd: remove duplicated flow type to string table Huisong Li
2022-06-24 7:23 ` [PATCH V5 0/7] app/testpmd: fix RSS and flow type Huisong Li
2022-06-24 7:23 ` [PATCH V5 1/7] app/testpmd: fix supported RSS offload display Huisong Li
2022-06-24 13:01 ` Ferruh Yigit
2022-06-25 2:12 ` lihuisong (C)
2022-06-28 13:18 ` Ferruh Yigit
2022-06-24 7:23 ` [PATCH V5 2/7] app/testpmd: unify the name of L2 payload offload Huisong Li
2022-06-24 13:53 ` Ferruh Yigit
2022-06-25 2:12 ` lihuisong (C)
2022-06-28 13:17 ` Ferruh Yigit
2022-06-29 1:47 ` lihuisong (C)
2022-06-24 7:23 ` [PATCH V5 3/7] app/testpmd: refactor config all RSS command Huisong Li
2022-06-24 13:55 ` Ferruh Yigit
2022-06-25 2:13 ` lihuisong (C)
2022-06-24 7:23 ` [PATCH V5 4/7] app/testpmd: unify RSS types display Huisong Li
2022-06-24 7:23 ` [PATCH V5 5/7] app/testpmd: compact RSS types output in some commands Huisong Li
2022-06-24 14:04 ` Ferruh Yigit
2022-06-25 2:13 ` lihuisong (C)
2022-06-28 13:18 ` Ferruh Yigit
2022-06-24 7:24 ` [PATCH V5 6/7] app/testpmd: reorder elements in RSS type table array Huisong Li
2022-06-24 14:00 ` Ferruh Yigit
2022-06-25 2:14 ` lihuisong (C)
2022-06-24 7:24 ` [PATCH V5 7/7] app/testpmd: remove duplicated flow type to string table Huisong Li
2022-06-24 8:55 ` [PATCH V5 0/7] app/testpmd: fix RSS and flow type lihuisong (C)
2022-06-24 8:59 ` David Marchand
2022-06-24 9:54 ` lihuisong (C)
2022-06-24 10:44 ` Ferruh Yigit
2022-06-25 1:09 ` lihuisong (C)
2022-06-28 13:18 ` Ferruh Yigit
2022-06-29 8:34 ` [PATCH V6 0/8] " Huisong Li
2022-06-29 8:34 ` [PATCH V6 1/8] app/testpmd: fix supported RSS offload display Huisong Li
2022-06-29 8:34 ` [PATCH V6 2/8] app/testpmd: unify the name of L2 payload offload Huisong Li
2022-06-29 8:34 ` [PATCH V6 3/8] doc: testpmd rename RSS type ether to L2 payload Huisong Li
2022-06-29 8:34 ` [PATCH V6 4/8] app/testpmd: refactor config all RSS command Huisong Li
2022-06-29 8:34 ` [PATCH V6 5/8] app/testpmd: unify RSS types display Huisong Li
2022-06-29 8:34 ` [PATCH V6 6/8] app/testpmd: compact RSS types output in some commands Huisong Li
2022-06-29 8:34 ` [PATCH V6 7/8] app/testpmd: reorder elements in RSS type table array Huisong Li
2022-06-29 8:34 ` [PATCH V6 8/8] app/testpmd: remove duplicated flow type to string table Huisong Li
2022-06-29 9:59 ` [PATCH V6 0/8] app/testpmd: fix RSS and flow type lihuisong (C)
2022-06-29 14:13 ` Ferruh Yigit
2022-06-29 20:05 ` Ferruh Yigit
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=20220607083246.12259-3-lihuisong@huawei.com \
--to=lihuisong@huawei.com \
--cc=aman.deep.singh@intel.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@xilinx.com \
--cc=huangdaode@huawei.com \
--cc=thomas@monjalon.net \
--cc=xiaoyun.li@intel.com \
--cc=yuying.zhang@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.