examples/l3fwd: fix conf propagation to RX queues

Message ID 20240216120207.126025-1-vojanec@cesnet.cz (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series examples/l3fwd: fix conf propagation to RX queues |

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/iol-abi-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-sample-apps-testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Kamil Vojanec Feb. 16, 2024, 12:02 p.m. UTC
  When configuring RX queues, the default port configuration was used,
even though it was modified before. This results in the
'relax-rx-offload' not being respected for RX queues.
This commit uses 'rte_eth_dev_conf_get()' to obtain the device
configuration structure instead.

Fixes: 4b01cabfb0 ("examples/l3fwd: add option to relax Rx offload")
Signed-off-by: Kamil Vojanec <vojanec@cesnet.cz>
---
 examples/l3fwd/main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon March 7, 2024, 8:47 a.m. UTC | #1
Review please?

16/02/2024 13:02, Kamil Vojanec:
> When configuring RX queues, the default port configuration was used,
> even though it was modified before. This results in the
> 'relax-rx-offload' not being respected for RX queues.
> This commit uses 'rte_eth_dev_conf_get()' to obtain the device
> configuration structure instead.
> 
> Fixes: 4b01cabfb0 ("examples/l3fwd: add option to relax Rx offload")
> Signed-off-by: Kamil Vojanec <vojanec@cesnet.cz>
  
Konstantin Ananyev March 7, 2024, 10:14 a.m. UTC | #2
> When configuring RX queues, the default port configuration was used,
> even though it was modified before. This results in the
> 'relax-rx-offload' not being respected for RX queues.
> This commit uses 'rte_eth_dev_conf_get()' to obtain the device
> configuration structure instead.
> 
> Fixes: 4b01cabfb0 ("examples/l3fwd: add option to relax Rx offload")
> Signed-off-by: Kamil Vojanec <vojanec@cesnet.cz>
> ---
>  examples/l3fwd/main.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
> index 3bf28aec0c..2b714a362a 100644
> --- a/examples/l3fwd/main.c
> +++ b/examples/l3fwd/main.c
> @@ -1388,6 +1388,7 @@ l3fwd_poll_resource_setup(void)
>  		fflush(stdout);
>  		/* init RX queues */
>  		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
> +			struct rte_eth_conf local_conf;
>  			struct rte_eth_rxconf rxq_conf;
> 
>  			portid = qconf->rx_queue_list[queue].port_id;
> @@ -1408,8 +1409,14 @@ l3fwd_poll_resource_setup(void)
>  					"Error during getting device (port %u) info: %s\n",
>  					portid, strerror(-ret));
> 
> +			ret = rte_eth_dev_conf_get(portid, &local_conf);
> +			if (ret != 0)
> +				rte_exit(EXIT_FAILURE,
> +					"Error during getting device (port %u) configuration: %s\n",
> +					portid, strerror(-ret));
> +
>  			rxq_conf = dev_info.default_rxconf;
> -			rxq_conf.offloads = port_conf.rxmode.offloads;
> +			rxq_conf.offloads = local_conf.rxmode.offloads;
>  			if (!per_port_pool)
>  				ret = rte_eth_rx_queue_setup(portid, queueid,
>  						nb_rxd, socketid,
> --

LGTM
Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
 

> 2.39.3
  
Kevin Traynor March 7, 2024, 2:07 p.m. UTC | #3
On 16/02/2024 12:02, Kamil Vojanec wrote:
> When configuring RX queues, the default port configuration was used,
> even though it was modified before. This results in the
> 'relax-rx-offload' not being respected for RX queues.
> This commit uses 'rte_eth_dev_conf_get()' to obtain the device
> configuration structure instead.
> 
> Fixes: 4b01cabfb0 ("examples/l3fwd: add option to relax Rx offload")
> Signed-off-by: Kamil Vojanec <vojanec@cesnet.cz>
> ---
>  examples/l3fwd/main.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
> index 3bf28aec0c..2b714a362a 100644
> --- a/examples/l3fwd/main.c
> +++ b/examples/l3fwd/main.c
> @@ -1388,6 +1388,7 @@ l3fwd_poll_resource_setup(void)
>  		fflush(stdout);
>  		/* init RX queues */
>  		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
> +			struct rte_eth_conf local_conf;
>  			struct rte_eth_rxconf rxq_conf;
>  
>  			portid = qconf->rx_queue_list[queue].port_id;
> @@ -1408,8 +1409,14 @@ l3fwd_poll_resource_setup(void)
>  					"Error during getting device (port %u) info: %s\n",
>  					portid, strerror(-ret));
>  
> +			ret = rte_eth_dev_conf_get(portid, &local_conf);
> +			if (ret != 0)
> +				rte_exit(EXIT_FAILURE,
> +					"Error during getting device (port %u) configuration: %s\n",
> +					portid, strerror(-ret));
> +
>  			rxq_conf = dev_info.default_rxconf;
> -			rxq_conf.offloads = port_conf.rxmode.offloads;
> +			rxq_conf.offloads = local_conf.rxmode.offloads;
>  			if (!per_port_pool)
>  				ret = rte_eth_rx_queue_setup(portid, queueid,
>  						nb_rxd, socketid,

Acked-by: Kevin Traynor <ktraynor@redhat.com>
  
Thomas Monjalon March 7, 2024, 3:03 p.m. UTC | #4
07/03/2024 11:14, Konstantin Ananyev:
> 
> > When configuring RX queues, the default port configuration was used,
> > even though it was modified before. This results in the
> > 'relax-rx-offload' not being respected for RX queues.
> > This commit uses 'rte_eth_dev_conf_get()' to obtain the device
> > configuration structure instead.
> > 
> > Fixes: 4b01cabfb0 ("examples/l3fwd: add option to relax Rx offload")
> > Signed-off-by: Kamil Vojanec <vojanec@cesnet.cz>
> 
> LGTM
> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>

Applied, thanks.
  

Patch

diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 3bf28aec0c..2b714a362a 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -1388,6 +1388,7 @@  l3fwd_poll_resource_setup(void)
 		fflush(stdout);
 		/* init RX queues */
 		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
+			struct rte_eth_conf local_conf;
 			struct rte_eth_rxconf rxq_conf;
 
 			portid = qconf->rx_queue_list[queue].port_id;
@@ -1408,8 +1409,14 @@  l3fwd_poll_resource_setup(void)
 					"Error during getting device (port %u) info: %s\n",
 					portid, strerror(-ret));
 
+			ret = rte_eth_dev_conf_get(portid, &local_conf);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"Error during getting device (port %u) configuration: %s\n",
+					portid, strerror(-ret));
+
 			rxq_conf = dev_info.default_rxconf;
-			rxq_conf.offloads = port_conf.rxmode.offloads;
+			rxq_conf.offloads = local_conf.rxmode.offloads;
 			if (!per_port_pool)
 				ret = rte_eth_rx_queue_setup(portid, queueid,
 						nb_rxd, socketid,