patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] vdpa/mlx5: fix TSO offload without CSUM
@ 2021-06-13 12:51 Xueming Li
  2021-06-25  7:35 ` Xia, Chenbo
  2021-06-30 11:55 ` Xia, Chenbo
  0 siblings, 2 replies; 3+ messages in thread
From: Xueming Li @ 2021-06-13 12:51 UTC (permalink / raw)
  Cc: dev, xuemingl, matan, stable, Viacheslav Ovsiienko, Maxime Coquelin

Packet was corrupted when TSO requested without CSUM update.

Enables CSUM automatically if only TSO requested.

Fixes: 2aa8444b0084 ("vdpa/mlx5: support stateless offloads")
Cc: matan@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
index 024c5c4180..f530646058 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -442,6 +442,13 @@ mlx5_vdpa_virtqs_prepare(struct mlx5_vdpa_priv *priv)
 		DRV_LOG(ERR, "Failed to configure negotiated features.");
 		return -1;
 	}
+	if ((priv->features & (1ULL << VIRTIO_NET_F_CSUM)) == 0 &&
+	    ((priv->features & (1ULL << VIRTIO_NET_F_HOST_TSO4)) > 0 ||
+	     (priv->features & (1ULL << VIRTIO_NET_F_HOST_TSO6)) > 0)) {
+		/* Packet may be corrupted if TSO is enabled without CSUM. */
+		DRV_LOG(INFO, "TSO is enabled without CSUM, force CSUM.");
+		priv->features |= (1ULL << VIRTIO_NET_F_CSUM);
+	}
 	if (nr_vring > priv->caps.max_num_virtio_queues * 2) {
 		DRV_LOG(ERR, "Do not support more than %d virtqs(%d).",
 			(int)priv->caps.max_num_virtio_queues * 2,
-- 
2.25.1


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

* Re: [dpdk-stable] [PATCH] vdpa/mlx5: fix TSO offload without CSUM
  2021-06-13 12:51 [dpdk-stable] [PATCH] vdpa/mlx5: fix TSO offload without CSUM Xueming Li
@ 2021-06-25  7:35 ` Xia, Chenbo
  2021-06-30 11:55 ` Xia, Chenbo
  1 sibling, 0 replies; 3+ messages in thread
From: Xia, Chenbo @ 2021-06-25  7:35 UTC (permalink / raw)
  To: Xueming Li; +Cc: dev, matan, stable, Viacheslav Ovsiienko, Maxime Coquelin

> -----Original Message-----
> From: stable <stable-bounces@dpdk.org> On Behalf Of Xueming Li
> Sent: Sunday, June 13, 2021 8:52 PM
> Cc: dev@dpdk.org; xuemingl@nvidia.com; matan@nvidia.com; stable@dpdk.org;
> Viacheslav Ovsiienko <viacheslavo@nvidia.com>; Maxime Coquelin
> <maxime.coquelin@redhat.com>
> Subject: [dpdk-stable] [PATCH] vdpa/mlx5: fix TSO offload without CSUM
> 
> Packet was corrupted when TSO requested without CSUM update.
> 
> Enables CSUM automatically if only TSO requested.
> 
> Fixes: 2aa8444b0084 ("vdpa/mlx5: support stateless offloads")
> Cc: matan@nvidia.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> ---
>  drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
> b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
> index 024c5c4180..f530646058 100644
> --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
> +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
> @@ -442,6 +442,13 @@ mlx5_vdpa_virtqs_prepare(struct mlx5_vdpa_priv *priv)
>  		DRV_LOG(ERR, "Failed to configure negotiated features.");
>  		return -1;
>  	}
> +	if ((priv->features & (1ULL << VIRTIO_NET_F_CSUM)) == 0 &&
> +	    ((priv->features & (1ULL << VIRTIO_NET_F_HOST_TSO4)) > 0 ||
> +	     (priv->features & (1ULL << VIRTIO_NET_F_HOST_TSO6)) > 0)) {
> +		/* Packet may be corrupted if TSO is enabled without CSUM. */
> +		DRV_LOG(INFO, "TSO is enabled without CSUM, force CSUM.");
> +		priv->features |= (1ULL << VIRTIO_NET_F_CSUM);
> +	}
>  	if (nr_vring > priv->caps.max_num_virtio_queues * 2) {
>  		DRV_LOG(ERR, "Do not support more than %d virtqs(%d).",
>  			(int)priv->caps.max_num_virtio_queues * 2,
> --
> 2.25.1

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>

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

* Re: [dpdk-stable] [PATCH] vdpa/mlx5: fix TSO offload without CSUM
  2021-06-13 12:51 [dpdk-stable] [PATCH] vdpa/mlx5: fix TSO offload without CSUM Xueming Li
  2021-06-25  7:35 ` Xia, Chenbo
@ 2021-06-30 11:55 ` Xia, Chenbo
  1 sibling, 0 replies; 3+ messages in thread
From: Xia, Chenbo @ 2021-06-30 11:55 UTC (permalink / raw)
  To: Xueming Li; +Cc: dev, matan, stable, Viacheslav Ovsiienko, Maxime Coquelin

> -----Original Message-----
> From: stable <stable-bounces@dpdk.org> On Behalf Of Xueming Li
> Sent: Sunday, June 13, 2021 8:52 PM
> Cc: dev@dpdk.org; xuemingl@nvidia.com; matan@nvidia.com; stable@dpdk.org;
> Viacheslav Ovsiienko <viacheslavo@nvidia.com>; Maxime Coquelin
> <maxime.coquelin@redhat.com>
> Subject: [dpdk-stable] [PATCH] vdpa/mlx5: fix TSO offload without CSUM
> 
> Packet was corrupted when TSO requested without CSUM update.
> 
> Enables CSUM automatically if only TSO requested.
> 
> Fixes: 2aa8444b0084 ("vdpa/mlx5: support stateless offloads")
> Cc: matan@nvidia.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> ---
>  drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
> b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
> index 024c5c4180..f530646058 100644
> --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
> +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
> @@ -442,6 +442,13 @@ mlx5_vdpa_virtqs_prepare(struct mlx5_vdpa_priv *priv)
>  		DRV_LOG(ERR, "Failed to configure negotiated features.");
>  		return -1;
>  	}
> +	if ((priv->features & (1ULL << VIRTIO_NET_F_CSUM)) == 0 &&
> +	    ((priv->features & (1ULL << VIRTIO_NET_F_HOST_TSO4)) > 0 ||
> +	     (priv->features & (1ULL << VIRTIO_NET_F_HOST_TSO6)) > 0)) {
> +		/* Packet may be corrupted if TSO is enabled without CSUM. */
> +		DRV_LOG(INFO, "TSO is enabled without CSUM, force CSUM.");
> +		priv->features |= (1ULL << VIRTIO_NET_F_CSUM);
> +	}
>  	if (nr_vring > priv->caps.max_num_virtio_queues * 2) {
>  		DRV_LOG(ERR, "Do not support more than %d virtqs(%d).",
>  			(int)priv->caps.max_num_virtio_queues * 2,
> --
> 2.25.1

Applied to next-virtio/main, thanks!

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

end of thread, other threads:[~2021-06-30 11:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-13 12:51 [dpdk-stable] [PATCH] vdpa/mlx5: fix TSO offload without CSUM Xueming Li
2021-06-25  7:35 ` Xia, Chenbo
2021-06-30 11:55 ` Xia, Chenbo

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git