* [PATCH V2 0/2] fix RSS types display
@ 2022-04-29 10:24 Huisong Li
2022-04-29 10:24 ` [PATCH V2 1/2] app/testpmd: fix supported RSS offload display Huisong Li
` (5 more replies)
0 siblings, 6 replies; 72+ messages in thread
From: Huisong Li @ 2022-04-29 10:24 UTC (permalink / raw)
To: dev
Cc: thomas, ferruh.yigit, andrew.rybchenko, david.marchand,
huangdaode, lihuisong
Fix RSS types display.
v2:
- resovle compilation failure when disable i40e and ixgbe
Huisong Li (2):
app/testpmd: fix supported RSS offload display
app/testpmd: unify RSS types display
app/test-pmd/config.c | 52 +++++++++++++++++--------------------------
1 file changed, 20 insertions(+), 32 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V2 1/2] app/testpmd: fix supported RSS offload display
2022-04-29 10:24 [PATCH V2 0/2] fix RSS types display Huisong Li
@ 2022-04-29 10:24 ` Huisong Li
2022-04-29 10:24 ` [PATCH V2 2/2] app/testpmd: unify RSS types display Huisong Li
` (4 subsequent siblings)
5 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-04-29 10:24 UTC (permalink / raw)
To: dev
Cc: thomas, ferruh.yigit, andrew.rybchenko, david.marchand,
huangdaode, lihuisong
And 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. This patch uses the
RTE_ETH_RSS_* bits to display supported RSS offload of PMD.
Fixes: b12964f621dc ("ethdev: unification of RSS offload types")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/config.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cc8e7aa138..cc47db3690 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;
@@ -669,6 +667,20 @@ print_dev_capabilities(uint64_t capabilities)
}
}
+static void
+show_rss_types(uint64_t rss_hf)
+{
+ uint16_t i;
+
+ 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("\n");
+}
+
void
port_infos_display(portid_t port_id)
{
@@ -773,20 +785,8 @@ port_infos_display(portid_t port_id)
if (!dev_info.flow_type_rss_offloads)
printf("No RSS offload flow type is supported.\n");
else {
- 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);
- }
+ printf("Supported RSS offload:\n");
+ show_rss_types(dev_info.flow_type_rss_offloads);
}
printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize);
@@ -5512,6 +5512,8 @@ 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)
{
@@ -5555,8 +5557,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
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V2 2/2] app/testpmd: unify RSS types display
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 ` Huisong Li
2022-06-07 8:32 ` [PATCH V3 app/testpmd 0/4] fix RSS types and flow type Huisong Li
` (3 subsequent siblings)
5 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-04-29 10:24 UTC (permalink / raw)
To: dev
Cc: thomas, ferruh.yigit, andrew.rybchenko, david.marchand,
huangdaode, lihuisong
Unify RSS types display.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/config.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cc47db3690..1d9ac4a038 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1525,13 +1525,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);
- }
+ show_rss_types(rss_conf->types);
}
static struct port_indirect_action *
@@ -3731,13 +3725,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
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("\n");
+ show_rss_types(rss_hf);
if (!show_rss_key)
return;
printf("RSS key:\n");
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V3 app/testpmd 0/4] fix RSS types and flow type
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 ` Huisong Li
2022-06-07 8:32 ` [PATCH V3 app/testpmd 1/4] app/testpmd: fix supported RSS offload display Huisong Li
` (3 more replies)
2022-06-24 4:12 ` [PATCH V4 0/7] app/testpmd: fix RSS and flow type Huisong Li
` (2 subsequent siblings)
5 siblings, 4 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-07 8:32 UTC (permalink / raw)
To: xiaoyun.li, aman.deep.singh, yuying.zhang, ferruh.yigit,
andrew.rybchenko
Cc: dev, thomas, huangdaode, lihuisong
This patch fixes RSS types output and removes duplicated flow type to
string table.
---
v3:
- add 'rss_offload_table[]' to display supported RSS offload.
- add patch 3/4 and 4/4.
v2:
- resovle compilation failure when disable i40e and ixgbe.
Ferruh Yigit (2):
app/testpmd: compact RSS types output in some commands
app/testpmd: remove duplicated flow type to string table
Huisong Li (2):
app/testpmd: fix supported RSS offload display
app/testpmd: unify RSS types display and obtaination
app/test-pmd/cmdline.c | 41 +------
app/test-pmd/config.c | 272 ++++++++++++++++++++++++++++++-----------
app/test-pmd/testpmd.h | 5 +
3 files changed, 209 insertions(+), 109 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V3 app/testpmd 1/4] app/testpmd: fix supported RSS offload display
2022-06-07 8:32 ` [PATCH V3 app/testpmd 0/4] fix RSS types and flow type Huisong Li
@ 2022-06-07 8:32 ` Huisong Li
2022-06-07 15:45 ` Ferruh Yigit
2022-06-07 8:32 ` [PATCH V3 app/testpmd 2/4] app/testpmd: unify RSS types display and obtaination Huisong Li
` (2 subsequent siblings)
3 siblings, 1 reply; 72+ messages in thread
From: Huisong Li @ 2022-06-07 8:32 UTC (permalink / raw)
To: xiaoyun.li, aman.deep.singh, yuying.zhang, ferruh.yigit,
andrew.rybchenko
Cc: dev, thomas, huangdaode, lihuisong
And 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. This patch uses the
RTE_ETH_RSS_* bits to display supported RSS offload of PMD.
Fixes: b12964f621dc ("ethdev: unification of RSS offload types")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
---
app/test-pmd/config.c | 85 ++++++++++++++++++++++++++++++++++++++-----
1 file changed, 75 insertions(+), 10 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 72d2606d19..d290ca3a06 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -86,6 +86,56 @@ static const struct {
},
};
+const struct rss_type_info rss_offload_table[] = {
+ {"ipv4", RTE_ETH_RSS_IPV4},
+ {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
+ {"ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP},
+ {"ipv4-udp", RTE_ETH_RSS_NONFRAG_IPV4_UDP},
+ {"ipv4-sctp", RTE_ETH_RSS_NONFRAG_IPV4_SCTP},
+ {"ipv4-other", RTE_ETH_RSS_NONFRAG_IPV4_OTHER},
+ {"ipv6", RTE_ETH_RSS_IPV6},
+ {"ipv6-frag", RTE_ETH_RSS_FRAG_IPV6},
+ {"ipv6-tcp", RTE_ETH_RSS_NONFRAG_IPV6_TCP},
+ {"ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP},
+ {"ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP},
+ {"ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER},
+ {"l2_payload", RTE_ETH_RSS_L2_PAYLOAD},
+ {"ipv6-ex", RTE_ETH_RSS_IPV6_EX},
+ {"ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX},
+ {"ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX},
+ {"port", RTE_ETH_RSS_PORT},
+ {"vxlan", RTE_ETH_RSS_VXLAN},
+ {"geneve", RTE_ETH_RSS_GENEVE},
+ {"nvgre", RTE_ETH_RSS_NVGRE},
+ {"gtpu", RTE_ETH_RSS_GTPU},
+ {"eth", RTE_ETH_RSS_ETH},
+ {"s-vlan", RTE_ETH_RSS_S_VLAN},
+ {"c-vlan", RTE_ETH_RSS_C_VLAN},
+ {"esp", RTE_ETH_RSS_ESP},
+ {"ah", RTE_ETH_RSS_AH},
+ {"l2tpv3", RTE_ETH_RSS_L2TPV3},
+ {"pfcp", RTE_ETH_RSS_PFCP},
+ {"pppoe", RTE_ETH_RSS_PPPOE},
+ {"ecpri", RTE_ETH_RSS_ECPRI},
+ {"mpls", RTE_ETH_RSS_MPLS},
+ {"ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM},
+ {"l4-chksum", RTE_ETH_RSS_L4_CHKSUM},
+ {"l2tpv2", RTE_ETH_RSS_L2TPV2},
+ {"l3-pre96", RTE_ETH_RSS_L3_PRE96},
+ {"l3-pre64", RTE_ETH_RSS_L3_PRE64},
+ {"l3-pre56", RTE_ETH_RSS_L3_PRE56},
+ {"l3-pre48", RTE_ETH_RSS_L3_PRE48},
+ {"l3-pre40", RTE_ETH_RSS_L3_PRE40},
+ {"l3-pre32", RTE_ETH_RSS_L3_PRE32},
+ {"l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY},
+ {"l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY},
+ {"l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY},
+ {"l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY},
+ {"l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY},
+ {"l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY},
+ {NULL, 0},
+};
+
const struct rss_type_info rss_type_table[] = {
{ "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |
RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD |
@@ -675,6 +725,19 @@ print_dev_capabilities(uint64_t capabilities)
}
}
+static const char *
+rss_offload_to_str(uint64_t rss_offload)
+{
+ uint16_t i;
+
+ for (i = 0; rss_offload_table[i].str != NULL; i++) {
+ if (rss_offload_table[i].rss_type == rss_offload)
+ return rss_offload_table[i].str;
+ }
+
+ return NULL;
+}
+
void
port_infos_display(portid_t port_id)
{
@@ -779,19 +842,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 = RTE_BIT64(i);
+ if ((rss_offload_types & rss_offload) != 0) {
+ const char *p =
+ rss_offload_to_str(rss_offload);
+ if (p)
+ printf(" %s\n", p);
+ else
+ printf(" user defined 0x%"PRIx64"\n",
+ rss_offload);
+ }
}
}
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V3 app/testpmd 2/4] app/testpmd: unify RSS types display and obtaination
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 8:32 ` Huisong Li
2022-06-07 15:46 ` Ferruh Yigit
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 8:32 ` [PATCH V3 app/testpmd 4/4] app/testpmd: remove duplicated flow type to string table Huisong Li
3 siblings, 1 reply; 72+ messages in thread
From: Huisong Li @ 2022-06-07 8:32 UTC (permalink / raw)
To: xiaoyun.li, aman.deep.singh, yuying.zhang, ferruh.yigit,
andrew.rybchenko
Cc: dev, thomas, huangdaode, lihuisong
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
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V3 app/testpmd 3/4] app/testpmd: compact RSS types output in some commands
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 8:32 ` [PATCH V3 app/testpmd 2/4] app/testpmd: unify RSS types display and obtaination Huisong Li
@ 2022-06-07 8:32 ` Huisong Li
2022-06-07 15:46 ` Ferruh Yigit
2022-06-07 8:32 ` [PATCH V3 app/testpmd 4/4] app/testpmd: remove duplicated flow type to string table Huisong Li
3 siblings, 1 reply; 72+ messages in thread
From: Huisong Li @ 2022-06-07 8:32 UTC (permalink / raw)
To: xiaoyun.li, aman.deep.singh, yuying.zhang, ferruh.yigit,
andrew.rybchenko
Cc: dev, thomas, huangdaode, lihuisong
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
In port info command output, 'show port info all', supported RSS offload
types printed one type per line, and although this information is not
most important part of the command it takes big part of the command
output.
In port RSS hash and flow RSS command output, 'show port 0 rss-hash',
and 'flow query 0 0 rss', all enabled RSS types are printed on one line.
If there are many types, the print will be very long.
Compacting these RSS offloads and types output by fixing the length of the
character string printed on each line, instead of one per line or one line.
Output becomes as following:
Supported RSS offload flow types:
ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other ipv6-frag ipv6-tcp
ipv6-udp ipv6-sctp ipv6-other l4-dst-only l4-src-only l3-dst-only
l3-src-only
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/config.c | 64 ++++++++++++++++++++++++++++++++-----------
1 file changed, 48 insertions(+), 16 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 9cb1211f00..209cbcc514 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -66,6 +66,8 @@
#define NS_PER_SEC 1E9
+#define MAX_CHAR_NUM_PER_LINE 64
+
static const struct {
enum tx_pkt_split split;
const char *name;
@@ -198,6 +200,8 @@ const struct rss_type_info rss_type_table[] = {
static void
rss_types_display(uint64_t rss_types)
{
+ uint16_t total_len = 0;
+ uint16_t str_len = 0;
uint16_t i;
if (rss_types == 0)
@@ -206,9 +210,18 @@ rss_types_display(uint64_t rss_types)
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)
+ rss_type_table[i].rss_type) {
+ /* contain two blanks */
+ str_len = strlen(rss_type_table[i].str) + 2;
+ if (total_len + str_len > MAX_CHAR_NUM_PER_LINE) {
+ printf("\n");
+ total_len = 0;
+ }
printf(" %s", rss_type_table[i].str);
+ total_len += str_len;
+ }
}
}
@@ -766,6 +779,38 @@ rss_offload_to_str(uint64_t rss_offload)
return NULL;
}
+static void
+rss_offload_types_display(uint64_t rss_offload_types)
+{
+#define USER_DEFINED_DISPLAY_STR_LEN 23
+
+ uint16_t total_len = 0;
+ uint16_t str_len = 0;
+ uint64_t rss_offload;
+ uint16_t i;
+
+ for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) {
+ rss_offload = RTE_BIT64(i);
+ if ((rss_offload_types & rss_offload) != 0) {
+ const char *p = rss_offload_to_str(rss_offload);
+
+ str_len = p ? strlen(p) : USER_DEFINED_DISPLAY_STR_LEN;
+ str_len += 2; /* add two blanks */
+ if (total_len + str_len >= MAX_CHAR_NUM_PER_LINE) {
+ total_len = 0;
+ printf("\n");
+ }
+
+ if (p)
+ printf(" %s", p);
+ else
+ printf(" user defined 0x%"PRIx64"",
+ rss_offload);
+ total_len += str_len;
+ }
+ }
+}
+
void
port_infos_display(portid_t port_id)
{
@@ -870,22 +915,9 @@ 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;
-
printf("Supported RSS offload flow types:\n");
- for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) {
- uint64_t rss_offload = RTE_BIT64(i);
- if ((rss_offload_types & rss_offload) != 0) {
- const char *p =
- rss_offload_to_str(rss_offload);
- if (p)
- printf(" %s\n", p);
- else
- printf(" user defined 0x%"PRIx64"\n",
- rss_offload);
- }
- }
+ rss_offload_types_display(dev_info.flow_type_rss_offloads);
+ printf("\n");
}
printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize);
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V3 app/testpmd 4/4] app/testpmd: remove duplicated flow type to string table
2022-06-07 8:32 ` [PATCH V3 app/testpmd 0/4] fix RSS types and flow type Huisong Li
` (2 preceding siblings ...)
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 8:32 ` Huisong Li
2022-06-07 15:47 ` Ferruh Yigit
3 siblings, 1 reply; 72+ messages in thread
From: Huisong Li @ 2022-06-07 8:32 UTC (permalink / raw)
To: xiaoyun.li, aman.deep.singh, yuying.zhang, ferruh.yigit,
andrew.rybchenko
Cc: dev, thomas, huangdaode, lihuisong
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
Flow type table has two instance, one is used for flow type to string
conversion, and other is used for string to flow type conversion.
And tables are diverged by time.
Unifying tables to prevent maintaining two different tables.
Note: made 'flowtype_to_str()' non-static to prevent build error for the
case PMDs using it disables. Making function generic, not for some PMDs.
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/cmdline.c | 41 +------------------
app/test-pmd/config.c | 92 +++++++++++++++++++++++++++---------------
app/test-pmd/testpmd.h | 5 +++
3 files changed, 65 insertions(+), 73 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index fdd0cada3b..e44bb3f475 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -10591,45 +10591,6 @@ do { \
#ifdef RTE_NET_I40E
-static uint16_t
-str2flowtype(char *string)
-{
- uint8_t i = 0;
- static const struct {
- char str[32];
- uint16_t type;
- } flowtype_str[] = {
- {"raw", RTE_ETH_FLOW_RAW},
- {"ipv4", RTE_ETH_FLOW_IPV4},
- {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
- {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
- {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
- {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
- {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
- {"ipv6", RTE_ETH_FLOW_IPV6},
- {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
- {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
- {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
- {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
- {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
- {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
- {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
- {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
- {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
- {"gtpu", RTE_ETH_FLOW_GTPU},
- };
-
- for (i = 0; i < RTE_DIM(flowtype_str); i++) {
- if (!strcmp(flowtype_str[i].str, string))
- return flowtype_str[i].type;
- }
-
- if (isdigit(string[0]) && atoi(string) > 0 && atoi(string) < 64)
- return (uint16_t)atoi(string);
-
- return RTE_ETH_FLOW_UNKNOWN;
-}
-
/* *** deal with flow director filter *** */
struct cmd_flow_director_result {
cmdline_fixed_string_t flow_director_filter;
@@ -10658,7 +10619,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
struct rte_pmd_i40e_flow_type_mapping
mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
struct rte_pmd_i40e_pkt_template_conf conf;
- uint16_t flow_type = str2flowtype(res->flow_type);
+ uint16_t flow_type = str_to_flowtype(res->flow_type);
uint16_t i, port = res->port_id;
uint8_t add;
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 209cbcc514..ed0be8036b 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -86,6 +86,38 @@ static const struct {
},
};
+#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
+
+static const struct {
+ char str[32];
+ uint16_t ftype;
+} flowtype_str_table[] = {
+ {"raw", RTE_ETH_FLOW_RAW},
+ {"ipv4", RTE_ETH_FLOW_IPV4},
+ {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
+ {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
+ {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
+ {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
+ {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
+ {"ipv6", RTE_ETH_FLOW_IPV6},
+ {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
+ {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
+ {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
+ {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
+ {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
+ {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
+ {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
+ {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
+ {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
+ {"port", RTE_ETH_FLOW_PORT},
+ {"vxlan", RTE_ETH_FLOW_VXLAN},
+ {"geneve", RTE_ETH_FLOW_GENEVE},
+ {"nvgre", RTE_ETH_FLOW_NVGRE},
+ {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
+ {"gtpu", RTE_ETH_FLOW_GTPU},
+};
+#endif
+
const struct rss_type_info rss_offload_table[] = {
{"ipv4", RTE_ETH_RSS_IPV4},
{"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
@@ -5713,41 +5745,35 @@ set_record_burst_stats(uint8_t on_off)
record_burst_stats = on_off;
}
+#ifdef RTE_NET_I40E
+
+uint16_t
+str_to_flowtype(const char *string)
+{
+ uint8_t i;
+
+ for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
+ if (!strcmp(flowtype_str_table[i].str, string))
+ return flowtype_str_table[i].ftype;
+ }
+
+ if (isdigit(string[0])) {
+ int val = atoi(string);
+ if (val > 0 && val < 64)
+ return (uint16_t)val;
+ }
+
+ return RTE_ETH_FLOW_UNKNOWN;
+}
+
+#endif /* RTE_NET_I40E */
+
#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
-static char*
+
+static const char*
flowtype_to_str(uint16_t flow_type)
{
- struct flow_type_info {
- char str[32];
- uint16_t ftype;
- };
-
uint8_t i;
- static struct flow_type_info flowtype_str_table[] = {
- {"raw", RTE_ETH_FLOW_RAW},
- {"ipv4", RTE_ETH_FLOW_IPV4},
- {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
- {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
- {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
- {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
- {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
- {"ipv6", RTE_ETH_FLOW_IPV6},
- {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
- {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
- {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
- {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
- {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
- {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
- {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
- {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
- {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
- {"port", RTE_ETH_FLOW_PORT},
- {"vxlan", RTE_ETH_FLOW_VXLAN},
- {"geneve", RTE_ETH_FLOW_GENEVE},
- {"nvgre", RTE_ETH_FLOW_NVGRE},
- {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
- {"gtpu", RTE_ETH_FLOW_GTPU},
- };
for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
if (flowtype_str_table[i].ftype == flow_type)
@@ -5821,7 +5847,7 @@ print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
{
struct rte_eth_fdir_flex_mask *mask;
uint32_t i, j;
- char *p;
+ const char *p;
for (i = 0; i < flex_conf->nb_flexmasks; i++) {
mask = &flex_conf->flex_mask[i];
@@ -5837,7 +5863,7 @@ static inline void
print_fdir_flow_type(uint32_t flow_types_mask)
{
int i;
- char *p;
+ const char *p;
for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
if (!(flow_types_mask & (1 << i)))
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 6693813dda..b7931a2bee 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1086,6 +1086,11 @@ void pmd_test_exit(void);
#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
void fdir_get_infos(portid_t port_id);
#endif
+
+#ifdef RTE_NET_I40E
+uint16_t str_to_flowtype(const char *string);
+#endif
+
void fdir_set_flex_mask(portid_t port_id,
struct rte_eth_fdir_flex_mask *cfg);
void fdir_set_flex_payload(portid_t port_id,
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 1/4] app/testpmd: fix supported RSS offload display
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)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-07 15:45 UTC (permalink / raw)
To: Huisong Li, xiaoyun.li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode
On 6/7/2022 9:32 AM, Huisong Li wrote:
>
> And 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. This patch uses the
> RTE_ETH_RSS_* bits to display supported RSS offload of PMD.
>
> Fixes: b12964f621dc ("ethdev: unification of RSS offload types")
> Cc: stable@dpdk.org
>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
> ---
> app/test-pmd/config.c | 85 ++++++++++++++++++++++++++++++++++++++-----
> 1 file changed, 75 insertions(+), 10 deletions(-)
>
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 72d2606d19..d290ca3a06 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -86,6 +86,56 @@ static const struct {
> },
> };
>
> +const struct rss_type_info rss_offload_table[] = {
> + {"ipv4", RTE_ETH_RSS_IPV4},
> + {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
> + {"ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP},
> + {"ipv4-udp", RTE_ETH_RSS_NONFRAG_IPV4_UDP},
> + {"ipv4-sctp", RTE_ETH_RSS_NONFRAG_IPV4_SCTP},
> + {"ipv4-other", RTE_ETH_RSS_NONFRAG_IPV4_OTHER},
> + {"ipv6", RTE_ETH_RSS_IPV6},
> + {"ipv6-frag", RTE_ETH_RSS_FRAG_IPV6},
> + {"ipv6-tcp", RTE_ETH_RSS_NONFRAG_IPV6_TCP},
> + {"ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP},
> + {"ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP},
> + {"ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER},
> + {"l2_payload", RTE_ETH_RSS_L2_PAYLOAD},
> + {"ipv6-ex", RTE_ETH_RSS_IPV6_EX},
> + {"ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX},
> + {"ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX},
> + {"port", RTE_ETH_RSS_PORT},
> + {"vxlan", RTE_ETH_RSS_VXLAN},
> + {"geneve", RTE_ETH_RSS_GENEVE},
> + {"nvgre", RTE_ETH_RSS_NVGRE},
> + {"gtpu", RTE_ETH_RSS_GTPU},
> + {"eth", RTE_ETH_RSS_ETH},
> + {"s-vlan", RTE_ETH_RSS_S_VLAN},
> + {"c-vlan", RTE_ETH_RSS_C_VLAN},
> + {"esp", RTE_ETH_RSS_ESP},
> + {"ah", RTE_ETH_RSS_AH},
> + {"l2tpv3", RTE_ETH_RSS_L2TPV3},
> + {"pfcp", RTE_ETH_RSS_PFCP},
> + {"pppoe", RTE_ETH_RSS_PPPOE},
> + {"ecpri", RTE_ETH_RSS_ECPRI},
> + {"mpls", RTE_ETH_RSS_MPLS},
> + {"ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM},
> + {"l4-chksum", RTE_ETH_RSS_L4_CHKSUM},
> + {"l2tpv2", RTE_ETH_RSS_L2TPV2},
> + {"l3-pre96", RTE_ETH_RSS_L3_PRE96},
> + {"l3-pre64", RTE_ETH_RSS_L3_PRE64},
> + {"l3-pre56", RTE_ETH_RSS_L3_PRE56},
> + {"l3-pre48", RTE_ETH_RSS_L3_PRE48},
> + {"l3-pre40", RTE_ETH_RSS_L3_PRE40},
> + {"l3-pre32", RTE_ETH_RSS_L3_PRE32},
> + {"l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY},
> + {"l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY},
> + {"l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY},
> + {"l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY},
> + {"l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY},
> + {"l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY},
> + {NULL, 0},
> +};
> +
Hi Huisong,
Why not reusing existing 'rss_type_table[]', but adding a new one?
Is it to have each individual RSS type instead of grouping
'rss_type_table[]' has? If so, since command "port config all rss ..."
using the grouping, I think it makes sense to have grouping.
Another thing is having two different array with very similar content is
easy to confuse and can cause diversion on arrays and generate bugs.
As mentioned from "port config all rss ..." command, it seems it is also
not using 'rss_type_table[]', but all string to RSS type matching done
within the function ('cmd_config_rss_parsed()') duplicating what we have
in 'rss_type_table[]'. Again this has concern to diverge between set and
show functions.
If you have time for it, can you make an additional patch to update
'cmd_config_rss_parsed()' to use new 'str_to_rsstypes()' function?
Thanks,
ferruh
> const struct rss_type_info rss_type_table[] = {
> { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |
> RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD |
> @@ -675,6 +725,19 @@ print_dev_capabilities(uint64_t capabilities)
> }
> }
>
> +static const char *
> +rss_offload_to_str(uint64_t rss_offload)
> +{
> + uint16_t i;
> +
> + for (i = 0; rss_offload_table[i].str != NULL; i++) {
> + if (rss_offload_table[i].rss_type == rss_offload)
> + return rss_offload_table[i].str;
> + }
> +
> + return NULL;
> +}
> +
> void
> port_infos_display(portid_t port_id)
> {
> @@ -779,19 +842,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 = RTE_BIT64(i);
> + if ((rss_offload_types & rss_offload) != 0) {
> + const char *p =
> + rss_offload_to_str(rss_offload);
> + if (p)
> + printf(" %s\n", p);
> + else
> + printf(" user defined 0x%"PRIx64"\n",
> + rss_offload);
> + }
If you go with 'rss_type_table[]', you need to change above logic as you
did in your v2.
> }
> }
>
> --
> 2.33.0
>
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 2/4] app/testpmd: unify RSS types display and obtaination
2022-06-07 8:32 ` [PATCH V3 app/testpmd 2/4] app/testpmd: unify RSS types display and obtaination Huisong Li
@ 2022-06-07 15:46 ` Ferruh Yigit
2022-06-09 3:25 ` lihuisong (C)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-07 15:46 UTC (permalink / raw)
To: Huisong Li, xiaoyun.li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode
On 6/7/2022 9:32 AM, Huisong Li wrote:
>
> 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>
<...>
> @@ -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)
> -
I think this change should be in first patch (v1/4) where
'flowtype_to_str' stopped being used.
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 3/4] app/testpmd: compact RSS types output in some commands
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)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-07 15:46 UTC (permalink / raw)
To: Huisong Li, xiaoyun.li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode
On 6/7/2022 9:32 AM, Huisong Li wrote:
>
> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>
> In port info command output, 'show port info all', supported RSS offload
> types printed one type per line, and although this information is not
> most important part of the command it takes big part of the command
> output.
>
> In port RSS hash and flow RSS command output, 'show port 0 rss-hash',
> and 'flow query 0 0 rss', all enabled RSS types are printed on one line.
> If there are many types, the print will be very long.
>
> Compacting these RSS offloads and types output by fixing the length of the
> character string printed on each line, instead of one per line or one line.
> Output becomes as following:
>
> Supported RSS offload flow types:
> ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other ipv6-frag ipv6-tcp
> ipv6-udp ipv6-sctp ipv6-other l4-dst-only l4-src-only l3-dst-only
> l3-src-only
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> ---
> app/test-pmd/config.c | 64 ++++++++++++++++++++++++++++++++-----------
> 1 file changed, 48 insertions(+), 16 deletions(-)
>
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 9cb1211f00..209cbcc514 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -66,6 +66,8 @@
>
> #define NS_PER_SEC 1E9
>
> +#define MAX_CHAR_NUM_PER_LINE 64
> +
> static const struct {
> enum tx_pkt_split split;
> const char *name;
> @@ -198,6 +200,8 @@ const struct rss_type_info rss_type_table[] = {
> static void
> rss_types_display(uint64_t rss_types)
> {
> + uint16_t total_len = 0;
> + uint16_t str_len = 0;
> uint16_t i;
>
> if (rss_types == 0)
> @@ -206,9 +210,18 @@ rss_types_display(uint64_t rss_types)
> 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)
> + rss_type_table[i].rss_type) {
> + /* contain two blanks */
> + str_len = strlen(rss_type_table[i].str) + 2;
> + if (total_len + str_len > MAX_CHAR_NUM_PER_LINE) {
> + printf("\n");
> + total_len = 0;
> + }
> printf(" %s", rss_type_table[i].str);
> + total_len += str_len;
> + }
> }
> }
>
> @@ -766,6 +779,38 @@ rss_offload_to_str(uint64_t rss_offload)
> return NULL;
> }
>
> +static void
> +rss_offload_types_display(uint64_t rss_offload_types)
> +{
> +#define USER_DEFINED_DISPLAY_STR_LEN 23
> +
> + uint16_t total_len = 0;
> + uint16_t str_len = 0;
> + uint64_t rss_offload;
> + uint16_t i;
> +
> + for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) {
> + rss_offload = RTE_BIT64(i);
> + if ((rss_offload_types & rss_offload) != 0) {
> + const char *p = rss_offload_to_str(rss_offload);
> +
> + str_len = p ? strlen(p) : USER_DEFINED_DISPLAY_STR_LEN;
> + str_len += 2; /* add two blanks */
> + if (total_len + str_len >= MAX_CHAR_NUM_PER_LINE) {
> + total_len = 0;
> + printf("\n");
> + }
> +
> + if (p)
> + printf(" %s", p);
> + else
> + printf(" user defined 0x%"PRIx64"",
> + rss_offload);
> + total_len += str_len;
> + }
> + }
> +}
If you go with 'rss_type_table[]', above function can be used for both
'port_infos_display()' and 'rss_types_display()', what do you think?
And perhaps 'rss_offload_types_display()' can get length as parameter.
> +
> void
> port_infos_display(portid_t port_id)
> {
> @@ -870,22 +915,9 @@ 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;
> -
> printf("Supported RSS offload flow types:\n");
> - for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) {
> - uint64_t rss_offload = RTE_BIT64(i);
> - if ((rss_offload_types & rss_offload) != 0) {
> - const char *p =
> - rss_offload_to_str(rss_offload);
> - if (p)
> - printf(" %s\n", p);
> - else
> - printf(" user defined 0x%"PRIx64"\n",
> - rss_offload);
> - }
> - }
> + rss_offload_types_display(dev_info.flow_type_rss_offloads);
> + printf("\n");
> }
>
> printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize);
> --
> 2.33.0
>
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 4/4] app/testpmd: remove duplicated flow type to string table
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)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-07 15:47 UTC (permalink / raw)
To: Huisong Li, xiaoyun.li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode
On 6/7/2022 9:32 AM, Huisong Li wrote:
>
> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>
> Flow type table has two instance, one is used for flow type to string
> conversion, and other is used for string to flow type conversion.
> And tables are diverged by time.
>
> Unifying tables to prevent maintaining two different tables.
>
> Note: made 'flowtype_to_str()' non-static to prevent build error for the
> case PMDs using it disables. Making function generic, not for some PMDs.
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> ---
> app/test-pmd/cmdline.c | 41 +------------------
> app/test-pmd/config.c | 92 +++++++++++++++++++++++++++---------------
> app/test-pmd/testpmd.h | 5 +++
> 3 files changed, 65 insertions(+), 73 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index fdd0cada3b..e44bb3f475 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -10591,45 +10591,6 @@ do { \
>
> #ifdef RTE_NET_I40E
>
> -static uint16_t
> -str2flowtype(char *string)
> -{
> - uint8_t i = 0;
> - static const struct {
> - char str[32];
> - uint16_t type;
> - } flowtype_str[] = {
> - {"raw", RTE_ETH_FLOW_RAW},
> - {"ipv4", RTE_ETH_FLOW_IPV4},
> - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
> - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
> - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
> - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
> - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
> - {"ipv6", RTE_ETH_FLOW_IPV6},
> - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
> - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
> - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
> - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
> - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
> - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
> - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
> - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
> - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
> - {"gtpu", RTE_ETH_FLOW_GTPU},
> - };
> -
> - for (i = 0; i < RTE_DIM(flowtype_str); i++) {
> - if (!strcmp(flowtype_str[i].str, string))
> - return flowtype_str[i].type;
> - }
> -
> - if (isdigit(string[0]) && atoi(string) > 0 && atoi(string) < 64)
> - return (uint16_t)atoi(string);
> -
> - return RTE_ETH_FLOW_UNKNOWN;
> -}
> -
> /* *** deal with flow director filter *** */
> struct cmd_flow_director_result {
> cmdline_fixed_string_t flow_director_filter;
> @@ -10658,7 +10619,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
> struct rte_pmd_i40e_flow_type_mapping
> mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
> struct rte_pmd_i40e_pkt_template_conf conf;
> - uint16_t flow_type = str2flowtype(res->flow_type);
> + uint16_t flow_type = str_to_flowtype(res->flow_type);
> uint16_t i, port = res->port_id;
> uint8_t add;
>
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 209cbcc514..ed0be8036b 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -86,6 +86,38 @@ static const struct {
> },
> };
>
> +#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
> +
Although right now 'flowtype_to_str()' & 'str_to_flowtype()' are used by
code for above PMDs, the functionality is nothing special to any PMD.
What about making above functions as non-static functions and get rid of
all related #ifdef?
> +static const struct {
> + char str[32];
> + uint16_t ftype;
> +} flowtype_str_table[] = {
> + {"raw", RTE_ETH_FLOW_RAW},
> + {"ipv4", RTE_ETH_FLOW_IPV4},
> + {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
> + {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
> + {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
> + {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
> + {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
> + {"ipv6", RTE_ETH_FLOW_IPV6},
> + {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
> + {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
> + {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
> + {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
> + {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
> + {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
> + {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
> + {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
> + {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
> + {"port", RTE_ETH_FLOW_PORT},
> + {"vxlan", RTE_ETH_FLOW_VXLAN},
> + {"geneve", RTE_ETH_FLOW_GENEVE},
> + {"nvgre", RTE_ETH_FLOW_NVGRE},
> + {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
> + {"gtpu", RTE_ETH_FLOW_GTPU},
> +};
> +#endif
> +
> const struct rss_type_info rss_offload_table[] = {
> {"ipv4", RTE_ETH_RSS_IPV4},
> {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
> @@ -5713,41 +5745,35 @@ set_record_burst_stats(uint8_t on_off)
> record_burst_stats = on_off;
> }
>
> +#ifdef RTE_NET_I40E
> +
> +uint16_t
> +str_to_flowtype(const char *string)
> +{
> + uint8_t i;
> +
> + for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
> + if (!strcmp(flowtype_str_table[i].str, string))
> + return flowtype_str_table[i].ftype;
> + }
> +
> + if (isdigit(string[0])) {
> + int val = atoi(string);
> + if (val > 0 && val < 64)
> + return (uint16_t)val;
> + }
> +
> + return RTE_ETH_FLOW_UNKNOWN;
> +}
> +
> +#endif /* RTE_NET_I40E */
> +
> #if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
> -static char*
> +
> +static const char*
> flowtype_to_str(uint16_t flow_type)
> {
> - struct flow_type_info {
> - char str[32];
> - uint16_t ftype;
> - };
> -
> uint8_t i;
> - static struct flow_type_info flowtype_str_table[] = {
> - {"raw", RTE_ETH_FLOW_RAW},
> - {"ipv4", RTE_ETH_FLOW_IPV4},
> - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
> - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
> - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
> - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
> - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
> - {"ipv6", RTE_ETH_FLOW_IPV6},
> - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
> - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
> - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
> - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
> - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
> - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
> - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
> - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
> - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
> - {"port", RTE_ETH_FLOW_PORT},
> - {"vxlan", RTE_ETH_FLOW_VXLAN},
> - {"geneve", RTE_ETH_FLOW_GENEVE},
> - {"nvgre", RTE_ETH_FLOW_NVGRE},
> - {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
> - {"gtpu", RTE_ETH_FLOW_GTPU},
> - };
>
> for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
> if (flowtype_str_table[i].ftype == flow_type)
> @@ -5821,7 +5847,7 @@ print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
> {
> struct rte_eth_fdir_flex_mask *mask;
> uint32_t i, j;
> - char *p;
> + const char *p;
>
> for (i = 0; i < flex_conf->nb_flexmasks; i++) {
> mask = &flex_conf->flex_mask[i];
> @@ -5837,7 +5863,7 @@ static inline void
> print_fdir_flow_type(uint32_t flow_types_mask)
> {
> int i;
> - char *p;
> + const char *p;
>
> for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
> if (!(flow_types_mask & (1 << i)))
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index 6693813dda..b7931a2bee 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -1086,6 +1086,11 @@ void pmd_test_exit(void);
> #if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
> void fdir_get_infos(portid_t port_id);
> #endif
> +
> +#ifdef RTE_NET_I40E
> +uint16_t str_to_flowtype(const char *string);
> +#endif
> +
> void fdir_set_flex_mask(portid_t port_id,
> struct rte_eth_fdir_flex_mask *cfg);
> void fdir_set_flex_payload(portid_t port_id,
> --
> 2.33.0
>
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 1/4] app/testpmd: fix supported RSS offload display
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
0 siblings, 2 replies; 72+ messages in thread
From: lihuisong (C) @ 2022-06-09 3:25 UTC (permalink / raw)
To: Ferruh Yigit, xiaoyun.li, aman.deep.singh, yuying.zhang,
andrew.rybchenko
Cc: dev, thomas, huangdaode
在 2022/6/7 23:45, Ferruh Yigit 写道:
> On 6/7/2022 9:32 AM, Huisong Li wrote:
>
>>
>> And 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. This patch uses the
>> RTE_ETH_RSS_* bits to display supported RSS offload of PMD.
>>
>> Fixes: b12964f621dc ("ethdev: unification of RSS offload types")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>> ---
>> app/test-pmd/config.c | 85 ++++++++++++++++++++++++++++++++++++++-----
>> 1 file changed, 75 insertions(+), 10 deletions(-)
>>
>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>> index 72d2606d19..d290ca3a06 100644
>> --- a/app/test-pmd/config.c
>> +++ b/app/test-pmd/config.c
>> @@ -86,6 +86,56 @@ static const struct {
>> },
>> };
>>
>> +const struct rss_type_info rss_offload_table[] = {
>> + {"ipv4", RTE_ETH_RSS_IPV4},
>> + {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
>> + {"ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP},
>> + {"ipv4-udp", RTE_ETH_RSS_NONFRAG_IPV4_UDP},
>> + {"ipv4-sctp", RTE_ETH_RSS_NONFRAG_IPV4_SCTP},
>> + {"ipv4-other", RTE_ETH_RSS_NONFRAG_IPV4_OTHER},
>> + {"ipv6", RTE_ETH_RSS_IPV6},
>> + {"ipv6-frag", RTE_ETH_RSS_FRAG_IPV6},
>> + {"ipv6-tcp", RTE_ETH_RSS_NONFRAG_IPV6_TCP},
>> + {"ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP},
>> + {"ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP},
>> + {"ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER},
>> + {"l2_payload", RTE_ETH_RSS_L2_PAYLOAD},
>> + {"ipv6-ex", RTE_ETH_RSS_IPV6_EX},
>> + {"ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX},
>> + {"ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX},
>> + {"port", RTE_ETH_RSS_PORT},
>> + {"vxlan", RTE_ETH_RSS_VXLAN},
>> + {"geneve", RTE_ETH_RSS_GENEVE},
>> + {"nvgre", RTE_ETH_RSS_NVGRE},
>> + {"gtpu", RTE_ETH_RSS_GTPU},
>> + {"eth", RTE_ETH_RSS_ETH},
>> + {"s-vlan", RTE_ETH_RSS_S_VLAN},
>> + {"c-vlan", RTE_ETH_RSS_C_VLAN},
>> + {"esp", RTE_ETH_RSS_ESP},
>> + {"ah", RTE_ETH_RSS_AH},
>> + {"l2tpv3", RTE_ETH_RSS_L2TPV3},
>> + {"pfcp", RTE_ETH_RSS_PFCP},
>> + {"pppoe", RTE_ETH_RSS_PPPOE},
>> + {"ecpri", RTE_ETH_RSS_ECPRI},
>> + {"mpls", RTE_ETH_RSS_MPLS},
>> + {"ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM},
>> + {"l4-chksum", RTE_ETH_RSS_L4_CHKSUM},
>> + {"l2tpv2", RTE_ETH_RSS_L2TPV2},
>> + {"l3-pre96", RTE_ETH_RSS_L3_PRE96},
>> + {"l3-pre64", RTE_ETH_RSS_L3_PRE64},
>> + {"l3-pre56", RTE_ETH_RSS_L3_PRE56},
>> + {"l3-pre48", RTE_ETH_RSS_L3_PRE48},
>> + {"l3-pre40", RTE_ETH_RSS_L3_PRE40},
>> + {"l3-pre32", RTE_ETH_RSS_L3_PRE32},
>> + {"l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY},
>> + {"l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY},
>> + {"l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY},
>> + {"l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY},
>> + {"l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY},
>> + {"l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY},
>> + {NULL, 0},
>> +};
>> +
>
> Hi Huisong,
>
> Why not reusing existing 'rss_type_table[]', but adding a new one?
> Is it to have each individual RSS type instead of grouping
> 'rss_type_table[]' has? If so, since command "port config all rss ..."
> using the grouping, I think it makes sense to have grouping.
>
The 'rss_offload_table[]' includes all defined RSS offloads in ethdev
layer, every iterm has one bit,
and is part of 'rss_type_table[]'. Some iterms in 'rss_type_table[]'
consist of multiple bits. If we
want to display all RSS offloads PMD supported and resolve undefined
offload, we have to check
'flow_type_rss_offloads' bit by bit. However, "port config all rss ..."
and "show port 0 rss-hash"
commands supports the configuration and display of multiple offload bits
at a time. So it is necessary
to introduce this 'rss_offload_table[]' to display
'flow_type_rss_offloads'. That's what I think.
> Another thing is having two different array with very similar content
> is easy to confuse and can cause diversion on arrays and generate bugs.
>
Add some notes about the use of the 'rss_offload_table[]'?
>
> As mentioned from "port config all rss ..." command, it seems it is
> also not using 'rss_type_table[]', but all string to RSS type matching
> done within the function ('cmd_config_rss_parsed()') duplicating what
> we have in 'rss_type_table[]'. Again this has concern to diverge
> between set and show functions.
> If you have time for it, can you make an additional patch to update
> 'cmd_config_rss_parsed()' to use new 'str_to_rsstypes()' function?
All right. Let's fix it.
>
> Thanks,
> ferruh
>
>> const struct rss_type_info rss_type_table[] = {
>> { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP
>> | RTE_ETH_RSS_TCP |
>> RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP |
>> RTE_ETH_RSS_L2_PAYLOAD |
>> @@ -675,6 +725,19 @@ print_dev_capabilities(uint64_t capabilities)
>> }
>> }
>>
>> +static const char *
>> +rss_offload_to_str(uint64_t rss_offload)
>> +{
>> + uint16_t i;
>> +
>> + for (i = 0; rss_offload_table[i].str != NULL; i++) {
>> + if (rss_offload_table[i].rss_type == rss_offload)
>> + return rss_offload_table[i].str;
>> + }
>> +
>> + return NULL;
>> +}
>> +
>> void
>> port_infos_display(portid_t port_id)
>> {
>> @@ -779,19 +842,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 = RTE_BIT64(i);
>> + if ((rss_offload_types & rss_offload) != 0) {
>> + const char *p =
>> + rss_offload_to_str(rss_offload);
>> + if (p)
>> + printf(" %s\n", p);
>> + else
>> + printf(" user defined
>> 0x%"PRIx64"\n",
>> + rss_offload);
>> + }
>
> If you go with 'rss_type_table[]', you need to change above logic as
> you did in your v2.
>
>> }
>> }
>>
>> --
>> 2.33.0
>>
>
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 2/4] app/testpmd: unify RSS types display and obtaination
2022-06-07 15:46 ` Ferruh Yigit
@ 2022-06-09 3:25 ` lihuisong (C)
0 siblings, 0 replies; 72+ messages in thread
From: lihuisong (C) @ 2022-06-09 3:25 UTC (permalink / raw)
To: Ferruh Yigit, xiaoyun.li, aman.deep.singh, yuying.zhang,
andrew.rybchenko
Cc: dev, thomas, huangdaode
在 2022/6/7 23:46, Ferruh Yigit 写道:
> On 6/7/2022 9:32 AM, Huisong Li wrote:
>
>>
>> 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>
>
> <...>
>
>> @@ -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)
>> -
>
> I think this change should be in first patch (v1/4) where
> 'flowtype_to_str' stopped being used.
Ack.
>
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 4/4] app/testpmd: remove duplicated flow type to string table
2022-06-07 15:47 ` Ferruh Yigit
@ 2022-06-09 3:26 ` lihuisong (C)
2022-06-20 12:38 ` Ferruh Yigit
0 siblings, 1 reply; 72+ messages in thread
From: lihuisong (C) @ 2022-06-09 3:26 UTC (permalink / raw)
To: Ferruh Yigit, xiaoyun.li, aman.deep.singh, yuying.zhang,
andrew.rybchenko
Cc: dev, thomas, huangdaode
在 2022/6/7 23:47, Ferruh Yigit 写道:
> On 6/7/2022 9:32 AM, Huisong Li wrote:
>
>>
>> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>
>> Flow type table has two instance, one is used for flow type to string
>> conversion, and other is used for string to flow type conversion.
>> And tables are diverged by time.
>>
>> Unifying tables to prevent maintaining two different tables.
>>
>> Note: made 'flowtype_to_str()' non-static to prevent build error for the
>> case PMDs using it disables. Making function generic, not for some PMDs.
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> ---
>> app/test-pmd/cmdline.c | 41 +------------------
>> app/test-pmd/config.c | 92 +++++++++++++++++++++++++++---------------
>> app/test-pmd/testpmd.h | 5 +++
>> 3 files changed, 65 insertions(+), 73 deletions(-)
>>
>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
>> index fdd0cada3b..e44bb3f475 100644
>> --- a/app/test-pmd/cmdline.c
>> +++ b/app/test-pmd/cmdline.c
>> @@ -10591,45 +10591,6 @@ do { \
>>
>> #ifdef RTE_NET_I40E
>>
>> -static uint16_t
>> -str2flowtype(char *string)
>> -{
>> - uint8_t i = 0;
>> - static const struct {
>> - char str[32];
>> - uint16_t type;
>> - } flowtype_str[] = {
>> - {"raw", RTE_ETH_FLOW_RAW},
>> - {"ipv4", RTE_ETH_FLOW_IPV4},
>> - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>> - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>> - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>> - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>> - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>> - {"ipv6", RTE_ETH_FLOW_IPV6},
>> - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>> - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>> - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>> - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>> - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>> - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>> - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>> - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>> - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>> - {"gtpu", RTE_ETH_FLOW_GTPU},
>> - };
>> -
>> - for (i = 0; i < RTE_DIM(flowtype_str); i++) {
>> - if (!strcmp(flowtype_str[i].str, string))
>> - return flowtype_str[i].type;
>> - }
>> -
>> - if (isdigit(string[0]) && atoi(string) > 0 && atoi(string) < 64)
>> - return (uint16_t)atoi(string);
>> -
>> - return RTE_ETH_FLOW_UNKNOWN;
>> -}
>> -
>> /* *** deal with flow director filter *** */
>> struct cmd_flow_director_result {
>> cmdline_fixed_string_t flow_director_filter;
>> @@ -10658,7 +10619,7 @@ cmd_flow_director_filter_parsed(void
>> *parsed_result,
>> struct rte_pmd_i40e_flow_type_mapping
>> mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
>> struct rte_pmd_i40e_pkt_template_conf conf;
>> - uint16_t flow_type = str2flowtype(res->flow_type);
>> + uint16_t flow_type = str_to_flowtype(res->flow_type);
>> uint16_t i, port = res->port_id;
>> uint8_t add;
>>
>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>> index 209cbcc514..ed0be8036b 100644
>> --- a/app/test-pmd/config.c
>> +++ b/app/test-pmd/config.c
>> @@ -86,6 +86,38 @@ static const struct {
>> },
>> };
>>
>> +#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>> +
>
> Although right now 'flowtype_to_str()' & 'str_to_flowtype()' are used
> by code for above PMDs, the functionality is nothing special to any PMD.
> What about making above functions as non-static functions and get rid
> of all related #ifdef?
>
Currently, they are not used anywhere but here. If remove #ifdef, a
warning will encounter.
>
>> +static const struct {
>> + char str[32];
>> + uint16_t ftype;
>> +} flowtype_str_table[] = {
>> + {"raw", RTE_ETH_FLOW_RAW},
>> + {"ipv4", RTE_ETH_FLOW_IPV4},
>> + {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>> + {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>> + {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>> + {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>> + {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>> + {"ipv6", RTE_ETH_FLOW_IPV6},
>> + {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>> + {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>> + {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>> + {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>> + {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>> + {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>> + {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>> + {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>> + {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>> + {"port", RTE_ETH_FLOW_PORT},
>> + {"vxlan", RTE_ETH_FLOW_VXLAN},
>> + {"geneve", RTE_ETH_FLOW_GENEVE},
>> + {"nvgre", RTE_ETH_FLOW_NVGRE},
>> + {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
>> + {"gtpu", RTE_ETH_FLOW_GTPU},
>> +};
>> +#endif
>> +
>> const struct rss_type_info rss_offload_table[] = {
>> {"ipv4", RTE_ETH_RSS_IPV4},
>> {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
>> @@ -5713,41 +5745,35 @@ set_record_burst_stats(uint8_t on_off)
>> record_burst_stats = on_off;
>> }
>>
>> +#ifdef RTE_NET_I40E
>> +
>> +uint16_t
>> +str_to_flowtype(const char *string)
>> +{
>> + uint8_t i;
>> +
>> + for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
>> + if (!strcmp(flowtype_str_table[i].str, string))
>> + return flowtype_str_table[i].ftype;
>> + }
>> +
>> + if (isdigit(string[0])) {
>> + int val = atoi(string);
>> + if (val > 0 && val < 64)
>> + return (uint16_t)val;
>> + }
>> +
>> + return RTE_ETH_FLOW_UNKNOWN;
>> +}
>> +
>> +#endif /* RTE_NET_I40E */
>> +
>> #if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>> -static char*
>> +
>> +static const char*
>> flowtype_to_str(uint16_t flow_type)
>> {
>> - struct flow_type_info {
>> - char str[32];
>> - uint16_t ftype;
>> - };
>> -
>> uint8_t i;
>> - static struct flow_type_info flowtype_str_table[] = {
>> - {"raw", RTE_ETH_FLOW_RAW},
>> - {"ipv4", RTE_ETH_FLOW_IPV4},
>> - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>> - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>> - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>> - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>> - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>> - {"ipv6", RTE_ETH_FLOW_IPV6},
>> - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>> - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>> - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>> - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>> - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>> - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>> - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>> - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>> - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>> - {"port", RTE_ETH_FLOW_PORT},
>> - {"vxlan", RTE_ETH_FLOW_VXLAN},
>> - {"geneve", RTE_ETH_FLOW_GENEVE},
>> - {"nvgre", RTE_ETH_FLOW_NVGRE},
>> - {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
>> - {"gtpu", RTE_ETH_FLOW_GTPU},
>> - };
>>
>> for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
>> if (flowtype_str_table[i].ftype == flow_type)
>> @@ -5821,7 +5847,7 @@ print_fdir_flex_mask(struct
>> rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
>> {
>> struct rte_eth_fdir_flex_mask *mask;
>> uint32_t i, j;
>> - char *p;
>> + const char *p;
>>
>> for (i = 0; i < flex_conf->nb_flexmasks; i++) {
>> mask = &flex_conf->flex_mask[i];
>> @@ -5837,7 +5863,7 @@ static inline void
>> print_fdir_flow_type(uint32_t flow_types_mask)
>> {
>> int i;
>> - char *p;
>> + const char *p;
>>
>> for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
>> if (!(flow_types_mask & (1 << i)))
>> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
>> index 6693813dda..b7931a2bee 100644
>> --- a/app/test-pmd/testpmd.h
>> +++ b/app/test-pmd/testpmd.h
>> @@ -1086,6 +1086,11 @@ void pmd_test_exit(void);
>> #if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>> void fdir_get_infos(portid_t port_id);
>> #endif
>> +
>> +#ifdef RTE_NET_I40E
>> +uint16_t str_to_flowtype(const char *string);
>> +#endif
>> +
>> void fdir_set_flex_mask(portid_t port_id,
>> struct rte_eth_fdir_flex_mask *cfg);
>> void fdir_set_flex_payload(portid_t port_id,
>> --
>> 2.33.0
>>
>
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 3/4] app/testpmd: compact RSS types output in some commands
2022-06-07 15:46 ` Ferruh Yigit
@ 2022-06-09 3:41 ` lihuisong (C)
2022-06-20 12:37 ` Ferruh Yigit
0 siblings, 1 reply; 72+ messages in thread
From: lihuisong (C) @ 2022-06-09 3:41 UTC (permalink / raw)
To: Ferruh Yigit, xiaoyun.li, aman.deep.singh, yuying.zhang,
andrew.rybchenko
Cc: dev, thomas, huangdaode
在 2022/6/7 23:46, Ferruh Yigit 写道:
> On 6/7/2022 9:32 AM, Huisong Li wrote:
>
>>
>> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>
>> In port info command output, 'show port info all', supported RSS offload
>> types printed one type per line, and although this information is not
>> most important part of the command it takes big part of the command
>> output.
>>
>> In port RSS hash and flow RSS command output, 'show port 0 rss-hash',
>> and 'flow query 0 0 rss', all enabled RSS types are printed on one line.
>> If there are many types, the print will be very long.
>>
>> Compacting these RSS offloads and types output by fixing the length
>> of the
>> character string printed on each line, instead of one per line or one
>> line.
>> Output becomes as following:
>>
>> Supported RSS offload flow types:
>> ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other ipv6-frag
>> ipv6-tcp
>> ipv6-udp ipv6-sctp ipv6-other l4-dst-only l4-src-only l3-dst-only
>> l3-src-only
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> ---
>> app/test-pmd/config.c | 64 ++++++++++++++++++++++++++++++++-----------
>> 1 file changed, 48 insertions(+), 16 deletions(-)
>>
>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>> index 9cb1211f00..209cbcc514 100644
>> --- a/app/test-pmd/config.c
>> +++ b/app/test-pmd/config.c
>> @@ -66,6 +66,8 @@
>>
>> #define NS_PER_SEC 1E9
>>
>> +#define MAX_CHAR_NUM_PER_LINE 64
>> +
>> static const struct {
>> enum tx_pkt_split split;
>> const char *name;
>> @@ -198,6 +200,8 @@ const struct rss_type_info rss_type_table[] = {
>> static void
>> rss_types_display(uint64_t rss_types)
>> {
>> + uint16_t total_len = 0;
>> + uint16_t str_len = 0;
>> uint16_t i;
>>
>> if (rss_types == 0)
>> @@ -206,9 +210,18 @@ rss_types_display(uint64_t rss_types)
>> 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)
>> + rss_type_table[i].rss_type) {
>> + /* contain two blanks */
>> + str_len = strlen(rss_type_table[i].str) + 2;
>> + if (total_len + str_len >
>> MAX_CHAR_NUM_PER_LINE) {
>> + printf("\n");
>> + total_len = 0;
>> + }
>> printf(" %s", rss_type_table[i].str);
>> + total_len += str_len;
>> + }
>> }
>> }
>>
>> @@ -766,6 +779,38 @@ rss_offload_to_str(uint64_t rss_offload)
>> return NULL;
>> }
>>
>> +static void
>> +rss_offload_types_display(uint64_t rss_offload_types)
>> +{
>> +#define USER_DEFINED_DISPLAY_STR_LEN 23
>> +
>> + uint16_t total_len = 0;
>> + uint16_t str_len = 0;
>> + uint64_t rss_offload;
>> + uint16_t i;
>> +
>> + for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) {
>> + rss_offload = RTE_BIT64(i);
>> + if ((rss_offload_types & rss_offload) != 0) {
>> + const char *p = rss_offload_to_str(rss_offload);
>> +
>> + str_len = p ? strlen(p) :
>> USER_DEFINED_DISPLAY_STR_LEN;
>> + str_len += 2; /* add two blanks */
>> + if (total_len + str_len >=
>> MAX_CHAR_NUM_PER_LINE) {
>> + total_len = 0;
>> + printf("\n");
>> + }
>> +
>> + if (p)
>> + printf(" %s", p);
>> + else
>> + printf(" user defined 0x%"PRIx64"",
>> + rss_offload);
>> + total_len += str_len;
>> + }
>> + }
>> +}
>
> If you go with 'rss_type_table[]', above function can be used for both
> 'port_infos_display()' and 'rss_types_display()', what do you think?
I just don't think it's appropriate to use this table for that.
> And perhaps 'rss_offload_types_display()' can get length as parameter.
Ack.
>
>> +
>> void
>> port_infos_display(portid_t port_id)
>> {
>> @@ -870,22 +915,9 @@ 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;
>> -
>> printf("Supported RSS offload flow types:\n");
>> - for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT;
>> i++) {
>> - uint64_t rss_offload = RTE_BIT64(i);
>> - if ((rss_offload_types & rss_offload) != 0) {
>> - const char *p =
>> - rss_offload_to_str(rss_offload);
>> - if (p)
>> - printf(" %s\n", p);
>> - else
>> - printf(" user defined
>> 0x%"PRIx64"\n",
>> - rss_offload);
>> - }
>> - }
>> + rss_offload_types_display(dev_info.flow_type_rss_offloads);
>> + printf("\n");
>> }
>>
>> printf("Minimum size of RX buffer: %u\n",
>> dev_info.min_rx_bufsize);
>> --
>> 2.33.0
>>
>
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 1/4] app/testpmd: fix supported RSS offload display
2022-06-09 3:25 ` lihuisong (C)
@ 2022-06-17 1:38 ` lihuisong (C)
2022-06-20 12:35 ` Ferruh Yigit
1 sibling, 0 replies; 72+ messages in thread
From: lihuisong (C) @ 2022-06-17 1:38 UTC (permalink / raw)
To: Ferruh Yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, aman.deep.singh, yuying.zhang
在 2022/6/9 11:25, lihuisong (C) 写道:
>
> 在 2022/6/7 23:45, Ferruh Yigit 写道:
>> On 6/7/2022 9:32 AM, Huisong Li wrote:
>>
>>>
>>> And 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. This patch uses the
>>> RTE_ETH_RSS_* bits to display supported RSS offload of PMD.
>>>
>>> Fixes: b12964f621dc ("ethdev: unification of RSS offload types")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>> ---
>>> app/test-pmd/config.c | 85
>>> ++++++++++++++++++++++++++++++++++++++-----
>>> 1 file changed, 75 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>>> index 72d2606d19..d290ca3a06 100644
>>> --- a/app/test-pmd/config.c
>>> +++ b/app/test-pmd/config.c
>>> @@ -86,6 +86,56 @@ static const struct {
>>> },
>>> };
>>>
>>> +const struct rss_type_info rss_offload_table[] = {
>>> + {"ipv4", RTE_ETH_RSS_IPV4},
>>> + {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
>>> + {"ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP},
>>> + {"ipv4-udp", RTE_ETH_RSS_NONFRAG_IPV4_UDP},
>>> + {"ipv4-sctp", RTE_ETH_RSS_NONFRAG_IPV4_SCTP},
>>> + {"ipv4-other", RTE_ETH_RSS_NONFRAG_IPV4_OTHER},
>>> + {"ipv6", RTE_ETH_RSS_IPV6},
>>> + {"ipv6-frag", RTE_ETH_RSS_FRAG_IPV6},
>>> + {"ipv6-tcp", RTE_ETH_RSS_NONFRAG_IPV6_TCP},
>>> + {"ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP},
>>> + {"ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP},
>>> + {"ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER},
>>> + {"l2_payload", RTE_ETH_RSS_L2_PAYLOAD},
>>> + {"ipv6-ex", RTE_ETH_RSS_IPV6_EX},
>>> + {"ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX},
>>> + {"ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX},
>>> + {"port", RTE_ETH_RSS_PORT},
>>> + {"vxlan", RTE_ETH_RSS_VXLAN},
>>> + {"geneve", RTE_ETH_RSS_GENEVE},
>>> + {"nvgre", RTE_ETH_RSS_NVGRE},
>>> + {"gtpu", RTE_ETH_RSS_GTPU},
>>> + {"eth", RTE_ETH_RSS_ETH},
>>> + {"s-vlan", RTE_ETH_RSS_S_VLAN},
>>> + {"c-vlan", RTE_ETH_RSS_C_VLAN},
>>> + {"esp", RTE_ETH_RSS_ESP},
>>> + {"ah", RTE_ETH_RSS_AH},
>>> + {"l2tpv3", RTE_ETH_RSS_L2TPV3},
>>> + {"pfcp", RTE_ETH_RSS_PFCP},
>>> + {"pppoe", RTE_ETH_RSS_PPPOE},
>>> + {"ecpri", RTE_ETH_RSS_ECPRI},
>>> + {"mpls", RTE_ETH_RSS_MPLS},
>>> + {"ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM},
>>> + {"l4-chksum", RTE_ETH_RSS_L4_CHKSUM},
>>> + {"l2tpv2", RTE_ETH_RSS_L2TPV2},
>>> + {"l3-pre96", RTE_ETH_RSS_L3_PRE96},
>>> + {"l3-pre64", RTE_ETH_RSS_L3_PRE64},
>>> + {"l3-pre56", RTE_ETH_RSS_L3_PRE56},
>>> + {"l3-pre48", RTE_ETH_RSS_L3_PRE48},
>>> + {"l3-pre40", RTE_ETH_RSS_L3_PRE40},
>>> + {"l3-pre32", RTE_ETH_RSS_L3_PRE32},
>>> + {"l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY},
>>> + {"l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY},
>>> + {"l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY},
>>> + {"l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY},
>>> + {"l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY},
>>> + {"l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY},
>>> + {NULL, 0},
>>> +};
>>> +
>>
>> Hi Huisong,
>>
>> Why not reusing existing 'rss_type_table[]', but adding a new one?
>> Is it to have each individual RSS type instead of grouping
>> 'rss_type_table[]' has? If so, since command "port config all rss
>> ..." using the grouping, I think it makes sense to have grouping.
>>
> The 'rss_offload_table[]' includes all defined RSS offloads in ethdev
> layer, every iterm has one bit,
> and is part of 'rss_type_table[]'. Some iterms in 'rss_type_table[]'
> consist of multiple bits. If we
> want to display all RSS offloads PMD supported and resolve undefined
> offload, we have to check
> 'flow_type_rss_offloads' bit by bit. However, "port config all rss
> ..." and "show port 0 rss-hash"
> commands supports the configuration and display of multiple offload
> bits at a time. So it is necessary
> to introduce this 'rss_offload_table[]' to display
> 'flow_type_rss_offloads'. That's what I think.
Hi Ferruh,
What do you think of what I mentioned above? Looking forward to your
reply.😁
>> Another thing is having two different array with very similar content
>> is easy to confuse and can cause diversion on arrays and generate bugs.
>>
> Add some notes about the use of the 'rss_offload_table[]'?
>>
>> As mentioned from "port config all rss ..." command, it seems it is
>> also not using 'rss_type_table[]', but all string to RSS type
>> matching done within the function ('cmd_config_rss_parsed()')
>> duplicating what we have in 'rss_type_table[]'. Again this has
>> concern to diverge between set and show functions.
>> If you have time for it, can you make an additional patch to update
>> 'cmd_config_rss_parsed()' to use new 'str_to_rsstypes()' function?
> All right. Let's fix it.
>>
>> Thanks,
>> ferruh
>>
>>> const struct rss_type_info rss_type_table[] = {
>>> { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN |
>>> RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |
>>> RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP |
>>> RTE_ETH_RSS_L2_PAYLOAD |
>>> @@ -675,6 +725,19 @@ print_dev_capabilities(uint64_t capabilities)
>>> }
>>> }
>>>
>>> +static const char *
>>> +rss_offload_to_str(uint64_t rss_offload)
>>> +{
>>> + uint16_t i;
>>> +
>>> + for (i = 0; rss_offload_table[i].str != NULL; i++) {
>>> + if (rss_offload_table[i].rss_type == rss_offload)
>>> + return rss_offload_table[i].str;
>>> + }
>>> +
>>> + return NULL;
>>> +}
>>> +
>>> void
>>> port_infos_display(portid_t port_id)
>>> {
>>> @@ -779,19 +842,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 = RTE_BIT64(i);
>>> + if ((rss_offload_types & rss_offload) != 0) {
>>> + const char *p =
>>> + rss_offload_to_str(rss_offload);
>>> + if (p)
>>> + printf(" %s\n", p);
>>> + else
>>> + printf(" user defined
>>> 0x%"PRIx64"\n",
>>> + rss_offload);
>>> + }
>>
>> If you go with 'rss_type_table[]', you need to change above logic as
>> you did in your v2.
>>
>>> }
>>> }
>>>
>>> --
>>> 2.33.0
>>>
>>
>> .
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 1/4] app/testpmd: fix supported RSS offload display
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)
1 sibling, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-20 12:35 UTC (permalink / raw)
To: lihuisong (C),
xiaoyun.li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode
On 6/9/2022 4:25 AM, lihuisong (C) wrote:
> CAUTION: This message has originated from an External Source. Please use
> proper judgment and caution when opening attachments, clicking links, or
> responding to this email.
>
>
> 在 2022/6/7 23:45, Ferruh Yigit 写道:
>> On 6/7/2022 9:32 AM, Huisong Li wrote:
>>
>>>
>>> And 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. This patch uses the
>>> RTE_ETH_RSS_* bits to display supported RSS offload of PMD.
>>>
>>> Fixes: b12964f621dc ("ethdev: unification of RSS offload types")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>> ---
>>> app/test-pmd/config.c | 85 ++++++++++++++++++++++++++++++++++++++-----
>>> 1 file changed, 75 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>>> index 72d2606d19..d290ca3a06 100644
>>> --- a/app/test-pmd/config.c
>>> +++ b/app/test-pmd/config.c
>>> @@ -86,6 +86,56 @@ static const struct {
>>> },
>>> };
>>>
>>> +const struct rss_type_info rss_offload_table[] = {
>>> + {"ipv4", RTE_ETH_RSS_IPV4},
>>> + {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
>>> + {"ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP},
>>> + {"ipv4-udp", RTE_ETH_RSS_NONFRAG_IPV4_UDP},
>>> + {"ipv4-sctp", RTE_ETH_RSS_NONFRAG_IPV4_SCTP},
>>> + {"ipv4-other", RTE_ETH_RSS_NONFRAG_IPV4_OTHER},
>>> + {"ipv6", RTE_ETH_RSS_IPV6},
>>> + {"ipv6-frag", RTE_ETH_RSS_FRAG_IPV6},
>>> + {"ipv6-tcp", RTE_ETH_RSS_NONFRAG_IPV6_TCP},
>>> + {"ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP},
>>> + {"ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP},
>>> + {"ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER},
>>> + {"l2_payload", RTE_ETH_RSS_L2_PAYLOAD},
>>> + {"ipv6-ex", RTE_ETH_RSS_IPV6_EX},
>>> + {"ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX},
>>> + {"ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX},
>>> + {"port", RTE_ETH_RSS_PORT},
>>> + {"vxlan", RTE_ETH_RSS_VXLAN},
>>> + {"geneve", RTE_ETH_RSS_GENEVE},
>>> + {"nvgre", RTE_ETH_RSS_NVGRE},
>>> + {"gtpu", RTE_ETH_RSS_GTPU},
>>> + {"eth", RTE_ETH_RSS_ETH},
>>> + {"s-vlan", RTE_ETH_RSS_S_VLAN},
>>> + {"c-vlan", RTE_ETH_RSS_C_VLAN},
>>> + {"esp", RTE_ETH_RSS_ESP},
>>> + {"ah", RTE_ETH_RSS_AH},
>>> + {"l2tpv3", RTE_ETH_RSS_L2TPV3},
>>> + {"pfcp", RTE_ETH_RSS_PFCP},
>>> + {"pppoe", RTE_ETH_RSS_PPPOE},
>>> + {"ecpri", RTE_ETH_RSS_ECPRI},
>>> + {"mpls", RTE_ETH_RSS_MPLS},
>>> + {"ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM},
>>> + {"l4-chksum", RTE_ETH_RSS_L4_CHKSUM},
>>> + {"l2tpv2", RTE_ETH_RSS_L2TPV2},
>>> + {"l3-pre96", RTE_ETH_RSS_L3_PRE96},
>>> + {"l3-pre64", RTE_ETH_RSS_L3_PRE64},
>>> + {"l3-pre56", RTE_ETH_RSS_L3_PRE56},
>>> + {"l3-pre48", RTE_ETH_RSS_L3_PRE48},
>>> + {"l3-pre40", RTE_ETH_RSS_L3_PRE40},
>>> + {"l3-pre32", RTE_ETH_RSS_L3_PRE32},
>>> + {"l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY},
>>> + {"l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY},
>>> + {"l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY},
>>> + {"l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY},
>>> + {"l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY},
>>> + {"l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY},
>>> + {NULL, 0},
>>> +};
>>> +
>>
>> Hi Huisong,
>>
>> Why not reusing existing 'rss_type_table[]', but adding a new one?
>> Is it to have each individual RSS type instead of grouping
>> 'rss_type_table[]' has? If so, since command "port config all rss ..."
>> using the grouping, I think it makes sense to have grouping.
>>
> The 'rss_offload_table[]' includes all defined RSS offloads in ethdev
> layer, every iterm has one bit,
> and is part of 'rss_type_table[]'. Some iterms in 'rss_type_table[]'
> consist of multiple bits. If we
> want to display all RSS offloads PMD supported and resolve undefined
> offload, we have to check
> 'flow_type_rss_offloads' bit by bit. However, "port config all rss ..."
> and "show port 0 rss-hash"
> commands supports the configuration and display of multiple offload bits
> at a time. So it is necessary
> to introduce this 'rss_offload_table[]' to display
> 'flow_type_rss_offloads'. That's what I think.
'rss_type_table[]' has both group and individual types, so show
functions displays both.
A sample of grouping is UDP, a few UDP flags compined under UDP,
#define RTE_ETH_RSS_UDP ( \
RTE_ETH_RSS_NONFRAG_IPV4_UDP | \
RTE_ETH_RSS_NONFRAG_IPV6_UDP | \
RTE_ETH_RSS_IPV6_UDP_EX)
Above mentioned commands use 'RTE_ETH_RSS_UDP' to set "udp" type RSS,
and when displying instead of displaying each above type separately, I
think displaying as "udp" makes sense.
And again I believe having two different arrays is prone to error for
future.
>> Another thing is having two different array with very similar content
>> is easy to confuse and can cause diversion on arrays and generate bugs.
>>
> Add some notes about the use of the 'rss_offload_table[]'?
>>
>> As mentioned from "port config all rss ..." command, it seems it is
>> also not using 'rss_type_table[]', but all string to RSS type matching
>> done within the function ('cmd_config_rss_parsed()') duplicating what
>> we have in 'rss_type_table[]'. Again this has concern to diverge
>> between set and show functions.
>> If you have time for it, can you make an additional patch to update
>> 'cmd_config_rss_parsed()' to use new 'str_to_rsstypes()' function?
> All right. Let's fix it.
Thanks, and if you want it can be a separate patch on top of this one,
it doesn't have to be part of this set if you don't have time for it.
>>
>> Thanks,
>> ferruh
>>
>>> const struct rss_type_info rss_type_table[] = {
>>> { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP
>>> | RTE_ETH_RSS_TCP |
>>> RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP |
>>> RTE_ETH_RSS_L2_PAYLOAD |
>>> @@ -675,6 +725,19 @@ print_dev_capabilities(uint64_t capabilities)
>>> }
>>> }
>>>
>>> +static const char *
>>> +rss_offload_to_str(uint64_t rss_offload)
>>> +{
>>> + uint16_t i;
>>> +
>>> + for (i = 0; rss_offload_table[i].str != NULL; i++) {
>>> + if (rss_offload_table[i].rss_type == rss_offload)
>>> + return rss_offload_table[i].str;
>>> + }
>>> +
>>> + return NULL;
>>> +}
>>> +
>>> void
>>> port_infos_display(portid_t port_id)
>>> {
>>> @@ -779,19 +842,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 = RTE_BIT64(i);
>>> + if ((rss_offload_types & rss_offload) != 0) {
>>> + const char *p =
>>> + rss_offload_to_str(rss_offload);
>>> + if (p)
>>> + printf(" %s\n", p);
>>> + else
>>> + printf(" user defined
>>> 0x%"PRIx64"\n",
>>> + rss_offload);
>>> + }
>>
>> If you go with 'rss_type_table[]', you need to change above logic as
>> you did in your v2.
>>
>>> }
>>> }
>>>
>>> --
>>> 2.33.0
>>>
>>
>> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 3/4] app/testpmd: compact RSS types output in some commands
2022-06-09 3:41 ` lihuisong (C)
@ 2022-06-20 12:37 ` Ferruh Yigit
0 siblings, 0 replies; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-20 12:37 UTC (permalink / raw)
To: lihuisong (C),
xiaoyun.li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode
On 6/9/2022 4:41 AM, lihuisong (C) wrote:
> CAUTION: This message has originated from an External Source. Please use
> proper judgment and caution when opening attachments, clicking links, or
> responding to this email.
>
>
> 在 2022/6/7 23:46, Ferruh Yigit 写道:
>> On 6/7/2022 9:32 AM, Huisong Li wrote:
>>
>>>
>>> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>>
>>> In port info command output, 'show port info all', supported RSS offload
>>> types printed one type per line, and although this information is not
>>> most important part of the command it takes big part of the command
>>> output.
>>>
>>> In port RSS hash and flow RSS command output, 'show port 0 rss-hash',
>>> and 'flow query 0 0 rss', all enabled RSS types are printed on one line.
>>> If there are many types, the print will be very long.
>>>
>>> Compacting these RSS offloads and types output by fixing the length
>>> of the
>>> character string printed on each line, instead of one per line or one
>>> line.
>>> Output becomes as following:
>>>
>>> Supported RSS offload flow types:
>>> ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other ipv6-frag
>>> ipv6-tcp
>>> ipv6-udp ipv6-sctp ipv6-other l4-dst-only l4-src-only l3-dst-only
>>> l3-src-only
>>>
>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>> ---
>>> app/test-pmd/config.c | 64 ++++++++++++++++++++++++++++++++-----------
>>> 1 file changed, 48 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>>> index 9cb1211f00..209cbcc514 100644
>>> --- a/app/test-pmd/config.c
>>> +++ b/app/test-pmd/config.c
>>> @@ -66,6 +66,8 @@
>>>
>>> #define NS_PER_SEC 1E9
>>>
>>> +#define MAX_CHAR_NUM_PER_LINE 64
>>> +
>>> static const struct {
>>> enum tx_pkt_split split;
>>> const char *name;
>>> @@ -198,6 +200,8 @@ const struct rss_type_info rss_type_table[] = {
>>> static void
>>> rss_types_display(uint64_t rss_types)
>>> {
>>> + uint16_t total_len = 0;
>>> + uint16_t str_len = 0;
>>> uint16_t i;
>>>
>>> if (rss_types == 0)
>>> @@ -206,9 +210,18 @@ rss_types_display(uint64_t rss_types)
>>> 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)
>>> + rss_type_table[i].rss_type) {
>>> + /* contain two blanks */
>>> + str_len = strlen(rss_type_table[i].str) + 2;
>>> + if (total_len + str_len >
>>> MAX_CHAR_NUM_PER_LINE) {
>>> + printf("\n");
>>> + total_len = 0;
>>> + }
>>> printf(" %s", rss_type_table[i].str);
>>> + total_len += str_len;
>>> + }
>>> }
>>> }
>>>
>>> @@ -766,6 +779,38 @@ rss_offload_to_str(uint64_t rss_offload)
>>> return NULL;
>>> }
>>>
>>> +static void
>>> +rss_offload_types_display(uint64_t rss_offload_types)
>>> +{
>>> +#define USER_DEFINED_DISPLAY_STR_LEN 23
>>> +
>>> + uint16_t total_len = 0;
>>> + uint16_t str_len = 0;
>>> + uint64_t rss_offload;
>>> + uint16_t i;
>>> +
>>> + for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) {
>>> + rss_offload = RTE_BIT64(i);
>>> + if ((rss_offload_types & rss_offload) != 0) {
>>> + const char *p = rss_offload_to_str(rss_offload);
>>> +
>>> + str_len = p ? strlen(p) :
>>> USER_DEFINED_DISPLAY_STR_LEN;
>>> + str_len += 2; /* add two blanks */
>>> + if (total_len + str_len >=
>>> MAX_CHAR_NUM_PER_LINE) {
>>> + total_len = 0;
>>> + printf("\n");
>>> + }
>>> +
>>> + if (p)
>>> + printf(" %s", p);
>>> + else
>>> + printf(" user defined 0x%"PRIx64"",
>>> + rss_offload);
>>> + total_len += str_len;
>>> + }
>>> + }
>>> +}
>>
>> If you go with 'rss_type_table[]', above function can be used for both
>> 'port_infos_display()' and 'rss_types_display()', what do you think?
> I just don't think it's appropriate to use this table for that.
I put some more comment to other patch on why 'rss_type_table[]' can be
used.
>> And perhaps 'rss_offload_types_display()' can get length as parameter.
> Ack.
>>
>>> +
>>> void
>>> port_infos_display(portid_t port_id)
>>> {
>>> @@ -870,22 +915,9 @@ 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;
>>> -
>>> printf("Supported RSS offload flow types:\n");
>>> - for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT;
>>> i++) {
>>> - uint64_t rss_offload = RTE_BIT64(i);
>>> - if ((rss_offload_types & rss_offload) != 0) {
>>> - const char *p =
>>> - rss_offload_to_str(rss_offload);
>>> - if (p)
>>> - printf(" %s\n", p);
>>> - else
>>> - printf(" user defined
>>> 0x%"PRIx64"\n",
>>> - rss_offload);
>>> - }
>>> - }
>>> + rss_offload_types_display(dev_info.flow_type_rss_offloads);
>>> + printf("\n");
>>> }
>>>
>>> printf("Minimum size of RX buffer: %u\n",
>>> dev_info.min_rx_bufsize);
>>> --
>>> 2.33.0
>>>
>>
>> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 4/4] app/testpmd: remove duplicated flow type to string table
2022-06-09 3:26 ` lihuisong (C)
@ 2022-06-20 12:38 ` Ferruh Yigit
2022-06-21 2:18 ` lihuisong (C)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-20 12:38 UTC (permalink / raw)
To: lihuisong (C),
xiaoyun.li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode
On 6/9/2022 4:26 AM, lihuisong (C) wrote:
> CAUTION: This message has originated from an External Source. Please use
> proper judgment and caution when opening attachments, clicking links, or
> responding to this email.
>
>
> 在 2022/6/7 23:47, Ferruh Yigit 写道:
>> On 6/7/2022 9:32 AM, Huisong Li wrote:
>>
>>>
>>> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>>
>>> Flow type table has two instance, one is used for flow type to string
>>> conversion, and other is used for string to flow type conversion.
>>> And tables are diverged by time.
>>>
>>> Unifying tables to prevent maintaining two different tables.
>>>
>>> Note: made 'flowtype_to_str()' non-static to prevent build error for the
>>> case PMDs using it disables. Making function generic, not for some PMDs.
>>>
>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>> ---
>>> app/test-pmd/cmdline.c | 41 +------------------
>>> app/test-pmd/config.c | 92 +++++++++++++++++++++++++++---------------
>>> app/test-pmd/testpmd.h | 5 +++
>>> 3 files changed, 65 insertions(+), 73 deletions(-)
>>>
>>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
>>> index fdd0cada3b..e44bb3f475 100644
>>> --- a/app/test-pmd/cmdline.c
>>> +++ b/app/test-pmd/cmdline.c
>>> @@ -10591,45 +10591,6 @@ do { \
>>>
>>> #ifdef RTE_NET_I40E
>>>
>>> -static uint16_t
>>> -str2flowtype(char *string)
>>> -{
>>> - uint8_t i = 0;
>>> - static const struct {
>>> - char str[32];
>>> - uint16_t type;
>>> - } flowtype_str[] = {
>>> - {"raw", RTE_ETH_FLOW_RAW},
>>> - {"ipv4", RTE_ETH_FLOW_IPV4},
>>> - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>>> - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>>> - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>>> - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>>> - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>>> - {"ipv6", RTE_ETH_FLOW_IPV6},
>>> - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>>> - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>>> - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>>> - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>>> - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>>> - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>>> - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>>> - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>>> - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>>> - {"gtpu", RTE_ETH_FLOW_GTPU},
>>> - };
>>> -
>>> - for (i = 0; i < RTE_DIM(flowtype_str); i++) {
>>> - if (!strcmp(flowtype_str[i].str, string))
>>> - return flowtype_str[i].type;
>>> - }
>>> -
>>> - if (isdigit(string[0]) && atoi(string) > 0 && atoi(string) < 64)
>>> - return (uint16_t)atoi(string);
>>> -
>>> - return RTE_ETH_FLOW_UNKNOWN;
>>> -}
>>> -
>>> /* *** deal with flow director filter *** */
>>> struct cmd_flow_director_result {
>>> cmdline_fixed_string_t flow_director_filter;
>>> @@ -10658,7 +10619,7 @@ cmd_flow_director_filter_parsed(void
>>> *parsed_result,
>>> struct rte_pmd_i40e_flow_type_mapping
>>> mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
>>> struct rte_pmd_i40e_pkt_template_conf conf;
>>> - uint16_t flow_type = str2flowtype(res->flow_type);
>>> + uint16_t flow_type = str_to_flowtype(res->flow_type);
>>> uint16_t i, port = res->port_id;
>>> uint8_t add;
>>>
>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>>> index 209cbcc514..ed0be8036b 100644
>>> --- a/app/test-pmd/config.c
>>> +++ b/app/test-pmd/config.c
>>> @@ -86,6 +86,38 @@ static const struct {
>>> },
>>> };
>>>
>>> +#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>>> +
>>
>> Although right now 'flowtype_to_str()' & 'str_to_flowtype()' are used
>> by code for above PMDs, the functionality is nothing special to any PMD.
>> What about making above functions as non-static functions and get rid
>> of all related #ifdef?
>>
> Currently, they are not used anywhere but here. If remove #ifdef, a
> warning will encounter.
If you make functions non-static, I think there won't be any warnings.
It is better to make functionality more generic, instead of PMD specific.
>>
>>> +static const struct {
>>> + char str[32];
>>> + uint16_t ftype;
>>> +} flowtype_str_table[] = {
>>> + {"raw", RTE_ETH_FLOW_RAW},
>>> + {"ipv4", RTE_ETH_FLOW_IPV4},
>>> + {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>>> + {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>>> + {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>>> + {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>>> + {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>>> + {"ipv6", RTE_ETH_FLOW_IPV6},
>>> + {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>>> + {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>>> + {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>>> + {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>>> + {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>>> + {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>>> + {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>>> + {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>>> + {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>>> + {"port", RTE_ETH_FLOW_PORT},
>>> + {"vxlan", RTE_ETH_FLOW_VXLAN},
>>> + {"geneve", RTE_ETH_FLOW_GENEVE},
>>> + {"nvgre", RTE_ETH_FLOW_NVGRE},
>>> + {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
>>> + {"gtpu", RTE_ETH_FLOW_GTPU},
>>> +};
>>> +#endif
>>> +
>>> const struct rss_type_info rss_offload_table[] = {
>>> {"ipv4", RTE_ETH_RSS_IPV4},
>>> {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
>>> @@ -5713,41 +5745,35 @@ set_record_burst_stats(uint8_t on_off)
>>> record_burst_stats = on_off;
>>> }
>>>
>>> +#ifdef RTE_NET_I40E
>>> +
>>> +uint16_t
>>> +str_to_flowtype(const char *string)
>>> +{
>>> + uint8_t i;
>>> +
>>> + for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
>>> + if (!strcmp(flowtype_str_table[i].str, string))
>>> + return flowtype_str_table[i].ftype;
>>> + }
>>> +
>>> + if (isdigit(string[0])) {
>>> + int val = atoi(string);
>>> + if (val > 0 && val < 64)
>>> + return (uint16_t)val;
>>> + }
>>> +
>>> + return RTE_ETH_FLOW_UNKNOWN;
>>> +}
>>> +
>>> +#endif /* RTE_NET_I40E */
>>> +
>>> #if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>>> -static char*
>>> +
>>> +static const char*
>>> flowtype_to_str(uint16_t flow_type)
>>> {
>>> - struct flow_type_info {
>>> - char str[32];
>>> - uint16_t ftype;
>>> - };
>>> -
>>> uint8_t i;
>>> - static struct flow_type_info flowtype_str_table[] = {
>>> - {"raw", RTE_ETH_FLOW_RAW},
>>> - {"ipv4", RTE_ETH_FLOW_IPV4},
>>> - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>>> - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>>> - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>>> - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>>> - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>>> - {"ipv6", RTE_ETH_FLOW_IPV6},
>>> - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>>> - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>>> - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>>> - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>>> - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>>> - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>>> - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>>> - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>>> - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>>> - {"port", RTE_ETH_FLOW_PORT},
>>> - {"vxlan", RTE_ETH_FLOW_VXLAN},
>>> - {"geneve", RTE_ETH_FLOW_GENEVE},
>>> - {"nvgre", RTE_ETH_FLOW_NVGRE},
>>> - {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
>>> - {"gtpu", RTE_ETH_FLOW_GTPU},
>>> - };
>>>
>>> for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
>>> if (flowtype_str_table[i].ftype == flow_type)
>>> @@ -5821,7 +5847,7 @@ print_fdir_flex_mask(struct
>>> rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
>>> {
>>> struct rte_eth_fdir_flex_mask *mask;
>>> uint32_t i, j;
>>> - char *p;
>>> + const char *p;
>>>
>>> for (i = 0; i < flex_conf->nb_flexmasks; i++) {
>>> mask = &flex_conf->flex_mask[i];
>>> @@ -5837,7 +5863,7 @@ static inline void
>>> print_fdir_flow_type(uint32_t flow_types_mask)
>>> {
>>> int i;
>>> - char *p;
>>> + const char *p;
>>>
>>> for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
>>> if (!(flow_types_mask & (1 << i)))
>>> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
>>> index 6693813dda..b7931a2bee 100644
>>> --- a/app/test-pmd/testpmd.h
>>> +++ b/app/test-pmd/testpmd.h
>>> @@ -1086,6 +1086,11 @@ void pmd_test_exit(void);
>>> #if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>>> void fdir_get_infos(portid_t port_id);
>>> #endif
>>> +
>>> +#ifdef RTE_NET_I40E
>>> +uint16_t str_to_flowtype(const char *string);
>>> +#endif
>>> +
>>> void fdir_set_flex_mask(portid_t port_id,
>>> struct rte_eth_fdir_flex_mask *cfg);
>>> void fdir_set_flex_payload(portid_t port_id,
>>> --
>>> 2.33.0
>>>
>>
>> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 1/4] app/testpmd: fix supported RSS offload display
2022-06-20 12:35 ` Ferruh Yigit
@ 2022-06-21 2:17 ` lihuisong (C)
0 siblings, 0 replies; 72+ messages in thread
From: lihuisong (C) @ 2022-06-21 2:17 UTC (permalink / raw)
To: Ferruh Yigit, xiaoyun.li, aman.deep.singh, yuying.zhang,
andrew.rybchenko
Cc: dev, thomas, huangdaode
在 2022/6/20 20:35, Ferruh Yigit 写道:
> On 6/9/2022 4:25 AM, lihuisong (C) wrote:
>> CAUTION: This message has originated from an External Source. Please
>> use proper judgment and caution when opening attachments, clicking
>> links, or responding to this email.
>>
>>
>> 在 2022/6/7 23:45, Ferruh Yigit 写道:
>>> On 6/7/2022 9:32 AM, Huisong Li wrote:
>>>
>>>>
>>>> And 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. This patch uses the
>>>> RTE_ETH_RSS_* bits to display supported RSS offload of PMD.
>>>>
>>>> Fixes: b12964f621dc ("ethdev: unification of RSS offload types")
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>>> ---
>>>> app/test-pmd/config.c | 85
>>>> ++++++++++++++++++++++++++++++++++++++-----
>>>> 1 file changed, 75 insertions(+), 10 deletions(-)
>>>>
>>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>>>> index 72d2606d19..d290ca3a06 100644
>>>> --- a/app/test-pmd/config.c
>>>> +++ b/app/test-pmd/config.c
>>>> @@ -86,6 +86,56 @@ static const struct {
>>>> },
>>>> };
>>>>
>>>> +const struct rss_type_info rss_offload_table[] = {
>>>> + {"ipv4", RTE_ETH_RSS_IPV4},
>>>> + {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
>>>> + {"ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP},
>>>> + {"ipv4-udp", RTE_ETH_RSS_NONFRAG_IPV4_UDP},
>>>> + {"ipv4-sctp", RTE_ETH_RSS_NONFRAG_IPV4_SCTP},
>>>> + {"ipv4-other", RTE_ETH_RSS_NONFRAG_IPV4_OTHER},
>>>> + {"ipv6", RTE_ETH_RSS_IPV6},
>>>> + {"ipv6-frag", RTE_ETH_RSS_FRAG_IPV6},
>>>> + {"ipv6-tcp", RTE_ETH_RSS_NONFRAG_IPV6_TCP},
>>>> + {"ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP},
>>>> + {"ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP},
>>>> + {"ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER},
>>>> + {"l2_payload", RTE_ETH_RSS_L2_PAYLOAD},
>>>> + {"ipv6-ex", RTE_ETH_RSS_IPV6_EX},
>>>> + {"ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX},
>>>> + {"ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX},
>>>> + {"port", RTE_ETH_RSS_PORT},
>>>> + {"vxlan", RTE_ETH_RSS_VXLAN},
>>>> + {"geneve", RTE_ETH_RSS_GENEVE},
>>>> + {"nvgre", RTE_ETH_RSS_NVGRE},
>>>> + {"gtpu", RTE_ETH_RSS_GTPU},
>>>> + {"eth", RTE_ETH_RSS_ETH},
>>>> + {"s-vlan", RTE_ETH_RSS_S_VLAN},
>>>> + {"c-vlan", RTE_ETH_RSS_C_VLAN},
>>>> + {"esp", RTE_ETH_RSS_ESP},
>>>> + {"ah", RTE_ETH_RSS_AH},
>>>> + {"l2tpv3", RTE_ETH_RSS_L2TPV3},
>>>> + {"pfcp", RTE_ETH_RSS_PFCP},
>>>> + {"pppoe", RTE_ETH_RSS_PPPOE},
>>>> + {"ecpri", RTE_ETH_RSS_ECPRI},
>>>> + {"mpls", RTE_ETH_RSS_MPLS},
>>>> + {"ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM},
>>>> + {"l4-chksum", RTE_ETH_RSS_L4_CHKSUM},
>>>> + {"l2tpv2", RTE_ETH_RSS_L2TPV2},
>>>> + {"l3-pre96", RTE_ETH_RSS_L3_PRE96},
>>>> + {"l3-pre64", RTE_ETH_RSS_L3_PRE64},
>>>> + {"l3-pre56", RTE_ETH_RSS_L3_PRE56},
>>>> + {"l3-pre48", RTE_ETH_RSS_L3_PRE48},
>>>> + {"l3-pre40", RTE_ETH_RSS_L3_PRE40},
>>>> + {"l3-pre32", RTE_ETH_RSS_L3_PRE32},
>>>> + {"l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY},
>>>> + {"l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY},
>>>> + {"l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY},
>>>> + {"l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY},
>>>> + {"l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY},
>>>> + {"l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY},
>>>> + {NULL, 0},
>>>> +};
>>>> +
>>>
>>> Hi Huisong,
>>>
>>> Why not reusing existing 'rss_type_table[]', but adding a new one?
>>> Is it to have each individual RSS type instead of grouping
>>> 'rss_type_table[]' has? If so, since command "port config all rss ..."
>>> using the grouping, I think it makes sense to have grouping.
>>>
>> The 'rss_offload_table[]' includes all defined RSS offloads in ethdev
>> layer, every iterm has one bit,
>> and is part of 'rss_type_table[]'. Some iterms in 'rss_type_table[]'
>> consist of multiple bits. If we
>> want to display all RSS offloads PMD supported and resolve undefined
>> offload, we have to check
>> 'flow_type_rss_offloads' bit by bit. However, "port config all rss ..."
>> and "show port 0 rss-hash"
>> commands supports the configuration and display of multiple offload bits
>> at a time. So it is necessary
>> to introduce this 'rss_offload_table[]' to display
>> 'flow_type_rss_offloads'. That's what I think.
>
> 'rss_type_table[]' has both group and individual types, so show
> functions displays both.
>
> A sample of grouping is UDP, a few UDP flags compined under UDP,
> #define RTE_ETH_RSS_UDP ( \
> RTE_ETH_RSS_NONFRAG_IPV4_UDP | \
> RTE_ETH_RSS_NONFRAG_IPV6_UDP | \
> RTE_ETH_RSS_IPV6_UDP_EX)
>
> Above mentioned commands use 'RTE_ETH_RSS_UDP' to set "udp" type RSS,
> and when displying instead of displaying each above type separately, I
> think displaying as "udp" makes sense.
>
> And again I believe having two different arrays is prone to error for
> future.
Agreed.
>
>>> Another thing is having two different array with very similar content
>>> is easy to confuse and can cause diversion on arrays and generate bugs.
>>>
>> Add some notes about the use of the 'rss_offload_table[]'?
>>>
>>> As mentioned from "port config all rss ..." command, it seems it is
>>> also not using 'rss_type_table[]', but all string to RSS type matching
>>> done within the function ('cmd_config_rss_parsed()') duplicating what
>>> we have in 'rss_type_table[]'. Again this has concern to diverge
>>> between set and show functions.
>>> If you have time for it, can you make an additional patch to update
>>> 'cmd_config_rss_parsed()' to use new 'str_to_rsstypes()' function?
>> All right. Let's fix it.
>
> Thanks, and if you want it can be a separate patch on top of this one,
> it doesn't have to be part of this set if you don't have time for it.
>
I think it's better to do it in this patch set. So I will do it.
>>>
>>> Thanks,
>>> ferruh
>>>
>>>> const struct rss_type_info rss_type_table[] = {
>>>> { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP
>>>> | RTE_ETH_RSS_TCP |
>>>> RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP |
>>>> RTE_ETH_RSS_L2_PAYLOAD |
>>>> @@ -675,6 +725,19 @@ print_dev_capabilities(uint64_t capabilities)
>>>> }
>>>> }
>>>>
>>>> +static const char *
>>>> +rss_offload_to_str(uint64_t rss_offload)
>>>> +{
>>>> + uint16_t i;
>>>> +
>>>> + for (i = 0; rss_offload_table[i].str != NULL; i++) {
>>>> + if (rss_offload_table[i].rss_type == rss_offload)
>>>> + return rss_offload_table[i].str;
>>>> + }
>>>> +
>>>> + return NULL;
>>>> +}
>>>> +
>>>> void
>>>> port_infos_display(portid_t port_id)
>>>> {
>>>> @@ -779,19 +842,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 = RTE_BIT64(i);
>>>> + if ((rss_offload_types & rss_offload) != 0) {
>>>> + const char *p =
>>>> + rss_offload_to_str(rss_offload);
>>>> + if (p)
>>>> + printf(" %s\n", p);
>>>> + else
>>>> + printf(" user defined
>>>> 0x%"PRIx64"\n",
>>>> + rss_offload);
>>>> + }
>>>
>>> If you go with 'rss_type_table[]', you need to change above logic as
>>> you did in your v2.
>>>
>>>> }
>>>> }
>>>>
>>>> --
>>>> 2.33.0
>>>>
>>>
>>> .
>
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 4/4] app/testpmd: remove duplicated flow type to string table
2022-06-20 12:38 ` Ferruh Yigit
@ 2022-06-21 2:18 ` lihuisong (C)
2022-06-21 7:51 ` Ferruh Yigit
0 siblings, 1 reply; 72+ messages in thread
From: lihuisong (C) @ 2022-06-21 2:18 UTC (permalink / raw)
To: Ferruh Yigit, xiaoyun.li, aman.deep.singh, yuying.zhang,
andrew.rybchenko
Cc: dev, thomas, huangdaode
在 2022/6/20 20:38, Ferruh Yigit 写道:
> On 6/9/2022 4:26 AM, lihuisong (C) wrote:
>> CAUTION: This message has originated from an External Source. Please
>> use proper judgment and caution when opening attachments, clicking
>> links, or responding to this email.
>>
>>
>> 在 2022/6/7 23:47, Ferruh Yigit 写道:
>>> On 6/7/2022 9:32 AM, Huisong Li wrote:
>>>
>>>>
>>>> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>>>
>>>> Flow type table has two instance, one is used for flow type to string
>>>> conversion, and other is used for string to flow type conversion.
>>>> And tables are diverged by time.
>>>>
>>>> Unifying tables to prevent maintaining two different tables.
>>>>
>>>> Note: made 'flowtype_to_str()' non-static to prevent build error
>>>> for the
>>>> case PMDs using it disables. Making function generic, not for some
>>>> PMDs.
>>>>
>>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>> ---
>>>> app/test-pmd/cmdline.c | 41 +------------------
>>>> app/test-pmd/config.c | 92
>>>> +++++++++++++++++++++++++++---------------
>>>> app/test-pmd/testpmd.h | 5 +++
>>>> 3 files changed, 65 insertions(+), 73 deletions(-)
>>>>
>>>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
>>>> index fdd0cada3b..e44bb3f475 100644
>>>> --- a/app/test-pmd/cmdline.c
>>>> +++ b/app/test-pmd/cmdline.c
>>>> @@ -10591,45 +10591,6 @@ do { \
>>>>
>>>> #ifdef RTE_NET_I40E
>>>>
>>>> -static uint16_t
>>>> -str2flowtype(char *string)
>>>> -{
>>>> - uint8_t i = 0;
>>>> - static const struct {
>>>> - char str[32];
>>>> - uint16_t type;
>>>> - } flowtype_str[] = {
>>>> - {"raw", RTE_ETH_FLOW_RAW},
>>>> - {"ipv4", RTE_ETH_FLOW_IPV4},
>>>> - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>>>> - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>>>> - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>>>> - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>>>> - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>>>> - {"ipv6", RTE_ETH_FLOW_IPV6},
>>>> - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>>>> - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>>>> - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>>>> - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>>>> - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>>>> - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>>>> - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>>>> - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>>>> - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>>>> - {"gtpu", RTE_ETH_FLOW_GTPU},
>>>> - };
>>>> -
>>>> - for (i = 0; i < RTE_DIM(flowtype_str); i++) {
>>>> - if (!strcmp(flowtype_str[i].str, string))
>>>> - return flowtype_str[i].type;
>>>> - }
>>>> -
>>>> - if (isdigit(string[0]) && atoi(string) > 0 && atoi(string)
>>>> < 64)
>>>> - return (uint16_t)atoi(string);
>>>> -
>>>> - return RTE_ETH_FLOW_UNKNOWN;
>>>> -}
>>>> -
>>>> /* *** deal with flow director filter *** */
>>>> struct cmd_flow_director_result {
>>>> cmdline_fixed_string_t flow_director_filter;
>>>> @@ -10658,7 +10619,7 @@ cmd_flow_director_filter_parsed(void
>>>> *parsed_result,
>>>> struct rte_pmd_i40e_flow_type_mapping
>>>> mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
>>>> struct rte_pmd_i40e_pkt_template_conf conf;
>>>> - uint16_t flow_type = str2flowtype(res->flow_type);
>>>> + uint16_t flow_type = str_to_flowtype(res->flow_type);
>>>> uint16_t i, port = res->port_id;
>>>> uint8_t add;
>>>>
>>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>>>> index 209cbcc514..ed0be8036b 100644
>>>> --- a/app/test-pmd/config.c
>>>> +++ b/app/test-pmd/config.c
>>>> @@ -86,6 +86,38 @@ static const struct {
>>>> },
>>>> };
>>>>
>>>> +#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>>>> +
>>>
>>> Although right now 'flowtype_to_str()' & 'str_to_flowtype()' are used
>>> by code for above PMDs, the functionality is nothing special to any
>>> PMD.
>>> What about making above functions as non-static functions and get rid
>>> of all related #ifdef?
>>>
>> Currently, they are not used anywhere but here. If remove #ifdef, a
>> warning will encounter.
>
> If you make functions non-static, I think there won't be any warnings.
>
> It is better to make functionality more generic, instead of PMD specific.
These codes has been moved to i40e PMD. Can we remove this patch from
the set?
>
>>>
>>>> +static const struct {
>>>> + char str[32];
>>>> + uint16_t ftype;
>>>> +} flowtype_str_table[] = {
>>>> + {"raw", RTE_ETH_FLOW_RAW},
>>>> + {"ipv4", RTE_ETH_FLOW_IPV4},
>>>> + {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>>>> + {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>>>> + {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>>>> + {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>>>> + {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>>>> + {"ipv6", RTE_ETH_FLOW_IPV6},
>>>> + {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>>>> + {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>>>> + {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>>>> + {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>>>> + {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>>>> + {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>>>> + {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>>>> + {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>>>> + {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>>>> + {"port", RTE_ETH_FLOW_PORT},
>>>> + {"vxlan", RTE_ETH_FLOW_VXLAN},
>>>> + {"geneve", RTE_ETH_FLOW_GENEVE},
>>>> + {"nvgre", RTE_ETH_FLOW_NVGRE},
>>>> + {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
>>>> + {"gtpu", RTE_ETH_FLOW_GTPU},
>>>> +};
>>>> +#endif
>>>> +
>>>> const struct rss_type_info rss_offload_table[] = {
>>>> {"ipv4", RTE_ETH_RSS_IPV4},
>>>> {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
>>>> @@ -5713,41 +5745,35 @@ set_record_burst_stats(uint8_t on_off)
>>>> record_burst_stats = on_off;
>>>> }
>>>>
>>>> +#ifdef RTE_NET_I40E
>>>> +
>>>> +uint16_t
>>>> +str_to_flowtype(const char *string)
>>>> +{
>>>> + uint8_t i;
>>>> +
>>>> + for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
>>>> + if (!strcmp(flowtype_str_table[i].str, string))
>>>> + return flowtype_str_table[i].ftype;
>>>> + }
>>>> +
>>>> + if (isdigit(string[0])) {
>>>> + int val = atoi(string);
>>>> + if (val > 0 && val < 64)
>>>> + return (uint16_t)val;
>>>> + }
>>>> +
>>>> + return RTE_ETH_FLOW_UNKNOWN;
>>>> +}
>>>> +
>>>> +#endif /* RTE_NET_I40E */
>>>> +
>>>> #if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>>>> -static char*
>>>> +
>>>> +static const char*
>>>> flowtype_to_str(uint16_t flow_type)
>>>> {
>>>> - struct flow_type_info {
>>>> - char str[32];
>>>> - uint16_t ftype;
>>>> - };
>>>> -
>>>> uint8_t i;
>>>> - static struct flow_type_info flowtype_str_table[] = {
>>>> - {"raw", RTE_ETH_FLOW_RAW},
>>>> - {"ipv4", RTE_ETH_FLOW_IPV4},
>>>> - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>>>> - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>>>> - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>>>> - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>>>> - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>>>> - {"ipv6", RTE_ETH_FLOW_IPV6},
>>>> - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>>>> - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>>>> - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>>>> - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>>>> - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>>>> - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>>>> - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>>>> - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>>>> - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>>>> - {"port", RTE_ETH_FLOW_PORT},
>>>> - {"vxlan", RTE_ETH_FLOW_VXLAN},
>>>> - {"geneve", RTE_ETH_FLOW_GENEVE},
>>>> - {"nvgre", RTE_ETH_FLOW_NVGRE},
>>>> - {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
>>>> - {"gtpu", RTE_ETH_FLOW_GTPU},
>>>> - };
>>>>
>>>> for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
>>>> if (flowtype_str_table[i].ftype == flow_type)
>>>> @@ -5821,7 +5847,7 @@ print_fdir_flex_mask(struct
>>>> rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
>>>> {
>>>> struct rte_eth_fdir_flex_mask *mask;
>>>> uint32_t i, j;
>>>> - char *p;
>>>> + const char *p;
>>>>
>>>> for (i = 0; i < flex_conf->nb_flexmasks; i++) {
>>>> mask = &flex_conf->flex_mask[i];
>>>> @@ -5837,7 +5863,7 @@ static inline void
>>>> print_fdir_flow_type(uint32_t flow_types_mask)
>>>> {
>>>> int i;
>>>> - char *p;
>>>> + const char *p;
>>>>
>>>> for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
>>>> if (!(flow_types_mask & (1 << i)))
>>>> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
>>>> index 6693813dda..b7931a2bee 100644
>>>> --- a/app/test-pmd/testpmd.h
>>>> +++ b/app/test-pmd/testpmd.h
>>>> @@ -1086,6 +1086,11 @@ void pmd_test_exit(void);
>>>> #if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>>>> void fdir_get_infos(portid_t port_id);
>>>> #endif
>>>> +
>>>> +#ifdef RTE_NET_I40E
>>>> +uint16_t str_to_flowtype(const char *string);
>>>> +#endif
>>>> +
>>>> void fdir_set_flex_mask(portid_t port_id,
>>>> struct rte_eth_fdir_flex_mask *cfg);
>>>> void fdir_set_flex_payload(portid_t port_id,
>>>> --
>>>> 2.33.0
>>>>
>>>
>>> .
>
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 4/4] app/testpmd: remove duplicated flow type to string table
2022-06-21 2:18 ` lihuisong (C)
@ 2022-06-21 7:51 ` Ferruh Yigit
2022-06-21 12:21 ` lihuisong (C)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-21 7:51 UTC (permalink / raw)
To: lihuisong (C),
xiaoyun.li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode
On 6/21/2022 3:18 AM, lihuisong (C) wrote:
> CAUTION: This message has originated from an External Source. Please use
> proper judgment and caution when opening attachments, clicking links, or
> responding to this email.
>
>
> 在 2022/6/20 20:38, Ferruh Yigit 写道:
>> On 6/9/2022 4:26 AM, lihuisong (C) wrote:
>>> CAUTION: This message has originated from an External Source. Please
>>> use proper judgment and caution when opening attachments, clicking
>>> links, or responding to this email.
>>>
>>>
>>> 在 2022/6/7 23:47, Ferruh Yigit 写道:
>>>> On 6/7/2022 9:32 AM, Huisong Li wrote:
>>>>
>>>>>
>>>>> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>>>>
>>>>> Flow type table has two instance, one is used for flow type to string
>>>>> conversion, and other is used for string to flow type conversion.
>>>>> And tables are diverged by time.
>>>>>
>>>>> Unifying tables to prevent maintaining two different tables.
>>>>>
>>>>> Note: made 'flowtype_to_str()' non-static to prevent build error
>>>>> for the
>>>>> case PMDs using it disables. Making function generic, not for some
>>>>> PMDs.
>>>>>
>>>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>>> ---
>>>>> app/test-pmd/cmdline.c | 41 +------------------
>>>>> app/test-pmd/config.c | 92
>>>>> +++++++++++++++++++++++++++---------------
>>>>> app/test-pmd/testpmd.h | 5 +++
>>>>> 3 files changed, 65 insertions(+), 73 deletions(-)
>>>>>
>>>>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
>>>>> index fdd0cada3b..e44bb3f475 100644
>>>>> --- a/app/test-pmd/cmdline.c
>>>>> +++ b/app/test-pmd/cmdline.c
>>>>> @@ -10591,45 +10591,6 @@ do { \
>>>>>
>>>>> #ifdef RTE_NET_I40E
>>>>>
>>>>> -static uint16_t
>>>>> -str2flowtype(char *string)
>>>>> -{
>>>>> - uint8_t i = 0;
>>>>> - static const struct {
>>>>> - char str[32];
>>>>> - uint16_t type;
>>>>> - } flowtype_str[] = {
>>>>> - {"raw", RTE_ETH_FLOW_RAW},
>>>>> - {"ipv4", RTE_ETH_FLOW_IPV4},
>>>>> - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>>>>> - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>>>>> - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>>>>> - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>>>>> - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>>>>> - {"ipv6", RTE_ETH_FLOW_IPV6},
>>>>> - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>>>>> - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>>>>> - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>>>>> - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>>>>> - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>>>>> - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>>>>> - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>>>>> - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>>>>> - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>>>>> - {"gtpu", RTE_ETH_FLOW_GTPU},
>>>>> - };
>>>>> -
>>>>> - for (i = 0; i < RTE_DIM(flowtype_str); i++) {
>>>>> - if (!strcmp(flowtype_str[i].str, string))
>>>>> - return flowtype_str[i].type;
>>>>> - }
>>>>> -
>>>>> - if (isdigit(string[0]) && atoi(string) > 0 && atoi(string)
>>>>> < 64)
>>>>> - return (uint16_t)atoi(string);
>>>>> -
>>>>> - return RTE_ETH_FLOW_UNKNOWN;
>>>>> -}
>>>>> -
>>>>> /* *** deal with flow director filter *** */
>>>>> struct cmd_flow_director_result {
>>>>> cmdline_fixed_string_t flow_director_filter;
>>>>> @@ -10658,7 +10619,7 @@ cmd_flow_director_filter_parsed(void
>>>>> *parsed_result,
>>>>> struct rte_pmd_i40e_flow_type_mapping
>>>>> mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
>>>>> struct rte_pmd_i40e_pkt_template_conf conf;
>>>>> - uint16_t flow_type = str2flowtype(res->flow_type);
>>>>> + uint16_t flow_type = str_to_flowtype(res->flow_type);
>>>>> uint16_t i, port = res->port_id;
>>>>> uint8_t add;
>>>>>
>>>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>>>>> index 209cbcc514..ed0be8036b 100644
>>>>> --- a/app/test-pmd/config.c
>>>>> +++ b/app/test-pmd/config.c
>>>>> @@ -86,6 +86,38 @@ static const struct {
>>>>> },
>>>>> };
>>>>>
>>>>> +#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>>>>> +
>>>>
>>>> Although right now 'flowtype_to_str()' & 'str_to_flowtype()' are used
>>>> by code for above PMDs, the functionality is nothing special to any
>>>> PMD.
>>>> What about making above functions as non-static functions and get rid
>>>> of all related #ifdef?
>>>>
>>> Currently, they are not used anywhere but here. If remove #ifdef, a
>>> warning will encounter.
>>
>> If you make functions non-static, I think there won't be any warnings.
>>
>> It is better to make functionality more generic, instead of PMD specific.
> These codes has been moved to i40e PMD. Can we remove this patch from
> the set?
There are two set of arrays, one moved to i40e folder, other not, right?
I think better to move 'str2flowtype()' back to testpmd and unify
arrays. As discussed above it is not i40e specific.
>>
>>>>
>>>>> +static const struct {
>>>>> + char str[32];
>>>>> + uint16_t ftype;
>>>>> +} flowtype_str_table[] = {
>>>>> + {"raw", RTE_ETH_FLOW_RAW},
>>>>> + {"ipv4", RTE_ETH_FLOW_IPV4},
>>>>> + {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>>>>> + {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>>>>> + {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>>>>> + {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>>>>> + {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>>>>> + {"ipv6", RTE_ETH_FLOW_IPV6},
>>>>> + {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>>>>> + {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>>>>> + {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>>>>> + {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>>>>> + {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>>>>> + {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>>>>> + {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>>>>> + {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>>>>> + {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>>>>> + {"port", RTE_ETH_FLOW_PORT},
>>>>> + {"vxlan", RTE_ETH_FLOW_VXLAN},
>>>>> + {"geneve", RTE_ETH_FLOW_GENEVE},
>>>>> + {"nvgre", RTE_ETH_FLOW_NVGRE},
>>>>> + {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
>>>>> + {"gtpu", RTE_ETH_FLOW_GTPU},
>>>>> +};
>>>>> +#endif
>>>>> +
>>>>> const struct rss_type_info rss_offload_table[] = {
>>>>> {"ipv4", RTE_ETH_RSS_IPV4},
>>>>> {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
>>>>> @@ -5713,41 +5745,35 @@ set_record_burst_stats(uint8_t on_off)
>>>>> record_burst_stats = on_off;
>>>>> }
>>>>>
>>>>> +#ifdef RTE_NET_I40E
>>>>> +
>>>>> +uint16_t
>>>>> +str_to_flowtype(const char *string)
>>>>> +{
>>>>> + uint8_t i;
>>>>> +
>>>>> + for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
>>>>> + if (!strcmp(flowtype_str_table[i].str, string))
>>>>> + return flowtype_str_table[i].ftype;
>>>>> + }
>>>>> +
>>>>> + if (isdigit(string[0])) {
>>>>> + int val = atoi(string);
>>>>> + if (val > 0 && val < 64)
>>>>> + return (uint16_t)val;
>>>>> + }
>>>>> +
>>>>> + return RTE_ETH_FLOW_UNKNOWN;
>>>>> +}
>>>>> +
>>>>> +#endif /* RTE_NET_I40E */
>>>>> +
>>>>> #if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>>>>> -static char*
>>>>> +
>>>>> +static const char*
>>>>> flowtype_to_str(uint16_t flow_type)
>>>>> {
>>>>> - struct flow_type_info {
>>>>> - char str[32];
>>>>> - uint16_t ftype;
>>>>> - };
>>>>> -
>>>>> uint8_t i;
>>>>> - static struct flow_type_info flowtype_str_table[] = {
>>>>> - {"raw", RTE_ETH_FLOW_RAW},
>>>>> - {"ipv4", RTE_ETH_FLOW_IPV4},
>>>>> - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>>>>> - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>>>>> - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>>>>> - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>>>>> - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>>>>> - {"ipv6", RTE_ETH_FLOW_IPV6},
>>>>> - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>>>>> - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>>>>> - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>>>>> - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>>>>> - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>>>>> - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>>>>> - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>>>>> - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>>>>> - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>>>>> - {"port", RTE_ETH_FLOW_PORT},
>>>>> - {"vxlan", RTE_ETH_FLOW_VXLAN},
>>>>> - {"geneve", RTE_ETH_FLOW_GENEVE},
>>>>> - {"nvgre", RTE_ETH_FLOW_NVGRE},
>>>>> - {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
>>>>> - {"gtpu", RTE_ETH_FLOW_GTPU},
>>>>> - };
>>>>>
>>>>> for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
>>>>> if (flowtype_str_table[i].ftype == flow_type)
>>>>> @@ -5821,7 +5847,7 @@ print_fdir_flex_mask(struct
>>>>> rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
>>>>> {
>>>>> struct rte_eth_fdir_flex_mask *mask;
>>>>> uint32_t i, j;
>>>>> - char *p;
>>>>> + const char *p;
>>>>>
>>>>> for (i = 0; i < flex_conf->nb_flexmasks; i++) {
>>>>> mask = &flex_conf->flex_mask[i];
>>>>> @@ -5837,7 +5863,7 @@ static inline void
>>>>> print_fdir_flow_type(uint32_t flow_types_mask)
>>>>> {
>>>>> int i;
>>>>> - char *p;
>>>>> + const char *p;
>>>>>
>>>>> for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
>>>>> if (!(flow_types_mask & (1 << i)))
>>>>> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
>>>>> index 6693813dda..b7931a2bee 100644
>>>>> --- a/app/test-pmd/testpmd.h
>>>>> +++ b/app/test-pmd/testpmd.h
>>>>> @@ -1086,6 +1086,11 @@ void pmd_test_exit(void);
>>>>> #if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>>>>> void fdir_get_infos(portid_t port_id);
>>>>> #endif
>>>>> +
>>>>> +#ifdef RTE_NET_I40E
>>>>> +uint16_t str_to_flowtype(const char *string);
>>>>> +#endif
>>>>> +
>>>>> void fdir_set_flex_mask(portid_t port_id,
>>>>> struct rte_eth_fdir_flex_mask *cfg);
>>>>> void fdir_set_flex_payload(portid_t port_id,
>>>>> --
>>>>> 2.33.0
>>>>>
>>>>
>>>> .
>>
>> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V3 app/testpmd 4/4] app/testpmd: remove duplicated flow type to string table
2022-06-21 7:51 ` Ferruh Yigit
@ 2022-06-21 12:21 ` lihuisong (C)
0 siblings, 0 replies; 72+ messages in thread
From: lihuisong (C) @ 2022-06-21 12:21 UTC (permalink / raw)
To: Ferruh Yigit, xiaoyun.li, aman.deep.singh, yuying.zhang,
andrew.rybchenko
Cc: dev, thomas, huangdaode
在 2022/6/21 15:51, Ferruh Yigit 写道:
> On 6/21/2022 3:18 AM, lihuisong (C) wrote:
>> CAUTION: This message has originated from an External Source. Please
>> use proper judgment and caution when opening attachments, clicking
>> links, or responding to this email.
>>
>>
>> 在 2022/6/20 20:38, Ferruh Yigit 写道:
>>> On 6/9/2022 4:26 AM, lihuisong (C) wrote:
>>>> CAUTION: This message has originated from an External Source. Please
>>>> use proper judgment and caution when opening attachments, clicking
>>>> links, or responding to this email.
>>>>
>>>>
>>>> 在 2022/6/7 23:47, Ferruh Yigit 写道:
>>>>> On 6/7/2022 9:32 AM, Huisong Li wrote:
>>>>>
>>>>>>
>>>>>> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>>>>>
>>>>>> Flow type table has two instance, one is used for flow type to
>>>>>> string
>>>>>> conversion, and other is used for string to flow type conversion.
>>>>>> And tables are diverged by time.
>>>>>>
>>>>>> Unifying tables to prevent maintaining two different tables.
>>>>>>
>>>>>> Note: made 'flowtype_to_str()' non-static to prevent build error
>>>>>> for the
>>>>>> case PMDs using it disables. Making function generic, not for some
>>>>>> PMDs.
>>>>>>
>>>>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>>>> ---
>>>>>> app/test-pmd/cmdline.c | 41 +------------------
>>>>>> app/test-pmd/config.c | 92
>>>>>> +++++++++++++++++++++++++++---------------
>>>>>> app/test-pmd/testpmd.h | 5 +++
>>>>>> 3 files changed, 65 insertions(+), 73 deletions(-)
>>>>>>
>>>>>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
>>>>>> index fdd0cada3b..e44bb3f475 100644
>>>>>> --- a/app/test-pmd/cmdline.c
>>>>>> +++ b/app/test-pmd/cmdline.c
>>>>>> @@ -10591,45 +10591,6 @@ do { \
>>>>>>
>>>>>> #ifdef RTE_NET_I40E
>>>>>>
>>>>>> -static uint16_t
>>>>>> -str2flowtype(char *string)
>>>>>> -{
>>>>>> - uint8_t i = 0;
>>>>>> - static const struct {
>>>>>> - char str[32];
>>>>>> - uint16_t type;
>>>>>> - } flowtype_str[] = {
>>>>>> - {"raw", RTE_ETH_FLOW_RAW},
>>>>>> - {"ipv4", RTE_ETH_FLOW_IPV4},
>>>>>> - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>>>>>> - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>>>>>> - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>>>>>> - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>>>>>> - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>>>>>> - {"ipv6", RTE_ETH_FLOW_IPV6},
>>>>>> - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>>>>>> - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>>>>>> - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>>>>>> - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>>>>>> - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>>>>>> - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>>>>>> - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>>>>>> - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>>>>>> - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>>>>>> - {"gtpu", RTE_ETH_FLOW_GTPU},
>>>>>> - };
>>>>>> -
>>>>>> - for (i = 0; i < RTE_DIM(flowtype_str); i++) {
>>>>>> - if (!strcmp(flowtype_str[i].str, string))
>>>>>> - return flowtype_str[i].type;
>>>>>> - }
>>>>>> -
>>>>>> - if (isdigit(string[0]) && atoi(string) > 0 && atoi(string)
>>>>>> < 64)
>>>>>> - return (uint16_t)atoi(string);
>>>>>> -
>>>>>> - return RTE_ETH_FLOW_UNKNOWN;
>>>>>> -}
>>>>>> -
>>>>>> /* *** deal with flow director filter *** */
>>>>>> struct cmd_flow_director_result {
>>>>>> cmdline_fixed_string_t flow_director_filter;
>>>>>> @@ -10658,7 +10619,7 @@ cmd_flow_director_filter_parsed(void
>>>>>> *parsed_result,
>>>>>> struct rte_pmd_i40e_flow_type_mapping
>>>>>> mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
>>>>>> struct rte_pmd_i40e_pkt_template_conf conf;
>>>>>> - uint16_t flow_type = str2flowtype(res->flow_type);
>>>>>> + uint16_t flow_type = str_to_flowtype(res->flow_type);
>>>>>> uint16_t i, port = res->port_id;
>>>>>> uint8_t add;
>>>>>>
>>>>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>>>>>> index 209cbcc514..ed0be8036b 100644
>>>>>> --- a/app/test-pmd/config.c
>>>>>> +++ b/app/test-pmd/config.c
>>>>>> @@ -86,6 +86,38 @@ static const struct {
>>>>>> },
>>>>>> };
>>>>>>
>>>>>> +#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>>>>>> +
>>>>>
>>>>> Although right now 'flowtype_to_str()' & 'str_to_flowtype()' are used
>>>>> by code for above PMDs, the functionality is nothing special to any
>>>>> PMD.
>>>>> What about making above functions as non-static functions and get rid
>>>>> of all related #ifdef?
>>>>>
>>>> Currently, they are not used anywhere but here. If remove #ifdef, a
>>>> warning will encounter.
>>>
>>> If you make functions non-static, I think there won't be any warnings.
>>>
>>> It is better to make functionality more generic, instead of PMD
>>> specific.
>> These codes has been moved to i40e PMD. Can we remove this patch from
>> the set?
>
> There are two set of arrays, one moved to i40e folder, other not, right?
>
> I think better to move 'str2flowtype()' back to testpmd and unify
> arrays. As discussed above it is not i40e specific.
Ok.
>>>
>>>>>
>>>>>> +static const struct {
>>>>>> + char str[32];
>>>>>> + uint16_t ftype;
>>>>>> +} flowtype_str_table[] = {
>>>>>> + {"raw", RTE_ETH_FLOW_RAW},
>>>>>> + {"ipv4", RTE_ETH_FLOW_IPV4},
>>>>>> + {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>>>>>> + {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>>>>>> + {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>>>>>> + {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>>>>>> + {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>>>>>> + {"ipv6", RTE_ETH_FLOW_IPV6},
>>>>>> + {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>>>>>> + {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>>>>>> + {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>>>>>> + {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>>>>>> + {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>>>>>> + {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>>>>>> + {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>>>>>> + {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>>>>>> + {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>>>>>> + {"port", RTE_ETH_FLOW_PORT},
>>>>>> + {"vxlan", RTE_ETH_FLOW_VXLAN},
>>>>>> + {"geneve", RTE_ETH_FLOW_GENEVE},
>>>>>> + {"nvgre", RTE_ETH_FLOW_NVGRE},
>>>>>> + {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
>>>>>> + {"gtpu", RTE_ETH_FLOW_GTPU},
>>>>>> +};
>>>>>> +#endif
>>>>>> +
>>>>>> const struct rss_type_info rss_offload_table[] = {
>>>>>> {"ipv4", RTE_ETH_RSS_IPV4},
>>>>>> {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4},
>>>>>> @@ -5713,41 +5745,35 @@ set_record_burst_stats(uint8_t on_off)
>>>>>> record_burst_stats = on_off;
>>>>>> }
>>>>>>
>>>>>> +#ifdef RTE_NET_I40E
>>>>>> +
>>>>>> +uint16_t
>>>>>> +str_to_flowtype(const char *string)
>>>>>> +{
>>>>>> + uint8_t i;
>>>>>> +
>>>>>> + for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
>>>>>> + if (!strcmp(flowtype_str_table[i].str, string))
>>>>>> + return flowtype_str_table[i].ftype;
>>>>>> + }
>>>>>> +
>>>>>> + if (isdigit(string[0])) {
>>>>>> + int val = atoi(string);
>>>>>> + if (val > 0 && val < 64)
>>>>>> + return (uint16_t)val;
>>>>>> + }
>>>>>> +
>>>>>> + return RTE_ETH_FLOW_UNKNOWN;
>>>>>> +}
>>>>>> +
>>>>>> +#endif /* RTE_NET_I40E */
>>>>>> +
>>>>>> #if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>>>>>> -static char*
>>>>>> +
>>>>>> +static const char*
>>>>>> flowtype_to_str(uint16_t flow_type)
>>>>>> {
>>>>>> - struct flow_type_info {
>>>>>> - char str[32];
>>>>>> - uint16_t ftype;
>>>>>> - };
>>>>>> -
>>>>>> uint8_t i;
>>>>>> - static struct flow_type_info flowtype_str_table[] = {
>>>>>> - {"raw", RTE_ETH_FLOW_RAW},
>>>>>> - {"ipv4", RTE_ETH_FLOW_IPV4},
>>>>>> - {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
>>>>>> - {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
>>>>>> - {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
>>>>>> - {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
>>>>>> - {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
>>>>>> - {"ipv6", RTE_ETH_FLOW_IPV6},
>>>>>> - {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
>>>>>> - {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
>>>>>> - {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
>>>>>> - {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
>>>>>> - {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
>>>>>> - {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
>>>>>> - {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
>>>>>> - {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
>>>>>> - {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
>>>>>> - {"port", RTE_ETH_FLOW_PORT},
>>>>>> - {"vxlan", RTE_ETH_FLOW_VXLAN},
>>>>>> - {"geneve", RTE_ETH_FLOW_GENEVE},
>>>>>> - {"nvgre", RTE_ETH_FLOW_NVGRE},
>>>>>> - {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
>>>>>> - {"gtpu", RTE_ETH_FLOW_GTPU},
>>>>>> - };
>>>>>>
>>>>>> for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
>>>>>> if (flowtype_str_table[i].ftype == flow_type)
>>>>>> @@ -5821,7 +5847,7 @@ print_fdir_flex_mask(struct
>>>>>> rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
>>>>>> {
>>>>>> struct rte_eth_fdir_flex_mask *mask;
>>>>>> uint32_t i, j;
>>>>>> - char *p;
>>>>>> + const char *p;
>>>>>>
>>>>>> for (i = 0; i < flex_conf->nb_flexmasks; i++) {
>>>>>> mask = &flex_conf->flex_mask[i];
>>>>>> @@ -5837,7 +5863,7 @@ static inline void
>>>>>> print_fdir_flow_type(uint32_t flow_types_mask)
>>>>>> {
>>>>>> int i;
>>>>>> - char *p;
>>>>>> + const char *p;
>>>>>>
>>>>>> for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
>>>>>> if (!(flow_types_mask & (1 << i)))
>>>>>> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
>>>>>> index 6693813dda..b7931a2bee 100644
>>>>>> --- a/app/test-pmd/testpmd.h
>>>>>> +++ b/app/test-pmd/testpmd.h
>>>>>> @@ -1086,6 +1086,11 @@ void pmd_test_exit(void);
>>>>>> #if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
>>>>>> void fdir_get_infos(portid_t port_id);
>>>>>> #endif
>>>>>> +
>>>>>> +#ifdef RTE_NET_I40E
>>>>>> +uint16_t str_to_flowtype(const char *string);
>>>>>> +#endif
>>>>>> +
>>>>>> void fdir_set_flex_mask(portid_t port_id,
>>>>>> struct rte_eth_fdir_flex_mask *cfg);
>>>>>> void fdir_set_flex_payload(portid_t port_id,
>>>>>> --
>>>>>> 2.33.0
>>>>>>
>>>>>
>>>>> .
>>>
>>> .
>
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V4 0/7] app/testpmd: fix RSS and flow type
2022-04-29 10:24 [PATCH V2 0/2] fix RSS types display Huisong Li
` (2 preceding siblings ...)
2022-06-07 8:32 ` [PATCH V3 app/testpmd 0/4] fix RSS types and flow type Huisong Li
@ 2022-06-24 4:12 ` Huisong Li
2022-06-24 4:12 ` [PATCH V4 1/7] app/testpmd: fix supported RSS offload display Huisong Li
` (6 more replies)
2022-06-24 7:23 ` [PATCH V5 0/7] app/testpmd: fix RSS and flow type Huisong Li
2022-06-29 8:34 ` [PATCH V6 0/8] " Huisong Li
5 siblings, 7 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-24 4:12 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
This patchset fix RSS related code and remove duplicated flow type to
string table.
---
v4:
- delete 'rss_offload_table[]' and use 'rss_type_table[]'
- add an 'char_num_per_line' parameter to control RSS types display.
- add 2/7, 3/7 and 6/7 patch.
v3:
- add 'rss_offload_table[]' to display supported RSS offload.
- add patch 3/4 and 4/4.
v2:
- resovle compilation failure when disable i40e and ixgbe.
Ferruh Yigit (2):
app/testpmd: compact RSS types output in some commands
app/testpmd: remove duplicated flow type to string table
Huisong Li (5):
app/testpmd: fix supported RSS offload display
app/testpmd: unify the name of L2 payload offload
app/testpmd: refactor config all RSS command
app/testpmd: unify RSS types display
app/testpmd: reorder elements in RSS type table array
app/test-pmd/cmdline.c | 127 +++-------
app/test-pmd/config.c | 263 +++++++++++++-------
app/test-pmd/testpmd.h | 8 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +-
drivers/net/i40e/i40e_testpmd.c | 41 +--
5 files changed, 228 insertions(+), 222 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V4 1/7] app/testpmd: fix supported RSS offload display
2022-06-24 4:12 ` [PATCH V4 0/7] app/testpmd: fix RSS and flow type Huisong Li
@ 2022-06-24 4:12 ` Huisong Li
2022-06-24 4:12 ` [PATCH V4 2/7] app/testpmd: unify the name of L2 payload offload Huisong Li
` (5 subsequent siblings)
6 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-24 4:12 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
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.
In addition, offloads that are not in rss_type_table[] should be displayed
as "unknown offload xxx", instead of "user defined 63". So this patch fixes
it.
Fixes: b12964f621dc ("ethdev: unification of RSS offload types")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
---
app/test-pmd/config.c | 40 ++++++++++++++++++++++++++--------------
app/test-pmd/testpmd.h | 2 ++
2 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 62833fe97c..36a828307c 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;
@@ -675,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities)
}
}
+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)
{
@@ -779,19 +790,20 @@ 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 = RTE_BIT64(i);
+ if ((rss_offload_types & rss_offload) != 0) {
+ const char *p = rsstypes_to_str(rss_offload);
+ if (p)
+ printf(" %s\n", p);
+ else
+ printf(" unknown_offload(BIT(%u))\n",
+ i);
+ }
}
}
@@ -5604,6 +5616,8 @@ 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)
{
@@ -5647,8 +5661,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)
{
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index eeefb5e70f..195488b602 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1199,6 +1199,8 @@ extern int flow_parse(const char *src, void *result, unsigned int size,
struct rte_flow_item **pattern,
struct rte_flow_action **actions);
+const char *rsstypes_to_str(uint64_t rss_type);
+
/* For registering driver specific testpmd commands. */
struct testpmd_driver_commands {
TAILQ_ENTRY(testpmd_driver_commands) next;
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V4 2/7] app/testpmd: unify the name of L2 payload offload
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 ` Huisong Li
2022-06-24 4:12 ` [PATCH V4 3/7] app/testpmd: refactor config all RSS command Huisong Li
` (4 subsequent siblings)
6 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-24 4:12 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
Currently, the "port config all rss xx" command uses 'ether' name to match
and to set 'RTE_ETH_RSS_L2_PAYLOAD' offload. However, others RSS command,
such as, "port config <port_id> rss-hash-key" and "show port <port_id>
rss-hash key", use 'l2-payload' to represent this offload. So this patch
unifies the name of 'RTE_ETH_RSS_L2_PAYLOAD' offload.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/cmdline.c | 6 +++---
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 9a7fd5fc35..a701bac953 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -694,7 +694,7 @@ static void cmd_help_long_parsed(void *parsed_result,
"receive buffers available.\n\n"
"port config all rss (all|default|ip|tcp|udp|sctp|"
- "ether|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
+ "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
"none|level-default|level-outer|level-inner|<flowtype_id>)\n"
" Set the RSS mode.\n\n"
@@ -2080,7 +2080,7 @@ cmd_config_rss_parsed(void *parsed_result,
rss_conf.rss_hf = RTE_ETH_RSS_TCP;
else if (!strcmp(res->value, "sctp"))
rss_conf.rss_hf = RTE_ETH_RSS_SCTP;
- else if (!strcmp(res->value, "ether"))
+ else if (!strcmp(res->value, "l2_payload"))
rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD;
else if (!strcmp(res->value, "port"))
rss_conf.rss_hf = RTE_ETH_RSS_PORT;
@@ -2203,7 +2203,7 @@ static cmdline_parse_inst_t cmd_config_rss = {
.f = cmd_config_rss_parsed,
.data = NULL,
.help_str = "port config all rss "
- "all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|"
+ "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|"
"nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|"
"none|level-default|level-outer|level-inner|<flowtype_id>",
.tokens = {
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 0b7a53fdf1..cc299cff6c 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2144,7 +2144,7 @@ port config - RSS
Set the RSS (Receive Side Scaling) mode on or off::
- testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
+ testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
RSS is on by default.
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V4 3/7] app/testpmd: refactor config all RSS command
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 ` Huisong Li
2022-06-24 4:12 ` [PATCH V4 4/7] app/testpmd: unify RSS types display Huisong Li
` (3 subsequent siblings)
6 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-24 4:12 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
The "port config <port_id> rss-hash-key" and "show port <port_id> rss-hash
key" commands both use the 'rss_type_table[]' to get 'rss_types' or the RSS
type name. So this patch uses the 'rss_type_table[]' to get the rss types.
In this way, this command naturally supports more individual types.
Suggested-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/cmdline.c | 127 ++++++--------------
app/test-pmd/config.c | 20 ++-
app/test-pmd/testpmd.h | 1 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +-
4 files changed, 63 insertions(+), 96 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index a701bac953..bea869ce56 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -693,9 +693,14 @@ static void cmd_help_long_parsed(void *parsed_result,
" Enable or disable packet drop on all RX queues of all ports when no "
"receive buffers available.\n\n"
- "port config all rss (all|default|ip|tcp|udp|sctp|"
- "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
- "none|level-default|level-outer|level-inner|<flowtype_id>)\n"
+ "port config all rss (all|default|level-default|level-outer|level-inner|"
+ "ip|tcp|udp|sctp|tunnel|vlan|none|"
+ "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
+ "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
+ "l2_payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|"
+ "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|"
+ "l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|"
+ "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)\n"
" Set the RSS mode.\n\n"
"port config port-id rss reta (hash,queue)[,(hash,queue)]\n"
@@ -2062,81 +2067,7 @@ cmd_config_rss_parsed(void *parsed_result,
uint16_t i;
int ret;
- if (!strcmp(res->value, "all"))
- rss_conf.rss_hf = RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP |
- RTE_ETH_RSS_TCP | RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP |
- RTE_ETH_RSS_L2_PAYLOAD | RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP |
- RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP | RTE_ETH_RSS_GTPU |
- RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_L2TPV2;
- else if (!strcmp(res->value, "eth"))
- rss_conf.rss_hf = RTE_ETH_RSS_ETH;
- else if (!strcmp(res->value, "vlan"))
- rss_conf.rss_hf = RTE_ETH_RSS_VLAN;
- else if (!strcmp(res->value, "ip"))
- rss_conf.rss_hf = RTE_ETH_RSS_IP;
- else if (!strcmp(res->value, "udp"))
- rss_conf.rss_hf = RTE_ETH_RSS_UDP;
- else if (!strcmp(res->value, "tcp"))
- rss_conf.rss_hf = RTE_ETH_RSS_TCP;
- else if (!strcmp(res->value, "sctp"))
- rss_conf.rss_hf = RTE_ETH_RSS_SCTP;
- else if (!strcmp(res->value, "l2_payload"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD;
- else if (!strcmp(res->value, "port"))
- rss_conf.rss_hf = RTE_ETH_RSS_PORT;
- else if (!strcmp(res->value, "vxlan"))
- rss_conf.rss_hf = RTE_ETH_RSS_VXLAN;
- else if (!strcmp(res->value, "geneve"))
- rss_conf.rss_hf = RTE_ETH_RSS_GENEVE;
- else if (!strcmp(res->value, "nvgre"))
- rss_conf.rss_hf = RTE_ETH_RSS_NVGRE;
- else if (!strcmp(res->value, "l3-pre32"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE32;
- else if (!strcmp(res->value, "l3-pre40"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE40;
- else if (!strcmp(res->value, "l3-pre48"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE48;
- else if (!strcmp(res->value, "l3-pre56"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE56;
- else if (!strcmp(res->value, "l3-pre64"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE64;
- else if (!strcmp(res->value, "l3-pre96"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE96;
- else if (!strcmp(res->value, "l3-src-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_SRC_ONLY;
- else if (!strcmp(res->value, "l3-dst-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_DST_ONLY;
- else if (!strcmp(res->value, "l4-src-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L4_SRC_ONLY;
- else if (!strcmp(res->value, "l4-dst-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L4_DST_ONLY;
- else if (!strcmp(res->value, "l2-src-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2_SRC_ONLY;
- else if (!strcmp(res->value, "l2-dst-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2_DST_ONLY;
- else if (!strcmp(res->value, "l2tpv3"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2TPV3;
- else if (!strcmp(res->value, "esp"))
- rss_conf.rss_hf = RTE_ETH_RSS_ESP;
- else if (!strcmp(res->value, "ah"))
- rss_conf.rss_hf = RTE_ETH_RSS_AH;
- else if (!strcmp(res->value, "pfcp"))
- rss_conf.rss_hf = RTE_ETH_RSS_PFCP;
- else if (!strcmp(res->value, "pppoe"))
- rss_conf.rss_hf = RTE_ETH_RSS_PPPOE;
- else if (!strcmp(res->value, "gtpu"))
- rss_conf.rss_hf = RTE_ETH_RSS_GTPU;
- else if (!strcmp(res->value, "ecpri"))
- rss_conf.rss_hf = RTE_ETH_RSS_ECPRI;
- else if (!strcmp(res->value, "mpls"))
- rss_conf.rss_hf = RTE_ETH_RSS_MPLS;
- else if (!strcmp(res->value, "ipv4-chksum"))
- rss_conf.rss_hf = RTE_ETH_RSS_IPV4_CHKSUM;
- else if (!strcmp(res->value, "l2tpv2"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2TPV2;
- else if (!strcmp(res->value, "none"))
- rss_conf.rss_hf = 0;
- else if (!strcmp(res->value, "level-default")) {
+ if (!strcmp(res->value, "level-default")) {
rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK);
rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_PMD_DEFAULT);
} else if (!strcmp(res->value, "level-outer")) {
@@ -2145,14 +2076,29 @@ cmd_config_rss_parsed(void *parsed_result,
} else if (!strcmp(res->value, "level-inner")) {
rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK);
rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_INNERMOST);
- } else if (!strcmp(res->value, "default"))
+ } else if (!strcmp(res->value, "default")) {
use_default = 1;
- else if (isdigit(res->value[0]) && atoi(res->value) > 0 &&
- atoi(res->value) < 64)
- rss_conf.rss_hf = 1ULL << atoi(res->value);
- else {
- fprintf(stderr, "Unknown parameter\n");
- return;
+ } else if (isdigit(res->value[0])) {
+ int value = atoi(res->value);
+ if (value > 0 && value < 64)
+ rss_conf.rss_hf = 1ULL << (uint8_t)value;
+ else {
+ fprintf(stderr, "flowtype_id should be greater than 0 and less than 64.\n");
+ return;
+ }
+ } else if (!strcmp(res->value, "all") || !strcmp(res->value, "ip") ||
+ !strcmp(res->value, "udp") || !strcmp(res->value, "tcp") ||
+ !strcmp(res->value, "sctp") || !strcmp(res->value, "vlan") ||
+ !strcmp(res->value, "none")) {
+ /* Parse group types or none type */
+ rss_conf.rss_hf = str_to_rsstypes(res->value);
+ } else {
+ /* Get individual type. */
+ rss_conf.rss_hf = str_to_rsstypes(res->value);
+ if (rss_conf.rss_hf == 0) {
+ fprintf(stderr, "Unknown parameter\n");
+ return;
+ }
}
rss_conf.rss_key = NULL;
/* Update global configuration for RSS types. */
@@ -2203,9 +2149,14 @@ static cmdline_parse_inst_t cmd_config_rss = {
.f = cmd_config_rss_parsed,
.data = NULL,
.help_str = "port config all rss "
- "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|"
- "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|"
- "none|level-default|level-outer|level-inner|<flowtype_id>",
+ "all|default|level-default|level-outer|level-inner|"
+ "ip|tcp|udp|sctp|tunnel|vlan|none|"
+ "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
+ "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
+ "l2_payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|"
+ "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|"
+ "l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|"
+ "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>",
.tokens = {
(void *)&cmd_config_rss_port,
(void *)&cmd_config_rss_keyword,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 36a828307c..3bf03c0969 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -673,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities)
}
}
+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;
+}
+
const char *
rsstypes_to_str(uint64_t rss_type)
{
@@ -3856,15 +3869,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;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 195488b602..2e2987eb66 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1199,6 +1199,7 @@ extern int flow_parse(const char *src, void *result, unsigned int size,
struct rte_flow_item **pattern,
struct rte_flow_action **actions);
+uint64_t str_to_rsstypes(const char *str);
const char *rsstypes_to_str(uint64_t rss_type);
/* For registering driver specific testpmd commands. */
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index cc299cff6c..47c1f6a4bb 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2143,8 +2143,15 @@ port config - RSS
~~~~~~~~~~~~~~~~~
Set the RSS (Receive Side Scaling) mode on or off::
-
- testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
+ testpmd> port config all rss (all|default|level-default|level-outer|level-inner|
+ ip|tcp|udp|sctp|tunnel|vlan|none|
+ ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|
+ ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|
+ ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-exl2_payload|port|
+ vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|
+ esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|
+ l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|
+ l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)
RSS is on by default.
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V4 4/7] app/testpmd: unify RSS types display
2022-06-24 4:12 ` [PATCH V4 0/7] app/testpmd: fix RSS and flow type Huisong Li
` (2 preceding siblings ...)
2022-06-24 4:12 ` [PATCH V4 3/7] app/testpmd: refactor config all RSS command Huisong Li
@ 2022-06-24 4:12 ` Huisong Li
2022-06-24 4:12 ` [PATCH V4 5/7] app/testpmd: compact RSS types output in some commands Huisong Li
` (2 subsequent siblings)
6 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-24 4:12 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
The 'rss_type_table[]' maintains the name and value of RSS types. This
patch unifies a common interface to display RSS types.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
---
app/test-pmd/config.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3bf03c0969..a0a5f12c71 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1569,6 +1569,23 @@ port_flow_complain(struct rte_flow_error *error)
return -err;
}
+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 void
rss_config_display(struct rte_flow_action_rss *rss_conf)
{
@@ -1611,13 +1628,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 *
@@ -3847,13 +3858,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;
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V4 5/7] app/testpmd: compact RSS types output in some commands
2022-06-24 4:12 ` [PATCH V4 0/7] app/testpmd: fix RSS and flow type Huisong Li
` (3 preceding siblings ...)
2022-06-24 4:12 ` [PATCH V4 4/7] app/testpmd: unify RSS types display Huisong Li
@ 2022-06-24 4:12 ` 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
6 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-24 4:12 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
In port info command output, 'show port info all', supported RSS offload
types printed one type per line, and although this information is not
most important part of the command it takes big part of the command
output.
In port RSS hash and flow RSS command output, 'show port 0 rss-hash',
and 'flow query 0 0 rss', all enabled RSS types are printed on one line.
If there are many types, the print will be very long.
Compacting these RSS offloads and types output by fixing the length of the
character string printed on each line, instead of one per line or one line.
Output becomes as following:
Supported RSS offload flow types:
ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other
ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other
l4-dst-only l4-src-only l3-dst-only l3-src-only
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/config.c | 68 +++++++++++++++++++++++++++++++-----------
app/test-pmd/testpmd.h | 2 ++
2 files changed, 52 insertions(+), 18 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index a0a5f12c71..b3cb68003c 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -699,6 +699,38 @@ rsstypes_to_str(uint64_t rss_type)
return NULL;
}
+static void
+rss_offload_types_display(uint64_t offload_types, uint16_t char_num_per_line)
+{
+ uint16_t unknown_offload_str_len;
+ uint16_t total_len = 0;
+ uint16_t str_len = 0;
+ uint64_t rss_offload;
+ uint16_t i;
+
+ for (i = 0; i < sizeof(offload_types) * CHAR_BIT; i++) {
+ rss_offload = RTE_BIT64(i);
+ if ((offload_types & rss_offload) != 0) {
+ const char *p = rsstypes_to_str(rss_offload);
+
+ unknown_offload_str_len =
+ strlen("unknown_offload(BIT())") + (i / 10 + 1);
+ str_len = p ? strlen(p) : unknown_offload_str_len;
+ str_len += 2; /* add two spaces */
+ if (total_len + str_len >= char_num_per_line) {
+ total_len = 0;
+ printf("\n");
+ }
+
+ if (p)
+ printf(" %s", p);
+ else
+ printf(" unknown_offload(BIT(%u))", i);
+ total_len += str_len;
+ }
+ }
+}
+
void
port_infos_display(portid_t port_id)
{
@@ -803,21 +835,10 @@ 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;
-
printf("Supported RSS offload flow types:\n");
- for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) {
- uint64_t rss_offload = RTE_BIT64(i);
- if ((rss_offload_types & rss_offload) != 0) {
- const char *p = rsstypes_to_str(rss_offload);
- if (p)
- printf(" %s\n", p);
- else
- printf(" unknown_offload(BIT(%u))\n",
- i);
- }
- }
+ rss_offload_types_display(dev_info.flow_type_rss_offloads,
+ TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
+ printf("\n");
}
printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize);
@@ -1570,8 +1591,10 @@ port_flow_complain(struct rte_flow_error *error)
}
static void
-rss_types_display(uint64_t rss_types)
+rss_types_display(uint64_t rss_types, uint16_t char_num_per_line)
{
+ uint16_t total_len = 0;
+ uint16_t str_len;
uint16_t i;
if (rss_types == 0)
@@ -1580,9 +1603,18 @@ rss_types_display(uint64_t rss_types)
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)
+ rss_type_table[i].rss_type) {
+ /* contain two spces */
+ str_len = strlen(rss_type_table[i].str) + 2;
+ if (total_len + str_len > char_num_per_line) {
+ printf("\n");
+ total_len = 0;
+ }
printf(" %s", rss_type_table[i].str);
+ total_len += str_len;
+ }
}
}
@@ -1628,7 +1660,7 @@ rss_config_display(struct rte_flow_action_rss *rss_conf)
printf(" none\n");
return;
}
- rss_types_display(rss_conf->types);
+ rss_types_display(rss_conf->types, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
}
static struct port_indirect_action *
@@ -3859,7 +3891,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
return;
}
printf("RSS functions:\n");
- rss_types_display(rss_hf);
+ rss_types_display(rss_hf, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
printf("\n");
if (!show_rss_key)
return;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 2e2987eb66..9cc5752f62 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -113,6 +113,8 @@ struct pkt_burst_stats {
unsigned int pkt_burst_spread[MAX_PKT_BURST + 1];
};
+
+#define TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE 64
/** Information for a given RSS type. */
struct rss_type_info {
const char *str; /**< Type name. */
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V4 6/7] app/testpmd: reorder elements in RSS type table array
2022-06-24 4:12 ` [PATCH V4 0/7] app/testpmd: fix RSS and flow type Huisong Li
` (4 preceding siblings ...)
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 ` Huisong Li
2022-06-24 4:12 ` [PATCH V4 7/7] app/testpmd: remove duplicated flow type to string table Huisong Li
6 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-24 4:12 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
There are group and individual types in rss_type_table[]. However, group
types are very scattered, and individual types are not arranged based on
the bit number order in 'RTE_ETH_RSS_xxx'. For a clear distribution of
types and better maintenance, this patch reorders this table.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/config.c | 51 +++++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 24 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index b3cb68003c..cc97aaa0ce 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -85,17 +85,20 @@ static const struct {
};
const struct rss_type_info rss_type_table[] = {
+ /* Group types */
{ "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |
RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD |
RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP |
RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS | RTE_ETH_RSS_L2TPV2},
{ "none", 0 },
- { "eth", RTE_ETH_RSS_ETH },
- { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
- { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
+ { "ip", RTE_ETH_RSS_IP },
+ { "udp", RTE_ETH_RSS_UDP },
+ { "tcp", RTE_ETH_RSS_TCP },
+ { "sctp", RTE_ETH_RSS_SCTP },
+ { "tunnel", RTE_ETH_RSS_TUNNEL },
{ "vlan", RTE_ETH_RSS_VLAN },
- { "s-vlan", RTE_ETH_RSS_S_VLAN },
- { "c-vlan", RTE_ETH_RSS_C_VLAN },
+
+ /* Individual type */
{ "ipv4", RTE_ETH_RSS_IPV4 },
{ "ipv4-frag", RTE_ETH_RSS_FRAG_IPV4 },
{ "ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP },
@@ -108,7 +111,7 @@ const struct rss_type_info rss_type_table[] = {
{ "ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP },
{ "ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP },
{ "ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER },
- { "l2-payload", RTE_ETH_RSS_L2_PAYLOAD },
+ { "l2_payload", RTE_ETH_RSS_L2_PAYLOAD },
{ "ipv6-ex", RTE_ETH_RSS_IPV6_EX },
{ "ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX },
{ "ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX },
@@ -116,33 +119,33 @@ const struct rss_type_info rss_type_table[] = {
{ "vxlan", RTE_ETH_RSS_VXLAN },
{ "geneve", RTE_ETH_RSS_GENEVE },
{ "nvgre", RTE_ETH_RSS_NVGRE },
- { "ip", RTE_ETH_RSS_IP },
- { "udp", RTE_ETH_RSS_UDP },
- { "tcp", RTE_ETH_RSS_TCP },
- { "sctp", RTE_ETH_RSS_SCTP },
- { "tunnel", RTE_ETH_RSS_TUNNEL },
- { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
- { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
- { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
- { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
- { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
- { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
- { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
- { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
- { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
- { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
+ { "gtpu", RTE_ETH_RSS_GTPU },
+ { "eth", RTE_ETH_RSS_ETH },
+ { "s-vlan", RTE_ETH_RSS_S_VLAN },
+ { "c-vlan", RTE_ETH_RSS_C_VLAN },
{ "esp", RTE_ETH_RSS_ESP },
{ "ah", RTE_ETH_RSS_AH },
{ "l2tpv3", RTE_ETH_RSS_L2TPV3 },
{ "pfcp", RTE_ETH_RSS_PFCP },
{ "pppoe", RTE_ETH_RSS_PPPOE },
- { "gtpu", RTE_ETH_RSS_GTPU },
- { "ecpri", RTE_ETH_RSS_ECPRI },
+ {"ecpri", RTE_ETH_RSS_ECPRI },
{ "mpls", RTE_ETH_RSS_MPLS },
{ "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM },
{ "l4-chksum", RTE_ETH_RSS_L4_CHKSUM },
{ "l2tpv2", RTE_ETH_RSS_L2TPV2 },
- { NULL, 0 },
+ { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
+ { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
+ { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
+ { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
+ { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
+ { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
+ { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
+ { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
+ { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
+ { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
+ { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
+ { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
+ { NULL, 0},
};
static const struct {
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V4 7/7] app/testpmd: remove duplicated flow type to string table
2022-06-24 4:12 ` [PATCH V4 0/7] app/testpmd: fix RSS and flow type Huisong Li
` (5 preceding siblings ...)
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 ` Huisong Li
6 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-24 4:12 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
Flow type table has two instance, one is used for flow type to string
conversion, and other is used for string to flow type conversion.
And tables are diverged by time.
Unifying tables to prevent maintaining two different tables.
Note: made 'flowtype_to_str()' and 'str_to_flowtype()' non-static to
prevent build error for the case PMDs using it disables. Making the two
functions generic, not for some PMDs.
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/config.c | 86 ++++++++++++++++++++-------------
app/test-pmd/testpmd.h | 3 ++
drivers/net/i40e/i40e_testpmd.c | 41 +---------------
3 files changed, 56 insertions(+), 74 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cc97aaa0ce..37797289f7 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -170,6 +170,35 @@ static const struct {
},
};
+const struct {
+ char str[32];
+ uint16_t ftype;
+} flowtype_str_table[] = {
+ {"raw", RTE_ETH_FLOW_RAW},
+ {"ipv4", RTE_ETH_FLOW_IPV4},
+ {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
+ {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
+ {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
+ {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
+ {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
+ {"ipv6", RTE_ETH_FLOW_IPV6},
+ {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
+ {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
+ {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
+ {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
+ {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
+ {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
+ {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
+ {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
+ {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
+ {"port", RTE_ETH_FLOW_PORT},
+ {"vxlan", RTE_ETH_FLOW_VXLAN},
+ {"geneve", RTE_ETH_FLOW_GENEVE},
+ {"nvgre", RTE_ETH_FLOW_NVGRE},
+ {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
+ {"gtpu", RTE_ETH_FLOW_GTPU},
+};
+
static void
print_ethaddr(const char *name, struct rte_ether_addr *eth_addr)
{
@@ -5665,42 +5694,29 @@ set_record_burst_stats(uint8_t on_off)
record_burst_stats = on_off;
}
-#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
+uint16_t
+str_to_flowtype(const char *string)
+{
+ uint8_t i;
-static char*
+ for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
+ if (!strcmp(flowtype_str_table[i].str, string))
+ return flowtype_str_table[i].ftype;
+ }
+
+ if (isdigit(string[0])) {
+ int val = atoi(string);
+ if (val > 0 && val < 64)
+ return (uint16_t)val;
+ }
+
+ return RTE_ETH_FLOW_UNKNOWN;
+}
+
+const char*
flowtype_to_str(uint16_t flow_type)
{
- struct flow_type_info {
- char str[32];
- uint16_t ftype;
- };
-
uint8_t i;
- static struct flow_type_info flowtype_str_table[] = {
- {"raw", RTE_ETH_FLOW_RAW},
- {"ipv4", RTE_ETH_FLOW_IPV4},
- {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
- {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
- {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
- {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
- {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
- {"ipv6", RTE_ETH_FLOW_IPV6},
- {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
- {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
- {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
- {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
- {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
- {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
- {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
- {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
- {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
- {"port", RTE_ETH_FLOW_PORT},
- {"vxlan", RTE_ETH_FLOW_VXLAN},
- {"geneve", RTE_ETH_FLOW_GENEVE},
- {"nvgre", RTE_ETH_FLOW_NVGRE},
- {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
- {"gtpu", RTE_ETH_FLOW_GTPU},
- };
for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
if (flowtype_str_table[i].ftype == flow_type)
@@ -5710,6 +5726,8 @@ 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)
{
@@ -5774,7 +5792,7 @@ print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
{
struct rte_eth_fdir_flex_mask *mask;
uint32_t i, j;
- char *p;
+ const char *p;
for (i = 0; i < flex_conf->nb_flexmasks; i++) {
mask = &flex_conf->flex_mask[i];
@@ -5790,7 +5808,7 @@ static inline void
print_fdir_flow_type(uint32_t flow_types_mask)
{
int i;
- char *p;
+ const char *p;
for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
if (!(flow_types_mask & (1 << i)))
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 9cc5752f62..fb2f5195d3 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1204,6 +1204,9 @@ extern int flow_parse(const char *src, void *result, unsigned int size,
uint64_t str_to_rsstypes(const char *str);
const char *rsstypes_to_str(uint64_t rss_type);
+uint16_t str_to_flowtype(const char *string);
+const char *flowtype_to_str(uint16_t flow_type);
+
/* For registering driver specific testpmd commands. */
struct testpmd_driver_commands {
TAILQ_ENTRY(testpmd_driver_commands) next;
diff --git a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c
index 86159e5c1c..45f8da270d 100644
--- a/drivers/net/i40e/i40e_testpmd.c
+++ b/drivers/net/i40e/i40e_testpmd.c
@@ -461,45 +461,6 @@ static cmdline_parse_inst_t cmd_show_queue_region_info_all = {
},
};
-static uint16_t
-str2flowtype(char *string)
-{
- uint8_t i = 0;
- static const struct {
- char str[32];
- uint16_t type;
- } flowtype_str[] = {
- {"raw", RTE_ETH_FLOW_RAW},
- {"ipv4", RTE_ETH_FLOW_IPV4},
- {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
- {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
- {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
- {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
- {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
- {"ipv6", RTE_ETH_FLOW_IPV6},
- {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
- {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
- {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
- {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
- {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
- {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
- {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
- {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
- {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
- {"gtpu", RTE_ETH_FLOW_GTPU},
- };
-
- for (i = 0; i < RTE_DIM(flowtype_str); i++) {
- if (!strcmp(flowtype_str[i].str, string))
- return flowtype_str[i].type;
- }
-
- if (isdigit(string[0]) && atoi(string) > 0 && atoi(string) < 64)
- return (uint16_t)atoi(string);
-
- return RTE_ETH_FLOW_UNKNOWN;
-}
-
/* *** deal with flow director filter *** */
struct cmd_flow_director_result {
cmdline_fixed_string_t flow_director_filter;
@@ -527,7 +488,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
struct rte_pmd_i40e_flow_type_mapping
mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
struct rte_pmd_i40e_pkt_template_conf conf;
- uint16_t flow_type = str2flowtype(res->flow_type);
+ uint16_t flow_type = str_to_flowtype(res->flow_type);
uint16_t i, port = res->port_id;
uint8_t add;
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V5 0/7] app/testpmd: fix RSS and flow type
2022-04-29 10:24 [PATCH V2 0/2] fix RSS types display Huisong Li
` (3 preceding siblings ...)
2022-06-24 4:12 ` [PATCH V4 0/7] app/testpmd: fix RSS and flow type Huisong Li
@ 2022-06-24 7:23 ` Huisong Li
2022-06-24 7:23 ` [PATCH V5 1/7] app/testpmd: fix supported RSS offload display Huisong Li
` (7 more replies)
2022-06-29 8:34 ` [PATCH V6 0/8] " Huisong Li
5 siblings, 8 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-24 7:23 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
This patchset fix RSS related code and remove duplicated flow type to
string table.
---
v5:
- resolve a warning in testpmd_funcs.rst file
v4:
- delete 'rss_offload_table[]' and use 'rss_type_table[]'
- add an 'char_num_per_line' parameter to control RSS types display.
- add 2/7, 3/7 and 6/7 patch.
v3:
- add 'rss_offload_table[]' to display supported RSS offload.
- add patch 3/4 and 4/4.
v2:
- resovle compilation failure when disable i40e and ixgbe.
Ferruh Yigit (2):
app/testpmd: compact RSS types output in some commands
app/testpmd: remove duplicated flow type to string table
Huisong Li (5):
app/testpmd: fix supported RSS offload display
app/testpmd: unify the name of L2 payload offload
app/testpmd: refactor config all RSS command
app/testpmd: unify RSS types display
app/testpmd: reorder elements in RSS type table array
app/test-pmd/cmdline.c | 127 +++-------
app/test-pmd/config.c | 263 +++++++++++++-------
app/test-pmd/testpmd.h | 8 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +-
drivers/net/i40e/i40e_testpmd.c | 41 +--
5 files changed, 228 insertions(+), 222 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V5 1/7] app/testpmd: fix supported RSS offload display
2022-06-24 7:23 ` [PATCH V5 0/7] app/testpmd: fix RSS and flow type Huisong Li
@ 2022-06-24 7:23 ` Huisong Li
2022-06-24 13:01 ` Ferruh Yigit
2022-06-24 7:23 ` [PATCH V5 2/7] app/testpmd: unify the name of L2 payload offload Huisong Li
` (6 subsequent siblings)
7 siblings, 1 reply; 72+ messages in thread
From: Huisong Li @ 2022-06-24 7:23 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
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.
In addition, offloads that are not in rss_type_table[] should be displayed
as "unknown offload xxx", instead of "user defined 63". So this patch fixes
it.
Fixes: b12964f621dc ("ethdev: unification of RSS offload types")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
---
app/test-pmd/config.c | 40 ++++++++++++++++++++++++++--------------
app/test-pmd/testpmd.h | 2 ++
2 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 62833fe97c..36a828307c 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;
@@ -675,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities)
}
}
+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)
{
@@ -779,19 +790,20 @@ 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 = RTE_BIT64(i);
+ if ((rss_offload_types & rss_offload) != 0) {
+ const char *p = rsstypes_to_str(rss_offload);
+ if (p)
+ printf(" %s\n", p);
+ else
+ printf(" unknown_offload(BIT(%u))\n",
+ i);
+ }
}
}
@@ -5604,6 +5616,8 @@ 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)
{
@@ -5647,8 +5661,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)
{
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index eeefb5e70f..195488b602 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1199,6 +1199,8 @@ extern int flow_parse(const char *src, void *result, unsigned int size,
struct rte_flow_item **pattern,
struct rte_flow_action **actions);
+const char *rsstypes_to_str(uint64_t rss_type);
+
/* For registering driver specific testpmd commands. */
struct testpmd_driver_commands {
TAILQ_ENTRY(testpmd_driver_commands) next;
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V5 2/7] app/testpmd: unify the name of L2 payload offload
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 7:23 ` Huisong Li
2022-06-24 13:53 ` Ferruh Yigit
2022-06-24 7:23 ` [PATCH V5 3/7] app/testpmd: refactor config all RSS command Huisong Li
` (5 subsequent siblings)
7 siblings, 1 reply; 72+ messages in thread
From: Huisong Li @ 2022-06-24 7:23 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
Currently, the "port config all rss xx" command uses 'ether' name to match
and to set 'RTE_ETH_RSS_L2_PAYLOAD' offload. However, others RSS command,
such as, "port config <port_id> rss-hash-key" and "show port <port_id>
rss-hash key", use 'l2-payload' to represent this offload. So this patch
unifies the name of 'RTE_ETH_RSS_L2_PAYLOAD' offload.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/cmdline.c | 6 +++---
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 9a7fd5fc35..a701bac953 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -694,7 +694,7 @@ static void cmd_help_long_parsed(void *parsed_result,
"receive buffers available.\n\n"
"port config all rss (all|default|ip|tcp|udp|sctp|"
- "ether|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
+ "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
"none|level-default|level-outer|level-inner|<flowtype_id>)\n"
" Set the RSS mode.\n\n"
@@ -2080,7 +2080,7 @@ cmd_config_rss_parsed(void *parsed_result,
rss_conf.rss_hf = RTE_ETH_RSS_TCP;
else if (!strcmp(res->value, "sctp"))
rss_conf.rss_hf = RTE_ETH_RSS_SCTP;
- else if (!strcmp(res->value, "ether"))
+ else if (!strcmp(res->value, "l2_payload"))
rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD;
else if (!strcmp(res->value, "port"))
rss_conf.rss_hf = RTE_ETH_RSS_PORT;
@@ -2203,7 +2203,7 @@ static cmdline_parse_inst_t cmd_config_rss = {
.f = cmd_config_rss_parsed,
.data = NULL,
.help_str = "port config all rss "
- "all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|"
+ "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|"
"nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|"
"none|level-default|level-outer|level-inner|<flowtype_id>",
.tokens = {
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 0b7a53fdf1..cc299cff6c 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2144,7 +2144,7 @@ port config - RSS
Set the RSS (Receive Side Scaling) mode on or off::
- testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
+ testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
RSS is on by default.
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V5 3/7] app/testpmd: refactor config all RSS command
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 7:23 ` [PATCH V5 2/7] app/testpmd: unify the name of L2 payload offload Huisong Li
@ 2022-06-24 7:23 ` Huisong Li
2022-06-24 13:55 ` Ferruh Yigit
2022-06-24 7:23 ` [PATCH V5 4/7] app/testpmd: unify RSS types display Huisong Li
` (4 subsequent siblings)
7 siblings, 1 reply; 72+ messages in thread
From: Huisong Li @ 2022-06-24 7:23 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
The "port config <port_id> rss-hash-key" and "show port <port_id> rss-hash
key" commands both use the 'rss_type_table[]' to get 'rss_types' or the RSS
type name. So this patch uses the 'rss_type_table[]' to get the rss types.
In this way, this command naturally supports more individual types.
Suggested-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/cmdline.c | 127 ++++++--------------
app/test-pmd/config.c | 20 ++-
app/test-pmd/testpmd.h | 1 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +-
4 files changed, 63 insertions(+), 96 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index a701bac953..bea869ce56 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -693,9 +693,14 @@ static void cmd_help_long_parsed(void *parsed_result,
" Enable or disable packet drop on all RX queues of all ports when no "
"receive buffers available.\n\n"
- "port config all rss (all|default|ip|tcp|udp|sctp|"
- "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
- "none|level-default|level-outer|level-inner|<flowtype_id>)\n"
+ "port config all rss (all|default|level-default|level-outer|level-inner|"
+ "ip|tcp|udp|sctp|tunnel|vlan|none|"
+ "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
+ "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
+ "l2_payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|"
+ "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|"
+ "l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|"
+ "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)\n"
" Set the RSS mode.\n\n"
"port config port-id rss reta (hash,queue)[,(hash,queue)]\n"
@@ -2062,81 +2067,7 @@ cmd_config_rss_parsed(void *parsed_result,
uint16_t i;
int ret;
- if (!strcmp(res->value, "all"))
- rss_conf.rss_hf = RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP |
- RTE_ETH_RSS_TCP | RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP |
- RTE_ETH_RSS_L2_PAYLOAD | RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP |
- RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP | RTE_ETH_RSS_GTPU |
- RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_L2TPV2;
- else if (!strcmp(res->value, "eth"))
- rss_conf.rss_hf = RTE_ETH_RSS_ETH;
- else if (!strcmp(res->value, "vlan"))
- rss_conf.rss_hf = RTE_ETH_RSS_VLAN;
- else if (!strcmp(res->value, "ip"))
- rss_conf.rss_hf = RTE_ETH_RSS_IP;
- else if (!strcmp(res->value, "udp"))
- rss_conf.rss_hf = RTE_ETH_RSS_UDP;
- else if (!strcmp(res->value, "tcp"))
- rss_conf.rss_hf = RTE_ETH_RSS_TCP;
- else if (!strcmp(res->value, "sctp"))
- rss_conf.rss_hf = RTE_ETH_RSS_SCTP;
- else if (!strcmp(res->value, "l2_payload"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD;
- else if (!strcmp(res->value, "port"))
- rss_conf.rss_hf = RTE_ETH_RSS_PORT;
- else if (!strcmp(res->value, "vxlan"))
- rss_conf.rss_hf = RTE_ETH_RSS_VXLAN;
- else if (!strcmp(res->value, "geneve"))
- rss_conf.rss_hf = RTE_ETH_RSS_GENEVE;
- else if (!strcmp(res->value, "nvgre"))
- rss_conf.rss_hf = RTE_ETH_RSS_NVGRE;
- else if (!strcmp(res->value, "l3-pre32"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE32;
- else if (!strcmp(res->value, "l3-pre40"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE40;
- else if (!strcmp(res->value, "l3-pre48"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE48;
- else if (!strcmp(res->value, "l3-pre56"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE56;
- else if (!strcmp(res->value, "l3-pre64"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE64;
- else if (!strcmp(res->value, "l3-pre96"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE96;
- else if (!strcmp(res->value, "l3-src-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_SRC_ONLY;
- else if (!strcmp(res->value, "l3-dst-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_DST_ONLY;
- else if (!strcmp(res->value, "l4-src-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L4_SRC_ONLY;
- else if (!strcmp(res->value, "l4-dst-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L4_DST_ONLY;
- else if (!strcmp(res->value, "l2-src-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2_SRC_ONLY;
- else if (!strcmp(res->value, "l2-dst-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2_DST_ONLY;
- else if (!strcmp(res->value, "l2tpv3"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2TPV3;
- else if (!strcmp(res->value, "esp"))
- rss_conf.rss_hf = RTE_ETH_RSS_ESP;
- else if (!strcmp(res->value, "ah"))
- rss_conf.rss_hf = RTE_ETH_RSS_AH;
- else if (!strcmp(res->value, "pfcp"))
- rss_conf.rss_hf = RTE_ETH_RSS_PFCP;
- else if (!strcmp(res->value, "pppoe"))
- rss_conf.rss_hf = RTE_ETH_RSS_PPPOE;
- else if (!strcmp(res->value, "gtpu"))
- rss_conf.rss_hf = RTE_ETH_RSS_GTPU;
- else if (!strcmp(res->value, "ecpri"))
- rss_conf.rss_hf = RTE_ETH_RSS_ECPRI;
- else if (!strcmp(res->value, "mpls"))
- rss_conf.rss_hf = RTE_ETH_RSS_MPLS;
- else if (!strcmp(res->value, "ipv4-chksum"))
- rss_conf.rss_hf = RTE_ETH_RSS_IPV4_CHKSUM;
- else if (!strcmp(res->value, "l2tpv2"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2TPV2;
- else if (!strcmp(res->value, "none"))
- rss_conf.rss_hf = 0;
- else if (!strcmp(res->value, "level-default")) {
+ if (!strcmp(res->value, "level-default")) {
rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK);
rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_PMD_DEFAULT);
} else if (!strcmp(res->value, "level-outer")) {
@@ -2145,14 +2076,29 @@ cmd_config_rss_parsed(void *parsed_result,
} else if (!strcmp(res->value, "level-inner")) {
rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK);
rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_INNERMOST);
- } else if (!strcmp(res->value, "default"))
+ } else if (!strcmp(res->value, "default")) {
use_default = 1;
- else if (isdigit(res->value[0]) && atoi(res->value) > 0 &&
- atoi(res->value) < 64)
- rss_conf.rss_hf = 1ULL << atoi(res->value);
- else {
- fprintf(stderr, "Unknown parameter\n");
- return;
+ } else if (isdigit(res->value[0])) {
+ int value = atoi(res->value);
+ if (value > 0 && value < 64)
+ rss_conf.rss_hf = 1ULL << (uint8_t)value;
+ else {
+ fprintf(stderr, "flowtype_id should be greater than 0 and less than 64.\n");
+ return;
+ }
+ } else if (!strcmp(res->value, "all") || !strcmp(res->value, "ip") ||
+ !strcmp(res->value, "udp") || !strcmp(res->value, "tcp") ||
+ !strcmp(res->value, "sctp") || !strcmp(res->value, "vlan") ||
+ !strcmp(res->value, "none")) {
+ /* Parse group types or none type */
+ rss_conf.rss_hf = str_to_rsstypes(res->value);
+ } else {
+ /* Get individual type. */
+ rss_conf.rss_hf = str_to_rsstypes(res->value);
+ if (rss_conf.rss_hf == 0) {
+ fprintf(stderr, "Unknown parameter\n");
+ return;
+ }
}
rss_conf.rss_key = NULL;
/* Update global configuration for RSS types. */
@@ -2203,9 +2149,14 @@ static cmdline_parse_inst_t cmd_config_rss = {
.f = cmd_config_rss_parsed,
.data = NULL,
.help_str = "port config all rss "
- "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|"
- "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|"
- "none|level-default|level-outer|level-inner|<flowtype_id>",
+ "all|default|level-default|level-outer|level-inner|"
+ "ip|tcp|udp|sctp|tunnel|vlan|none|"
+ "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
+ "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
+ "l2_payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|"
+ "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|"
+ "l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|"
+ "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>",
.tokens = {
(void *)&cmd_config_rss_port,
(void *)&cmd_config_rss_keyword,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 36a828307c..3bf03c0969 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -673,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities)
}
}
+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;
+}
+
const char *
rsstypes_to_str(uint64_t rss_type)
{
@@ -3856,15 +3869,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;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 195488b602..2e2987eb66 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1199,6 +1199,7 @@ extern int flow_parse(const char *src, void *result, unsigned int size,
struct rte_flow_item **pattern,
struct rte_flow_action **actions);
+uint64_t str_to_rsstypes(const char *str);
const char *rsstypes_to_str(uint64_t rss_type);
/* For registering driver specific testpmd commands. */
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index cc299cff6c..63a9e26f33 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2143,8 +2143,15 @@ port config - RSS
~~~~~~~~~~~~~~~~~
Set the RSS (Receive Side Scaling) mode on or off::
-
- testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
+ testpmd> port config all rss (all|default|level-default|level-outer|level-inner| \
+ ip|tcp|udp|sctp|tunnel|vlan|none| \
+ ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other| \
+ ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \
+ ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-exl2_payload|port| \
+ vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan| \
+ esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum| \
+ l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32| \
+ l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)
RSS is on by default.
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V5 4/7] app/testpmd: unify RSS types display
2022-06-24 7:23 ` [PATCH V5 0/7] app/testpmd: fix RSS and flow type Huisong Li
` (2 preceding siblings ...)
2022-06-24 7:23 ` [PATCH V5 3/7] app/testpmd: refactor config all RSS command Huisong Li
@ 2022-06-24 7:23 ` Huisong Li
2022-06-24 7:23 ` [PATCH V5 5/7] app/testpmd: compact RSS types output in some commands Huisong Li
` (3 subsequent siblings)
7 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-24 7:23 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
The 'rss_type_table[]' maintains the name and value of RSS types. This
patch unifies a common interface to display RSS types.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
---
app/test-pmd/config.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3bf03c0969..a0a5f12c71 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1569,6 +1569,23 @@ port_flow_complain(struct rte_flow_error *error)
return -err;
}
+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 void
rss_config_display(struct rte_flow_action_rss *rss_conf)
{
@@ -1611,13 +1628,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 *
@@ -3847,13 +3858,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;
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V5 5/7] app/testpmd: compact RSS types output in some commands
2022-06-24 7:23 ` [PATCH V5 0/7] app/testpmd: fix RSS and flow type Huisong Li
` (3 preceding siblings ...)
2022-06-24 7:23 ` [PATCH V5 4/7] app/testpmd: unify RSS types display Huisong Li
@ 2022-06-24 7:23 ` Huisong Li
2022-06-24 14:04 ` Ferruh Yigit
2022-06-24 7:24 ` [PATCH V5 6/7] app/testpmd: reorder elements in RSS type table array Huisong Li
` (2 subsequent siblings)
7 siblings, 1 reply; 72+ messages in thread
From: Huisong Li @ 2022-06-24 7:23 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
In port info command output, 'show port info all', supported RSS offload
types printed one type per line, and although this information is not
most important part of the command it takes big part of the command
output.
In port RSS hash and flow RSS command output, 'show port 0 rss-hash',
and 'flow query 0 0 rss', all enabled RSS types are printed on one line.
If there are many types, the print will be very long.
Compacting these RSS offloads and types output by fixing the length of the
character string printed on each line, instead of one per line or one line.
Output becomes as following:
Supported RSS offload flow types:
ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other
ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other
l4-dst-only l4-src-only l3-dst-only l3-src-only
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/config.c | 68 +++++++++++++++++++++++++++++++-----------
app/test-pmd/testpmd.h | 2 ++
2 files changed, 52 insertions(+), 18 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index a0a5f12c71..b3cb68003c 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -699,6 +699,38 @@ rsstypes_to_str(uint64_t rss_type)
return NULL;
}
+static void
+rss_offload_types_display(uint64_t offload_types, uint16_t char_num_per_line)
+{
+ uint16_t unknown_offload_str_len;
+ uint16_t total_len = 0;
+ uint16_t str_len = 0;
+ uint64_t rss_offload;
+ uint16_t i;
+
+ for (i = 0; i < sizeof(offload_types) * CHAR_BIT; i++) {
+ rss_offload = RTE_BIT64(i);
+ if ((offload_types & rss_offload) != 0) {
+ const char *p = rsstypes_to_str(rss_offload);
+
+ unknown_offload_str_len =
+ strlen("unknown_offload(BIT())") + (i / 10 + 1);
+ str_len = p ? strlen(p) : unknown_offload_str_len;
+ str_len += 2; /* add two spaces */
+ if (total_len + str_len >= char_num_per_line) {
+ total_len = 0;
+ printf("\n");
+ }
+
+ if (p)
+ printf(" %s", p);
+ else
+ printf(" unknown_offload(BIT(%u))", i);
+ total_len += str_len;
+ }
+ }
+}
+
void
port_infos_display(portid_t port_id)
{
@@ -803,21 +835,10 @@ 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;
-
printf("Supported RSS offload flow types:\n");
- for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) {
- uint64_t rss_offload = RTE_BIT64(i);
- if ((rss_offload_types & rss_offload) != 0) {
- const char *p = rsstypes_to_str(rss_offload);
- if (p)
- printf(" %s\n", p);
- else
- printf(" unknown_offload(BIT(%u))\n",
- i);
- }
- }
+ rss_offload_types_display(dev_info.flow_type_rss_offloads,
+ TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
+ printf("\n");
}
printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize);
@@ -1570,8 +1591,10 @@ port_flow_complain(struct rte_flow_error *error)
}
static void
-rss_types_display(uint64_t rss_types)
+rss_types_display(uint64_t rss_types, uint16_t char_num_per_line)
{
+ uint16_t total_len = 0;
+ uint16_t str_len;
uint16_t i;
if (rss_types == 0)
@@ -1580,9 +1603,18 @@ rss_types_display(uint64_t rss_types)
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)
+ rss_type_table[i].rss_type) {
+ /* contain two spces */
+ str_len = strlen(rss_type_table[i].str) + 2;
+ if (total_len + str_len > char_num_per_line) {
+ printf("\n");
+ total_len = 0;
+ }
printf(" %s", rss_type_table[i].str);
+ total_len += str_len;
+ }
}
}
@@ -1628,7 +1660,7 @@ rss_config_display(struct rte_flow_action_rss *rss_conf)
printf(" none\n");
return;
}
- rss_types_display(rss_conf->types);
+ rss_types_display(rss_conf->types, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
}
static struct port_indirect_action *
@@ -3859,7 +3891,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
return;
}
printf("RSS functions:\n");
- rss_types_display(rss_hf);
+ rss_types_display(rss_hf, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
printf("\n");
if (!show_rss_key)
return;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 2e2987eb66..9cc5752f62 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -113,6 +113,8 @@ struct pkt_burst_stats {
unsigned int pkt_burst_spread[MAX_PKT_BURST + 1];
};
+
+#define TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE 64
/** Information for a given RSS type. */
struct rss_type_info {
const char *str; /**< Type name. */
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V5 6/7] app/testpmd: reorder elements in RSS type table array
2022-06-24 7:23 ` [PATCH V5 0/7] app/testpmd: fix RSS and flow type Huisong Li
` (4 preceding siblings ...)
2022-06-24 7:23 ` [PATCH V5 5/7] app/testpmd: compact RSS types output in some commands Huisong Li
@ 2022-06-24 7:24 ` Huisong Li
2022-06-24 14:00 ` Ferruh Yigit
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)
7 siblings, 1 reply; 72+ messages in thread
From: Huisong Li @ 2022-06-24 7:24 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
There are group and individual types in rss_type_table[]. However, group
types are very scattered, and individual types are not arranged based on
the bit number order in 'RTE_ETH_RSS_xxx'. For a clear distribution of
types and better maintenance, this patch reorders this table.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/config.c | 51 +++++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 24 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index b3cb68003c..cc97aaa0ce 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -85,17 +85,20 @@ static const struct {
};
const struct rss_type_info rss_type_table[] = {
+ /* Group types */
{ "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |
RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD |
RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP |
RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS | RTE_ETH_RSS_L2TPV2},
{ "none", 0 },
- { "eth", RTE_ETH_RSS_ETH },
- { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
- { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
+ { "ip", RTE_ETH_RSS_IP },
+ { "udp", RTE_ETH_RSS_UDP },
+ { "tcp", RTE_ETH_RSS_TCP },
+ { "sctp", RTE_ETH_RSS_SCTP },
+ { "tunnel", RTE_ETH_RSS_TUNNEL },
{ "vlan", RTE_ETH_RSS_VLAN },
- { "s-vlan", RTE_ETH_RSS_S_VLAN },
- { "c-vlan", RTE_ETH_RSS_C_VLAN },
+
+ /* Individual type */
{ "ipv4", RTE_ETH_RSS_IPV4 },
{ "ipv4-frag", RTE_ETH_RSS_FRAG_IPV4 },
{ "ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP },
@@ -108,7 +111,7 @@ const struct rss_type_info rss_type_table[] = {
{ "ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP },
{ "ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP },
{ "ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER },
- { "l2-payload", RTE_ETH_RSS_L2_PAYLOAD },
+ { "l2_payload", RTE_ETH_RSS_L2_PAYLOAD },
{ "ipv6-ex", RTE_ETH_RSS_IPV6_EX },
{ "ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX },
{ "ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX },
@@ -116,33 +119,33 @@ const struct rss_type_info rss_type_table[] = {
{ "vxlan", RTE_ETH_RSS_VXLAN },
{ "geneve", RTE_ETH_RSS_GENEVE },
{ "nvgre", RTE_ETH_RSS_NVGRE },
- { "ip", RTE_ETH_RSS_IP },
- { "udp", RTE_ETH_RSS_UDP },
- { "tcp", RTE_ETH_RSS_TCP },
- { "sctp", RTE_ETH_RSS_SCTP },
- { "tunnel", RTE_ETH_RSS_TUNNEL },
- { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
- { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
- { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
- { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
- { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
- { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
- { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
- { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
- { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
- { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
+ { "gtpu", RTE_ETH_RSS_GTPU },
+ { "eth", RTE_ETH_RSS_ETH },
+ { "s-vlan", RTE_ETH_RSS_S_VLAN },
+ { "c-vlan", RTE_ETH_RSS_C_VLAN },
{ "esp", RTE_ETH_RSS_ESP },
{ "ah", RTE_ETH_RSS_AH },
{ "l2tpv3", RTE_ETH_RSS_L2TPV3 },
{ "pfcp", RTE_ETH_RSS_PFCP },
{ "pppoe", RTE_ETH_RSS_PPPOE },
- { "gtpu", RTE_ETH_RSS_GTPU },
- { "ecpri", RTE_ETH_RSS_ECPRI },
+ {"ecpri", RTE_ETH_RSS_ECPRI },
{ "mpls", RTE_ETH_RSS_MPLS },
{ "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM },
{ "l4-chksum", RTE_ETH_RSS_L4_CHKSUM },
{ "l2tpv2", RTE_ETH_RSS_L2TPV2 },
- { NULL, 0 },
+ { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
+ { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
+ { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
+ { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
+ { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
+ { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
+ { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
+ { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
+ { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
+ { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
+ { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
+ { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
+ { NULL, 0},
};
static const struct {
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V5 7/7] app/testpmd: remove duplicated flow type to string table
2022-06-24 7:23 ` [PATCH V5 0/7] app/testpmd: fix RSS and flow type Huisong Li
` (5 preceding siblings ...)
2022-06-24 7:24 ` [PATCH V5 6/7] app/testpmd: reorder elements in RSS type table array Huisong Li
@ 2022-06-24 7:24 ` Huisong Li
2022-06-24 8:55 ` [PATCH V5 0/7] app/testpmd: fix RSS and flow type lihuisong (C)
7 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-24 7:24 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
Flow type table has two instance, one is used for flow type to string
conversion, and other is used for string to flow type conversion.
And tables are diverged by time.
Unifying tables to prevent maintaining two different tables.
Note: made 'flowtype_to_str()' and 'str_to_flowtype()' non-static to
prevent build error for the case PMDs using it disables. Making the two
functions generic, not for some PMDs.
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/config.c | 86 ++++++++++++++++++++-------------
app/test-pmd/testpmd.h | 3 ++
drivers/net/i40e/i40e_testpmd.c | 41 +---------------
3 files changed, 56 insertions(+), 74 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cc97aaa0ce..37797289f7 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -170,6 +170,35 @@ static const struct {
},
};
+const struct {
+ char str[32];
+ uint16_t ftype;
+} flowtype_str_table[] = {
+ {"raw", RTE_ETH_FLOW_RAW},
+ {"ipv4", RTE_ETH_FLOW_IPV4},
+ {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
+ {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
+ {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
+ {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
+ {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
+ {"ipv6", RTE_ETH_FLOW_IPV6},
+ {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
+ {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
+ {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
+ {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
+ {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
+ {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
+ {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
+ {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
+ {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
+ {"port", RTE_ETH_FLOW_PORT},
+ {"vxlan", RTE_ETH_FLOW_VXLAN},
+ {"geneve", RTE_ETH_FLOW_GENEVE},
+ {"nvgre", RTE_ETH_FLOW_NVGRE},
+ {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
+ {"gtpu", RTE_ETH_FLOW_GTPU},
+};
+
static void
print_ethaddr(const char *name, struct rte_ether_addr *eth_addr)
{
@@ -5665,42 +5694,29 @@ set_record_burst_stats(uint8_t on_off)
record_burst_stats = on_off;
}
-#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
+uint16_t
+str_to_flowtype(const char *string)
+{
+ uint8_t i;
-static char*
+ for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
+ if (!strcmp(flowtype_str_table[i].str, string))
+ return flowtype_str_table[i].ftype;
+ }
+
+ if (isdigit(string[0])) {
+ int val = atoi(string);
+ if (val > 0 && val < 64)
+ return (uint16_t)val;
+ }
+
+ return RTE_ETH_FLOW_UNKNOWN;
+}
+
+const char*
flowtype_to_str(uint16_t flow_type)
{
- struct flow_type_info {
- char str[32];
- uint16_t ftype;
- };
-
uint8_t i;
- static struct flow_type_info flowtype_str_table[] = {
- {"raw", RTE_ETH_FLOW_RAW},
- {"ipv4", RTE_ETH_FLOW_IPV4},
- {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
- {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
- {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
- {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
- {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
- {"ipv6", RTE_ETH_FLOW_IPV6},
- {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
- {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
- {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
- {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
- {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
- {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
- {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
- {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
- {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
- {"port", RTE_ETH_FLOW_PORT},
- {"vxlan", RTE_ETH_FLOW_VXLAN},
- {"geneve", RTE_ETH_FLOW_GENEVE},
- {"nvgre", RTE_ETH_FLOW_NVGRE},
- {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
- {"gtpu", RTE_ETH_FLOW_GTPU},
- };
for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
if (flowtype_str_table[i].ftype == flow_type)
@@ -5710,6 +5726,8 @@ 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)
{
@@ -5774,7 +5792,7 @@ print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
{
struct rte_eth_fdir_flex_mask *mask;
uint32_t i, j;
- char *p;
+ const char *p;
for (i = 0; i < flex_conf->nb_flexmasks; i++) {
mask = &flex_conf->flex_mask[i];
@@ -5790,7 +5808,7 @@ static inline void
print_fdir_flow_type(uint32_t flow_types_mask)
{
int i;
- char *p;
+ const char *p;
for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
if (!(flow_types_mask & (1 << i)))
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 9cc5752f62..fb2f5195d3 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1204,6 +1204,9 @@ extern int flow_parse(const char *src, void *result, unsigned int size,
uint64_t str_to_rsstypes(const char *str);
const char *rsstypes_to_str(uint64_t rss_type);
+uint16_t str_to_flowtype(const char *string);
+const char *flowtype_to_str(uint16_t flow_type);
+
/* For registering driver specific testpmd commands. */
struct testpmd_driver_commands {
TAILQ_ENTRY(testpmd_driver_commands) next;
diff --git a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c
index 86159e5c1c..45f8da270d 100644
--- a/drivers/net/i40e/i40e_testpmd.c
+++ b/drivers/net/i40e/i40e_testpmd.c
@@ -461,45 +461,6 @@ static cmdline_parse_inst_t cmd_show_queue_region_info_all = {
},
};
-static uint16_t
-str2flowtype(char *string)
-{
- uint8_t i = 0;
- static const struct {
- char str[32];
- uint16_t type;
- } flowtype_str[] = {
- {"raw", RTE_ETH_FLOW_RAW},
- {"ipv4", RTE_ETH_FLOW_IPV4},
- {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
- {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
- {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
- {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
- {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
- {"ipv6", RTE_ETH_FLOW_IPV6},
- {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
- {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
- {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
- {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
- {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
- {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
- {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
- {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
- {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
- {"gtpu", RTE_ETH_FLOW_GTPU},
- };
-
- for (i = 0; i < RTE_DIM(flowtype_str); i++) {
- if (!strcmp(flowtype_str[i].str, string))
- return flowtype_str[i].type;
- }
-
- if (isdigit(string[0]) && atoi(string) > 0 && atoi(string) < 64)
- return (uint16_t)atoi(string);
-
- return RTE_ETH_FLOW_UNKNOWN;
-}
-
/* *** deal with flow director filter *** */
struct cmd_flow_director_result {
cmdline_fixed_string_t flow_director_filter;
@@ -527,7 +488,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
struct rte_pmd_i40e_flow_type_mapping
mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
struct rte_pmd_i40e_pkt_template_conf conf;
- uint16_t flow_type = str2flowtype(res->flow_type);
+ uint16_t flow_type = str_to_flowtype(res->flow_type);
uint16_t i, port = res->port_id;
uint8_t add;
--
2.33.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 0/7] app/testpmd: fix RSS and flow type
2022-06-24 7:23 ` [PATCH V5 0/7] app/testpmd: fix RSS and flow type Huisong Li
` (6 preceding siblings ...)
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 ` lihuisong (C)
2022-06-24 8:59 ` David Marchand
7 siblings, 1 reply; 72+ messages in thread
From: lihuisong (C) @ 2022-06-24 8:55 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
Hi Ferruh,
This patchset has been sent. However, a merge conflict is displayed on
the CI.
In fact, I'm do it based on the latest mainline, and there are nothing
conflict.
Can you help me re-trigger the build?
Thanks,
huisong
在 2022/6/24 15:23, Huisong Li 写道:
> This patchset fix RSS related code and remove duplicated flow type to
> string table.
>
> ---
> v5:
> - resolve a warning in testpmd_funcs.rst file
>
> v4:
> - delete 'rss_offload_table[]' and use 'rss_type_table[]'
> - add an 'char_num_per_line' parameter to control RSS types display.
> - add 2/7, 3/7 and 6/7 patch.
>
> v3:
> - add 'rss_offload_table[]' to display supported RSS offload.
> - add patch 3/4 and 4/4.
>
> v2:
> - resovle compilation failure when disable i40e and ixgbe.
>
> Ferruh Yigit (2):
> app/testpmd: compact RSS types output in some commands
> app/testpmd: remove duplicated flow type to string table
>
> Huisong Li (5):
> app/testpmd: fix supported RSS offload display
> app/testpmd: unify the name of L2 payload offload
> app/testpmd: refactor config all RSS command
> app/testpmd: unify RSS types display
> app/testpmd: reorder elements in RSS type table array
>
> app/test-pmd/cmdline.c | 127 +++-------
> app/test-pmd/config.c | 263 +++++++++++++-------
> app/test-pmd/testpmd.h | 8 +
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +-
> drivers/net/i40e/i40e_testpmd.c | 41 +--
> 5 files changed, 228 insertions(+), 222 deletions(-)
>
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 0/7] app/testpmd: fix RSS and flow type
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)
0 siblings, 1 reply; 72+ messages in thread
From: David Marchand @ 2022-06-24 8:59 UTC (permalink / raw)
To: lihuisong (C)
Cc: Singh, Aman Deep, Yuying Zhang, Ferruh Yigit, Andrew Rybchenko,
dev, Thomas Monjalon, huangdaode, liudongdong (C)
On Fri, Jun 24, 2022 at 10:55 AM lihuisong (C) <lihuisong@huawei.com> wrote:
>
> Hi Ferruh,
>
> This patchset has been sent. However, a merge conflict is displayed on
> the CI.
> In fact, I'm do it based on the latest mainline, and there are nothing
> conflict.
>
> Can you help me re-trigger the build?
There may be different reasons why (likely on your side), but
patchwork does not see the patches you sent as a single series.
For example, patch 4 is seen as part of the v2 series.
The CI tools rely on patchwork.
So the various CI won't be able to apply them.
Please resend.
--
David Marchand
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 0/7] app/testpmd: fix RSS and flow type
2022-06-24 8:59 ` David Marchand
@ 2022-06-24 9:54 ` lihuisong (C)
2022-06-24 10:44 ` Ferruh Yigit
0 siblings, 1 reply; 72+ messages in thread
From: lihuisong (C) @ 2022-06-24 9:54 UTC (permalink / raw)
To: David Marchand
Cc: Singh, Aman Deep, Yuying Zhang, Ferruh Yigit, Andrew Rybchenko,
dev, Thomas Monjalon, huangdaode, liudongdong (C)
Hi David,
在 2022/6/24 16:59, David Marchand 写道:
> On Fri, Jun 24, 2022 at 10:55 AM lihuisong (C) <lihuisong@huawei.com> wrote:
>> Hi Ferruh,
>>
>> This patchset has been sent. However, a merge conflict is displayed on
>> the CI.
>> In fact, I'm do it based on the latest mainline, and there are nothing
>> conflict.
>>
>> Can you help me re-trigger the build?
> There may be different reasons why (likely on your side), but
> patchwork does not see the patches you sent as a single series.
> For example, patch 4 is seen as part of the v2 series.
>
> The CI tools rely on patchwork.
> So the various CI won't be able to apply them.
>
> Please resend.
Thanks. It's the patchwork problem. This patchset are assigned to two
series.
As shown in the link below:
http://patches.dpdk.org/project/dpdk/list/?series=&submitter=2085&state=&q=&archive=&delegate=
If I resend, but this patchset hasn't changed.
Do I need to change the version number of this patchset?
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 0/7] app/testpmd: fix RSS and flow type
2022-06-24 9:54 ` lihuisong (C)
@ 2022-06-24 10:44 ` Ferruh Yigit
2022-06-25 1:09 ` lihuisong (C)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-24 10:44 UTC (permalink / raw)
To: lihuisong (C), David Marchand
Cc: Singh, Aman Deep, Yuying Zhang, Andrew Rybchenko, dev,
Thomas Monjalon, huangdaode, liudongdong (C)
On 6/24/2022 10:54 AM, lihuisong (C) wrote:
> CAUTION: This message has originated from an External Source. Please use
> proper judgment and caution when opening attachments, clicking links, or
> responding to this email.
>
>
> Hi David,
>
> 在 2022/6/24 16:59, David Marchand 写道:
>> On Fri, Jun 24, 2022 at 10:55 AM lihuisong (C) <lihuisong@huawei.com>
>> wrote:
>>> Hi Ferruh,
>>>
>>> This patchset has been sent. However, a merge conflict is displayed on
>>> the CI.
>>> In fact, I'm do it based on the latest mainline, and there are nothing
>>> conflict.
>>>
>>> Can you help me re-trigger the build?
>> There may be different reasons why (likely on your side), but
>> patchwork does not see the patches you sent as a single series.
>> For example, patch 4 is seen as part of the v2 series.
>>
>> The CI tools rely on patchwork.
>> So the various CI won't be able to apply them.
>>
>> Please resend.
> Thanks. It's the patchwork problem. This patchset are assigned to two
> series.
> As shown in the link below:
> http://patches.dpdk.org/project/dpdk/list/?series=&submitter=2085&state=&q=&archive=&delegate=
>
>
> If I resend, but this patchset hasn't changed.
> Do I need to change the version number of this patchset?
Hi Huisong,
I think both are OK, but just to clarify which one is latest, I think
there is no harm to increase the version.
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 1/7] app/testpmd: fix supported RSS offload display
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)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-24 13:01 UTC (permalink / raw)
To: Huisong Li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, kirill.rybalchenko
On 6/24/2022 8:23 AM, Huisong Li wrote:
>
> 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.
>
> In addition, offloads that are not in rss_type_table[] should be displayed
> as "unknown offload xxx", instead of "user defined 63". So this patch fixes
> it.
>
There is something as "user defined" RSS type, so please keep it as it is.
For more details please check:
Commit 8b94c81e3341 ("app/testpmd: port info prints dynamically mapped
flow types")
Commit 5a4806d304e0 ("app/testpmd: support updating pctype mapping")
Simply this is to allow doing RSS on user defined protocols, supported
by plugging like Intel DDP.
> Fixes: b12964f621dc ("ethdev: unification of RSS offload types")
> Cc: stable@dpdk.org
>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
> ---
> app/test-pmd/config.c | 40 ++++++++++++++++++++++++++--------------
> app/test-pmd/testpmd.h | 2 ++
> 2 files changed, 28 insertions(+), 14 deletions(-)
>
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 62833fe97c..36a828307c 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;
> @@ -675,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities)
> }
> }
>
> +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)
> {
> @@ -779,19 +790,20 @@ 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 = RTE_BIT64(i);
This logic is wrong, as we talked before some RSS types can be multiple
bit, with about logic you can't catch them.
The logic in the V2 of this set [1] is correct, which walks through
'rss_type_table[]' array and check if any value in that array exists in
'flow_type_rss_offloads'.
[1]
https://patchwork.dpdk.org/project/dpdk/patch/20220425092523.52338-2-lihuisong@huawei.com/
> + if ((rss_offload_types & rss_offload) != 0) {
> + const char *p = rsstypes_to_str(rss_offload);
> + if (p)
> + printf(" %s\n", p);
> + else
> + printf(" unknown_offload(BIT(%u))\n",
> + i);
> + }
> }
> }
>
> @@ -5604,6 +5616,8 @@ 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)
> {
> @@ -5647,8 +5661,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)
> {
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index eeefb5e70f..195488b602 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -1199,6 +1199,8 @@ extern int flow_parse(const char *src, void *result, unsigned int size,
> struct rte_flow_item **pattern,
> struct rte_flow_action **actions);
>
> +const char *rsstypes_to_str(uint64_t rss_type);
> +
> /* For registering driver specific testpmd commands. */
> struct testpmd_driver_commands {
> TAILQ_ENTRY(testpmd_driver_commands) next;
> --
> 2.33.0
>
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 2/7] app/testpmd: unify the name of L2 payload offload
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)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-24 13:53 UTC (permalink / raw)
To: Huisong Li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
On 6/24/2022 8:23 AM, Huisong Li wrote:
> Currently, the "port config all rss xx" command uses 'ether' name to match
> and to set 'RTE_ETH_RSS_L2_PAYLOAD' offload. However, others RSS command,
> such as, "port config <port_id> rss-hash-key" and "show port <port_id>
> rss-hash key", use 'l2-payload' to represent this offload. So this patch
> unifies the name of 'RTE_ETH_RSS_L2_PAYLOAD' offload.
>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
ack
But I wonder if we should continue to support 'ether' with an exception
to not break the interface, at least for a while like to next LTS.
> ---
> app/test-pmd/cmdline.c | 6 +++---
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +-
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 9a7fd5fc35..a701bac953 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -694,7 +694,7 @@ static void cmd_help_long_parsed(void *parsed_result,
> "receive buffers available.\n\n"
>
> "port config all rss (all|default|ip|tcp|udp|sctp|"
> - "ether|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
> + "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
> "none|level-default|level-outer|level-inner|<flowtype_id>)\n"
> " Set the RSS mode.\n\n"
>
> @@ -2080,7 +2080,7 @@ cmd_config_rss_parsed(void *parsed_result,
> rss_conf.rss_hf = RTE_ETH_RSS_TCP;
> else if (!strcmp(res->value, "sctp"))
> rss_conf.rss_hf = RTE_ETH_RSS_SCTP;
> - else if (!strcmp(res->value, "ether"))
> + else if (!strcmp(res->value, "l2_payload"))
> rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD;
> else if (!strcmp(res->value, "port"))
> rss_conf.rss_hf = RTE_ETH_RSS_PORT;
> @@ -2203,7 +2203,7 @@ static cmdline_parse_inst_t cmd_config_rss = {
> .f = cmd_config_rss_parsed,
> .data = NULL,
> .help_str = "port config all rss "
> - "all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|"
> + "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|"
> "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|"
> "none|level-default|level-outer|level-inner|<flowtype_id>",
> .tokens = {
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 0b7a53fdf1..cc299cff6c 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -2144,7 +2144,7 @@ port config - RSS
>
> Set the RSS (Receive Side Scaling) mode on or off::
>
> - testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
> + testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
>
> RSS is on by default.
>
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 3/7] app/testpmd: refactor config all RSS command
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)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-24 13:55 UTC (permalink / raw)
To: Huisong Li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
On 6/24/2022 8:23 AM, Huisong Li wrote:
> CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
>
>
> The "port config <port_id> rss-hash-key" and "show port <port_id> rss-hash
> key" commands both use the 'rss_type_table[]' to get 'rss_types' or the RSS
> type name. So this patch uses the 'rss_type_table[]' to get the rss types.
> In this way, this command naturally supports more individual types.
>
> Suggested-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> ---
> app/test-pmd/cmdline.c | 127 ++++++--------------
> app/test-pmd/config.c | 20 ++-
> app/test-pmd/testpmd.h | 1 +
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +-
> 4 files changed, 63 insertions(+), 96 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index a701bac953..bea869ce56 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -693,9 +693,14 @@ static void cmd_help_long_parsed(void *parsed_result,
> " Enable or disable packet drop on all RX queues of all ports when no "
> "receive buffers available.\n\n"
>
> - "port config all rss (all|default|ip|tcp|udp|sctp|"
> - "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
> - "none|level-default|level-outer|level-inner|<flowtype_id>)\n"
> + "port config all rss (all|default|level-default|level-outer|level-inner|"
> + "ip|tcp|udp|sctp|tunnel|vlan|none|"
> + "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
> + "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
> + "l2_payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|"
> + "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|"
> + "l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|"
> + "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)\n"
> " Set the RSS mode.\n\n"
>
> "port config port-id rss reta (hash,queue)[,(hash,queue)]\n"
> @@ -2062,81 +2067,7 @@ cmd_config_rss_parsed(void *parsed_result,
> uint16_t i;
> int ret;
>
> - if (!strcmp(res->value, "all"))
> - rss_conf.rss_hf = RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP |
> - RTE_ETH_RSS_TCP | RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP |
> - RTE_ETH_RSS_L2_PAYLOAD | RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP |
> - RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP | RTE_ETH_RSS_GTPU |
> - RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_L2TPV2;
> - else if (!strcmp(res->value, "eth"))
> - rss_conf.rss_hf = RTE_ETH_RSS_ETH;
> - else if (!strcmp(res->value, "vlan"))
> - rss_conf.rss_hf = RTE_ETH_RSS_VLAN;
> - else if (!strcmp(res->value, "ip"))
> - rss_conf.rss_hf = RTE_ETH_RSS_IP;
> - else if (!strcmp(res->value, "udp"))
> - rss_conf.rss_hf = RTE_ETH_RSS_UDP;
> - else if (!strcmp(res->value, "tcp"))
> - rss_conf.rss_hf = RTE_ETH_RSS_TCP;
> - else if (!strcmp(res->value, "sctp"))
> - rss_conf.rss_hf = RTE_ETH_RSS_SCTP;
> - else if (!strcmp(res->value, "l2_payload"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD;
> - else if (!strcmp(res->value, "port"))
> - rss_conf.rss_hf = RTE_ETH_RSS_PORT;
> - else if (!strcmp(res->value, "vxlan"))
> - rss_conf.rss_hf = RTE_ETH_RSS_VXLAN;
> - else if (!strcmp(res->value, "geneve"))
> - rss_conf.rss_hf = RTE_ETH_RSS_GENEVE;
> - else if (!strcmp(res->value, "nvgre"))
> - rss_conf.rss_hf = RTE_ETH_RSS_NVGRE;
> - else if (!strcmp(res->value, "l3-pre32"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE32;
> - else if (!strcmp(res->value, "l3-pre40"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE40;
> - else if (!strcmp(res->value, "l3-pre48"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE48;
> - else if (!strcmp(res->value, "l3-pre56"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE56;
> - else if (!strcmp(res->value, "l3-pre64"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE64;
> - else if (!strcmp(res->value, "l3-pre96"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE96;
> - else if (!strcmp(res->value, "l3-src-only"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L3_SRC_ONLY;
> - else if (!strcmp(res->value, "l3-dst-only"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L3_DST_ONLY;
> - else if (!strcmp(res->value, "l4-src-only"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L4_SRC_ONLY;
> - else if (!strcmp(res->value, "l4-dst-only"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L4_DST_ONLY;
> - else if (!strcmp(res->value, "l2-src-only"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L2_SRC_ONLY;
> - else if (!strcmp(res->value, "l2-dst-only"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L2_DST_ONLY;
> - else if (!strcmp(res->value, "l2tpv3"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L2TPV3;
> - else if (!strcmp(res->value, "esp"))
> - rss_conf.rss_hf = RTE_ETH_RSS_ESP;
> - else if (!strcmp(res->value, "ah"))
> - rss_conf.rss_hf = RTE_ETH_RSS_AH;
> - else if (!strcmp(res->value, "pfcp"))
> - rss_conf.rss_hf = RTE_ETH_RSS_PFCP;
> - else if (!strcmp(res->value, "pppoe"))
> - rss_conf.rss_hf = RTE_ETH_RSS_PPPOE;
> - else if (!strcmp(res->value, "gtpu"))
> - rss_conf.rss_hf = RTE_ETH_RSS_GTPU;
> - else if (!strcmp(res->value, "ecpri"))
> - rss_conf.rss_hf = RTE_ETH_RSS_ECPRI;
> - else if (!strcmp(res->value, "mpls"))
> - rss_conf.rss_hf = RTE_ETH_RSS_MPLS;
> - else if (!strcmp(res->value, "ipv4-chksum"))
> - rss_conf.rss_hf = RTE_ETH_RSS_IPV4_CHKSUM;
> - else if (!strcmp(res->value, "l2tpv2"))
> - rss_conf.rss_hf = RTE_ETH_RSS_L2TPV2;
> - else if (!strcmp(res->value, "none"))
> - rss_conf.rss_hf = 0;
> - else if (!strcmp(res->value, "level-default")) {
> + if (!strcmp(res->value, "level-default")) {
> rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK);
> rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_PMD_DEFAULT);
> } else if (!strcmp(res->value, "level-outer")) {
> @@ -2145,14 +2076,29 @@ cmd_config_rss_parsed(void *parsed_result,
> } else if (!strcmp(res->value, "level-inner")) {
> rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK);
> rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_INNERMOST);
> - } else if (!strcmp(res->value, "default"))
> + } else if (!strcmp(res->value, "default")) {
> use_default = 1;
> - else if (isdigit(res->value[0]) && atoi(res->value) > 0 &&
> - atoi(res->value) < 64)
> - rss_conf.rss_hf = 1ULL << atoi(res->value);
> - else {
> - fprintf(stderr, "Unknown parameter\n");
> - return;
> + } else if (isdigit(res->value[0])) {
> + int value = atoi(res->value);
> + if (value > 0 && value < 64)
> + rss_conf.rss_hf = 1ULL << (uint8_t)value;
> + else {
> + fprintf(stderr, "flowtype_id should be greater than 0 and less than 64.\n");
> + return;
> + }
> + } else if (!strcmp(res->value, "all") || !strcmp(res->value, "ip") ||
> + !strcmp(res->value, "udp") || !strcmp(res->value, "tcp") ||
> + !strcmp(res->value, "sctp") || !strcmp(res->value, "vlan") ||
> + !strcmp(res->value, "none")) {
> + /* Parse group types or none type */
> + rss_conf.rss_hf = str_to_rsstypes(res->value);
Why need to have a specific 'if' for the above types, why not directly
use 'str_to_rsstypes()'?
> + } else {
> + /* Get individual type. */
> + rss_conf.rss_hf = str_to_rsstypes(res->value);
> + if (rss_conf.rss_hf == 0) {
> + fprintf(stderr, "Unknown parameter\n");
> + return;
> + }
> }
> rss_conf.rss_key = NULL;
> /* Update global configuration for RSS types. */
> @@ -2203,9 +2149,14 @@ static cmdline_parse_inst_t cmd_config_rss = {
> .f = cmd_config_rss_parsed,
> .data = NULL,
> .help_str = "port config all rss "
> - "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|"
> - "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|"
> - "none|level-default|level-outer|level-inner|<flowtype_id>",
> + "all|default|level-default|level-outer|level-inner|"
> + "ip|tcp|udp|sctp|tunnel|vlan|none|"
> + "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
> + "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
> + "l2_payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|"
> + "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|"
> + "l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|"
> + "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>",
> .tokens = {
> (void *)&cmd_config_rss_port,
> (void *)&cmd_config_rss_keyword,
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 36a828307c..3bf03c0969 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -673,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities)
> }
> }
>
> +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;
> +}
> +
> const char *
> rsstypes_to_str(uint64_t rss_type)
> {
> @@ -3856,15 +3869,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;
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index 195488b602..2e2987eb66 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -1199,6 +1199,7 @@ extern int flow_parse(const char *src, void *result, unsigned int size,
> struct rte_flow_item **pattern,
> struct rte_flow_action **actions);
>
> +uint64_t str_to_rsstypes(const char *str);
> const char *rsstypes_to_str(uint64_t rss_type);
>
> /* For registering driver specific testpmd commands. */
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index cc299cff6c..63a9e26f33 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -2143,8 +2143,15 @@ port config - RSS
> ~~~~~~~~~~~~~~~~~
>
> Set the RSS (Receive Side Scaling) mode on or off::
> -
> - testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
> + testpmd> port config all rss (all|default|level-default|level-outer|level-inner| \
> + ip|tcp|udp|sctp|tunnel|vlan|none| \
> + ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other| \
> + ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \
> + ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-exl2_payload|port| \
> + vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan| \
> + esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum| \
> + l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32| \
> + l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)
>
> RSS is on by default.
>
> --
> 2.33.0
>
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 6/7] app/testpmd: reorder elements in RSS type table array
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)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-24 14:00 UTC (permalink / raw)
To: Huisong Li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
On 6/24/2022 8:24 AM, Huisong Li wrote:
> There are group and individual types in rss_type_table[]. However, group
> types are very scattered, and individual types are not arranged based on
> the bit number order in 'RTE_ETH_RSS_xxx'. For a clear distribution of
> types and better maintenance, this patch reorders this table.
>
> Signed-off-by: Huisong Li <lihuisong@huawei.com> > ---
> app/test-pmd/config.c | 51 +++++++++++++++++++++++--------------------
> 1 file changed, 27 insertions(+), 24 deletions(-)
>
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index b3cb68003c..cc97aaa0ce 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -85,17 +85,20 @@ static const struct {
> };
>
> const struct rss_type_info rss_type_table[] = {
> + /* Group types */
> { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |
> RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD |
> RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP |
> RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS | RTE_ETH_RSS_L2TPV2},
> { "none", 0 },
> - { "eth", RTE_ETH_RSS_ETH },
> - { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
> - { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
> + { "ip", RTE_ETH_RSS_IP },
> + { "udp", RTE_ETH_RSS_UDP },
> + { "tcp", RTE_ETH_RSS_TCP },
> + { "sctp", RTE_ETH_RSS_SCTP },
> + { "tunnel", RTE_ETH_RSS_TUNNEL },
> { "vlan", RTE_ETH_RSS_VLAN },
> - { "s-vlan", RTE_ETH_RSS_S_VLAN },
> - { "c-vlan", RTE_ETH_RSS_C_VLAN },
> +
> + /* Individual type */
> { "ipv4", RTE_ETH_RSS_IPV4 },
> { "ipv4-frag", RTE_ETH_RSS_FRAG_IPV4 },
> { "ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP },
> @@ -108,7 +111,7 @@ const struct rss_type_info rss_type_table[] = {
> { "ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP },
> { "ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP },
> { "ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER },
> - { "l2-payload", RTE_ETH_RSS_L2_PAYLOAD },
> + { "l2_payload", RTE_ETH_RSS_L2_PAYLOAD },
> { "ipv6-ex", RTE_ETH_RSS_IPV6_EX },
> { "ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX },
> { "ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX },
> @@ -116,33 +119,33 @@ const struct rss_type_info rss_type_table[] = {
> { "vxlan", RTE_ETH_RSS_VXLAN },
> { "geneve", RTE_ETH_RSS_GENEVE },
> { "nvgre", RTE_ETH_RSS_NVGRE },
> - { "ip", RTE_ETH_RSS_IP },
> - { "udp", RTE_ETH_RSS_UDP },
> - { "tcp", RTE_ETH_RSS_TCP },
> - { "sctp", RTE_ETH_RSS_SCTP },
> - { "tunnel", RTE_ETH_RSS_TUNNEL },
> - { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
> - { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
> - { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
> - { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
> - { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
> - { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
> - { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
> - { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
> - { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
> - { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
> + { "gtpu", RTE_ETH_RSS_GTPU },
> + { "eth", RTE_ETH_RSS_ETH },
> + { "s-vlan", RTE_ETH_RSS_S_VLAN },
> + { "c-vlan", RTE_ETH_RSS_C_VLAN },
> { "esp", RTE_ETH_RSS_ESP },
> { "ah", RTE_ETH_RSS_AH },
> { "l2tpv3", RTE_ETH_RSS_L2TPV3 },
> { "pfcp", RTE_ETH_RSS_PFCP },
> { "pppoe", RTE_ETH_RSS_PPPOE },
> - { "gtpu", RTE_ETH_RSS_GTPU },
> - { "ecpri", RTE_ETH_RSS_ECPRI },
> + {"ecpri", RTE_ETH_RSS_ECPRI },
syntax issue, space needed before "ecpri"
> { "mpls", RTE_ETH_RSS_MPLS },
> { "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM },
> { "l4-chksum", RTE_ETH_RSS_L4_CHKSUM },
> { "l2tpv2", RTE_ETH_RSS_L2TPV2 },
> - { NULL, 0 },
> + { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
> + { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
> + { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
> + { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
> + { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
> + { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
> + { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
> + { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
> + { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
> + { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
> + { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
> + { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
> + { NULL, 0},
> };
>
> static const struct {
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 5/7] app/testpmd: compact RSS types output in some commands
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)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-24 14:04 UTC (permalink / raw)
To: Huisong Li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
On 6/24/2022 8:23 AM, Huisong Li wrote:
> CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
>
>
> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>
> In port info command output, 'show port info all', supported RSS offload
> types printed one type per line, and although this information is not
> most important part of the command it takes big part of the command
> output.
>
> In port RSS hash and flow RSS command output, 'show port 0 rss-hash',
> and 'flow query 0 0 rss', all enabled RSS types are printed on one line.
> If there are many types, the print will be very long.
>
> Compacting these RSS offloads and types output by fixing the length of the
> character string printed on each line, instead of one per line or one line.
> Output becomes as following:
>
> Supported RSS offload flow types:
> ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other
> ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other
> l4-dst-only l4-src-only l3-dst-only l3-src-only
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> ---
> app/test-pmd/config.c | 68 +++++++++++++++++++++++++++++++-----------
> app/test-pmd/testpmd.h | 2 ++
> 2 files changed, 52 insertions(+), 18 deletions(-)
>
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index a0a5f12c71..b3cb68003c 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -699,6 +699,38 @@ rsstypes_to_str(uint64_t rss_type)
> return NULL;
> }
>
> +static void
> +rss_offload_types_display(uint64_t offload_types, uint16_t char_num_per_line)
> +{
> + uint16_t unknown_offload_str_len;
> + uint16_t total_len = 0;
> + uint16_t str_len = 0;
> + uint64_t rss_offload;
> + uint16_t i;
> +
> + for (i = 0; i < sizeof(offload_types) * CHAR_BIT; i++) {
> + rss_offload = RTE_BIT64(i);
> + if ((offload_types & rss_offload) != 0) {
> + const char *p = rsstypes_to_str(rss_offload);
> +
> + unknown_offload_str_len =
> + strlen("unknown_offload(BIT())") + (i / 10 + 1);
> + str_len = p ? strlen(p) : unknown_offload_str_len;
> + str_len += 2; /* add two spaces */
> + if (total_len + str_len >= char_num_per_line) {
> + total_len = 0;
> + printf("\n");
> + }
> +
> + if (p)
> + printf(" %s", p);
> + else
> + printf(" unknown_offload(BIT(%u))", i);
> + total_len += str_len;
> + }
> + }
> +}
> +
> void
> port_infos_display(portid_t port_id)
> {
> @@ -803,21 +835,10 @@ 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;
> -
> printf("Supported RSS offload flow types:\n");
> - for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) {
> - uint64_t rss_offload = RTE_BIT64(i);
> - if ((rss_offload_types & rss_offload) != 0) {
> - const char *p = rsstypes_to_str(rss_offload);
> - if (p)
> - printf(" %s\n", p);
> - else
> - printf(" unknown_offload(BIT(%u))\n",
> - i);
> - }
> - }
> + rss_offload_types_display(dev_info.flow_type_rss_offloads,
> + TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
> + printf("\n");
Why 'rss_types_display()' is not reused, but new function
'rss_offload_types_display()' created?
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 0/7] app/testpmd: fix RSS and flow type
2022-06-24 10:44 ` Ferruh Yigit
@ 2022-06-25 1:09 ` lihuisong (C)
2022-06-28 13:18 ` Ferruh Yigit
0 siblings, 1 reply; 72+ messages in thread
From: lihuisong (C) @ 2022-06-25 1:09 UTC (permalink / raw)
To: Ferruh Yigit, David Marchand
Cc: Singh, Aman Deep, Yuying Zhang, Andrew Rybchenko, dev,
Thomas Monjalon, huangdaode, liudongdong (C)
在 2022/6/24 18:44, Ferruh Yigit 写道:
> On 6/24/2022 10:54 AM, lihuisong (C) wrote:
>> CAUTION: This message has originated from an External Source. Please
>> use proper judgment and caution when opening attachments, clicking
>> links, or responding to this email.
>>
>>
>> Hi David,
>>
>> 在 2022/6/24 16:59, David Marchand 写道:
>>> On Fri, Jun 24, 2022 at 10:55 AM lihuisong (C)
>>> <lihuisong@huawei.com> wrote:
>>>> Hi Ferruh,
>>>>
>>>> This patchset has been sent. However, a merge conflict is displayed on
>>>> the CI.
>>>> In fact, I'm do it based on the latest mainline, and there are nothing
>>>> conflict.
>>>>
>>>> Can you help me re-trigger the build?
>>> There may be different reasons why (likely on your side), but
>>> patchwork does not see the patches you sent as a single series.
>>> For example, patch 4 is seen as part of the v2 series.
>>>
>>> The CI tools rely on patchwork.
>>> So the various CI won't be able to apply them.
>>>
>>> Please resend.
>> Thanks. It's the patchwork problem. This patchset are assigned to two
>> series.
>> As shown in the link below:
>> http://patches.dpdk.org/project/dpdk/list/?series=&submitter=2085&state=&q=&archive=&delegate=
>>
>>
>> If I resend, but this patchset hasn't changed.
>> Do I need to change the version number of this patchset?
>
> Hi Huisong,
>
> I think both are OK, but just to clarify which one is latest, I think
> there is no harm to increase the version.
Get it. V6 will be sent.
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 1/7] app/testpmd: fix supported RSS offload display
2022-06-24 13:01 ` Ferruh Yigit
@ 2022-06-25 2:12 ` lihuisong (C)
2022-06-28 13:18 ` Ferruh Yigit
0 siblings, 1 reply; 72+ messages in thread
From: lihuisong (C) @ 2022-06-25 2:12 UTC (permalink / raw)
To: Ferruh Yigit, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, kirill.rybalchenko
在 2022/6/24 21:01, Ferruh Yigit 写道:
> On 6/24/2022 8:23 AM, Huisong Li wrote:
>>
>> 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.
>>
>> In addition, offloads that are not in rss_type_table[] should be
>> displayed
>> as "unknown offload xxx", instead of "user defined 63". So this patch
>> fixes
>> it.
>>
>
> There is something as "user defined" RSS type, so please keep it as it
> is.
> For more details please check:
> Commit 8b94c81e3341 ("app/testpmd: port info prints dynamically mapped
> flow types")
> Commit 5a4806d304e0 ("app/testpmd: support updating pctype mapping")
>
> Simply this is to allow doing RSS on user defined protocols, supported
> by plugging like Intel DDP.
All right.
>
>> Fixes: b12964f621dc ("ethdev: unification of RSS offload types")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>> ---
>> app/test-pmd/config.c | 40 ++++++++++++++++++++++++++--------------
>> app/test-pmd/testpmd.h | 2 ++
>> 2 files changed, 28 insertions(+), 14 deletions(-)
>>
>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>> index 62833fe97c..36a828307c 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;
>> @@ -675,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities)
>> }
>> }
>>
>> +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)
>> {
>> @@ -779,19 +790,20 @@ 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 = RTE_BIT64(i);
>
> This logic is wrong, as we talked before some RSS types can be
> multiple bit, with about logic you can't catch them.
>
> The logic in the V2 of this set [1] is correct, which walks through
> 'rss_type_table[]' array and check if any value in that array exists
> in 'flow_type_rss_offloads'.
>
> [1]
> https://patchwork.dpdk.org/project/dpdk/patch/20220425092523.52338-2-lihuisong@huawei.com/
>
Here is what I think. They have different purposes. The logic of current
patch
is to retain the original display behavior that is single bit offload and
"user defined xx". However, the logic in the V2 has changed the behavior.
I don't think this patch should change its original behavior. And it is
better
to print offload by single bit. In this way, the parsed offload
capability is
more accurate and convenient to use.
>
>> + if ((rss_offload_types & rss_offload) != 0) {
>> + const char *p =
>> rsstypes_to_str(rss_offload);
>> + if (p)
>> + printf(" %s\n", p);
>> + else
>> + printf("
>> unknown_offload(BIT(%u))\n",
>> + i);
>> + }
>> }
>> }
>>
>> @@ -5604,6 +5616,8 @@ 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)
>> {
>> @@ -5647,8 +5661,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)
>> {
>> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
>> index eeefb5e70f..195488b602 100644
>> --- a/app/test-pmd/testpmd.h
>> +++ b/app/test-pmd/testpmd.h
>> @@ -1199,6 +1199,8 @@ extern int flow_parse(const char *src, void
>> *result, unsigned int size,
>> struct rte_flow_item **pattern,
>> struct rte_flow_action **actions);
>>
>> +const char *rsstypes_to_str(uint64_t rss_type);
>> +
>> /* For registering driver specific testpmd commands. */
>> struct testpmd_driver_commands {
>> TAILQ_ENTRY(testpmd_driver_commands) next;
>> --
>> 2.33.0
>>
>
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 2/7] app/testpmd: unify the name of L2 payload offload
2022-06-24 13:53 ` Ferruh Yigit
@ 2022-06-25 2:12 ` lihuisong (C)
2022-06-28 13:17 ` Ferruh Yigit
0 siblings, 1 reply; 72+ messages in thread
From: lihuisong (C) @ 2022-06-25 2:12 UTC (permalink / raw)
To: Ferruh Yigit, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
在 2022/6/24 21:53, Ferruh Yigit 写道:
> On 6/24/2022 8:23 AM, Huisong Li wrote:
>> Currently, the "port config all rss xx" command uses 'ether' name to
>> match
>> and to set 'RTE_ETH_RSS_L2_PAYLOAD' offload. However, others RSS
>> command,
>> such as, "port config <port_id> rss-hash-key" and "show port <port_id>
>> rss-hash key", use 'l2-payload' to represent this offload. So this patch
>> unifies the name of 'RTE_ETH_RSS_L2_PAYLOAD' offload.
>>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>
> ack
>
> But I wonder if we should continue to support 'ether' with an
> exception to not break the interface, at least for a while like to
> next LTS.
It's supposed to have a very small impact, and it is just an optional input
of this command in testpmd. What's more, patch 3/7 has to use
"l2-payload" to
match. This shouldn't affect the optimization progress of "port config
all rss xx"
command, right?
>
>> ---
>> app/test-pmd/cmdline.c | 6 +++---
>> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +-
>> 2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
>> index 9a7fd5fc35..a701bac953 100644
>> --- a/app/test-pmd/cmdline.c
>> +++ b/app/test-pmd/cmdline.c
>> @@ -694,7 +694,7 @@ static void cmd_help_long_parsed(void
>> *parsed_result,
>> "receive buffers available.\n\n"
>> "port config all rss (all|default|ip|tcp|udp|sctp|"
>> -
>> "ether|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
>> +
>> "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
>> "none|level-default|level-outer|level-inner|<flowtype_id>)\n"
>> " Set the RSS mode.\n\n"
>> @@ -2080,7 +2080,7 @@ cmd_config_rss_parsed(void *parsed_result,
>> rss_conf.rss_hf = RTE_ETH_RSS_TCP;
>> else if (!strcmp(res->value, "sctp"))
>> rss_conf.rss_hf = RTE_ETH_RSS_SCTP;
>> - else if (!strcmp(res->value, "ether"))
>> + else if (!strcmp(res->value, "l2_payload"))
>> rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD;
>> else if (!strcmp(res->value, "port"))
>> rss_conf.rss_hf = RTE_ETH_RSS_PORT;
>> @@ -2203,7 +2203,7 @@ static cmdline_parse_inst_t cmd_config_rss = {
>> .f = cmd_config_rss_parsed,
>> .data = NULL,
>> .help_str = "port config all rss "
>> - "all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|"
>> + "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|"
>> "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|"
>> "none|level-default|level-outer|level-inner|<flowtype_id>",
>> .tokens = {
>> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>> index 0b7a53fdf1..cc299cff6c 100644
>> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>> @@ -2144,7 +2144,7 @@ port config - RSS
>> Set the RSS (Receive Side Scaling) mode on or off::
>> - testpmd> port config all rss
>> (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
>> + testpmd> port config all rss
>> (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
>> RSS is on by default.
>
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 3/7] app/testpmd: refactor config all RSS command
2022-06-24 13:55 ` Ferruh Yigit
@ 2022-06-25 2:13 ` lihuisong (C)
0 siblings, 0 replies; 72+ messages in thread
From: lihuisong (C) @ 2022-06-25 2:13 UTC (permalink / raw)
To: Ferruh Yigit, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
在 2022/6/24 21:55, Ferruh Yigit 写道:
> On 6/24/2022 8:23 AM, Huisong Li wrote:
>> CAUTION: This message has originated from an External Source. Please
>> use proper judgment and caution when opening attachments, clicking
>> links, or responding to this email.
>>
>>
>> The "port config <port_id> rss-hash-key" and "show port <port_id>
>> rss-hash
>> key" commands both use the 'rss_type_table[]' to get 'rss_types' or
>> the RSS
>> type name. So this patch uses the 'rss_type_table[]' to get the rss
>> types.
>> In this way, this command naturally supports more individual types.
>>
>> Suggested-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> ---
>> app/test-pmd/cmdline.c | 127 ++++++--------------
>> app/test-pmd/config.c | 20 ++-
>> app/test-pmd/testpmd.h | 1 +
>> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +-
>> 4 files changed, 63 insertions(+), 96 deletions(-)
>>
>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
>> index a701bac953..bea869ce56 100644
>> --- a/app/test-pmd/cmdline.c
>> +++ b/app/test-pmd/cmdline.c
>> @@ -693,9 +693,14 @@ static void cmd_help_long_parsed(void
>> *parsed_result,
>> " Enable or disable packet drop on all RX
>> queues of all ports when no "
>> "receive buffers available.\n\n"
>>
>> - "port config all rss
>> (all|default|ip|tcp|udp|sctp|"
>> -
>> "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
>> - "none|level-default|level-outer|level-inner|<flowtype_id>)\n"
>> + "port config all rss
>> (all|default|level-default|level-outer|level-inner|"
>> + "ip|tcp|udp|sctp|tunnel|vlan|none|"
>> + "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
>> +
>> "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
>> + "l2_payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|"
>> + "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|"
>> + "l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|"
>> +
>> "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)\n"
>> " Set the RSS mode.\n\n"
>>
>> "port config port-id rss reta
>> (hash,queue)[,(hash,queue)]\n"
>> @@ -2062,81 +2067,7 @@ cmd_config_rss_parsed(void *parsed_result,
>> uint16_t i;
>> int ret;
>>
>> - if (!strcmp(res->value, "all"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN
>> | RTE_ETH_RSS_IP |
>> - RTE_ETH_RSS_TCP | RTE_ETH_RSS_UDP |
>> RTE_ETH_RSS_SCTP |
>> - RTE_ETH_RSS_L2_PAYLOAD | RTE_ETH_RSS_L2TPV3 |
>> RTE_ETH_RSS_ESP |
>> - RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP |
>> RTE_ETH_RSS_GTPU |
>> - RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_L2TPV2;
>> - else if (!strcmp(res->value, "eth"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_ETH;
>> - else if (!strcmp(res->value, "vlan"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_VLAN;
>> - else if (!strcmp(res->value, "ip"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_IP;
>> - else if (!strcmp(res->value, "udp"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_UDP;
>> - else if (!strcmp(res->value, "tcp"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_TCP;
>> - else if (!strcmp(res->value, "sctp"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_SCTP;
>> - else if (!strcmp(res->value, "l2_payload"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD;
>> - else if (!strcmp(res->value, "port"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_PORT;
>> - else if (!strcmp(res->value, "vxlan"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_VXLAN;
>> - else if (!strcmp(res->value, "geneve"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_GENEVE;
>> - else if (!strcmp(res->value, "nvgre"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_NVGRE;
>> - else if (!strcmp(res->value, "l3-pre32"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE32;
>> - else if (!strcmp(res->value, "l3-pre40"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE40;
>> - else if (!strcmp(res->value, "l3-pre48"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE48;
>> - else if (!strcmp(res->value, "l3-pre56"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE56;
>> - else if (!strcmp(res->value, "l3-pre64"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE64;
>> - else if (!strcmp(res->value, "l3-pre96"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE96;
>> - else if (!strcmp(res->value, "l3-src-only"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L3_SRC_ONLY;
>> - else if (!strcmp(res->value, "l3-dst-only"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L3_DST_ONLY;
>> - else if (!strcmp(res->value, "l4-src-only"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L4_SRC_ONLY;
>> - else if (!strcmp(res->value, "l4-dst-only"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L4_DST_ONLY;
>> - else if (!strcmp(res->value, "l2-src-only"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L2_SRC_ONLY;
>> - else if (!strcmp(res->value, "l2-dst-only"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L2_DST_ONLY;
>> - else if (!strcmp(res->value, "l2tpv3"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L2TPV3;
>> - else if (!strcmp(res->value, "esp"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_ESP;
>> - else if (!strcmp(res->value, "ah"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_AH;
>> - else if (!strcmp(res->value, "pfcp"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_PFCP;
>> - else if (!strcmp(res->value, "pppoe"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_PPPOE;
>> - else if (!strcmp(res->value, "gtpu"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_GTPU;
>> - else if (!strcmp(res->value, "ecpri"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_ECPRI;
>> - else if (!strcmp(res->value, "mpls"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_MPLS;
>> - else if (!strcmp(res->value, "ipv4-chksum"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_IPV4_CHKSUM;
>> - else if (!strcmp(res->value, "l2tpv2"))
>> - rss_conf.rss_hf = RTE_ETH_RSS_L2TPV2;
>> - else if (!strcmp(res->value, "none"))
>> - rss_conf.rss_hf = 0;
>> - else if (!strcmp(res->value, "level-default")) {
>> + if (!strcmp(res->value, "level-default")) {
>> rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK);
>> rss_conf.rss_hf = (rss_hf |
>> RTE_ETH_RSS_LEVEL_PMD_DEFAULT);
>> } else if (!strcmp(res->value, "level-outer")) {
>> @@ -2145,14 +2076,29 @@ cmd_config_rss_parsed(void *parsed_result,
>> } else if (!strcmp(res->value, "level-inner")) {
>> rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK);
>> rss_conf.rss_hf = (rss_hf |
>> RTE_ETH_RSS_LEVEL_INNERMOST);
>> - } else if (!strcmp(res->value, "default"))
>> + } else if (!strcmp(res->value, "default")) {
>> use_default = 1;
>> - else if (isdigit(res->value[0]) && atoi(res->value) > 0 &&
>> - atoi(res->value) < 64)
>> - rss_conf.rss_hf = 1ULL << atoi(res->value);
>> - else {
>> - fprintf(stderr, "Unknown parameter\n");
>> - return;
>> + } else if (isdigit(res->value[0])) {
>> + int value = atoi(res->value);
>> + if (value > 0 && value < 64)
>> + rss_conf.rss_hf = 1ULL << (uint8_t)value;
>> + else {
>> + fprintf(stderr, "flowtype_id should be
>> greater than 0 and less than 64.\n");
>> + return;
>> + }
>> + } else if (!strcmp(res->value, "all") || !strcmp(res->value,
>> "ip") ||
>> + !strcmp(res->value, "udp") || !strcmp(res->value,
>> "tcp") ||
>> + !strcmp(res->value, "sctp") || !strcmp(res->value,
>> "vlan") ||
>> + !strcmp(res->value, "none")) {
>> + /* Parse group types or none type */
>> + rss_conf.rss_hf = str_to_rsstypes(res->value);
>
> Why need to have a specific 'if' for the above types, why not directly
> use 'str_to_rsstypes()'?
You are right. we can merge the switch of group types and individual type.
>
>> + } else {
>> + /* Get individual type. */
>> + rss_conf.rss_hf = str_to_rsstypes(res->value);
>> + if (rss_conf.rss_hf == 0) {
>> + fprintf(stderr, "Unknown parameter\n");
>> + return;
>> + }
>> }
>> rss_conf.rss_key = NULL;
>> /* Update global configuration for RSS types. */
>> @@ -2203,9 +2149,14 @@ static cmdline_parse_inst_t cmd_config_rss = {
>> .f = cmd_config_rss_parsed,
>> .data = NULL,
>> .help_str = "port config all rss "
>> - "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|"
>> - "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|"
>> - "none|level-default|level-outer|level-inner|<flowtype_id>",
>> + "all|default|level-default|level-outer|level-inner|"
>> + "ip|tcp|udp|sctp|tunnel|vlan|none|"
>> + "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
>> +
>> "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
>> + "l2_payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|"
>> + "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|"
>> + "l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|"
>> +
>> "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>",
>> .tokens = {
>> (void *)&cmd_config_rss_port,
>> (void *)&cmd_config_rss_keyword,
>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>> index 36a828307c..3bf03c0969 100644
>> --- a/app/test-pmd/config.c
>> +++ b/app/test-pmd/config.c
>> @@ -673,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities)
>> }
>> }
>>
>> +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;
>> +}
>> +
>> const char *
>> rsstypes_to_str(uint64_t rss_type)
>> {
>> @@ -3856,15 +3869,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;
>> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
>> index 195488b602..2e2987eb66 100644
>> --- a/app/test-pmd/testpmd.h
>> +++ b/app/test-pmd/testpmd.h
>> @@ -1199,6 +1199,7 @@ extern int flow_parse(const char *src, void
>> *result, unsigned int size,
>> struct rte_flow_item **pattern,
>> struct rte_flow_action **actions);
>>
>> +uint64_t str_to_rsstypes(const char *str);
>> const char *rsstypes_to_str(uint64_t rss_type);
>>
>> /* For registering driver specific testpmd commands. */
>> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>> index cc299cff6c..63a9e26f33 100644
>> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>> @@ -2143,8 +2143,15 @@ port config - RSS
>> ~~~~~~~~~~~~~~~~~
>>
>> Set the RSS (Receive Side Scaling) mode on or off::
>> -
>> - testpmd> port config all rss
>> (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
>> + testpmd> port config all rss
>> (all|default|level-default|level-outer|level-inner| \
>> + ip|tcp|udp|sctp|tunnel|vlan|none| \
>> + ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other| \
>> + ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \
>> + ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-exl2_payload|port| \
>> + vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan| \
>> + esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum| \
>> + l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32| \
>> +
>> l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)
>>
>> RSS is on by default.
>>
>> --
>> 2.33.0
>>
>
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 5/7] app/testpmd: compact RSS types output in some commands
2022-06-24 14:04 ` Ferruh Yigit
@ 2022-06-25 2:13 ` lihuisong (C)
2022-06-28 13:18 ` Ferruh Yigit
0 siblings, 1 reply; 72+ messages in thread
From: lihuisong (C) @ 2022-06-25 2:13 UTC (permalink / raw)
To: Ferruh Yigit, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
在 2022/6/24 22:04, Ferruh Yigit 写道:
> On 6/24/2022 8:23 AM, Huisong Li wrote:
>> CAUTION: This message has originated from an External Source. Please
>> use proper judgment and caution when opening attachments, clicking
>> links, or responding to this email.
>>
>>
>> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>
>> In port info command output, 'show port info all', supported RSS offload
>> types printed one type per line, and although this information is not
>> most important part of the command it takes big part of the command
>> output.
>>
>> In port RSS hash and flow RSS command output, 'show port 0 rss-hash',
>> and 'flow query 0 0 rss', all enabled RSS types are printed on one line.
>> If there are many types, the print will be very long.
>>
>> Compacting these RSS offloads and types output by fixing the length
>> of the
>> character string printed on each line, instead of one per line or one
>> line.
>> Output becomes as following:
>>
>> Supported RSS offload flow types:
>> ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other
>> ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other
>> l4-dst-only l4-src-only l3-dst-only l3-src-only
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> ---
>> app/test-pmd/config.c | 68 +++++++++++++++++++++++++++++++-----------
>> app/test-pmd/testpmd.h | 2 ++
>> 2 files changed, 52 insertions(+), 18 deletions(-)
>>
>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>> index a0a5f12c71..b3cb68003c 100644
>> --- a/app/test-pmd/config.c
>> +++ b/app/test-pmd/config.c
>> @@ -699,6 +699,38 @@ rsstypes_to_str(uint64_t rss_type)
>> return NULL;
>> }
>>
>> +static void
>> +rss_offload_types_display(uint64_t offload_types, uint16_t
>> char_num_per_line)
>> +{
>> + uint16_t unknown_offload_str_len;
>> + uint16_t total_len = 0;
>> + uint16_t str_len = 0;
>> + uint64_t rss_offload;
>> + uint16_t i;
>> +
>> + for (i = 0; i < sizeof(offload_types) * CHAR_BIT; i++) {
>> + rss_offload = RTE_BIT64(i);
>> + if ((offload_types & rss_offload) != 0) {
>> + const char *p = rsstypes_to_str(rss_offload);
>> +
>> + unknown_offload_str_len =
>> + strlen("unknown_offload(BIT())") + (i
>> / 10 + 1);
>> + str_len = p ? strlen(p) :
>> unknown_offload_str_len;
>> + str_len += 2; /* add two spaces */
>> + if (total_len + str_len >= char_num_per_line) {
>> + total_len = 0;
>> + printf("\n");
>> + }
>> +
>> + if (p)
>> + printf(" %s", p);
>> + else
>> + printf(" unknown_offload(BIT(%u))", i);
>> + total_len += str_len;
>> + }
>> + }
>> +}
>> +
>> void
>> port_infos_display(portid_t port_id)
>> {
>> @@ -803,21 +835,10 @@ 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;
>> -
>> printf("Supported RSS offload flow types:\n");
>> - for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT;
>> i++) {
>> - uint64_t rss_offload = RTE_BIT64(i);
>> - if ((rss_offload_types & rss_offload) != 0) {
>> - const char *p =
>> rsstypes_to_str(rss_offload);
>> - if (p)
>> - printf(" %s\n", p);
>> - else
>> - printf("
>> unknown_offload(BIT(%u))\n",
>> - i);
>> - }
>> - }
>> + rss_offload_types_display(dev_info.flow_type_rss_offloads,
>> + TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
>> + printf("\n");
>
> Why 'rss_types_display()' is not reused, but new function
> 'rss_offload_types_display()' created?
As mentioned in the 1/7 patch reply, there are different purposes.
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 6/7] app/testpmd: reorder elements in RSS type table array
2022-06-24 14:00 ` Ferruh Yigit
@ 2022-06-25 2:14 ` lihuisong (C)
0 siblings, 0 replies; 72+ messages in thread
From: lihuisong (C) @ 2022-06-25 2:14 UTC (permalink / raw)
To: Ferruh Yigit, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
在 2022/6/24 22:00, Ferruh Yigit 写道:
> On 6/24/2022 8:24 AM, Huisong Li wrote:
>> There are group and individual types in rss_type_table[]. However, group
>> types are very scattered, and individual types are not arranged based on
>> the bit number order in 'RTE_ETH_RSS_xxx'. For a clear distribution of
>> types and better maintenance, this patch reorders this table.
>>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com> > ---
>> app/test-pmd/config.c | 51 +++++++++++++++++++++++--------------------
>> 1 file changed, 27 insertions(+), 24 deletions(-)
>>
>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>> index b3cb68003c..cc97aaa0ce 100644
>> --- a/app/test-pmd/config.c
>> +++ b/app/test-pmd/config.c
>> @@ -85,17 +85,20 @@ static const struct {
>> };
>> const struct rss_type_info rss_type_table[] = {
>> + /* Group types */
>> { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP |
>> RTE_ETH_RSS_TCP |
>> RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD |
>> RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH |
>> RTE_ETH_RSS_PFCP |
>> RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS |
>> RTE_ETH_RSS_L2TPV2},
>> { "none", 0 },
>> - { "eth", RTE_ETH_RSS_ETH },
>> - { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
>> - { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
>> + { "ip", RTE_ETH_RSS_IP },
>> + { "udp", RTE_ETH_RSS_UDP },
>> + { "tcp", RTE_ETH_RSS_TCP },
>> + { "sctp", RTE_ETH_RSS_SCTP },
>> + { "tunnel", RTE_ETH_RSS_TUNNEL },
>> { "vlan", RTE_ETH_RSS_VLAN },
>> - { "s-vlan", RTE_ETH_RSS_S_VLAN },
>> - { "c-vlan", RTE_ETH_RSS_C_VLAN },
>> +
>> + /* Individual type */
>> { "ipv4", RTE_ETH_RSS_IPV4 },
>> { "ipv4-frag", RTE_ETH_RSS_FRAG_IPV4 },
>> { "ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP },
>> @@ -108,7 +111,7 @@ const struct rss_type_info rss_type_table[] = {
>> { "ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP },
>> { "ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP },
>> { "ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER },
>> - { "l2-payload", RTE_ETH_RSS_L2_PAYLOAD },
>> + { "l2_payload", RTE_ETH_RSS_L2_PAYLOAD },
>> { "ipv6-ex", RTE_ETH_RSS_IPV6_EX },
>> { "ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX },
>> { "ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX },
>> @@ -116,33 +119,33 @@ const struct rss_type_info rss_type_table[] = {
>> { "vxlan", RTE_ETH_RSS_VXLAN },
>> { "geneve", RTE_ETH_RSS_GENEVE },
>> { "nvgre", RTE_ETH_RSS_NVGRE },
>> - { "ip", RTE_ETH_RSS_IP },
>> - { "udp", RTE_ETH_RSS_UDP },
>> - { "tcp", RTE_ETH_RSS_TCP },
>> - { "sctp", RTE_ETH_RSS_SCTP },
>> - { "tunnel", RTE_ETH_RSS_TUNNEL },
>> - { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
>> - { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
>> - { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
>> - { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
>> - { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
>> - { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
>> - { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
>> - { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
>> - { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
>> - { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
>> + { "gtpu", RTE_ETH_RSS_GTPU },
>> + { "eth", RTE_ETH_RSS_ETH },
>> + { "s-vlan", RTE_ETH_RSS_S_VLAN },
>> + { "c-vlan", RTE_ETH_RSS_C_VLAN },
>> { "esp", RTE_ETH_RSS_ESP },
>> { "ah", RTE_ETH_RSS_AH },
>> { "l2tpv3", RTE_ETH_RSS_L2TPV3 },
>> { "pfcp", RTE_ETH_RSS_PFCP },
>> { "pppoe", RTE_ETH_RSS_PPPOE },
>> - { "gtpu", RTE_ETH_RSS_GTPU },
>> - { "ecpri", RTE_ETH_RSS_ECPRI },
>> + {"ecpri", RTE_ETH_RSS_ECPRI },
>
> syntax issue, space needed before "ecpri"
Agreed.
>
>> { "mpls", RTE_ETH_RSS_MPLS },
>> { "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM },
>> { "l4-chksum", RTE_ETH_RSS_L4_CHKSUM },
>> { "l2tpv2", RTE_ETH_RSS_L2TPV2 },
>> - { NULL, 0 },
>> + { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
>> + { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
>> + { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
>> + { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
>> + { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
>> + { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
>> + { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
>> + { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
>> + { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
>> + { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
>> + { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
>> + { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
>> + { NULL, 0},
>> };
>> static const struct {
>
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 2/7] app/testpmd: unify the name of L2 payload offload
2022-06-25 2:12 ` lihuisong (C)
@ 2022-06-28 13:17 ` Ferruh Yigit
2022-06-29 1:47 ` lihuisong (C)
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-28 13:17 UTC (permalink / raw)
To: lihuisong (C), aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
On 6/25/2022 3:12 AM, lihuisong (C) wrote:
>
> 在 2022/6/24 21:53, Ferruh Yigit 写道:
>> On 6/24/2022 8:23 AM, Huisong Li wrote:
>>> Currently, the "port config all rss xx" command uses 'ether' name to
>>> match
>>> and to set 'RTE_ETH_RSS_L2_PAYLOAD' offload. However, others RSS
>>> command,
>>> such as, "port config <port_id> rss-hash-key" and "show port <port_id>
>>> rss-hash key", use 'l2-payload' to represent this offload. So this patch
>>> unifies the name of 'RTE_ETH_RSS_L2_PAYLOAD' offload.
>>>
>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>
>> ack
>>
>> But I wonder if we should continue to support 'ether' with an
>> exception to not break the interface, at least for a while like to
>> next LTS.
> It's supposed to have a very small impact, and it is just an optional input
> of this command in testpmd. What's more, patch 3/7 has to use
> "l2-payload" to
> match. This shouldn't affect the optimization progress of "port config
> all rss xx"
> command, right?
Yes, impact is small, OK to rename. But can you please add a release
note update to inform any possible user. A brief, one line update is
good to say "testpmd RSS type 'ether' renamed to 'l2-payload'"
>>
>>> ---
>>> app/test-pmd/cmdline.c | 6 +++---
>>> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +-
>>> 2 files changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
>>> index 9a7fd5fc35..a701bac953 100644
>>> --- a/app/test-pmd/cmdline.c
>>> +++ b/app/test-pmd/cmdline.c
>>> @@ -694,7 +694,7 @@ static void cmd_help_long_parsed(void
>>> *parsed_result,
>>> "receive buffers available.\n\n"
>>> "port config all rss (all|default|ip|tcp|udp|sctp|"
>>> -
>>> "ether|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
>>> +
>>> "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
>>>
>>> "none|level-default|level-outer|level-inner|<flowtype_id>)\n"
>>> " Set the RSS mode.\n\n"
>>> @@ -2080,7 +2080,7 @@ cmd_config_rss_parsed(void *parsed_result,
>>> rss_conf.rss_hf = RTE_ETH_RSS_TCP;
>>> else if (!strcmp(res->value, "sctp"))
>>> rss_conf.rss_hf = RTE_ETH_RSS_SCTP;
>>> - else if (!strcmp(res->value, "ether"))
>>> + else if (!strcmp(res->value, "l2_payload"))
>>> rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD;
>>> else if (!strcmp(res->value, "port"))
>>> rss_conf.rss_hf = RTE_ETH_RSS_PORT;
>>> @@ -2203,7 +2203,7 @@ static cmdline_parse_inst_t cmd_config_rss = {
>>> .f = cmd_config_rss_parsed,
>>> .data = NULL,
>>> .help_str = "port config all rss "
>>> - "all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|"
>>> + "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|"
>>> "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|"
>>> "none|level-default|level-outer|level-inner|<flowtype_id>",
>>> .tokens = {
>>> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>>> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>>> index 0b7a53fdf1..cc299cff6c 100644
>>> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>>> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>>> @@ -2144,7 +2144,7 @@ port config - RSS
>>> Set the RSS (Receive Side Scaling) mode on or off::
>>> - testpmd> port config all rss
>>> (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
>>>
>>> + testpmd> port config all rss
>>> (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
>>>
>>> RSS is on by default.
>>
>> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 1/7] app/testpmd: fix supported RSS offload display
2022-06-25 2:12 ` lihuisong (C)
@ 2022-06-28 13:18 ` Ferruh Yigit
0 siblings, 0 replies; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-28 13:18 UTC (permalink / raw)
To: lihuisong (C), aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, kirill.rybalchenko
On 6/25/2022 3:12 AM, lihuisong (C) wrote:
>
> 在 2022/6/24 21:01, Ferruh Yigit 写道:
>> On 6/24/2022 8:23 AM, Huisong Li wrote:
>>>
>>> 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.
>>>
>>> In addition, offloads that are not in rss_type_table[] should be
>>> displayed
>>> as "unknown offload xxx", instead of "user defined 63". So this patch
>>> fixes
>>> it.
>>>
>>
>> There is something as "user defined" RSS type, so please keep it as it
>> is.
>> For more details please check:
>> Commit 8b94c81e3341 ("app/testpmd: port info prints dynamically mapped
>> flow types")
>> Commit 5a4806d304e0 ("app/testpmd: support updating pctype mapping")
>>
>> Simply this is to allow doing RSS on user defined protocols, supported
>> by plugging like Intel DDP.
> All right.
>>
>>> Fixes: b12964f621dc ("ethdev: unification of RSS offload types")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>> ---
>>> app/test-pmd/config.c | 40 ++++++++++++++++++++++++++--------------
>>> app/test-pmd/testpmd.h | 2 ++
>>> 2 files changed, 28 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>>> index 62833fe97c..36a828307c 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;
>>> @@ -675,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities)
>>> }
>>> }
>>>
>>> +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)
>>> {
>>> @@ -779,19 +790,20 @@ 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 = RTE_BIT64(i);
>>
>> This logic is wrong, as we talked before some RSS types can be
>> multiple bit, with about logic you can't catch them.
>>
>> The logic in the V2 of this set [1] is correct, which walks through
>> 'rss_type_table[]' array and check if any value in that array exists
>> in 'flow_type_rss_offloads'.
>>
>> [1]
>> https://patchwork.dpdk.org/project/dpdk/patch/20220425092523.52338-2-lihuisong@huawei.com/
>>
> Here is what I think. They have different purposes. The logic of current
> patch
> is to retain the original display behavior that is single bit offload and
> "user defined xx". However, the logic in the V2 has changed the behavior.
> I don't think this patch should change its original behavior. And it is
> better
> to print offload by single bit. In this way, the parsed offload
> capability is
> more accurate and convenient to use.
OK, lets keep original behavior.
Since 'rss_type_table[]' array has both single bit and combined bit
entries, same array can work for both purposes.
>>
>>> + if ((rss_offload_types & rss_offload) != 0) {
>>> + const char *p =
>>> rsstypes_to_str(rss_offload);
>>> + if (p)
>>> + printf(" %s\n", p);
>>> + else
>>> + printf("
>>> unknown_offload(BIT(%u))\n",
>>> + i);
>>> + }
>>> }
>>> }
>>>
>>> @@ -5604,6 +5616,8 @@ 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)
>>> {
>>> @@ -5647,8 +5661,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)
>>> {
>>> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
>>> index eeefb5e70f..195488b602 100644
>>> --- a/app/test-pmd/testpmd.h
>>> +++ b/app/test-pmd/testpmd.h
>>> @@ -1199,6 +1199,8 @@ extern int flow_parse(const char *src, void
>>> *result, unsigned int size,
>>> struct rte_flow_item **pattern,
>>> struct rte_flow_action **actions);
>>>
>>> +const char *rsstypes_to_str(uint64_t rss_type);
>>> +
>>> /* For registering driver specific testpmd commands. */
>>> struct testpmd_driver_commands {
>>> TAILQ_ENTRY(testpmd_driver_commands) next;
>>> --
>>> 2.33.0
>>>
>>
>> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 5/7] app/testpmd: compact RSS types output in some commands
2022-06-25 2:13 ` lihuisong (C)
@ 2022-06-28 13:18 ` Ferruh Yigit
0 siblings, 0 replies; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-28 13:18 UTC (permalink / raw)
To: lihuisong (C), aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
On 6/25/2022 3:13 AM, lihuisong (C) wrote:
>
> 在 2022/6/24 22:04, Ferruh Yigit 写道:
>> On 6/24/2022 8:23 AM, Huisong Li wrote:
>>> CAUTION: This message has originated from an External Source. Please
>>> use proper judgment and caution when opening attachments, clicking
>>> links, or responding to this email.
>>>
>>>
>>> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>>
>>> In port info command output, 'show port info all', supported RSS offload
>>> types printed one type per line, and although this information is not
>>> most important part of the command it takes big part of the command
>>> output.
>>>
>>> In port RSS hash and flow RSS command output, 'show port 0 rss-hash',
>>> and 'flow query 0 0 rss', all enabled RSS types are printed on one line.
>>> If there are many types, the print will be very long.
>>>
>>> Compacting these RSS offloads and types output by fixing the length
>>> of the
>>> character string printed on each line, instead of one per line or one
>>> line.
>>> Output becomes as following:
>>>
>>> Supported RSS offload flow types:
>>> ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other
>>> ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other
>>> l4-dst-only l4-src-only l3-dst-only l3-src-only
>>>
>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>> ---
>>> app/test-pmd/config.c | 68 +++++++++++++++++++++++++++++++-----------
>>> app/test-pmd/testpmd.h | 2 ++
>>> 2 files changed, 52 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>>> index a0a5f12c71..b3cb68003c 100644
>>> --- a/app/test-pmd/config.c
>>> +++ b/app/test-pmd/config.c
>>> @@ -699,6 +699,38 @@ rsstypes_to_str(uint64_t rss_type)
>>> return NULL;
>>> }
>>>
>>> +static void
>>> +rss_offload_types_display(uint64_t offload_types, uint16_t
>>> char_num_per_line)
>>> +{
>>> + uint16_t unknown_offload_str_len;
>>> + uint16_t total_len = 0;
>>> + uint16_t str_len = 0;
>>> + uint64_t rss_offload;
>>> + uint16_t i;
>>> +
>>> + for (i = 0; i < sizeof(offload_types) * CHAR_BIT; i++) {
>>> + rss_offload = RTE_BIT64(i);
>>> + if ((offload_types & rss_offload) != 0) {
>>> + const char *p = rsstypes_to_str(rss_offload);
>>> +
>>> + unknown_offload_str_len =
>>> + strlen("unknown_offload(BIT())") + (i
>>> / 10 + 1);
>>> + str_len = p ? strlen(p) :
>>> unknown_offload_str_len;
>>> + str_len += 2; /* add two spaces */
>>> + if (total_len + str_len >= char_num_per_line) {
>>> + total_len = 0;
>>> + printf("\n");
>>> + }
>>> +
>>> + if (p)
>>> + printf(" %s", p);
>>> + else
>>> + printf(" unknown_offload(BIT(%u))", i);
>>> + total_len += str_len;
>>> + }
>>> + }
>>> +}
>>> +
>>> void
>>> port_infos_display(portid_t port_id)
>>> {
>>> @@ -803,21 +835,10 @@ 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;
>>> -
>>> printf("Supported RSS offload flow types:\n");
>>> - for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT;
>>> i++) {
>>> - uint64_t rss_offload = RTE_BIT64(i);
>>> - if ((rss_offload_types & rss_offload) != 0) {
>>> - const char *p =
>>> rsstypes_to_str(rss_offload);
>>> - if (p)
>>> - printf(" %s\n", p);
>>> - else
>>> - printf("
>>> unknown_offload(BIT(%u))\n",
>>> - i);
>>> - }
>>> - }
>>> + rss_offload_types_display(dev_info.flow_type_rss_offloads,
>>> + TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
>>> + printf("\n");
>>
>> Why 'rss_types_display()' is not reused, but new function
>> 'rss_offload_types_display()' created?
> As mentioned in the 1/7 patch reply, there are different purposes.
OK. Lets continue as it is.
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 0/7] app/testpmd: fix RSS and flow type
2022-06-25 1:09 ` lihuisong (C)
@ 2022-06-28 13:18 ` Ferruh Yigit
0 siblings, 0 replies; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-28 13:18 UTC (permalink / raw)
To: lihuisong (C), David Marchand
Cc: Singh, Aman Deep, Yuying Zhang, Andrew Rybchenko, dev,
Thomas Monjalon, huangdaode, liudongdong (C)
On 6/25/2022 2:09 AM, lihuisong (C) wrote:
>
> 在 2022/6/24 18:44, Ferruh Yigit 写道:
>> On 6/24/2022 10:54 AM, lihuisong (C) wrote:
>>> CAUTION: This message has originated from an External Source. Please
>>> use proper judgment and caution when opening attachments, clicking
>>> links, or responding to this email.
>>>
>>>
>>> Hi David,
>>>
>>> 在 2022/6/24 16:59, David Marchand 写道:
>>>> On Fri, Jun 24, 2022 at 10:55 AM lihuisong (C)
>>>> <lihuisong@huawei.com> wrote:
>>>>> Hi Ferruh,
>>>>>
>>>>> This patchset has been sent. However, a merge conflict is displayed on
>>>>> the CI.
>>>>> In fact, I'm do it based on the latest mainline, and there are nothing
>>>>> conflict.
>>>>>
>>>>> Can you help me re-trigger the build?
>>>> There may be different reasons why (likely on your side), but
>>>> patchwork does not see the patches you sent as a single series.
>>>> For example, patch 4 is seen as part of the v2 series.
>>>>
>>>> The CI tools rely on patchwork.
>>>> So the various CI won't be able to apply them.
>>>>
>>>> Please resend.
>>> Thanks. It's the patchwork problem. This patchset are assigned to two
>>> series.
>>> As shown in the link below:
>>> http://patches.dpdk.org/project/dpdk/list/?series=&submitter=2085&state=&q=&archive=&delegate=
>>>
>>>
>>>
>>> If I resend, but this patchset hasn't changed.
>>> Do I need to change the version number of this patchset?
>>
>> Hi Huisong,
>>
>> I think both are OK, but just to clarify which one is latest, I think
>> there is no harm to increase the version.
> Get it. V6 will be sent.
Thank you.
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V5 2/7] app/testpmd: unify the name of L2 payload offload
2022-06-28 13:17 ` Ferruh Yigit
@ 2022-06-29 1:47 ` lihuisong (C)
0 siblings, 0 replies; 72+ messages in thread
From: lihuisong (C) @ 2022-06-29 1:47 UTC (permalink / raw)
To: Ferruh Yigit, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
在 2022/6/28 21:17, Ferruh Yigit 写道:
> On 6/25/2022 3:12 AM, lihuisong (C) wrote:
>>
>> 在 2022/6/24 21:53, Ferruh Yigit 写道:
>>> On 6/24/2022 8:23 AM, Huisong Li wrote:
>>>> Currently, the "port config all rss xx" command uses 'ether' name to
>>>> match
>>>> and to set 'RTE_ETH_RSS_L2_PAYLOAD' offload. However, others RSS
>>>> command,
>>>> such as, "port config <port_id> rss-hash-key" and "show port <port_id>
>>>> rss-hash key", use 'l2-payload' to represent this offload. So this
>>>> patch
>>>> unifies the name of 'RTE_ETH_RSS_L2_PAYLOAD' offload.
>>>>
>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>
>>> ack
>>>
>>> But I wonder if we should continue to support 'ether' with an
>>> exception to not break the interface, at least for a while like to
>>> next LTS.
>> It's supposed to have a very small impact, and it is just an optional
>> input
>> of this command in testpmd. What's more, patch 3/7 has to use
>> "l2-payload" to
>> match. This shouldn't affect the optimization progress of "port config
>> all rss xx"
>> command, right?
>
> Yes, impact is small, OK to rename. But can you please add a release
> note update to inform any possible user. A brief, one line update is
> good to say "testpmd RSS type 'ether' renamed to 'l2-payload'"
ok
>
>>>
>>>> ---
>>>> app/test-pmd/cmdline.c | 6 +++---
>>>> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +-
>>>> 2 files changed, 4 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
>>>> index 9a7fd5fc35..a701bac953 100644
>>>> --- a/app/test-pmd/cmdline.c
>>>> +++ b/app/test-pmd/cmdline.c
>>>> @@ -694,7 +694,7 @@ static void cmd_help_long_parsed(void
>>>> *parsed_result,
>>>> "receive buffers available.\n\n"
>>>> "port config all rss (all|default|ip|tcp|udp|sctp|"
>>>> -
>>>> "ether|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
>>>>
>>>> +
>>>> "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
>>>>
>>>> "none|level-default|level-outer|level-inner|<flowtype_id>)\n"
>>>> " Set the RSS mode.\n\n"
>>>> @@ -2080,7 +2080,7 @@ cmd_config_rss_parsed(void *parsed_result,
>>>> rss_conf.rss_hf = RTE_ETH_RSS_TCP;
>>>> else if (!strcmp(res->value, "sctp"))
>>>> rss_conf.rss_hf = RTE_ETH_RSS_SCTP;
>>>> - else if (!strcmp(res->value, "ether"))
>>>> + else if (!strcmp(res->value, "l2_payload"))
>>>> rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD;
>>>> else if (!strcmp(res->value, "port"))
>>>> rss_conf.rss_hf = RTE_ETH_RSS_PORT;
>>>> @@ -2203,7 +2203,7 @@ static cmdline_parse_inst_t cmd_config_rss = {
>>>> .f = cmd_config_rss_parsed,
>>>> .data = NULL,
>>>> .help_str = "port config all rss "
>>>> - "all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|"
>>>> + "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|"
>>>> "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|"
>>>> "none|level-default|level-outer|level-inner|<flowtype_id>",
>>>> .tokens = {
>>>> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>>>> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>>>> index 0b7a53fdf1..cc299cff6c 100644
>>>> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>>>> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
>>>> @@ -2144,7 +2144,7 @@ port config - RSS
>>>> Set the RSS (Receive Side Scaling) mode on or off::
>>>> - testpmd> port config all rss
>>>> (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
>>>>
>>>> + testpmd> port config all rss
>>>> (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
>>>>
>>>> RSS is on by default.
>>>
>>> .
>
> .
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V6 0/8] app/testpmd: fix RSS and flow type
2022-04-29 10:24 [PATCH V2 0/2] fix RSS types display Huisong Li
` (4 preceding siblings ...)
2022-06-24 7:23 ` [PATCH V5 0/7] app/testpmd: fix RSS and flow type Huisong Li
@ 2022-06-29 8:34 ` Huisong Li
2022-06-29 8:34 ` [PATCH V6 1/8] app/testpmd: fix supported RSS offload display Huisong Li
` (9 more replies)
5 siblings, 10 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-29 8:34 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
This patchset fix RSS related code and remove duplicated flow type to
string table.
---
v6:
- add a release note for renaming testpmd RSS type 'ether'.
- revert "unknown offload xxx" print.
v5:
- resolve a warning in testpmd_funcs.rst file
v4:
- delete 'rss_offload_table[]' and use 'rss_type_table[]'
- add an 'char_num_per_line' parameter to control RSS types display.
- add 2/7, 3/7 and 6/7 patch.
v3:
- add 'rss_offload_table[]' to display supported RSS offload.
- add patch 3/4 and 4/4.
v2:
- resovle compilation failure when disable i40e and ixgbe.
Ferruh Yigit (2):
app/testpmd: compact RSS types output in some commands
app/testpmd: remove duplicated flow type to string table
Huisong Li (6):
app/testpmd: fix supported RSS offload display
app/testpmd: unify the name of L2 payload offload
doc: testpmd rename RSS type ether to L2 payload
app/testpmd: refactor config all RSS command
app/testpmd: unify RSS types display
app/testpmd: reorder elements in RSS type table array
app/test-pmd/cmdline.c | 122 +++------
app/test-pmd/config.c | 259 +++++++++++++-------
app/test-pmd/testpmd.h | 8 +
doc/guides/rel_notes/release_22_07.rst | 4 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +-
drivers/net/i40e/i40e_testpmd.c | 41 +---
6 files changed, 225 insertions(+), 220 deletions(-)
--
2.22.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V6 1/8] app/testpmd: fix supported RSS offload display
2022-06-29 8:34 ` [PATCH V6 0/8] " Huisong Li
@ 2022-06-29 8:34 ` Huisong Li
2022-06-29 8:34 ` [PATCH V6 2/8] app/testpmd: unify the name of L2 payload offload Huisong Li
` (8 subsequent siblings)
9 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-29 8:34 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
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")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
---
app/test-pmd/config.c | 40 ++++++++++++++++++++++++++--------------
app/test-pmd/testpmd.h | 2 ++
2 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 62833fe97c..a1183ad18e 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;
@@ -675,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities)
}
}
+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)
{
@@ -779,19 +790,20 @@ 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 = RTE_BIT64(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);
+ }
}
}
@@ -5604,6 +5616,8 @@ 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)
{
@@ -5647,8 +5661,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)
{
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index eeefb5e70f..195488b602 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1199,6 +1199,8 @@ extern int flow_parse(const char *src, void *result, unsigned int size,
struct rte_flow_item **pattern,
struct rte_flow_action **actions);
+const char *rsstypes_to_str(uint64_t rss_type);
+
/* For registering driver specific testpmd commands. */
struct testpmd_driver_commands {
TAILQ_ENTRY(testpmd_driver_commands) next;
--
2.22.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V6 2/8] app/testpmd: unify the name of L2 payload offload
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 ` Huisong Li
2022-06-29 8:34 ` [PATCH V6 3/8] doc: testpmd rename RSS type ether to L2 payload Huisong Li
` (7 subsequent siblings)
9 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-29 8:34 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
Currently, the "port config all rss xx" command uses 'ether' name to match
and to set 'RTE_ETH_RSS_L2_PAYLOAD' offload. However, others RSS command,
such as, "port config <port_id> rss-hash-key" and "show port <port_id>
rss-hash key", use 'l2-payload' to represent this offload. So this patch
unifies the name of 'RTE_ETH_RSS_L2_PAYLOAD' offload.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/cmdline.c | 6 +++---
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ded7dfe656..0123f4a4e5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -694,7 +694,7 @@ static void cmd_help_long_parsed(void *parsed_result,
"receive buffers available.\n\n"
"port config all rss (all|default|ip|tcp|udp|sctp|"
- "ether|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
+ "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
"none|level-default|level-outer|level-inner|<flowtype_id>)\n"
" Set the RSS mode.\n\n"
@@ -2080,7 +2080,7 @@ cmd_config_rss_parsed(void *parsed_result,
rss_conf.rss_hf = RTE_ETH_RSS_TCP;
else if (!strcmp(res->value, "sctp"))
rss_conf.rss_hf = RTE_ETH_RSS_SCTP;
- else if (!strcmp(res->value, "ether"))
+ else if (!strcmp(res->value, "l2_payload"))
rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD;
else if (!strcmp(res->value, "port"))
rss_conf.rss_hf = RTE_ETH_RSS_PORT;
@@ -2203,7 +2203,7 @@ static cmdline_parse_inst_t cmd_config_rss = {
.f = cmd_config_rss_parsed,
.data = NULL,
.help_str = "port config all rss "
- "all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|"
+ "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|"
"nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|"
"none|level-default|level-outer|level-inner|<flowtype_id>",
.tokens = {
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f716ea2797..9a79ffd03b 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2144,7 +2144,7 @@ port config - RSS
Set the RSS (Receive Side Scaling) mode on or off::
- testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
+ testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
RSS is on by default.
--
2.22.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V6 3/8] doc: testpmd rename RSS type ether to L2 payload
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 ` Huisong Li
2022-06-29 8:34 ` [PATCH V6 4/8] app/testpmd: refactor config all RSS command Huisong Li
` (6 subsequent siblings)
9 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-29 8:34 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
Rename RSS type 'ether' to 'l2-payload' for "port config all rss xx"
command.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
doc/guides/rel_notes/release_22_07.rst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index 6365800313..032290f05e 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -261,6 +261,10 @@ New Features
Merged l3fwd-acl code into l3fwd as l3fwd-acl contains duplicate
and common functions to l3fwd.
+* **Testpmd RSS type 'ether' renamed to 'l2-payload'.**
+
+ Rename RSS type 'ether' to 'l2-payload' for "port config all rss xx"
+ command.
Removed Items
-------------
--
2.22.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V6 4/8] app/testpmd: refactor config all RSS command
2022-06-29 8:34 ` [PATCH V6 0/8] " Huisong Li
` (2 preceding siblings ...)
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 ` Huisong Li
2022-06-29 8:34 ` [PATCH V6 5/8] app/testpmd: unify RSS types display Huisong Li
` (5 subsequent siblings)
9 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-29 8:34 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
The "port config <port_id> rss-hash-key" and "show port <port_id> rss-hash
key" commands both use the 'rss_type_table[]' to get 'rss_types' or the RSS
type name. So this patch uses the 'rss_type_table[]' to get the rss types.
In this way, this command naturally supports more individual types.
Suggested-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/cmdline.c | 122 ++++++--------------
app/test-pmd/config.c | 20 +++-
app/test-pmd/testpmd.h | 1 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +-
4 files changed, 58 insertions(+), 96 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0123f4a4e5..b4fe9dfb17 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -693,9 +693,14 @@ static void cmd_help_long_parsed(void *parsed_result,
" Enable or disable packet drop on all RX queues of all ports when no "
"receive buffers available.\n\n"
- "port config all rss (all|default|ip|tcp|udp|sctp|"
- "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|l2tpv2|"
- "none|level-default|level-outer|level-inner|<flowtype_id>)\n"
+ "port config all rss (all|default|level-default|level-outer|level-inner|"
+ "ip|tcp|udp|sctp|tunnel|vlan|none|"
+ "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
+ "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
+ "l2-payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|"
+ "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|"
+ "l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|"
+ "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)\n"
" Set the RSS mode.\n\n"
"port config port-id rss reta (hash,queue)[,(hash,queue)]\n"
@@ -2062,81 +2067,7 @@ cmd_config_rss_parsed(void *parsed_result,
uint16_t i;
int ret;
- if (!strcmp(res->value, "all"))
- rss_conf.rss_hf = RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP |
- RTE_ETH_RSS_TCP | RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP |
- RTE_ETH_RSS_L2_PAYLOAD | RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP |
- RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP | RTE_ETH_RSS_GTPU |
- RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_L2TPV2;
- else if (!strcmp(res->value, "eth"))
- rss_conf.rss_hf = RTE_ETH_RSS_ETH;
- else if (!strcmp(res->value, "vlan"))
- rss_conf.rss_hf = RTE_ETH_RSS_VLAN;
- else if (!strcmp(res->value, "ip"))
- rss_conf.rss_hf = RTE_ETH_RSS_IP;
- else if (!strcmp(res->value, "udp"))
- rss_conf.rss_hf = RTE_ETH_RSS_UDP;
- else if (!strcmp(res->value, "tcp"))
- rss_conf.rss_hf = RTE_ETH_RSS_TCP;
- else if (!strcmp(res->value, "sctp"))
- rss_conf.rss_hf = RTE_ETH_RSS_SCTP;
- else if (!strcmp(res->value, "l2_payload"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD;
- else if (!strcmp(res->value, "port"))
- rss_conf.rss_hf = RTE_ETH_RSS_PORT;
- else if (!strcmp(res->value, "vxlan"))
- rss_conf.rss_hf = RTE_ETH_RSS_VXLAN;
- else if (!strcmp(res->value, "geneve"))
- rss_conf.rss_hf = RTE_ETH_RSS_GENEVE;
- else if (!strcmp(res->value, "nvgre"))
- rss_conf.rss_hf = RTE_ETH_RSS_NVGRE;
- else if (!strcmp(res->value, "l3-pre32"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE32;
- else if (!strcmp(res->value, "l3-pre40"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE40;
- else if (!strcmp(res->value, "l3-pre48"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE48;
- else if (!strcmp(res->value, "l3-pre56"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE56;
- else if (!strcmp(res->value, "l3-pre64"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE64;
- else if (!strcmp(res->value, "l3-pre96"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE96;
- else if (!strcmp(res->value, "l3-src-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_SRC_ONLY;
- else if (!strcmp(res->value, "l3-dst-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L3_DST_ONLY;
- else if (!strcmp(res->value, "l4-src-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L4_SRC_ONLY;
- else if (!strcmp(res->value, "l4-dst-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L4_DST_ONLY;
- else if (!strcmp(res->value, "l2-src-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2_SRC_ONLY;
- else if (!strcmp(res->value, "l2-dst-only"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2_DST_ONLY;
- else if (!strcmp(res->value, "l2tpv3"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2TPV3;
- else if (!strcmp(res->value, "esp"))
- rss_conf.rss_hf = RTE_ETH_RSS_ESP;
- else if (!strcmp(res->value, "ah"))
- rss_conf.rss_hf = RTE_ETH_RSS_AH;
- else if (!strcmp(res->value, "pfcp"))
- rss_conf.rss_hf = RTE_ETH_RSS_PFCP;
- else if (!strcmp(res->value, "pppoe"))
- rss_conf.rss_hf = RTE_ETH_RSS_PPPOE;
- else if (!strcmp(res->value, "gtpu"))
- rss_conf.rss_hf = RTE_ETH_RSS_GTPU;
- else if (!strcmp(res->value, "ecpri"))
- rss_conf.rss_hf = RTE_ETH_RSS_ECPRI;
- else if (!strcmp(res->value, "mpls"))
- rss_conf.rss_hf = RTE_ETH_RSS_MPLS;
- else if (!strcmp(res->value, "ipv4-chksum"))
- rss_conf.rss_hf = RTE_ETH_RSS_IPV4_CHKSUM;
- else if (!strcmp(res->value, "l2tpv2"))
- rss_conf.rss_hf = RTE_ETH_RSS_L2TPV2;
- else if (!strcmp(res->value, "none"))
- rss_conf.rss_hf = 0;
- else if (!strcmp(res->value, "level-default")) {
+ if (!strcmp(res->value, "level-default")) {
rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK);
rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_PMD_DEFAULT);
} else if (!strcmp(res->value, "level-outer")) {
@@ -2145,14 +2076,24 @@ cmd_config_rss_parsed(void *parsed_result,
} else if (!strcmp(res->value, "level-inner")) {
rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK);
rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_INNERMOST);
- } else if (!strcmp(res->value, "default"))
+ } else if (!strcmp(res->value, "default")) {
use_default = 1;
- else if (isdigit(res->value[0]) && atoi(res->value) > 0 &&
- atoi(res->value) < 64)
- rss_conf.rss_hf = 1ULL << atoi(res->value);
- else {
- fprintf(stderr, "Unknown parameter\n");
- return;
+ } else if (isdigit(res->value[0])) {
+ int value = atoi(res->value);
+ if (value > 0 && value < 64)
+ rss_conf.rss_hf = 1ULL << (uint8_t)value;
+ else {
+ fprintf(stderr, "flowtype_id should be greater than 0 and less than 64.\n");
+ return;
+ }
+ } else if (!strcmp(res->value, "none")) {
+ rss_conf.rss_hf = 0;
+ } else {
+ rss_conf.rss_hf = str_to_rsstypes(res->value);
+ if (rss_conf.rss_hf == 0) {
+ fprintf(stderr, "Unknown parameter\n");
+ return;
+ }
}
rss_conf.rss_key = NULL;
/* Update global configuration for RSS types. */
@@ -2203,9 +2144,14 @@ static cmdline_parse_inst_t cmd_config_rss = {
.f = cmd_config_rss_parsed,
.data = NULL,
.help_str = "port config all rss "
- "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|"
- "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|l2tpv2|"
- "none|level-default|level-outer|level-inner|<flowtype_id>",
+ "all|default|level-default|level-outer|level-inner|"
+ "ip|tcp|udp|sctp|tunnel|vlan|none|"
+ "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
+ "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
+ "l2-payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|"
+ "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|"
+ "l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|"
+ "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>",
.tokens = {
(void *)&cmd_config_rss_port,
(void *)&cmd_config_rss_keyword,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index a1183ad18e..a8fd84439d 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -673,6 +673,19 @@ print_dev_capabilities(uint64_t capabilities)
}
}
+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;
+}
+
const char *
rsstypes_to_str(uint64_t rss_type)
{
@@ -3856,15 +3869,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;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 195488b602..2e2987eb66 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1199,6 +1199,7 @@ extern int flow_parse(const char *src, void *result, unsigned int size,
struct rte_flow_item **pattern,
struct rte_flow_action **actions);
+uint64_t str_to_rsstypes(const char *str);
const char *rsstypes_to_str(uint64_t rss_type);
/* For registering driver specific testpmd commands. */
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 9a79ffd03b..b0bb912455 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2143,8 +2143,15 @@ port config - RSS
~~~~~~~~~~~~~~~~~
Set the RSS (Receive Side Scaling) mode on or off::
-
- testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
+ testpmd> port config all rss (all|default|level-default|level-outer|level-inner| \
+ ip|tcp|udp|sctp|tunnel|vlan|none| \
+ ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other| \
+ ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \
+ ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex| \
+ l2-payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan| \
+ esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum| \
+ l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32| \
+ l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)
RSS is on by default.
--
2.22.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V6 5/8] app/testpmd: unify RSS types display
2022-06-29 8:34 ` [PATCH V6 0/8] " Huisong Li
` (3 preceding siblings ...)
2022-06-29 8:34 ` [PATCH V6 4/8] app/testpmd: refactor config all RSS command Huisong Li
@ 2022-06-29 8:34 ` Huisong Li
2022-06-29 8:34 ` [PATCH V6 6/8] app/testpmd: compact RSS types output in some commands Huisong Li
` (4 subsequent siblings)
9 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-29 8:34 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
The 'rss_type_table[]' maintains the name and value of RSS types. This
patch unifies a common interface to display RSS types.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
---
app/test-pmd/config.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index a8fd84439d..823699c72c 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1569,6 +1569,23 @@ port_flow_complain(struct rte_flow_error *error)
return -err;
}
+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 void
rss_config_display(struct rte_flow_action_rss *rss_conf)
{
@@ -1611,13 +1628,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 *
@@ -3847,13 +3858,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;
--
2.22.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V6 6/8] app/testpmd: compact RSS types output in some commands
2022-06-29 8:34 ` [PATCH V6 0/8] " Huisong Li
` (4 preceding siblings ...)
2022-06-29 8:34 ` [PATCH V6 5/8] app/testpmd: unify RSS types display Huisong Li
@ 2022-06-29 8:34 ` Huisong Li
2022-06-29 8:34 ` [PATCH V6 7/8] app/testpmd: reorder elements in RSS type table array Huisong Li
` (3 subsequent siblings)
9 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-29 8:34 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
In port info command output, 'show port info all', supported RSS offload
types printed one type per line, and although this information is not
most important part of the command it takes big part of the command
output.
In port RSS hash and flow RSS command output, 'show port 0 rss-hash',
and 'flow query 0 0 rss', all enabled RSS types are printed on one line.
If there are many types, the print will be very long.
Compacting these RSS offloads and types output by fixing the length of the
character string printed on each line, instead of one per line or one line.
Output becomes as following:
Supported RSS offload flow types:
ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other
ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other
l4-dst-only l4-src-only l3-dst-only l3-src-only
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/config.c | 68 +++++++++++++++++++++++++++++++-----------
app/test-pmd/testpmd.h | 2 ++
2 files changed, 52 insertions(+), 18 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 823699c72c..ca13d21cdd 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -699,6 +699,38 @@ rsstypes_to_str(uint64_t rss_type)
return NULL;
}
+static void
+rss_offload_types_display(uint64_t offload_types, uint16_t char_num_per_line)
+{
+ uint16_t user_defined_str_len;
+ uint16_t total_len = 0;
+ uint16_t str_len = 0;
+ uint64_t rss_offload;
+ uint16_t i;
+
+ for (i = 0; i < sizeof(offload_types) * CHAR_BIT; i++) {
+ rss_offload = RTE_BIT64(i);
+ if ((offload_types & rss_offload) != 0) {
+ const char *p = rsstypes_to_str(rss_offload);
+
+ user_defined_str_len =
+ strlen("user-defined-") + (i / 10 + 1);
+ str_len = p ? strlen(p) : user_defined_str_len;
+ str_len += 2; /* add two spaces */
+ if (total_len + str_len >= char_num_per_line) {
+ total_len = 0;
+ printf("\n");
+ }
+
+ if (p)
+ printf(" %s", p);
+ else
+ printf(" user-defined-%u", i);
+ total_len += str_len;
+ }
+ }
+}
+
void
port_infos_display(portid_t port_id)
{
@@ -803,21 +835,10 @@ 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;
-
printf("Supported RSS offload flow types:\n");
- for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) {
- uint64_t rss_offload = RTE_BIT64(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);
- }
- }
+ rss_offload_types_display(dev_info.flow_type_rss_offloads,
+ TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
+ printf("\n");
}
printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize);
@@ -1570,8 +1591,10 @@ port_flow_complain(struct rte_flow_error *error)
}
static void
-rss_types_display(uint64_t rss_types)
+rss_types_display(uint64_t rss_types, uint16_t char_num_per_line)
{
+ uint16_t total_len = 0;
+ uint16_t str_len;
uint16_t i;
if (rss_types == 0)
@@ -1580,9 +1603,18 @@ rss_types_display(uint64_t rss_types)
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)
+ rss_type_table[i].rss_type) {
+ /* Contain two spaces */
+ str_len = strlen(rss_type_table[i].str) + 2;
+ if (total_len + str_len > char_num_per_line) {
+ printf("\n");
+ total_len = 0;
+ }
printf(" %s", rss_type_table[i].str);
+ total_len += str_len;
+ }
}
}
@@ -1628,7 +1660,7 @@ rss_config_display(struct rte_flow_action_rss *rss_conf)
printf(" none\n");
return;
}
- rss_types_display(rss_conf->types);
+ rss_types_display(rss_conf->types, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
}
static struct port_indirect_action *
@@ -3859,7 +3891,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
return;
}
printf("RSS functions:\n");
- rss_types_display(rss_hf);
+ rss_types_display(rss_hf, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
printf("\n");
if (!show_rss_key)
return;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 2e2987eb66..9cc5752f62 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -113,6 +113,8 @@ struct pkt_burst_stats {
unsigned int pkt_burst_spread[MAX_PKT_BURST + 1];
};
+
+#define TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE 64
/** Information for a given RSS type. */
struct rss_type_info {
const char *str; /**< Type name. */
--
2.22.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V6 7/8] app/testpmd: reorder elements in RSS type table array
2022-06-29 8:34 ` [PATCH V6 0/8] " Huisong Li
` (5 preceding siblings ...)
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 ` Huisong Li
2022-06-29 8:34 ` [PATCH V6 8/8] app/testpmd: remove duplicated flow type to string table Huisong Li
` (2 subsequent siblings)
9 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-29 8:34 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
There are group and individual types in rss_type_table[]. However, group
types are very scattered, and individual types are not arranged based on
the bit number order in 'RTE_ETH_RSS_xxx'. For a clear distribution of
types and better maintenance, this patch reorders this table.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/config.c | 47 +++++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 22 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index ca13d21cdd..7be9a495d9 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -85,17 +85,20 @@ static const struct {
};
const struct rss_type_info rss_type_table[] = {
+ /* Group types */
{ "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |
RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD |
RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP |
RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS | RTE_ETH_RSS_L2TPV2},
{ "none", 0 },
- { "eth", RTE_ETH_RSS_ETH },
- { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
- { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
+ { "ip", RTE_ETH_RSS_IP },
+ { "udp", RTE_ETH_RSS_UDP },
+ { "tcp", RTE_ETH_RSS_TCP },
+ { "sctp", RTE_ETH_RSS_SCTP },
+ { "tunnel", RTE_ETH_RSS_TUNNEL },
{ "vlan", RTE_ETH_RSS_VLAN },
- { "s-vlan", RTE_ETH_RSS_S_VLAN },
- { "c-vlan", RTE_ETH_RSS_C_VLAN },
+
+ /* Individual type */
{ "ipv4", RTE_ETH_RSS_IPV4 },
{ "ipv4-frag", RTE_ETH_RSS_FRAG_IPV4 },
{ "ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP },
@@ -116,33 +119,33 @@ const struct rss_type_info rss_type_table[] = {
{ "vxlan", RTE_ETH_RSS_VXLAN },
{ "geneve", RTE_ETH_RSS_GENEVE },
{ "nvgre", RTE_ETH_RSS_NVGRE },
- { "ip", RTE_ETH_RSS_IP },
- { "udp", RTE_ETH_RSS_UDP },
- { "tcp", RTE_ETH_RSS_TCP },
- { "sctp", RTE_ETH_RSS_SCTP },
- { "tunnel", RTE_ETH_RSS_TUNNEL },
- { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
- { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
- { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
- { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
- { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
- { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
- { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
- { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
- { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
- { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
+ { "gtpu", RTE_ETH_RSS_GTPU },
+ { "eth", RTE_ETH_RSS_ETH },
+ { "s-vlan", RTE_ETH_RSS_S_VLAN },
+ { "c-vlan", RTE_ETH_RSS_C_VLAN },
{ "esp", RTE_ETH_RSS_ESP },
{ "ah", RTE_ETH_RSS_AH },
{ "l2tpv3", RTE_ETH_RSS_L2TPV3 },
{ "pfcp", RTE_ETH_RSS_PFCP },
{ "pppoe", RTE_ETH_RSS_PPPOE },
- { "gtpu", RTE_ETH_RSS_GTPU },
{ "ecpri", RTE_ETH_RSS_ECPRI },
{ "mpls", RTE_ETH_RSS_MPLS },
{ "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM },
{ "l4-chksum", RTE_ETH_RSS_L4_CHKSUM },
{ "l2tpv2", RTE_ETH_RSS_L2TPV2 },
- { NULL, 0 },
+ { "l3-pre96", RTE_ETH_RSS_L3_PRE96 },
+ { "l3-pre64", RTE_ETH_RSS_L3_PRE64 },
+ { "l3-pre56", RTE_ETH_RSS_L3_PRE56 },
+ { "l3-pre48", RTE_ETH_RSS_L3_PRE48 },
+ { "l3-pre40", RTE_ETH_RSS_L3_PRE40 },
+ { "l3-pre32", RTE_ETH_RSS_L3_PRE32 },
+ { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY },
+ { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
+ { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY },
+ { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY },
+ { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY },
+ { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY },
+ { NULL, 0},
};
static const struct {
--
2.22.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH V6 8/8] app/testpmd: remove duplicated flow type to string table
2022-06-29 8:34 ` [PATCH V6 0/8] " Huisong Li
` (6 preceding siblings ...)
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 ` Huisong Li
2022-06-29 9:59 ` [PATCH V6 0/8] app/testpmd: fix RSS and flow type lihuisong (C)
2022-06-29 20:05 ` Ferruh Yigit
9 siblings, 0 replies; 72+ messages in thread
From: Huisong Li @ 2022-06-29 8:34 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
Flow type table has two instance, one is used for flow type to string
conversion, and other is used for string to flow type conversion.
And tables are diverged by time.
Unifying tables to prevent maintaining two different tables.
Note: made 'flowtype_to_str()' and 'str_to_flowtype()' non-static to
prevent build error for the case PMDs using it disables. Making the two
functions generic, not for some PMDs.
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/config.c | 86 ++++++++++++++++++++-------------
app/test-pmd/testpmd.h | 3 ++
drivers/net/i40e/i40e_testpmd.c | 41 +---------------
3 files changed, 56 insertions(+), 74 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 7be9a495d9..388466f9ff 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -170,6 +170,35 @@ static const struct {
},
};
+const struct {
+ char str[32];
+ uint16_t ftype;
+} flowtype_str_table[] = {
+ {"raw", RTE_ETH_FLOW_RAW},
+ {"ipv4", RTE_ETH_FLOW_IPV4},
+ {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
+ {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
+ {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
+ {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
+ {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
+ {"ipv6", RTE_ETH_FLOW_IPV6},
+ {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
+ {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
+ {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
+ {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
+ {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
+ {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
+ {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
+ {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
+ {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
+ {"port", RTE_ETH_FLOW_PORT},
+ {"vxlan", RTE_ETH_FLOW_VXLAN},
+ {"geneve", RTE_ETH_FLOW_GENEVE},
+ {"nvgre", RTE_ETH_FLOW_NVGRE},
+ {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
+ {"gtpu", RTE_ETH_FLOW_GTPU},
+};
+
static void
print_ethaddr(const char *name, struct rte_ether_addr *eth_addr)
{
@@ -5665,42 +5694,29 @@ set_record_burst_stats(uint8_t on_off)
record_burst_stats = on_off;
}
-#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
+uint16_t
+str_to_flowtype(const char *string)
+{
+ uint8_t i;
-static char*
+ for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
+ if (!strcmp(flowtype_str_table[i].str, string))
+ return flowtype_str_table[i].ftype;
+ }
+
+ if (isdigit(string[0])) {
+ int val = atoi(string);
+ if (val > 0 && val < 64)
+ return (uint16_t)val;
+ }
+
+ return RTE_ETH_FLOW_UNKNOWN;
+}
+
+const char*
flowtype_to_str(uint16_t flow_type)
{
- struct flow_type_info {
- char str[32];
- uint16_t ftype;
- };
-
uint8_t i;
- static struct flow_type_info flowtype_str_table[] = {
- {"raw", RTE_ETH_FLOW_RAW},
- {"ipv4", RTE_ETH_FLOW_IPV4},
- {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
- {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
- {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
- {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
- {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
- {"ipv6", RTE_ETH_FLOW_IPV6},
- {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
- {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
- {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
- {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
- {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
- {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
- {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
- {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
- {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
- {"port", RTE_ETH_FLOW_PORT},
- {"vxlan", RTE_ETH_FLOW_VXLAN},
- {"geneve", RTE_ETH_FLOW_GENEVE},
- {"nvgre", RTE_ETH_FLOW_NVGRE},
- {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
- {"gtpu", RTE_ETH_FLOW_GTPU},
- };
for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
if (flowtype_str_table[i].ftype == flow_type)
@@ -5710,6 +5726,8 @@ 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)
{
@@ -5774,7 +5792,7 @@ print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
{
struct rte_eth_fdir_flex_mask *mask;
uint32_t i, j;
- char *p;
+ const char *p;
for (i = 0; i < flex_conf->nb_flexmasks; i++) {
mask = &flex_conf->flex_mask[i];
@@ -5790,7 +5808,7 @@ static inline void
print_fdir_flow_type(uint32_t flow_types_mask)
{
int i;
- char *p;
+ const char *p;
for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
if (!(flow_types_mask & (1 << i)))
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 9cc5752f62..fb2f5195d3 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1204,6 +1204,9 @@ extern int flow_parse(const char *src, void *result, unsigned int size,
uint64_t str_to_rsstypes(const char *str);
const char *rsstypes_to_str(uint64_t rss_type);
+uint16_t str_to_flowtype(const char *string);
+const char *flowtype_to_str(uint16_t flow_type);
+
/* For registering driver specific testpmd commands. */
struct testpmd_driver_commands {
TAILQ_ENTRY(testpmd_driver_commands) next;
diff --git a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c
index 86159e5c1c..45f8da270d 100644
--- a/drivers/net/i40e/i40e_testpmd.c
+++ b/drivers/net/i40e/i40e_testpmd.c
@@ -461,45 +461,6 @@ static cmdline_parse_inst_t cmd_show_queue_region_info_all = {
},
};
-static uint16_t
-str2flowtype(char *string)
-{
- uint8_t i = 0;
- static const struct {
- char str[32];
- uint16_t type;
- } flowtype_str[] = {
- {"raw", RTE_ETH_FLOW_RAW},
- {"ipv4", RTE_ETH_FLOW_IPV4},
- {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
- {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
- {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
- {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
- {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
- {"ipv6", RTE_ETH_FLOW_IPV6},
- {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
- {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
- {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
- {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
- {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
- {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
- {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
- {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
- {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
- {"gtpu", RTE_ETH_FLOW_GTPU},
- };
-
- for (i = 0; i < RTE_DIM(flowtype_str); i++) {
- if (!strcmp(flowtype_str[i].str, string))
- return flowtype_str[i].type;
- }
-
- if (isdigit(string[0]) && atoi(string) > 0 && atoi(string) < 64)
- return (uint16_t)atoi(string);
-
- return RTE_ETH_FLOW_UNKNOWN;
-}
-
/* *** deal with flow director filter *** */
struct cmd_flow_director_result {
cmdline_fixed_string_t flow_director_filter;
@@ -527,7 +488,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
struct rte_pmd_i40e_flow_type_mapping
mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
struct rte_pmd_i40e_pkt_template_conf conf;
- uint16_t flow_type = str2flowtype(res->flow_type);
+ uint16_t flow_type = str_to_flowtype(res->flow_type);
uint16_t i, port = res->port_id;
uint8_t add;
--
2.22.0
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V6 0/8] app/testpmd: fix RSS and flow type
2022-06-29 8:34 ` [PATCH V6 0/8] " Huisong Li
` (7 preceding siblings ...)
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 ` lihuisong (C)
2022-06-29 14:13 ` Ferruh Yigit
2022-06-29 20:05 ` Ferruh Yigit
9 siblings, 1 reply; 72+ messages in thread
From: lihuisong (C) @ 2022-06-29 9:59 UTC (permalink / raw)
To: aman.deep.singh, yuying.zhang, ferruh.yigit, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
Hi Ferruh,
The patch 8/8 fails to build.
Could you please have a look?
http://mails.dpdk.org/archives/test-report/2022-June/293418.html
Thanks,
Huisong
在 2022/6/29 16:34, Huisong Li 写道:
> This patchset fix RSS related code and remove duplicated flow type to
> string table.
>
> ---
> v6:
> - add a release note for renaming testpmd RSS type 'ether'.
> - revert "unknown offload xxx" print.
>
> v5:
> - resolve a warning in testpmd_funcs.rst file
>
> v4:
> - delete 'rss_offload_table[]' and use 'rss_type_table[]'
> - add an 'char_num_per_line' parameter to control RSS types display.
> - add 2/7, 3/7 and 6/7 patch.
>
> v3:
> - add 'rss_offload_table[]' to display supported RSS offload.
> - add patch 3/4 and 4/4.
>
> v2:
> - resovle compilation failure when disable i40e and ixgbe.
>
> Ferruh Yigit (2):
> app/testpmd: compact RSS types output in some commands
> app/testpmd: remove duplicated flow type to string table
>
> Huisong Li (6):
> app/testpmd: fix supported RSS offload display
> app/testpmd: unify the name of L2 payload offload
> doc: testpmd rename RSS type ether to L2 payload
> app/testpmd: refactor config all RSS command
> app/testpmd: unify RSS types display
> app/testpmd: reorder elements in RSS type table array
>
> app/test-pmd/cmdline.c | 122 +++------
> app/test-pmd/config.c | 259 +++++++++++++-------
> app/test-pmd/testpmd.h | 8 +
> doc/guides/rel_notes/release_22_07.rst | 4 +
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +-
> drivers/net/i40e/i40e_testpmd.c | 41 +---
> 6 files changed, 225 insertions(+), 220 deletions(-)
>
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V6 0/8] app/testpmd: fix RSS and flow type
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
0 siblings, 0 replies; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-29 14:13 UTC (permalink / raw)
To: David Marchand, Aaron Conole
Cc: dev, thomas, huangdaode, liudongdong3, lihuisong (C),
aman.deep.singh, yuying.zhang, andrew.rybchenko
On 6/29/2022 10:59 AM, lihuisong (C) wrote:
> Hi Ferruh,
>
> The patch 8/8 fails to build.
> Could you please have a look?
> http://mails.dpdk.org/archives/test-report/2022-June/293418.html
>
Hi David, Aaron,
'ovsrobot/dpdk' github action fails and error seems an infrastructure
error [1].
Can you restart the test?
[1]
Could not connect to ppa.launchpad.net:80 (185.125.190.52), connection
timed out
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH V6 0/8] app/testpmd: fix RSS and flow type
2022-06-29 8:34 ` [PATCH V6 0/8] " Huisong Li
` (8 preceding siblings ...)
2022-06-29 9:59 ` [PATCH V6 0/8] app/testpmd: fix RSS and flow type lihuisong (C)
@ 2022-06-29 20:05 ` Ferruh Yigit
9 siblings, 0 replies; 72+ messages in thread
From: Ferruh Yigit @ 2022-06-29 20:05 UTC (permalink / raw)
To: Huisong Li, aman.deep.singh, yuying.zhang, andrew.rybchenko
Cc: dev, thomas, huangdaode, liudongdong3
On 6/29/2022 9:34 AM, Huisong Li wrote:
> This patchset fix RSS related code and remove duplicated flow type to
> string table.
>
> ---
> v6:
> - add a release note for renaming testpmd RSS type 'ether'.
> - revert "unknown offload xxx" print.
>
> v5:
> - resolve a warning in testpmd_funcs.rst file
>
> v4:
> - delete 'rss_offload_table[]' and use 'rss_type_table[]'
> - add an 'char_num_per_line' parameter to control RSS types display.
> - add 2/7, 3/7 and 6/7 patch.
>
> v3:
> - add 'rss_offload_table[]' to display supported RSS offload.
> - add patch 3/4 and 4/4.
>
> v2:
> - resovle compilation failure when disable i40e and ixgbe.
>
> Ferruh Yigit (2):
> app/testpmd: compact RSS types output in some commands
> app/testpmd: remove duplicated flow type to string table
>
> Huisong Li (6):
> app/testpmd: fix supported RSS offload display
> app/testpmd: unify the name of L2 payload offload
> doc: testpmd rename RSS type ether to L2 payload
> app/testpmd: refactor config all RSS command
> app/testpmd: unify RSS types display
> app/testpmd: reorder elements in RSS type table array
>
For series,
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Series applied to dpdk-next-net/main, thanks.
Doc patch merged with relevant patch while merging.
Thanks for the cleanup. Addition to some internal cleanup/refactoring,
output improved as following [1].
The output is "Supported RSS offload flow types", so it is the
capability of the device, not current configuration.
Do you think does it make sense to add "Configured RSS offload types" too?
@Aman, @Yuying, what do you think?
[1] RSS related part of "show port info all"
new:
Supported RSS offload flow types:
ipv4 ipv4-frag ipv4-tcp ipv4-udp ipv4-other ipv6
ipv6-frag ipv6-tcp ipv6-udp ipv6-other ipv6-ex
ipv6-tcp-ex ipv6-udp-ex esp l4-dst-only l4-src-only
l3-dst-only l3-src-only
old:
Supported RSS offload flow types:
ipv4
ipv4-frag
ipv4-tcp
ipv4-udp
ipv4-other
ipv6
ipv6-frag
ipv6-tcp
ipv6-udp
ipv6-other
ipv6-ex
ipv6-tcp-ex
ipv6-udp-ex
user defined 27
user defined 60
user defined 61
user defined 62
user defined 63
^ permalink raw reply [flat|nested] 72+ messages in thread
end of thread, other threads:[~2022-06-29 20:06 UTC | newest]
Thread overview: 72+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH V3 app/testpmd 2/4] app/testpmd: unify RSS types display and obtaination Huisong Li
2022-06-07 15:46 ` 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
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).