[v3] examples/multi_process: reconfigure port when rss or csum isn't supported

Message ID 20220222105127.506505-1-wenwux.ma@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v3] examples/multi_process: reconfigure port when rss or csum isn't supported |

Checks

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

Commit Message

Ma, WenwuX Feb. 22, 2022, 10:51 a.m. UTC
  The default values of rx mq_mode and rx offloads for port
will cause symmetric_mp startup failure if the port do not
support rss or csum. This Patch make the app to reconfigure
the NIC without them. Only quit the app if the second
reconfiguration fails.

Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
---
 examples/multi_process/symmetric_mp/main.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
  

Comments

Bruce Richardson Feb. 22, 2022, 9:41 a.m. UTC | #1
On Tue, Feb 22, 2022 at 10:51:27AM +0000, Wenwu Ma wrote:
> The default values of rx mq_mode and rx offloads for port
> will cause symmetric_mp startup failure if the port do not
> support rss or csum. This Patch make the app to reconfigure
> the NIC without them. Only quit the app if the second
> reconfiguration fails.
> 
> Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> ---

While I am surprised to see different error codes for different essentially
the same issue - lack of HW support, that is a separate problem to the one
this is addressing. Given this is just a sample app, I think this approach
is fine for configuring things - keeping things simple for the user.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

>  examples/multi_process/symmetric_mp/main.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
> index 050337765f..0e991acdf2 100644
> --- a/examples/multi_process/symmetric_mp/main.c
> +++ b/examples/multi_process/symmetric_mp/main.c
> @@ -232,6 +232,20 @@ smp_port_init(uint16_t port, struct rte_mempool *mbuf_pool,
>  	}
>  
>  	retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
> +	if (retval == -EINVAL) {
> +		printf("Port %u configuration failed. Re-attempting with HW checksum disabled.\n",
> +			port);
> +		port_conf.rxmode.offloads &= ~(RTE_ETH_RX_OFFLOAD_CHECKSUM);
> +		retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
> +	}
> +
> +	if (retval == -ENOTSUP) {
> +		printf("Port %u configuration failed. Re-attempting with HW rss disabled.\n",
> +			port);
> +		port_conf.rxmode.mq_mode &= ~(RTE_ETH_MQ_RX_RSS);
> +		retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
> +	}
> +
>  	if (retval < 0)
>  		return retval;
>  
> -- 
> 2.25.1
>
  
Ling, WeiX Feb. 28, 2022, 7:55 a.m. UTC | #2
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Tuesday, February 22, 2022 5:41 PM
> To: Ma, WenwuX <wenwux.ma@intel.com>
> Cc: Burakov, Anatoly <anatoly.burakov@intel.com>; dev@dpdk.org; Hu,
> Jiayu <jiayu.hu@intel.com>; Wang, Yinan <yinan.wang@intel.com>; He,
> Xingguang <xingguang.he@intel.com>
> Subject: Re: [PATCH v3] examples/multi_process: reconfigure port when rss
> or csum isn't supported
> 
> On Tue, Feb 22, 2022 at 10:51:27AM +0000, Wenwu Ma wrote:
> > The default values of rx mq_mode and rx offloads for port will cause
> > symmetric_mp startup failure if the port do not support rss or csum.
> > This Patch make the app to reconfigure the NIC without them. Only quit
> > the app if the second reconfiguration fails.
> >
> > Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> > ---
> 
> While I am surprised to see different error codes for different essentially the
> same issue - lack of HW support, that is a separate problem to the one this is
> addressing. Given this is just a sample app, I think this approach is fine for
> configuring things - keeping things simple for the user.
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> 
Tested-by: Wei Ling <weix.ling@intel.com>
  
Thomas Monjalon March 8, 2022, 1:22 p.m. UTC | #3
28/02/2022 08:55, Ling, WeiX:
> From: Bruce Richardson <bruce.richardson@intel.com>
> > On Tue, Feb 22, 2022 at 10:51:27AM +0000, Wenwu Ma wrote:
> > > The default values of rx mq_mode and rx offloads for port will cause
> > > symmetric_mp startup failure if the port do not support rss or csum.
> > > This Patch make the app to reconfigure the NIC without them. Only quit
> > > the app if the second reconfiguration fails.
> > >
> > > Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> > > ---
> > 
> > While I am surprised to see different error codes for different essentially the
> > same issue - lack of HW support, that is a separate problem to the one this is
> > addressing. Given this is just a sample app, I think this approach is fine for
> > configuring things - keeping things simple for the user.
> > 
> > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> > 
> Tested-by: Wei Ling <weix.ling@intel.com>

Applied with title "examples/multi_process: make RSS and checksum optional"
  

Patch

diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index 050337765f..0e991acdf2 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -232,6 +232,20 @@  smp_port_init(uint16_t port, struct rte_mempool *mbuf_pool,
 	}
 
 	retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
+	if (retval == -EINVAL) {
+		printf("Port %u configuration failed. Re-attempting with HW checksum disabled.\n",
+			port);
+		port_conf.rxmode.offloads &= ~(RTE_ETH_RX_OFFLOAD_CHECKSUM);
+		retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
+	}
+
+	if (retval == -ENOTSUP) {
+		printf("Port %u configuration failed. Re-attempting with HW rss disabled.\n",
+			port);
+		port_conf.rxmode.mq_mode &= ~(RTE_ETH_MQ_RX_RSS);
+		retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
+	}
+
 	if (retval < 0)
 		return retval;