[v12,2/2] app/testpmd: fix testpmd doesn't show RSS hash offload

Message ID 20211012025417.134866-3-jie1x.wang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series testpmd shows incorrect rx_offload configuration |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing fail Testing issues

Commit Message

Jie Wang Oct. 12, 2021, 2:54 a.m. UTC
  The driver may change offloads info into dev->data->dev_conf
in dev_configure which may cause port->dev_conf and port->rx_conf
contain outdated values.

This patch updates the offloads info if it changes to fix this issue.

Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")

Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
 app/test-pmd/cmdline.c | 14 ++++++++++++--
 app/test-pmd/testpmd.c | 33 +++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h |  2 ++
 app/test-pmd/util.c    | 14 ++++++++++++++
 4 files changed, 61 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit Oct. 12, 2021, 2:37 p.m. UTC | #1
On 10/12/2021 3:54 AM, Jie Wang wrote:
> The driver may change offloads info into dev->data->dev_conf
> in dev_configure which may cause port->dev_conf and port->rx_conf
> contain outdated values.
> 
> This patch updates the offloads info if it changes to fix this issue.
> 
> Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
> 
> Signed-off-by: Jie Wang <jie1x.wang@intel.com>

Hi Jie,

ci/intel-Testing is still reporting some errors [1] with this patch,
did you able to investigate the reason of it?

This error seems not seen in other patches, so that shouldn't be an
infrastructure problem.


[1]
http://mails.dpdk.org/archives/test-report/2021-October/226766.html
  
Jie Wang Oct. 13, 2021, 2:42 a.m. UTC | #2
> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Tuesday, October 12, 2021 10:38 PM
> To: Wang, Jie1X <jie1x.wang@intel.com>; dev@dpdk.org
> Cc: thomas@monjalon.net; andrew.rybchenko@oktetlabs.ru; Li, Xiaoyun
> <xiaoyun.li@intel.com>; Yang, SteveX <stevex.yang@intel.com>
> Subject: Re: [PATCH v12 2/2] app/testpmd: fix testpmd doesn't show RSS hash
> offload
> 
> On 10/12/2021 3:54 AM, Jie Wang wrote:
> > The driver may change offloads info into dev->data->dev_conf in
> > dev_configure which may cause port->dev_conf and port->rx_conf contain
> > outdated values.
> >
> > This patch updates the offloads info if it changes to fix this issue.
> >
> > Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
> >
> > Signed-off-by: Jie Wang <jie1x.wang@intel.com>
> 
> Hi Jie,
> 
> ci/intel-Testing is still reporting some errors [1] with this patch, did you able to
> investigate the reason of it?
> 
> This error seems not seen in other patches, so that shouldn't be an infrastructure
> problem.
> 
> 
> [1]
> http://mails.dpdk.org/archives/test-report/2021-October/226766.html

Hi Ferruh,

When the dpdk runs the test_pf_tx_rx_queue test case, the port will be configured with rxq/txq to 1. This will cause the test to fail.

In rte_eth_dev_configure, if rxq/txq is 1, dev_conf->rxmode.mq_mode is ETH_MQ_RX_NONE, and  dev_conf->rxmode.offloads contains the DEV_RX_OFFLOAD_RSS_HASH value by default, which causes the program to report an error " Ethdev port_id=0 config invalid Rx mq_mode without RSS but RSS_HASH offload is requested".

When the port needs to configure txq/txq to 1, first clear the RSS_HASH configuration of dev_conf->rxmode.offloads.

And I have talked about this error with the tester a few days ago, and they will modify the test case. They will add a command (port config port_id rx_offload rss_hash off) before configuring txq/rxq to 1.
  
Ferruh Yigit Oct. 13, 2021, 8:50 a.m. UTC | #3
On 10/13/2021 3:42 AM, Wang, Jie1X wrote:
> 
> 
>> -----Original Message-----
>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>> Sent: Tuesday, October 12, 2021 10:38 PM
>> To: Wang, Jie1X <jie1x.wang@intel.com>; dev@dpdk.org
>> Cc: thomas@monjalon.net; andrew.rybchenko@oktetlabs.ru; Li, Xiaoyun
>> <xiaoyun.li@intel.com>; Yang, SteveX <stevex.yang@intel.com>
>> Subject: Re: [PATCH v12 2/2] app/testpmd: fix testpmd doesn't show RSS hash
>> offload
>>
>> On 10/12/2021 3:54 AM, Jie Wang wrote:
>>> The driver may change offloads info into dev->data->dev_conf in
>>> dev_configure which may cause port->dev_conf and port->rx_conf contain
>>> outdated values.
>>>
>>> This patch updates the offloads info if it changes to fix this issue.
>>>
>>> Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
>>>
>>> Signed-off-by: Jie Wang <jie1x.wang@intel.com>
>>
>> Hi Jie,
>>
>> ci/intel-Testing is still reporting some errors [1] with this patch, did you able to
>> investigate the reason of it?
>>
>> This error seems not seen in other patches, so that shouldn't be an infrastructure
>> problem.
>>
>>
>> [1]
>> http://mails.dpdk.org/archives/test-report/2021-October/226766.html
> 
> Hi Ferruh,
> 
> When the dpdk runs the test_pf_tx_rx_queue test case, the port will be configured with rxq/txq to 1. This will cause the test to fail.
> 
> In rte_eth_dev_configure, if rxq/txq is 1, dev_conf->rxmode.mq_mode is ETH_MQ_RX_NONE, and  dev_conf->rxmode.offloads contains the DEV_RX_OFFLOAD_RSS_HASH value by default, which causes the program to report an error " Ethdev port_id=0 config invalid Rx mq_mode without RSS but RSS_HASH offload is requested".
> 
> When the port needs to configure txq/txq to 1, first clear the RSS_HASH configuration of dev_conf->rxmode.offloads.
> 
> And I have talked about this error with the tester a few days ago, and they will modify the test case. They will add a command (port config port_id rx_offload rss_hash off) before configuring txq/rxq to 1.
> 

