Skip to content

Commit

Permalink
netdev-dpdk: Clean up all marker flags if no offloads requested.
Browse files Browse the repository at this point in the history
Some drivers (primarily, Intel ones) do not expect any marking flags
being set if no offloads are requested.  If these flags are present,
driver will fail Tx preparation or behave abnormally.

For exmaple, ixgbe driver will refuse to process the packet with
only RTE_MBUF_F_TX_TUNNEL_GENEVE and RTE_MBUF_F_TX_OUTER_IPV4 set.
This pretty much breaks geneve tunnels on these cards.

Fixes: 084c808 ("userspace: Support VXLAN and GENEVE TSO.")
Reported-at: openvswitch/ovs-issues#321
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
igsilya committed Mar 11, 2024
1 parent 33f45de commit 13b7dc2
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@ int netdev_dpdk_get_vid(const struct netdev_dpdk *dev);
struct ingress_policer *
netdev_dpdk_get_ingress_policer(const struct netdev_dpdk *dev);

static void netdev_dpdk_mbuf_dump(const char *prefix, const char *message,
const struct rte_mbuf *);

static bool
is_dpdk_class(const struct netdev_class *class)
{
Expand Down Expand Up @@ -2569,9 +2572,28 @@ netdev_dpdk_prep_hwol_packet(struct netdev_dpdk *dev, struct rte_mbuf *mbuf)
struct dp_packet *pkt = CONTAINER_OF(mbuf, struct dp_packet, mbuf);
struct tcp_header *th;

if (!(mbuf->ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_L4_MASK
| RTE_MBUF_F_TX_TCP_SEG))) {
mbuf->ol_flags &= ~(RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_IPV6);
const uint64_t all_requests = (RTE_MBUF_F_TX_IP_CKSUM |
RTE_MBUF_F_TX_L4_MASK |
RTE_MBUF_F_TX_OUTER_IP_CKSUM |
RTE_MBUF_F_TX_OUTER_UDP_CKSUM |
RTE_MBUF_F_TX_TCP_SEG);
const uint64_t all_marks = (RTE_MBUF_F_TX_IPV4 |
RTE_MBUF_F_TX_IPV6 |
RTE_MBUF_F_TX_OUTER_IPV4 |
RTE_MBUF_F_TX_OUTER_IPV6 |
RTE_MBUF_F_TX_TUNNEL_MASK);

if (!(mbuf->ol_flags & all_requests)) {
/* No offloads requested, no marks should be set. */
mbuf->ol_flags &= ~all_marks;

if (OVS_UNLIKELY(mbuf->ol_flags & RTE_MBUF_F_TX_OFFLOAD_MASK)) {
VLOG_WARN_RL(&rl, "%s: Unexpected Tx offload flags: 0x%"PRIx64,
netdev_get_name(&dev->up), mbuf->ol_flags);
netdev_dpdk_mbuf_dump(netdev_get_name(&dev->up),
"Packet with unexpected ol_flags", mbuf);
return false;
}
return true;
}

Expand Down

0 comments on commit 13b7dc2

Please sign in to comment.