app/test-pipeline: relax RSS hash requirement

Message ID 20230626074538.3354554-1-feifei.wang2@arm.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series app/test-pipeline: relax RSS hash requirement |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Feifei Wang June 26, 2023, 7:45 a.m. UTC
  For some drivers which can not support the configured RSS hash functions,
the thread reports 'invalid rss_hf' when doing device configure.

For example, i40e driver can not support 'RTE_ETH_RSS_IPV4',
'RTE_ETH_RSS_IPV6' and 'RTE_ETH_RSS_NONFRAG_IPV6_OTHER', thus it can not
run successfully in test-pipeline with XL710 NIC and reports the issue:
-------------------------------------------------------------
Ethdev port_id=0 invalid rss_hf: 0xa38c, valid value: 0x7ef8
PANIC in app_init_ports():
Cannot init NIC port 0 (-22)
-------------------------------------------------------------

To fix this, referring to l3fwd operation, adjust the 'rss_hf' based on
device capability and just report a warning.

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Trevor Tao <trevor.tao@arm.com>
---
 app/test-pipeline/init.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon July 12, 2023, 2:51 p.m. UTC | #1
Cristian, any comment?

26/06/2023 09:45, Feifei Wang:
> For some drivers which can not support the configured RSS hash functions,
> the thread reports 'invalid rss_hf' when doing device configure.
> 
> For example, i40e driver can not support 'RTE_ETH_RSS_IPV4',
> 'RTE_ETH_RSS_IPV6' and 'RTE_ETH_RSS_NONFRAG_IPV6_OTHER', thus it can not
> run successfully in test-pipeline with XL710 NIC and reports the issue:
> -------------------------------------------------------------
> Ethdev port_id=0 invalid rss_hf: 0xa38c, valid value: 0x7ef8
> PANIC in app_init_ports():
> Cannot init NIC port 0 (-22)
> -------------------------------------------------------------
> 
> To fix this, referring to l3fwd operation, adjust the 'rss_hf' based on
> device capability and just report a warning.
> 
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Trevor Tao <trevor.tao@arm.com>
> ---
>  app/test-pipeline/init.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c
> index d146c44be0..84a1734519 100644
> --- a/app/test-pipeline/init.c
> +++ b/app/test-pipeline/init.c
> @@ -188,21 +188,41 @@ static void
>  app_init_ports(void)
>  {
>  	uint32_t i;
> +	struct rte_eth_dev_info dev_info;
> +
>  
>  	/* Init NIC ports, then start the ports */
>  	for (i = 0; i < app.n_ports; i++) {
>  		uint16_t port;
>  		int ret;
> +		struct rte_eth_conf local_port_conf = port_conf;
>  
>  		port = app.ports[i];
>  		RTE_LOG(INFO, USER1, "Initializing NIC port %u ...\n", port);
>  
> +		ret = rte_eth_dev_info_get(port, &dev_info);
> +		if (ret != 0)
> +			rte_panic("Error during getting device (port %u) info: %s\n",
> +					port, rte_strerror(-ret));
> +
>  		/* Init port */
> +		local_port_conf.rx_adv_conf.rss_conf.rss_hf &=
> +			dev_info.flow_type_rss_offloads;
> +		if (local_port_conf.rx_adv_conf.rss_conf.rss_hf !=
> +				port_conf.rx_adv_conf.rss_conf.rss_hf) {
> +			printf("Warning:"
> +				"Port %u modified RSS hash function based on hardware support,"
> +				"requested:%#"PRIx64" configured:%#"PRIx64"\n",
> +				port,
> +				port_conf.rx_adv_conf.rss_conf.rss_hf,
> +				local_port_conf.rx_adv_conf.rss_conf.rss_hf);
> +		}
> +
>  		ret = rte_eth_dev_configure(
>  			port,
>  			1,
>  			1,
> -			&port_conf);
> +			&local_port_conf);
>  		if (ret < 0)
>  			rte_panic("Cannot init NIC port %u (%d)\n", port, ret);
>  
>
  
lihuisong (C) July 14, 2023, 7:50 a.m. UTC | #2
在 2023/6/26 15:45, Feifei Wang 写道:
> For some drivers which can not support the configured RSS hash functions,
> the thread reports 'invalid rss_hf' when doing device configure.
>
> For example, i40e driver can not support 'RTE_ETH_RSS_IPV4',
> 'RTE_ETH_RSS_IPV6' and 'RTE_ETH_RSS_NONFRAG_IPV6_OTHER', thus it can not
> run successfully in test-pipeline with XL710 NIC and reports the issue:
> -------------------------------------------------------------
> Ethdev port_id=0 invalid rss_hf: 0xa38c, valid value: 0x7ef8
> PANIC in app_init_ports():
> Cannot init NIC port 0 (-22)
> -------------------------------------------------------------
>
> To fix this, referring to l3fwd operation, adjust the 'rss_hf' based on
> device capability and just report a warning.
>
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Trevor Tao <trevor.tao@arm.com>
> ---
>   app/test-pipeline/init.c | 22 +++++++++++++++++++++-
>   1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c
> index d146c44be0..84a1734519 100644
> --- a/app/test-pipeline/init.c
> +++ b/app/test-pipeline/init.c
> @@ -188,21 +188,41 @@ static void
>   app_init_ports(void)
>   {
>   	uint32_t i;
> +	struct rte_eth_dev_info dev_info;
> +
please delete this blank line.
>   
>   	/* Init NIC ports, then start the ports */
>   	for (i = 0; i < app.n_ports; i++) {
>   		uint16_t port;
>   		int ret;
> +		struct rte_eth_conf local_port_conf = port_conf;
>   
>   		port = app.ports[i];
>   		RTE_LOG(INFO, USER1, "Initializing NIC port %u ...\n", port);
>   
> +		ret = rte_eth_dev_info_get(port, &dev_info);
> +		if (ret != 0)
> +			rte_panic("Error during getting device (port %u) info: %s\n",
> +					port, rte_strerror(-ret));
> +
>   		/* Init port */
> +		local_port_conf.rx_adv_conf.rss_conf.rss_hf &=
> +			dev_info.flow_type_rss_offloads;
> +		if (local_port_conf.rx_adv_conf.rss_conf.rss_hf !=
> +				port_conf.rx_adv_conf.rss_conf.rss_hf) {
> +			printf("Warning:"
> +				"Port %u modified RSS hash function based on hardware support,"
> +				"requested:%#"PRIx64" configured:%#"PRIx64"\n",
> +				port,
> +				port_conf.rx_adv_conf.rss_conf.rss_hf,
> +				local_port_conf.rx_adv_conf.rss_conf.rss_hf);
> +		}
> +
>   		ret = rte_eth_dev_configure(
>   			port,
>   			1,
>   			1,
> -			&port_conf);
> +			&local_port_conf);
>   		if (ret < 0)
>   			rte_panic("Cannot init NIC port %u (%d)\n", port, ret);
>   
This treatment is very common.
Acked-by: Huisong Li <lihuisong@huawei.com>
  
Feifei Wang July 14, 2023, 8:07 a.m. UTC | #3
> -----Original Message-----
> From: lihuisong (C) <lihuisong@huawei.com>
> Sent: Friday, July 14, 2023 3:50 PM
> To: Feifei Wang <Feifei.Wang2@arm.com>; Cristian Dumitrescu
> <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>; Trevor Tao <Trevor.Tao@arm.com>
> Subject: Re: [PATCH] app/test-pipeline: relax RSS hash requirement
> 
> 
> 在 2023/6/26 15:45, Feifei Wang 写道:
> > For some drivers which can not support the configured RSS hash
> > functions, the thread reports 'invalid rss_hf' when doing device configure.
> >
> > For example, i40e driver can not support 'RTE_ETH_RSS_IPV4',
> > 'RTE_ETH_RSS_IPV6' and 'RTE_ETH_RSS_NONFRAG_IPV6_OTHER', thus it
> can
> > not run successfully in test-pipeline with XL710 NIC and reports the issue:
> > -------------------------------------------------------------
> > Ethdev port_id=0 invalid rss_hf: 0xa38c, valid value: 0x7ef8 PANIC in
> > app_init_ports():
> > Cannot init NIC port 0 (-22)
> > -------------------------------------------------------------
> >
> > To fix this, referring to l3fwd operation, adjust the 'rss_hf' based
> > on device capability and just report a warning.
> >
> > Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > Reviewed-by: Trevor Tao <trevor.tao@arm.com>
> > ---
> >   app/test-pipeline/init.c | 22 +++++++++++++++++++++-
> >   1 file changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c index
> > d146c44be0..84a1734519 100644
> > --- a/app/test-pipeline/init.c
> > +++ b/app/test-pipeline/init.c
> > @@ -188,21 +188,41 @@ static void
> >   app_init_ports(void)
> >   {
> >   	uint32_t i;
> > +	struct rte_eth_dev_info dev_info;
> > +
> please delete this blank line.

Thanks for the reviewing. I will change this and update a new version.

> >
> >   	/* Init NIC ports, then start the ports */
> >   	for (i = 0; i < app.n_ports; i++) {
> >   		uint16_t port;
> >   		int ret;
> > +		struct rte_eth_conf local_port_conf = port_conf;
> >
> >   		port = app.ports[i];
> >   		RTE_LOG(INFO, USER1, "Initializing NIC port %u ...\n", port);
> >
> > +		ret = rte_eth_dev_info_get(port, &dev_info);
> > +		if (ret != 0)
> > +			rte_panic("Error during getting device (port %u)
> info: %s\n",
> > +					port, rte_strerror(-ret));
> > +
> >   		/* Init port */
> > +		local_port_conf.rx_adv_conf.rss_conf.rss_hf &=
> > +			dev_info.flow_type_rss_offloads;
> > +		if (local_port_conf.rx_adv_conf.rss_conf.rss_hf !=
> > +				port_conf.rx_adv_conf.rss_conf.rss_hf) {
> > +			printf("Warning:"
> > +				"Port %u modified RSS hash function based
> on hardware support,"
> > +				"requested:%#"PRIx64"
> configured:%#"PRIx64"\n",
> > +				port,
> > +				port_conf.rx_adv_conf.rss_conf.rss_hf,
> > +				local_port_conf.rx_adv_conf.rss_conf.rss_hf);
> > +		}
> > +
> >   		ret = rte_eth_dev_configure(
> >   			port,
> >   			1,
> >   			1,
> > -			&port_conf);
> > +			&local_port_conf);
> >   		if (ret < 0)
> >   			rte_panic("Cannot init NIC port %u (%d)\n", port,
> ret);
> >
> This treatment is very common.
> Acked-by: Huisong Li <lihuisong@huawei.com>
  
Thomas Monjalon Oct. 17, 2023, 8:01 p.m. UTC | #4
Cristian, please could you review this series please?

12/09/2023 08:39, Feifei Wang:
> For test-pipeline application, there are some problems with the normal
> operation of the program and security issues. These patches can fix
> these issues.
> 
> v3: fix SIGINT handling issue and add dev close operation
> 
> Feifei Wang (3):
>   app/test-pipeline: relax RSS hash requirement
>   app/test-pipeline: fix SIGINT handling issue
>   app/test-pipeline: add dev close operation
> 
>  app/test-pipeline/init.c              |  22 ++++-
>  app/test-pipeline/main.c              |  33 +++++++
>  app/test-pipeline/main.h              |   2 +
>  app/test-pipeline/pipeline_acl.c      |   6 +-
>  app/test-pipeline/pipeline_hash.c     | 110 ++++++++++-----------
>  app/test-pipeline/pipeline_lpm.c      |   6 +-
>  app/test-pipeline/pipeline_lpm_ipv6.c |   6 +-
>  app/test-pipeline/pipeline_stub.c     |   6 +-
>  app/test-pipeline/runtime.c           | 132 ++++++++++++++------------
>  9 files changed, 198 insertions(+), 125 deletions(-)
  
Cristian Dumitrescu Oct. 18, 2023, 1:39 p.m. UTC | #5
> -----Original Message-----
> From: Feifei Wang <feifei.wang2@arm.com>
> Sent: Tuesday, September 12, 2023 7:39 AM
> Cc: dev@dpdk.org; nd@arm.com; Feifei Wang <feifei.wang2@arm.com>
> Subject: [PATCH v3 0/3] fix test-pipeline issues
> 
> For test-pipeline application, there are some problems with the normal
> operation of the program and security issues. These patches can fix
> these issues.
> 
> v3: fix SIGINT handling issue and add dev close operation
> 
> Feifei Wang (3):
>   app/test-pipeline: relax RSS hash requirement
>   app/test-pipeline: fix SIGINT handling issue
>   app/test-pipeline: add dev close operation
> 
>  app/test-pipeline/init.c              |  22 ++++-
>  app/test-pipeline/main.c              |  33 +++++++
>  app/test-pipeline/main.h              |   2 +
>  app/test-pipeline/pipeline_acl.c      |   6 +-
>  app/test-pipeline/pipeline_hash.c     | 110 ++++++++++-----------
>  app/test-pipeline/pipeline_lpm.c      |   6 +-
>  app/test-pipeline/pipeline_lpm_ipv6.c |   6 +-
>  app/test-pipeline/pipeline_stub.c     |   6 +-
>  app/test-pipeline/runtime.c           | 132 ++++++++++++++------------
>  9 files changed, 198 insertions(+), 125 deletions(-)
> 
> --
> 2.25.1

Series-acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
  
Thomas Monjalon Nov. 23, 2023, 1:54 a.m. UTC | #6
> > Feifei Wang (3):
> >   app/test-pipeline: relax RSS hash requirement
> >   app/test-pipeline: fix SIGINT handling issue
> >   app/test-pipeline: add dev close operation
> > 
> Series-acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Applied with few minor cleanups.
  

Patch

diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c
index d146c44be0..84a1734519 100644
--- a/app/test-pipeline/init.c
+++ b/app/test-pipeline/init.c
@@ -188,21 +188,41 @@  static void
 app_init_ports(void)
 {
 	uint32_t i;
+	struct rte_eth_dev_info dev_info;
+
 
 	/* Init NIC ports, then start the ports */
 	for (i = 0; i < app.n_ports; i++) {
 		uint16_t port;
 		int ret;
+		struct rte_eth_conf local_port_conf = port_conf;
 
 		port = app.ports[i];
 		RTE_LOG(INFO, USER1, "Initializing NIC port %u ...\n", port);
 
+		ret = rte_eth_dev_info_get(port, &dev_info);
+		if (ret != 0)
+			rte_panic("Error during getting device (port %u) info: %s\n",
+					port, rte_strerror(-ret));
+
 		/* Init port */
+		local_port_conf.rx_adv_conf.rss_conf.rss_hf &=
+			dev_info.flow_type_rss_offloads;
+		if (local_port_conf.rx_adv_conf.rss_conf.rss_hf !=
+				port_conf.rx_adv_conf.rss_conf.rss_hf) {
+			printf("Warning:"
+				"Port %u modified RSS hash function based on hardware support,"
+				"requested:%#"PRIx64" configured:%#"PRIx64"\n",
+				port,
+				port_conf.rx_adv_conf.rss_conf.rss_hf,
+				local_port_conf.rx_adv_conf.rss_conf.rss_hf);
+		}
+
 		ret = rte_eth_dev_configure(
 			port,
 			1,
 			1,
-			&port_conf);
+			&local_port_conf);
 		if (ret < 0)
 			rte_panic("Cannot init NIC port %u (%d)\n", port, ret);