From dd443c1a7aa6cc236726dc5bf0f789ce1d8cc65b Mon Sep 17 00:00:00 2001 From: David Marchand Date: Tue, 17 Jun 2025 09:21:02 +0200 Subject: [PATCH] netdev-dpdk: Stop relying on vhost-user Tx flags. 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 Signed-off-by: Ilya Maximets --- lib/netdev-dpdk.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index b9a10afcb..b9e5ad9b8 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;