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

christian.ehrhardt at canonical.com christian.ehrhardt at canonical.com
Thu Jul 7 09:55:01 CEST 2022


Hi,

FYI, your patch has been queued to stable release 19.11.13

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/09/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/cpaelzer/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/cpaelzer/dpdk-stable-queue/commit/bf77b580a98ac6975ea69b7878e0bf8ac6e421a6

Thanks.

Christian Ehrhardt <christian.ehrhardt at canonical.com>

---
>From bf77b580a98ac6975ea69b7878e0bf8ac6e421a6 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

[ 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 | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 62b7bbda96..ae4e54a442 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -8,6 +8,7 @@
 
 #include <rte_mbuf.h>
 #include <rte_memcpy.h>
+#include <rte_net.h>
 #include <rte_ether.h>
 #include <rte_ip.h>
 #include <rte_vhost.h>
@@ -402,6 +403,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.37.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-07-07 09:54:13.896445577 +0200
+++ 0066-vhost-fix-missing-enqueue-pseudo-header-calculation.patch	2022-07-07 09:54:10.977824691 +0200
@@ -1 +1 @@
-From 7316b4fd610fe945a0bc20054ba5ab61b98bb155 Mon Sep 17 00:00:00 2001
+From bf77b580a98ac6975ea69b7878e0bf8ac6e421a6 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 7316b4fd610fe945a0bc20054ba5ab61b98bb155 ]
+
@@ -19 +20,0 @@
-Cc: stable at dpdk.org
@@ -24,2 +25,2 @@
- lib/vhost/virtio_net.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
+ lib/librte_vhost/virtio_net.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
@@ -27,6 +28,14 @@
-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 62b7bbda96..ae4e54a442 100644
+--- a/lib/librte_vhost/virtio_net.c
++++ b/lib/librte_vhost/virtio_net.c
+@@ -8,6 +8,7 @@
+ 
+ #include <rte_mbuf.h>
+ #include <rte_memcpy.h>
++#include <rte_net.h>
+ #include <rte_ether.h>
+ #include <rte_ip.h>
+ #include <rte_vhost.h>
+@@ -402,6 +403,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