DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xing, Beilei" <beilei.xing@intel.com>
To: Feifei Wang <feifei.wang2@arm.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "nd@arm.com" <nd@arm.com>,
	Ruifeng Wang <ruifeng.wang@arm.com>
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: improve performance for scalar Tx
Date: Wed, 30 Jun 2021 06:59:05 +0000	[thread overview]
Message-ID: <MN2PR11MB38077EBAAD4F09CFF877902EF7019@MN2PR11MB3807.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210630064036.105151-2-feifei.wang2@arm.com>



> -----Original Message-----
> From: Feifei Wang <feifei.wang2@arm.com>
> Sent: Wednesday, June 30, 2021 2:41 PM
> To: Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; nd@arm.com; Feifei Wang <feifei.wang2@arm.com>;
> Ruifeng Wang <ruifeng.wang@arm.com>
> Subject: [PATCH v3 1/2] net/i40e: improve performance for scalar Tx
> 
> For i40e scalar Tx path, if implement FAST_FREE_MBUF mode, it means per-
> queue all mbufs come from the same mempool and have refcnt = 1.
> 
> Thus we can use bulk free of the buffers when mbuf fast free mode is
> enabled.
> 
> Following are the test results with this patch:
> 
> MRR L3FWD Test:
> two ports & bi-directional flows & one core RX API:
> i40e_recv_pkts_bulk_alloc TX API: i40e_xmit_pkts_simple ring_descs_size =
> 1024; Ring_I40E_TX_MAX_FREE_SZ = 64; tx_rs_thresh =
> I40E_DEFAULT_TX_RSBIT_THRESH = 32; tx_free_thresh =
> I40E_DEFAULT_TX_FREE_THRESH = 32;
> 
> For scalar path in arm platform with default 'tx_rs_thresh':
> In n1sdp, performance is improved by 7.9%; In thunderx2, performance is
> improved by 7.6%.
> 
> For scalar path in x86 platform with default 'tx_rs_thresh':
> performance is improved by 4.7%.
> 
> Suggested-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  drivers/net/i40e/i40e_rxtx.c | 30 ++++++++++++++++++++++++------
>  1 file changed, 24 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index
> 6c58decece..0d3482a9d2 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -1294,22 +1294,40 @@ static __rte_always_inline int
> i40e_tx_free_bufs(struct i40e_tx_queue *txq)  {
>  	struct i40e_tx_entry *txep;
> -	uint16_t i;
> +	uint16_t tx_rs_thresh = txq->tx_rs_thresh;
> +	uint16_t i = 0, j = 0;
> +	struct rte_mbuf *free[RTE_I40E_TX_MAX_FREE_BUF_SZ];
> +	const uint16_t k = RTE_ALIGN_FLOOR(tx_rs_thresh,
> RTE_I40E_TX_MAX_FREE_BUF_SZ);
> +	const uint16_t m = tx_rs_thresh % RTE_I40E_TX_MAX_FREE_BUF_SZ;
> 
>  	if ((txq->tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
>  			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
> 
> 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
>  		return 0;
> 
> -	txep = &(txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh - 1)]);
> +	txep = &txq->sw_ring[txq->tx_next_dd - (tx_rs_thresh - 1)];
> 
> -	for (i = 0; i < txq->tx_rs_thresh; i++)
> +	for (i = 0; i < tx_rs_thresh; i++)
>  		rte_prefetch0((txep + i)->mbuf);
> 
>  	if (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE) {
> -		for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
> -			rte_mempool_put(txep->mbuf->pool, txep->mbuf);
> -			txep->mbuf = NULL;
> +		if (k) {
> +			for (j = 0; j != k; 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);
>  		}
>  	} else {
>  		for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
> --
> 2.25.1
Acked-by: Beilei Xing <beilei.xing@intel.com>


  reply	other threads:[~2021-06-30  6:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27  8:17 [dpdk-dev] [PATCH v1 0/2] net/i40e: improve free mbuf Feifei Wang
2021-05-27  8:17 ` [dpdk-dev] [PATCH v1 1/2] net/i40e: improve performance for scalar Tx Feifei Wang
2021-06-22  6:07   ` Xing, Beilei
2021-06-22  9:58     ` [dpdk-dev] 回复: " Feifei Wang
2021-06-22 10:08       ` Feifei Wang
2021-06-23  7:02         ` [dpdk-dev] " Xing, Beilei
2021-06-25  9:40           ` [dpdk-dev] 回复: " Feifei Wang
2021-06-28  2:27             ` [dpdk-dev] " Xing, Beilei
2021-06-28  2:28               ` [dpdk-dev] 回复: " Feifei Wang
2021-05-27  8:17 ` [dpdk-dev] [PATCH v1 2/2] net/i40e: improve performance for vector Tx Feifei Wang
2021-06-22  1:52 ` [dpdk-dev] 回复: [PATCH v1 0/2] net/i40e: improve free mbuf Feifei Wang
2021-06-30  6:40 ` [dpdk-dev] [PATCH v3 0/2] net/i40e: improve free mbuf for Tx Feifei Wang
2021-06-30  6:40   ` [dpdk-dev] [PATCH v3 1/2] net/i40e: improve performance for scalar Tx Feifei Wang
2021-06-30  6:59     ` Xing, Beilei [this message]
2021-06-30  6:40   ` [dpdk-dev] [PATCH v3 2/2] net/i40e: improve performance for vector Tx Feifei Wang
2021-07-01 12:34   ` [dpdk-dev] [PATCH v3 0/2] net/i40e: improve free mbuf for Tx Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR11MB38077EBAAD4F09CFF877902EF7019@MN2PR11MB3807.namprd11.prod.outlook.com \
    --to=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=feifei.wang2@arm.com \
    --cc=nd@arm.com \
    --cc=ruifeng.wang@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).