net: adjust L2 length on soft VLAN insertion
authorDilshod Urazov <dilshod.urazov@oktetlabs.ru>
Mon, 24 Jun 2019 13:46:02 +0000 (14:46 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 23 Jul 2019 12:31:35 +0000 (14:31 +0200)
Layer 2 length must be updated after the prepend to mbuf to keep
the length right to be used by other Tx offloads.

If the packet has tunnel encapsulation, outer_l2_len should be
updated. Otherwise l2_len should be updated.

Fixes: c974021a5949 ("ether: add soft vlan encap/decap")
Cc: stable@dpdk.org
Signed-off-by: Dilshod Urazov <dilshod.urazov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
lib/librte_net/rte_ether.h

index 8ac1afe..8a040ab 100644 (file)
@@ -405,6 +405,11 @@ static inline int rte_vlan_insert(struct rte_mbuf **m)
 
        (*m)->ol_flags &= ~(PKT_RX_VLAN_STRIPPED | PKT_TX_VLAN);
 
+       if ((*m)->ol_flags & PKT_TX_TUNNEL_MASK)
+               (*m)->outer_l2_len += sizeof(struct rte_vlan_hdr);
+       else
+               (*m)->l2_len += sizeof(struct rte_vlan_hdr);
+
        return 0;
 }