From 42caa11b370e17bdbba498766b0fbad0975d8fa9 Mon Sep 17 00:00:00 2001 From: Dilshod Urazov Date: Mon, 24 Jun 2019 14:46:02 +0100 Subject: [PATCH] net: adjust L2 length on soft VLAN insertion 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 Signed-off-by: Andrew Rybchenko Acked-by: Olivier Matz --- lib/librte_net/rte_ether.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index 8ac1afecc8..8a040abf56 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -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; } -- 2.20.1