patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 20.11] net/mlx5: fix LRO validation in Rx setup
@ 2022-06-26 10:43 Michael Baum
  2022-06-28 13:39 ` Xueming(Steven) Li
  2022-06-28 15:33 ` [PATCH 20.11 v2] " Michael Baum
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Baum @ 2022-06-26 10:43 UTC (permalink / raw)
  To: stable; +Cc: Matan Azrad, Viacheslav Ovsiienko, Xueming Li

[ upstream commit a213b8682117711c8e92475c5bbb321a3d8428dd ]

The mlx5_rx_queue_setup() get LRO offload from user.

When LRO is configured, the LRO flag in rxq_data is set to 1.

This patch adds validation to make sure the LRO is supported.

Fixes: 17ed314 ("net/mlx5: allow LRO per Rx queue")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 4a263a5803..6fad968eee 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -756,6 +756,14 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	uint16_t n_seg = conf->rx_nseg;
 	int res;
 
+	if ((offloads & RTE_ETH_RX_OFFLOAD_TCP_LRO) &&
+	    !priv->config.lro.supported) {
+		DRV_LOG(ERR,
+			"Port %u queue %u LRO is configured but not supported.",
+			dev->data->port_id, idx);
+		rte_errno = EINVAL;
+		return -rte_errno;
+	}
 	if (mp) {
 		/*
 		 * The parameters should be checked on rte_eth_dev layer.
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH 20.11] net/mlx5: fix LRO validation in Rx setup
  2022-06-26 10:43 [PATCH 20.11] net/mlx5: fix LRO validation in Rx setup Michael Baum
@ 2022-06-28 13:39 ` Xueming(Steven) Li
  2022-06-28 15:33 ` [PATCH 20.11 v2] " Michael Baum
  1 sibling, 0 replies; 4+ messages in thread
From: Xueming(Steven) Li @ 2022-06-28 13:39 UTC (permalink / raw)
  To: Michael Baum, stable; +Cc: Matan Azrad, Slava Ovsiienko

Hi Michael,

The patch can't compile with the 20.11 LTS work queue. Please rebase with the below branch:

    https://github.com/steevenlee/dpdk 

Thanks,
Xueming

> -----Original Message-----
> From: Michael Baum <michaelba@nvidia.com>
> Sent: Sunday, June 26, 2022 6:44 PM
> To: stable@dpdk.org
> Cc: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Xueming(Steven) Li <xuemingl@nvidia.com>
> Subject: [PATCH 20.11] net/mlx5: fix LRO validation in Rx setup
> 
> [ upstream commit a213b8682117711c8e92475c5bbb321a3d8428dd ]
> 
> The mlx5_rx_queue_setup() get LRO offload from user.
> 
> When LRO is configured, the LRO flag in rxq_data is set to 1.
> 
> This patch adds validation to make sure the LRO is supported.
> 
> Fixes: 17ed314 ("net/mlx5: allow LRO per Rx queue")
> 
> Signed-off-by: Michael Baum <michaelba@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_rxq.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 4a263a5803..6fad968eee 100644
> --- a/drivers/net/mlx5/mlx5_rxq.c
> +++ b/drivers/net/mlx5/mlx5_rxq.c
> @@ -756,6 +756,14 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
>  	uint16_t n_seg = conf->rx_nseg;
>  	int res;
> 
> +	if ((offloads & RTE_ETH_RX_OFFLOAD_TCP_LRO) &&
> +	    !priv->config.lro.supported) {
> +		DRV_LOG(ERR,
> +			"Port %u queue %u LRO is configured but not supported.",
> +			dev->data->port_id, idx);
> +		rte_errno = EINVAL;
> +		return -rte_errno;
> +	}
>  	if (mp) {
>  		/*
>  		 * The parameters should be checked on rte_eth_dev layer.
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 20.11 v2] net/mlx5: fix LRO validation in Rx setup
  2022-06-26 10:43 [PATCH 20.11] net/mlx5: fix LRO validation in Rx setup Michael Baum
  2022-06-28 13:39 ` Xueming(Steven) Li
@ 2022-06-28 15:33 ` Michael Baum
  2022-06-29  7:24   ` Xueming(Steven) Li
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Baum @ 2022-06-28 15:33 UTC (permalink / raw)
  To: stable; +Cc: Matan Azrad, Viacheslav Ovsiienko, Xueming Li

[ upstream commit a213b8682117711c8e92475c5bbb321a3d8428dd ]

The mlx5_rx_queue_setup() get LRO offload from user.

When LRO is configured, the LRO flag in rxq_data is set to 1.

This patch adds validation to make sure the LRO is supported.

Fixes: 17ed314 ("net/mlx5: allow LRO per Rx queue")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---

v2: fix compilation issue.

 drivers/net/mlx5/mlx5_rxq.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 4a263a5803..cb743a773c 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -754,8 +754,18 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 				(struct rte_eth_rxseg_split *)conf->rx_seg;
 	struct rte_eth_rxseg_split rx_single = {.mp = mp};
 	uint16_t n_seg = conf->rx_nseg;
+	uint64_t offloads = conf->offloads |
+			    dev->data->dev_conf.rxmode.offloads;
 	int res;
 
+	if ((offloads & DEV_RX_OFFLOAD_TCP_LRO) &&
+	    !priv->config.lro.supported) {
+		DRV_LOG(ERR,
+			"Port %u queue %u LRO is configured but not supported.",
+			dev->data->port_id, idx);
+		rte_errno = EINVAL;
+		return -rte_errno;
+	}
 	if (mp) {
 		/*
 		 * The parameters should be checked on rte_eth_dev layer.
@@ -766,9 +776,6 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 		n_seg = 1;
 	}
 	if (n_seg > 1) {
-		uint64_t offloads = conf->offloads |
-				    dev->data->dev_conf.rxmode.offloads;
-
 		/* The offloads should be checked on rte_eth_dev layer. */
 		MLX5_ASSERT(offloads & DEV_RX_OFFLOAD_SCATTER);
 		if (!(offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT)) {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH 20.11 v2] net/mlx5: fix LRO validation in Rx setup
  2022-06-28 15:33 ` [PATCH 20.11 v2] " Michael Baum
@ 2022-06-29  7:24   ` Xueming(Steven) Li
  0 siblings, 0 replies; 4+ messages in thread
From: Xueming(Steven) Li @ 2022-06-29  7:24 UTC (permalink / raw)
  To: Michael Baum, stable; +Cc: Matan Azrad, Slava Ovsiienko

Hey Michael,

Applied, thanks!

> -----Original Message-----
> From: Michael Baum <michaelba@nvidia.com>
> Sent: Tuesday, June 28, 2022 11:34 PM
> To: stable@dpdk.org
> Cc: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Xueming(Steven) Li <xuemingl@nvidia.com>
> Subject: [PATCH 20.11 v2] net/mlx5: fix LRO validation in Rx setup
> 
> [ upstream commit a213b8682117711c8e92475c5bbb321a3d8428dd ]
> 
> The mlx5_rx_queue_setup() get LRO offload from user.
> 
> When LRO is configured, the LRO flag in rxq_data is set to 1.
> 
> This patch adds validation to make sure the LRO is supported.
> 
> Fixes: 17ed314 ("net/mlx5: allow LRO per Rx queue")
> 
> Signed-off-by: Michael Baum <michaelba@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
> 
> v2: fix compilation issue.
> 
>  drivers/net/mlx5/mlx5_rxq.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 4a263a5803..cb743a773c 100644
> --- a/drivers/net/mlx5/mlx5_rxq.c
> +++ b/drivers/net/mlx5/mlx5_rxq.c
> @@ -754,8 +754,18 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
>  				(struct rte_eth_rxseg_split *)conf->rx_seg;
>  	struct rte_eth_rxseg_split rx_single = {.mp = mp};
>  	uint16_t n_seg = conf->rx_nseg;
> +	uint64_t offloads = conf->offloads |
> +			    dev->data->dev_conf.rxmode.offloads;
>  	int res;
> 
> +	if ((offloads & DEV_RX_OFFLOAD_TCP_LRO) &&
> +	    !priv->config.lro.supported) {
> +		DRV_LOG(ERR,
> +			"Port %u queue %u LRO is configured but not supported.",
> +			dev->data->port_id, idx);
> +		rte_errno = EINVAL;
> +		return -rte_errno;
> +	}
>  	if (mp) {
>  		/*
>  		 * The parameters should be checked on rte_eth_dev layer.
> @@ -766,9 +776,6 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
>  		n_seg = 1;
>  	}
>  	if (n_seg > 1) {
> -		uint64_t offloads = conf->offloads |
> -				    dev->data->dev_conf.rxmode.offloads;
> -
>  		/* The offloads should be checked on rte_eth_dev layer. */
>  		MLX5_ASSERT(offloads & DEV_RX_OFFLOAD_SCATTER);
>  		if (!(offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT)) {
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-29  7:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-26 10:43 [PATCH 20.11] net/mlx5: fix LRO validation in Rx setup Michael Baum
2022-06-28 13:39 ` Xueming(Steven) Li
2022-06-28 15:33 ` [PATCH 20.11 v2] " Michael Baum
2022-06-29  7:24   ` Xueming(Steven) Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).