diff mbox series

[ovs-dev,v5,11/12] netdev-dpdk: Stop relying on vhost-user Tx flags.

Message ID 20250603094637.1250238-12-david.marchand@redhat.com
State Superseded
Delegated to: Ilya Maximets
Headers show
Series OVS checksum offloads revamp. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

David Marchand June 3, 2025, 9:46 a.m. UTC
vhost-user legacy behavior has been to mark mbuf with Tx offload flags
based on what the virtio-net header contained (but provide no
Rx information, like IP checksum or L4 checksum validity).

Changing to the non legacy mode means that no code out of OVS should set
any RTE_MBUF_F_TX_* flag. Had a check accordingly.

Link: https://git.dpdk.org/dpdk/commit/?id=ca7036b4af3a
Reported-at: https://issues.redhat.com/browse/FDP-1147
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/netdev-dpdk.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index b9a10afcb1..b9e5ad9b8f 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2651,6 +2651,7 @@  static bool
 netdev_dpdk_prep_hwol_packet(struct netdev_dpdk *dev, struct rte_mbuf *mbuf)
 {
     struct dp_packet *pkt = CONTAINER_OF(mbuf, struct dp_packet, mbuf);
+    uint64_t unexpected = mbuf->ol_flags & RTE_MBUF_F_TX_OFFLOAD_MASK;
     const struct ip_header *ip;
     bool is_sctp;
     bool l3_csum;
@@ -2661,20 +2662,20 @@  netdev_dpdk_prep_hwol_packet(struct netdev_dpdk *dev, struct rte_mbuf *mbuf)
     void *l3;
     void *l4;
 
+    if (OVS_UNLIKELY(unexpected)) {
+        VLOG_WARN_RL(&rl, "%s: Unexpected Tx offload flags: %#"PRIx64,
+                     netdev_get_name(&dev->up), unexpected);
+        netdev_dpdk_mbuf_dump(netdev_get_name(&dev->up),
+                              "Packet with unexpected ol_flags", mbuf);
+        return false;
+    }
+
     if (!dp_packet_ip_checksum_partial(pkt)
         && !dp_packet_inner_ip_checksum_partial(pkt)
         && !dp_packet_l4_checksum_partial(pkt)
         && !dp_packet_inner_l4_checksum_partial(pkt)
         && !mbuf->tso_segsz) {
 
-        uint64_t unexpected = mbuf->ol_flags & RTE_MBUF_F_TX_OFFLOAD_MASK;
-        if (OVS_UNLIKELY(unexpected)) {
-            VLOG_WARN_RL(&rl, "%s: Unexpected Tx offload flags: %#"PRIx64,
-                         netdev_get_name(&dev->up), unexpected);
-            netdev_dpdk_mbuf_dump(netdev_get_name(&dev->up),
-                                  "Packet with unexpected ol_flags", mbuf);
-            return false;
-        }
         return true;
     }
 
@@ -6431,6 +6432,10 @@  netdev_dpdk_vhost_client_reconfigure(struct netdev *netdev)
             vhost_flags |= RTE_VHOST_USER_POSTCOPY_SUPPORT;
         }
 
+        /* Use "compliant" ol_flags API so that the vhost library behaves
+         * like a DPDK ethdev driver. */
+        vhost_flags |= RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
+
         /* Enable External Buffers if TCP Segmentation Offload is enabled. */
         if (enable_tso) {
             vhost_flags |= RTE_VHOST_USER_EXTBUF_SUPPORT;