[PATCH v2] net/iavf: fix segmentation offload buffer size

Radu Nicolau radu.nicolau at intel.com
Tue Feb 15 16:50:23 CET 2022


This fix commit ff8b8bcd2ebe, which resulted in incorrect buffer size
being computed for non IPses TSO packets.

Fixes: ff8b8bcd2ebe ("net/iavf: fix segmentation offload condition")

Signed-off-by: Radu Nicolau <radu.nicolau at intel.com>
---
v2: reworked it to fix the initial issue instead of just reverting ff8b8bcd2ebe

 drivers/net/iavf/iavf_rxtx.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 41244055e5..ca54c70dd0 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -2463,9 +2463,10 @@ iavf_fill_data_desc(volatile struct iavf_tx_desc *desc,
 	desc->buffer_addr = rte_mbuf_data_iova(m);
 
 	/* calculate data buffer size less set header lengths */
-	if (m->ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) {
-		if (m->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
-			hdrlen += m->outer_l3_len;
+	if ((m->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) &&
+			(m->ol_flags & (RTE_MBUF_F_TX_TCP_SEG |
+					RTE_MBUF_F_TX_UDP_SEG))) {
+		hdrlen += m->outer_l3_len;
 		if (m->ol_flags & RTE_MBUF_F_TX_L4_MASK)
 			hdrlen += m->l3_len + m->l4_len;
 		else
@@ -2473,6 +2474,14 @@ iavf_fill_data_desc(volatile struct iavf_tx_desc *desc,
 		if (m->ol_flags & RTE_MBUF_F_TX_SEC_OFFLOAD)
 			hdrlen += ipseclen;
 		bufsz = hdrlen + tlen;
+	} else if ((m->ol_flags & RTE_MBUF_F_TX_SEC_OFFLOAD) &&
+			(m->ol_flags & (RTE_MBUF_F_TX_TCP_SEG |
+					RTE_MBUF_F_TX_UDP_SEG))) {
+		hdrlen += m->outer_l3_len + m->l3_len + ipseclen;
+		if (m->ol_flags & RTE_MBUF_F_TX_L4_MASK)
+			hdrlen += m->l4_len;
+		bufsz = hdrlen + tlen;
+
 	} else {
 		bufsz = m->data_len;
 	}
-- 
2.25.1



More information about the dev mailing list