> -----Original Message----- > From: Feifei Wang <[email protected]> > Sent: Tuesday, June 22, 2021 6:08 PM > To: Xing, Beilei <[email protected]> > Cc: [email protected]; nd <[email protected]>; Ruifeng Wang > <[email protected]>; nd <[email protected]> > Subject: 回复: [PATCH v1 1/2] net/i40e: improve performance for scalar Tx > > Sorry for a mistake for the code, it should be: > ------------------------------------------------------------------------------------------------ > int n = txq->tx_rs_thresh; > int32_t i = 0, j = 0; > const int32_t k = RTE_ALIGN_FLOOR(n, RTE_I40E_TX_MAX_FREE_BUF_SZ); > const int32_t m = n % RTE_I40E_TX_MAX_FREE_BUF_SZ; struct rte_mbuf > *free[RTE_I40E_TX_MAX_FREE_BUF_SZ]; > > For FAST_FREE_MODE: > > if (k) { > for (j = 0; j != k - RTE_I40E_TX_MAX_FREE_BUF_SZ; > j += RTE_I40E_TX_MAX_FREE_BUF_SZ) { > for (i = 0; i <RTE_I40E_TX_MAX_FREE_BUF_SZ; ++i, ++txep) { > free[i] = txep->mbuf; > txep->mbuf = NULL; > } > rte_mempool_put_bulk(free[0]->pool, (void **)free, > RTE_I40E_TX_MAX_FREE_BUF_SZ); > } > } > > if (m) { > for (i = 0; i < m; ++i, ++txep) { > free[i] = txep->mbuf; > txep->mbuf = NULL; > } > } > rte_mempool_put_bulk(free[0]->pool, (void **)free, m); } > ------------------------------------------------------------------------------------------------
Seems no logical problem, but the code looks heavy due to for loops. Did you run performance with this change when tx_rs_thresh > RTE_I40E_TX_MAX_FREE_BUF_SZ?