I see, but shouldn't this fail for all patches, why it is only failing
for this set?
  
Ferruh Yigit Oct. 13, 2021, 10:14 a.m. UTC | #4
On 10/13/2021 9:50 AM, Ferruh Yigit wrote:
> On 10/13/2021 3:42 AM, Wang, Jie1X wrote:
>>
>>
>>> -----Original Message-----
>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>>> Sent: Tuesday, October 12, 2021 10:38 PM
>>> To: Wang, Jie1X <jie1x.wang@intel.com>; dev@dpdk.org
>>> Cc: thomas@monjalon.net; andrew.rybchenko@oktetlabs.ru; Li, Xiaoyun
>>> <xiaoyun.li@intel.com>; Yang, SteveX <stevex.yang@intel.com>
>>> Subject: Re: [PATCH v12 2/2] app/testpmd: fix testpmd doesn't show RSS hash
>>> offload
>>>
>>> On 10/12/2021 3:54 AM, Jie Wang wrote:
>>>> The driver may change offloads info into dev->data->dev_conf in
>>>> dev_configure which may cause port->dev_conf and port->rx_conf contain
>>>> outdated values.
>>>>
>>>> This patch updates the offloads info if it changes to fix this issue.
>>>>
>>>> Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
>>>>
>>>> Signed-off-by: Jie Wang <jie1x.wang@intel.com>
>>>
>>> Hi Jie,
>>>
>>> ci/intel-Testing is still reporting some errors [1] with this patch, did you able to
>>> investigate the reason of it?
>>>
>>> This error seems not seen in other patches, so that shouldn't be an infrastructure
>>> problem.
>>>
>>>
>>> [1]
>>> http://mails.dpdk.org/archives/test-report/2021-October/226766.html
>>
>> Hi Ferruh,
>>
>> When the dpdk runs the test_pf_tx_rx_queue test case, the port will be configured with rxq/txq to 1. This will cause the test to fail.
>>
>> In rte_eth_dev_configure, if rxq/txq is 1, dev_conf->rxmode.mq_mode is ETH_MQ_RX_NONE, and  dev_conf->rxmode.offloads contains the DEV_RX_OFFLOAD_RSS_HASH value by default, which causes the program to report an error " Ethdev port_id=0 config invalid Rx mq_mode without RSS but RSS_HASH offload is requested".
>>
>> When the port needs to configure txq/txq to 1, first clear the RSS_HASH configuration of dev_conf->rxmode.offloads.
>>
>> And I have talked about this error with the tester a few days ago, and they will modify the test case. They will add a command (port config port_id rx_offload rss_hash off) before configuring txq/rxq to 1.
>>
> 
> I see, but shouldn't this fail for all patches, why it is only failing
> for this set?

Got it now, in first config some PMDs force enables RSS_HASH, when testpmd disables
the RSS later, the existing RSS_HASH request cause failure in ethdev layer.

