net/mlx5: fix running without rxq

Message ID 1582209716-26527-1-git-send-email-shirik@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix running without rxq |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation fail apply issues
ci/travis-robot success Travis build: passed

Commit Message

Shiri Kuzin Feb. 20, 2020, 2:42 p.m. UTC
  When running mlx5_dev_start in mlx5_ethdev the function calls
mlx5_dev_configure_rss_reta in order to configure the rxq's.

Before mlx5_dev_configure_rss_reta there isn't a check whether
there are rxq's and if rxq's are 0 the function fails.
For example, this command:
/build/app/test-pmd/testpmd -n 4  -w 0000:08:00.0,rx_vec_en=0
-- --burst=64 --mbcache=512 -i  --nb-cores=27  --txd=2048 --rxd=2048
--vxlan-gpe-port=6081 --mp-alloc=xbuf --rxq 0 --forward-mode=txonly
would fail.

In order to fix this issue, we should call mlx5_dev_configure_rss_reta
only if we have rxq's.

Fixes: 63bd16292c3a ("net/mlx5: support RSS on hairpin")
Cc: stable@dpdk.org

Signed-off-by: Shiri Kuzin <shirik@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/mlx5_trigger.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
  

Comments

Raslan Darawsheh Feb. 20, 2020, 3:26 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: Shiri Kuzin <shirik@mellanox.com>
> Sent: Thursday, February 20, 2020 4:42 PM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@mellanox.com>; Raslan Darawsheh
> <rasland@mellanox.com>; Slava Ovsiienko <viacheslavo@mellanox.com>;
> stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix running without rxq
> 
> When running mlx5_dev_start in mlx5_ethdev the function calls
> mlx5_dev_configure_rss_reta in order to configure the rxq's.
> 
> Before mlx5_dev_configure_rss_reta there isn't a check whether
> there are rxq's and if rxq's are 0 the function fails.
> For example, this command:
> /build/app/test-pmd/testpmd -n 4  -w 0000:08:00.0,rx_vec_en=0
> -- --burst=64 --mbcache=512 -i  --nb-cores=27  --txd=2048 --rxd=2048
> --vxlan-gpe-port=6081 --mp-alloc=xbuf --rxq 0 --forward-mode=txonly
> would fail.
> 
> In order to fix this issue, we should call mlx5_dev_configure_rss_reta
> only if we have rxq's.
> 
> Fixes: 63bd16292c3a ("net/mlx5: support RSS on hairpin")
> Cc: stable@dpdk.org
> 
Reported-by: Sylvain <srn@nexatech.fr>
> Signed-off-by: Shiri Kuzin <shirik@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_trigger.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_trigger.c
> b/drivers/net/mlx5/mlx5_trigger.c
> index be47df5..571b7a0 100644
> --- a/drivers/net/mlx5/mlx5_trigger.c
> +++ b/drivers/net/mlx5/mlx5_trigger.c
> @@ -280,11 +280,13 @@
>  		rte_net_mlx5_dynf_inline_mask = 1UL << fine_inline;
>  	else
>  		rte_net_mlx5_dynf_inline_mask = 0;
> -	ret = mlx5_dev_configure_rss_reta(dev);
> -	if (ret) {
> -		DRV_LOG(ERR, "port %u reta config failed: %s",
> -			dev->data->port_id, strerror(rte_errno));
> -		return -rte_errno;
> +	if (dev->data->nb_rx_queues > 0) {
> +		ret = mlx5_dev_configure_rss_reta(dev);
> +		if (ret) {
> +			DRV_LOG(ERR, "port %u reta config failed: %s",
> +				dev->data->port_id, strerror(rte_errno));
> +			return -rte_errno;
> +		}
>  	}
>  	ret = mlx5_txq_start(dev);
>  	if (ret) {
> --
> 1.8.3.1


Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  

Patch

diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index be47df5..571b7a0 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -280,11 +280,13 @@ 
 		rte_net_mlx5_dynf_inline_mask = 1UL << fine_inline;
 	else
 		rte_net_mlx5_dynf_inline_mask = 0;
-	ret = mlx5_dev_configure_rss_reta(dev);
-	if (ret) {
-		DRV_LOG(ERR, "port %u reta config failed: %s",
-			dev->data->port_id, strerror(rte_errno));
-		return -rte_errno;
+	if (dev->data->nb_rx_queues > 0) {
+		ret = mlx5_dev_configure_rss_reta(dev);
+		if (ret) {
+			DRV_LOG(ERR, "port %u reta config failed: %s",
+				dev->data->port_id, strerror(rte_errno));
+			return -rte_errno;
+		}
 	}
 	ret = mlx5_txq_start(dev);
 	if (ret) {