From b68259f775b749ae860dfa4e170dd01774bf30d7 Mon Sep 17 00:00:00 2001 From: Hongbo Zheng Date: Wed, 3 Jun 2020 17:32:01 +0800 Subject: [PATCH] net/hns3: check TSO segment size during Tx Base on hns3 network engine, when the rte_eth_tx_burst API is called by Upper Level Process, if PKT_TX_TCP_SEG flag is set and tso_segsz is 0 in the input parameter structure rte_mbuf, hns3 PMD driver will process this packet as an non-TSO packet, otherwise hardware will enter an abnormal state. Fixes: 6dca716c9e1d ("net/hns3: support TSO") Cc: stable@dpdk.org Signed-off-by: Hongbo Zheng Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_rxtx.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 4341c6d60a..57017b6d88 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -1850,6 +1850,12 @@ hns3_tso_proc_tunnel(struct hns3_desc *desc, uint64_t ol_flags, return 0; } +static inline bool +hns3_pkt_is_tso(struct rte_mbuf *m) +{ + return (m->tso_segsz != 0 && m->ol_flags & PKT_TX_TCP_SEG); +} + static void hns3_set_tso(struct hns3_desc *desc, uint64_t ol_flags, struct rte_mbuf *rxm) @@ -1858,7 +1864,7 @@ hns3_set_tso(struct hns3_desc *desc, uint32_t tmp; uint8_t l2_len = rxm->l2_len; - if (!(ol_flags & PKT_TX_TCP_SEG)) + if (!hns3_pkt_is_tso(rxm)) return; if (hns3_tso_proc_tunnel(desc, ol_flags, rxm, &l2_len)) @@ -2307,12 +2313,6 @@ hns3_outer_header_cksum_prepare(struct rte_mbuf *m) } } -static inline bool -hns3_pkt_is_tso(struct rte_mbuf *m) -{ - return (m->tso_segsz != 0 && m->ol_flags & PKT_TX_TCP_SEG); -} - static int hns3_check_tso_pkt_valid(struct rte_mbuf *m) { -- 2.20.1