Skip to content

Commit 932b273

Browse files
igsilyaovsrobot
authored andcommitted
netdev-dpdk: Clean up all marker flags if no offloads requested.
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 example, 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. An extra check is added to make sure we don't have any unexpected Tx offload flags set. Fixes: 084c808 ("userspace: Support VXLAN and GENEVE TSO.") Reported-at: openvswitch/ovs-issues#321 Signed-off-by: Ilya Maximets <[email protected]> Signed-off-by: 0-day Robot <[email protected]>
1 parent 33f45de commit 932b273

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

lib/netdev-dpdk.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,9 @@ int netdev_dpdk_get_vid(const struct netdev_dpdk *dev);
607607
struct ingress_policer *
608608
netdev_dpdk_get_ingress_policer(const struct netdev_dpdk *dev);
609609

610+
static void netdev_dpdk_mbuf_dump(const char *prefix, const char *message,
611+
const struct rte_mbuf *);
612+
610613
static bool
611614
is_dpdk_class(const struct netdev_class *class)
612615
{
@@ -2569,9 +2572,29 @@ netdev_dpdk_prep_hwol_packet(struct netdev_dpdk *dev, struct rte_mbuf *mbuf)
25692572
struct dp_packet *pkt = CONTAINER_OF(mbuf, struct dp_packet, mbuf);
25702573
struct tcp_header *th;
25712574

2572-
if (!(mbuf->ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_L4_MASK
2573-
| RTE_MBUF_F_TX_TCP_SEG))) {
2574-
mbuf->ol_flags &= ~(RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_IPV6);
2575+
const uint64_t all_requests = (RTE_MBUF_F_TX_IP_CKSUM |
2576+
RTE_MBUF_F_TX_L4_MASK |
2577+
RTE_MBUF_F_TX_OUTER_IP_CKSUM |
2578+
RTE_MBUF_F_TX_OUTER_UDP_CKSUM |
2579+
RTE_MBUF_F_TX_TCP_SEG);
2580+
const uint64_t all_marks = (RTE_MBUF_F_TX_IPV4 |
2581+
RTE_MBUF_F_TX_IPV6 |
2582+
RTE_MBUF_F_TX_OUTER_IPV4 |
2583+
RTE_MBUF_F_TX_OUTER_IPV6 |
2584+
RTE_MBUF_F_TX_TUNNEL_MASK);
2585+
2586+
if (!(mbuf->ol_flags & all_requests)) {
2587+
/* No offloads requested, no marks should be set. */
2588+
mbuf->ol_flags &= ~all_marks;
2589+
2590+
uint64_t unexpected = mbuf->ol_flags & RTE_MBUF_F_TX_OFFLOAD_MASK;
2591+
if (OVS_UNLIKELY(unexpected)) {
2592+
VLOG_WARN_RL(&rl, "%s: Unexpected Tx offload flags: %#"PRIx64,
2593+
netdev_get_name(&dev->up), unexpected);
2594+
netdev_dpdk_mbuf_dump(netdev_get_name(&dev->up),
2595+
"Packet with unexpected ol_flags", mbuf);
2596+
return false;
2597+
}
25752598
return true;
25762599
}
25772600

0 commit comments

Comments
 (0)