diff --git a/0257-hinic-free-mbuf-use-rte_pktmbuf_free_seg.patch b/0257-hinic-free-mbuf-use-rte_pktmbuf_free_seg.patch new file mode 100644 index 0000000..9a8d751 --- /dev/null +++ b/0257-hinic-free-mbuf-use-rte_pktmbuf_free_seg.patch @@ -0,0 +1,107 @@ +From b5c93dae2b73115c46f2e66dc87be61a200e006b Mon Sep 17 00:00:00 2001 +From: jiangheng12 +Date: Sat, 1 Apr 2023 21:56:20 +0800 +Subject: [PATCH] hinic: free tx mbuf use rte_pktmbuf_free_seg + +--- + drivers/net/hinic/hinic_pmd_tx.c | 27 ++++++++++++++++++--------- + drivers/net/hinic/hinic_pmd_tx.h | 9 +++++++++ + 2 files changed, 27 insertions(+), 9 deletions(-) + +diff --git a/drivers/net/hinic/hinic_pmd_tx.c b/drivers/net/hinic/hinic_pmd_tx.c +index f09b1a6..8eab94d 100644 +--- a/drivers/net/hinic/hinic_pmd_tx.c ++++ b/drivers/net/hinic/hinic_pmd_tx.c +@@ -30,13 +30,6 @@ + #define TX_MSS_DEFAULT 0x3E00 + #define TX_MSS_MIN 0x50 + +-#define HINIC_NONTSO_PKT_MAX_SGE 17 /* non-tso max sge 17 */ +-#define HINIC_NONTSO_SEG_NUM_INVALID(num) \ +- ((num) > HINIC_NONTSO_PKT_MAX_SGE) +- +-#define HINIC_TSO_PKT_MAX_SGE 127 /* tso max sge 127 */ +-#define HINIC_TSO_SEG_NUM_INVALID(num) ((num) > HINIC_TSO_PKT_MAX_SGE) +- + /* sizeof(struct hinic_sq_bufdesc) == 16, shift 4 */ + #define HINIC_BUF_DESC_SIZE(nr_descs) (SIZE_8BYTES(((u32)nr_descs) << 4)) + +@@ -640,6 +633,7 @@ static inline void hinic_xmit_mbuf_cleanup(struct hinic_txq *txq) + if (likely(mbuf->nb_segs == 1)) { + m = rte_pktmbuf_prefree_seg(mbuf); + tx_info->mbuf = NULL; ++ tx_info->nb_segs = 0; + + if (unlikely(m == NULL)) + continue; +@@ -653,8 +647,11 @@ static inline void hinic_xmit_mbuf_cleanup(struct hinic_txq *txq) + mbuf_free[nb_free++] = m; + } + } else { +- rte_pktmbuf_free(mbuf); ++ for (int j = 0; j < tx_info->nb_segs; j++) { ++ rte_pktmbuf_free_seg(tx_info->mbufs[j]); ++ } + tx_info->mbuf = NULL; ++ tx_info->nb_segs = 0; + } + } + +@@ -1191,6 +1188,13 @@ u16 hinic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, u16 nb_pkts) + tx_info->mbuf = mbuf_pkt; + tx_info->wqebb_cnt = wqe_wqebb_cnt; + ++ tx_info->nb_segs = mbuf_pkt->nb_segs; ++ struct rte_mbuf *tmp = mbuf_pkt; ++ for (int j = 0; j < mbuf_pkt->nb_segs; j++) { ++ tx_info->mbufs[j] = tmp; ++ tmp = tmp->next; ++ } ++ + /* 7. fill sq wqe header section */ + hinic_fill_sq_wqe_header(&sq_wqe->ctrl, queue_info, + sqe_info.sge_cnt, sqe_info.owner); +@@ -1231,7 +1235,12 @@ void hinic_free_all_tx_mbufs(struct hinic_txq *txq) + tx_info->cpy_mbuf = NULL; + } + +- rte_pktmbuf_free(tx_info->mbuf); ++ for (int j = 0; j < tx_info->nb_segs; j++) { ++ rte_pktmbuf_free_seg(tx_info->mbufs[j]); ++ tx_info->mbufs[j] = NULL; ++ } ++ tx_info->nb_segs = 0; ++ + hinic_update_sq_local_ci(nic_dev->hwdev, txq->q_id, + tx_info->wqebb_cnt); + +diff --git a/drivers/net/hinic/hinic_pmd_tx.h b/drivers/net/hinic/hinic_pmd_tx.h +index a3ec629..70159bd 100644 +--- a/drivers/net/hinic/hinic_pmd_tx.h ++++ b/drivers/net/hinic/hinic_pmd_tx.h +@@ -20,6 +20,13 @@ + RTE_MBUF_F_TX_OUTER_IP_CKSUM | \ + RTE_MBUF_F_TX_TCP_SEG) + ++#define HINIC_NONTSO_PKT_MAX_SGE 17 /* non-tso max sge 17 */ ++#define HINIC_NONTSO_SEG_NUM_INVALID(num) \ ++ ((num) > HINIC_NONTSO_PKT_MAX_SGE) ++ ++#define HINIC_TSO_PKT_MAX_SGE 127 /* tso max sge 127 */ ++#define HINIC_TSO_SEG_NUM_INVALID(num) ((num) > HINIC_TSO_PKT_MAX_SGE) ++ + enum sq_wqe_type { + SQ_NORMAL_WQE = 0, + }; +@@ -98,6 +105,8 @@ struct hinic_txq_stats { + + struct hinic_tx_info { + struct rte_mbuf *mbuf; ++ struct rte_mbuf *mbufs[HINIC_TSO_PKT_MAX_SGE]; ++ int nb_segs; + int wqebb_cnt; + struct rte_mbuf *cpy_mbuf; + }; +-- +2.23.0 + diff --git a/dpdk.spec b/dpdk.spec index 574576f..bf42277 100644 --- a/dpdk.spec +++ b/dpdk.spec @@ -1,6 +1,6 @@ Name: dpdk Version: 21.11 -Release: 36 +Release: 37 Packager: packaging@6wind.com URL: http://dpdk.org %global source_version 21.11 @@ -275,6 +275,7 @@ Patch9253: 0253-net-hns3-reimplement-hash-flow-function.patch Patch9254: 0254-net-hns3-add-verification-of-RSS-types.patch Patch9255: 0255-test-mbuf-fix-mbuf-reset-test.patch Patch9256: 0256-examples-l3fwd-power-support-CPPC-cpufreq.patch +Patch9257: 0257-hinic-free-mbuf-use-rte_pktmbuf_free_seg.patch Summary: Data Plane Development Kit core Group: System Environment/Libraries @@ -417,6 +418,9 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko /usr/sbin/depmod %changelog +* Sat Apr 01 2023 jiangheng - 21.11-37 +- hinic: free tx mbuf use rte_pktmbuf_free_seg + * Thu Mar 23 2023 chenjiji - 21.11-36 Fix a m_buf pool was not freed bugs for test and support CPPC cpufreq for l3fwd-power. Patchs are as follow: