patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Dongdong Liu <liudongdong3@huawei.com>
To: Ferruh Yigit <ferruh.yigit@amd.com>, <dev@dpdk.org>,
	<thomas@monjalon.net>, <andrew.rybchenko@oktetlabs.ru>,
	<reshma.pattan@intel.com>
Cc: <stable@dpdk.org>, <yisen.zhuang@huawei.com>,
	Jie Hai <haijie1@huawei.com>,
	Maryam Tahhan <maryam.tahhan@intel.com>
Subject: Re: [PATCH 4/5] app/proc-info: show RSS types with strings
Date: Mon, 5 Jun 2023 21:12:44 +0800	[thread overview]
Message-ID: <a47d56b8-0dfc-c0d4-d283-9d948dd89bb2@huawei.com> (raw)
In-Reply-To: <915a41a6-936c-9e5c-67d7-f9864ba01863@amd.com>


Hi Ferruh
On 2023/6/3 4:22, Ferruh Yigit wrote:
> On 3/15/2023 11:00 AM, Dongdong Liu wrote:
>> From: Jie Hai <haijie1@huawei.com>
>>
>> show RSS types details and adjust RSS info display format as following:
>>
>>   - RSS info
>> 	  -- hf:
>> 		ipv4  ipv4-frag  ipv4-other  ipv6  ipv6-frag  ipv6-other
>> 	  -- key len: 40
>> 	  -- key (hex): 6d5a56da255b0ec24167253d43a38fb0d0ca2bcbae7b30b477cb2da38030f20c6a42b73bbeac01fa
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> ---
>>  app/proc-info/main.c | 120 ++++++++++++++++++++++++++++++++++++++++---
>>  1 file changed, 113 insertions(+), 7 deletions(-)
>>
>> diff --git a/app/proc-info/main.c b/app/proc-info/main.c
>> index 878ce37e8b..7b6f8f1228 100644
>> --- a/app/proc-info/main.c
>> +++ b/app/proc-info/main.c
>> @@ -54,6 +54,9 @@
>>  #define STATS_BDR_STR(w, s) printf("%.*s%s%.*s\n", w, \
>>  	STATS_BDR_FMT, s, w, STATS_BDR_FMT)
>>
>> +/* It is used to print the RSS types. */
>> +#define RSS_TYPES_CHAR_NUM_PER_LINE 64
>> +
>>  /* mask of enabled ports */
>>  static unsigned long enabled_port_mask;
>>  /* Enable stats. */
>> @@ -132,6 +135,76 @@ struct desc_param {
>>  static struct desc_param rx_desc_param;
>>  static struct desc_param tx_desc_param;
>>
>> +/* Information for a given RSS type. */
>> +struct rss_type_info {
>> +	const char *str; /* Type name. */
>> +	uint64_t rss_type; /* Type value. */
>> +};
>> +
>> +static 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 },
>> +	{ "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 },
>> +
>> +	/* Individual type */
>> +	{ "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},
>> +};
>> +
>
> Agree this makes output more user friendly, but this brings something to
> maintain in the application, and I am almost sure that it will become
> outdated by time as new RSS types added.
That's true.
>
> One option is to add this as an API in the library, so it will be easier
> to keep up to date, and use API from here. But not sure if it worths to
> have new API for this?
I will consider that.

Thanks,
Dongdong.
>
>>  /* display usage */
>>  static void
>>  proc_info_usage(const char *prgname)
>> @@ -806,6 +879,33 @@ show_offloads(uint64_t offloads,
>>  	}
>>  }
>>
>> +static void
>> +show_rss_types(uint64_t rss_types)
>> +{
>> +	uint16_t total_len = 0;
>> +	uint16_t str_len;
>> +	uint16_t i;
>> +
>> +	printf("\t\t");
>> +	for (i = 0; rss_type_table[i].str != NULL; i++) {
>> +		if (rss_type_table[i].rss_type == 0)
>> +			continue;
>> +
>> +		if ((rss_type_table[i].rss_type & rss_types) ==
>> +					rss_type_table[i].rss_type) {
>> +			/* Contain two spaces */
>> +			str_len = strlen(rss_type_table[i].str) + 2;
>> +			if (total_len + str_len > RSS_TYPES_CHAR_NUM_PER_LINE) {
>> +				printf("\n\t\t");
>> +				total_len = 0;
>> +			}
>> +			printf("%s  ", rss_type_table[i].str);
>> +			total_len += str_len;
>> +		}
>> +	}
>> +	printf("\n");
>> +}
>> +
>>  static void
>>  show_port(void)
>>  {
>> @@ -991,13 +1091,19 @@ show_port(void)
>>  		rss_conf.rss_key_len = dev_info.hash_key_size;
>>  		ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf);
>>  		if (ret == 0) {
>> -			printf("  - RSS\n");
>> -			printf("\t  -- RSS len %u key (hex):",
>> -					rss_conf.rss_key_len);
>> -			for (k = 0; k < rss_conf.rss_key_len; k++)
>> -				printf(" %x", rss_conf.rss_key[k]);
>> -			printf("\t  -- hf 0x%"PRIx64"\n",
>> -					rss_conf.rss_hf);
>> +			printf("  - RSS info\n");
>> +			if (rss_conf.rss_hf == 0) {
>> +				printf("\tRSS disabled\n");
>> +			} else {
>> +				printf("\t  -- hf:\n");
>> +				show_rss_types(rss_conf.rss_hf);
>> +				printf("\t  -- key len: %u\n",
>> +						rss_conf.rss_key_len);
>> +				printf("\t  -- key (hex): ");
>> +				for (k = 0; k < rss_conf.rss_key_len; k++)
>> +					printf("%02x", rss_conf.rss_key[k]);
>> +				printf("\n");
>> +			}
>>  		}
>>
>>  		rte_free(rss_key);
>
> .
>

  reply	other threads:[~2023-06-05 13:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 11:00 [PATCH 0/5] support setting and querying RSS algorithms Dongdong Liu
2023-03-15 11:00 ` [PATCH 1/5] ethdev: support setting and querying rss algorithm Dongdong Liu
2023-03-15 11:28   ` Ivan Malov
2023-03-16 13:10     ` Dongdong Liu
2023-03-16 14:31       ` Ivan Malov
2023-03-15 13:43   ` Thomas Monjalon
2023-03-16 13:16     ` Dongdong Liu
2023-06-02 20:19       ` Ferruh Yigit
2023-06-05 12:34         ` Dongdong Liu
2023-03-15 11:00 ` [PATCH 2/5] net/hns3: support setting and querying RSS hash function Dongdong Liu
2023-03-15 11:00 ` [PATCH 3/5] app/proc-info: fix never show RSS info Dongdong Liu
2023-06-02 20:19   ` Ferruh Yigit
2023-06-05 13:04     ` Dongdong Liu
2023-06-02 21:19   ` Stephen Hemminger
2023-06-05 13:07     ` Dongdong Liu
2023-03-15 11:00 ` [PATCH 4/5] app/proc-info: show RSS types with strings Dongdong Liu
2023-06-02 20:22   ` Ferruh Yigit
2023-06-05 13:12     ` Dongdong Liu [this message]
2023-03-15 11:00 ` [PATCH 5/5] app/proc-info: support querying RSS hash algorithm Dongdong Liu
2023-08-26  7:00 ` [PATCH v2 0/5] support setting and querying RSS algorithms Jie Hai
2023-08-26  7:00   ` [PATCH v2 1/5] ethdev: support setting and querying rss algorithm Jie Hai
2023-08-30 11:41     ` Thomas Monjalon
2023-08-26  7:00   ` [PATCH v2 2/5] net/hns3: support setting and querying RSS hash function Jie Hai
2023-08-26  7:00   ` [PATCH v2 3/5] app/proc-info: fix never show RSS info Jie Hai
2023-08-26  7:00   ` [PATCH v2 4/5] app/proc-info: adjust the display format of " Jie Hai
2023-08-26  7:00   ` [PATCH v2 5/5] app/proc-info: support querying RSS hash algorithm Jie Hai
2023-08-26  8:52   ` [PATCH v2 0/5] support setting and querying RSS algorithms Jie Hai

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=a47d56b8-0dfc-c0d4-d283-9d948dd89bb2@huawei.com \
    --to=liudongdong3@huawei.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=haijie1@huawei.com \
    --cc=maryam.tahhan@intel.com \
    --cc=reshma.pattan@intel.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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).