patch 'vhost: fix missing enqueue pseudo-header calculation' has been queued to stable release 20.11.6

Xueming Li xuemingl at nvidia.com
Wed Jul 20 10:20:51 CEST 2022


Hi,

FYI, your patch has been queued to stable release 20.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/22/22. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/338b9cbeb49b4e8ec6f576c99790b938141e7916

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 338b9cbeb49b4e8ec6f576c99790b938141e7916 Mon Sep 17 00:00:00 2001
From: Maxime Coquelin <maxime.coquelin at redhat.com>
Date: Wed, 8 Jun 2022 14:49:42 +0200
Subject: [PATCH] vhost: fix missing enqueue pseudo-header calculation
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 7316b4fd610fe945a0bc20054ba5ab61b98bb155 ]

The Virtio specification requires that in case of checksum
offloading, the pseudo-header checksum must be set in the
L4 header.

When received from another Vhost-user port, the packet
checksum might already contain the pseudo-header checksum
but we have no way to know it. So we have no other choice
than doing the pseudo-header checksum systematically.

This patch handles this using the rte_net_intel_cksum_prepare()
helper.

Fixes: 859b480d5afd ("vhost: add guest offload setting")

Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia at intel.com>
---
 lib/librte_vhost/virtio_net.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index d4e9da308a..485a93e313 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -428,6 +428,16 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr)
 		csum_l4 |= PKT_TX_TCP_CKSUM;
 
 	if (csum_l4) {
+		/*
+		 * Pseudo-header checksum must be set as per Virtio spec.
+		 *
+		 * Note: We don't propagate rte_net_intel_cksum_prepare()
+		 * errors, as it would have an impact on performance, and an
+		 * error would mean the packet is dropped by the guest instead
+		 * of being dropped here.
+		 */
+		rte_net_intel_cksum_prepare(m_buf);
+
 		net_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
 		net_hdr->csum_start = m_buf->l2_len + m_buf->l3_len;
 
-- 
2.35.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-07-20 15:00:59.797886762 +0800
+++ 0022-vhost-fix-missing-enqueue-pseudo-header-calculation.patch	2022-07-20 15:00:58.707667169 +0800
@@ -1 +1 @@
-From 7316b4fd610fe945a0bc20054ba5ab61b98bb155 Mon Sep 17 00:00:00 2001
+From 338b9cbeb49b4e8ec6f576c99790b938141e7916 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 7316b4fd610fe945a0bc20054ba5ab61b98bb155 ]
@@ -19 +21,0 @@
-Cc: stable at dpdk.org
@@ -24 +26 @@
- lib/vhost/virtio_net.c | 10 ++++++++++
+ lib/librte_vhost/virtio_net.c | 10 ++++++++++
@@ -27,6 +29,6 @@
-diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
-index 68a26eb17d..ce22e3ac79 100644
---- a/lib/vhost/virtio_net.c
-+++ b/lib/vhost/virtio_net.c
-@@ -596,6 +596,16 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr)
- 		csum_l4 |= RTE_MBUF_F_TX_TCP_CKSUM;
+diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
+index d4e9da308a..485a93e313 100644
+--- a/lib/librte_vhost/virtio_net.c
++++ b/lib/librte_vhost/virtio_net.c
+@@ -428,6 +428,16 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr)
+ 		csum_l4 |= PKT_TX_TCP_CKSUM;


More information about the stable mailing list