What about disable the RSS_HASH in application level, when RSS is disables, something
like following:

  diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
  index a7841c557f99..5f6daac8a616 100644
  --- a/app/test-pmd/testpmd.c
  +++ b/app/test-pmd/testpmd.c
  @@ -3601,12 +3601,15 @@ init_port_config(void)
                  }
   
                  if (port->dcb_flag == 0) {
  -                       if( port->dev_conf.rx_adv_conf.rss_conf.rss_hf != 0)
  +                       if( port->dev_conf.rx_adv_conf.rss_conf.rss_hf != 0) {
                                 port->dev_conf.rxmode.mq_mode =
                                          (enum rte_eth_rx_mq_mode)
                                                  (rx_mq_mode & ETH_MQ_RX_RSS);
  -                       else
  +                       } else {
                                  port->dev_conf.rxmode.mq_mode = ETH_MQ_RX_NONE;
  +                               port->dev_conf.rxmode.offloads &=
  +                                       ~DEV_RX_OFFLOAD_RSS_HASH;
  +                       }
                  }
   
                  rxtx_port_config(port);
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 826256b0b3..514a2d6f35 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -15717,6 +15717,7 @@  cmd_rx_offload_get_configuration_parsed(
 	struct rte_eth_dev_info dev_info;
 	portid_t port_id = res->port_id;
 	struct rte_port *port = &ports[port_id];
+	struct rte_eth_conf dev_conf;
 	uint64_t port_offloads;
 	uint64_t queue_offloads;
 	uint16_t nb_rx_queues;
@@ -15725,7 +15726,11 @@  cmd_rx_offload_get_configuration_parsed(
 
 	printf("Rx Offloading Configuration of port %d :\n", port_id);
 
-	port_offloads = port->dev_conf.rxmode.offloads;
+	ret = eth_dev_conf_get_print_err(port_id, &dev_conf);
+	if (ret != 0)
+		return;
+
+	port_offloads = dev_conf.rxmode.offloads;
 	printf("  Port :");
 	print_rx_offloads(port_offloads);
 	printf("\n");
@@ -16131,6 +16136,7 @@  cmd_tx_offload_get_configuration_parsed(
 	struct rte_eth_dev_info dev_info;
 	portid_t port_id = res->port_id;
 	struct rte_port *port = &ports[port_id];
+	struct rte_eth_conf dev_conf;
 	uint64_t port_offloads;
 	uint64_t queue_offloads;
 	uint16_t nb_tx_queues;
@@ -16139,7 +16145,11 @@  cmd_tx_offload_get_configuration_parsed(
 
 	printf("Tx Offloading Configuration of port %d :\n", port_id);
 
-	port_offloads = port->dev_conf.txmode.offloads;
+	ret = eth_dev_conf_get_print_err(port_id, &dev_conf);
+	if (ret != 0)
+		return;
+
+	port_offloads = dev_conf.txmode.offloads;
 	printf("  Port :");
 	print_tx_offloads(port_offloads);
 	printf("\n");
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 97ae52e17e..d7f463df51 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2531,6 +2531,9 @@  start_port(portid_t pid)
 		}
 
 		if (port->need_reconfig > 0) {
+			struct rte_eth_conf dev_conf;
+			int k;
+
 			port->need_reconfig = 0;
 
 			if (flow_isolate_all) {
@@ -2568,6 +2571,36 @@  start_port(portid_t pid)
 				port->need_reconfig = 1;
 				return -1;
 			}
+			/* get device configuration*/
+			if (0 !=
+				eth_dev_conf_get_print_err(pi, &dev_conf)) {
+				fprintf(stderr,
+					"port %d can not get device configuration\n",
+					pi);
+				return -1;
+			}
+			/* Apply Rx offloads configuration */
+			if (dev_conf.rxmode.offloads !=
+			    port->dev_conf.rxmode.offloads) {
+				port->dev_conf.rxmode.offloads |=
+					dev_conf.rxmode.offloads;
+				for (k = 0;
+				     k < port->dev_info.max_rx_queues;
+				     k++)
+					port->rx_conf[k].offloads |=
+						dev_conf.rxmode.offloads;
+			}
+			/* Apply Tx offloads configuration */
+			if (dev_conf.txmode.offloads !=
+			    port->dev_conf.txmode.offloads) {
+				port->dev_conf.txmode.offloads |=
+					dev_conf.txmode.offloads;
+				for (k = 0;
+				     k < port->dev_info.max_tx_queues;
+				     k++)
+					port->tx_conf[k].offloads |=
+						dev_conf.txmode.offloads;
+			}
 		}
 		if (port->need_reconfig_queues > 0 && is_proc_primary()) {
 			port->need_reconfig_queues = 0;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 5863b2f43f..45a79f9085 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -960,6 +960,8 @@  void show_gro(portid_t port_id);
 void setup_gso(const char *mode, portid_t port_id);
 int eth_dev_info_get_print_err(uint16_t port_id,
 			struct rte_eth_dev_info *dev_info);
+int eth_dev_conf_get_print_err(uint16_t port_id,
+			struct rte_eth_conf *dev_conf);
 void eth_set_promisc_mode(uint16_t port_id, int enable);
 void eth_set_allmulticast_mode(uint16_t port, int enable);
 int eth_link_get_nowait_print_err(uint16_t port_id, struct rte_eth_link *link);
diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
index 14a9a251fb..55c07e1b82 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -444,6 +444,20 @@  eth_dev_info_get_print_err(uint16_t port_id,
 	return ret;
 }
 
+int
+eth_dev_conf_get_print_err(uint16_t port_id, struct rte_eth_conf *dev_conf)
+{
+	int ret;
+
+	ret = rte_eth_dev_conf_get(port_id, dev_conf);
+	if (ret != 0)
+		fprintf(stderr,
+			"Error during getting device configuration (port %u): %s\n",
+			port_id, strerror(-ret));
+
+	return ret;
+}
+
 void
 eth_set_promisc_mode(uint16_t port, int enable)
 {