DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: wangzengyuan <wangzengyuan@huawei.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "chenbo.xia@intel.com" <chenbo.xia@intel.com>,
	"zhangxu (BA)" <jesse.zhangxu@huawei.com>,
	luyicai <luyicai@huawei.com>,
	wangyunjian <wangyunjian@huawei.com>
Subject: Re: dpdk: Inquiry about vring cleanup during packets transmission
Date: Tue, 30 May 2023 11:48:27 +0200	[thread overview]
Message-ID: <1d846873-9bc5-814f-b0a7-2375f0a332a6@redhat.com> (raw)
In-Reply-To: <cbb8e8c33fcd4661a844a9993d29f9fa@huawei.com>

Hello,

On 5/27/23 09:08, wangzengyuan wrote:
> Hi,
> 
>           I am writing to inquire about the vring cleanup process during 
> packets transmission.
> 
> In the virtio_xmit_pkts function, there is the following code:
> 
>           nb_used = virtqueue_nused(vq);
> 
>           if (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))
> 
>                     virtio_xmit_cleanup(vq, nb_used);
> 
> In other words, cleaning is performed when the number of items used in 
> the vring exceeds (vq->vq_nentries - vq->vq_free_thresh). In the case of 
> an vring size of 4096, at least (4096-32) items need to be cleaned at 
> once, which will take a considerable amount of time.
> 
> I'm curious why not clean up fewer items each time to avoid taking up 
> too much CPU time in one transmission. Because during the debugging 
> process, I found that cleaning up thousands of items at once takes up a 
> considerable amount of time.
> 
> As I am not familiar with this process, I would appreciate it if you 
> could provide me with some information on what its purpose is.

Both the Tx and Rx queues free threshold are configurable via ethdev
APIs:

int rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
		uint16_t nb_tx_desc, unsigned int socket_id,
		const struct rte_eth_txconf *tx_conf);

int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
		uint16_t nb_rx_desc, unsigned int socket_id,
		const struct rte_eth_rxconf *rx_conf,
		struct rte_mempool *mb_pool);

As you are using large rings, your application may use above APIs to set 
more appropriate values.

Regards,
Maxime

> Best regards,
> 
> Zengyuan Wang
> 


      reply	other threads:[~2023-05-30  9:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-27  7:08 wangzengyuan
2023-05-30  9:48 ` Maxime Coquelin [this message]

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=1d846873-9bc5-814f-b0a7-2375f0a332a6@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=jesse.zhangxu@huawei.com \
    --cc=luyicai@huawei.com \
    --cc=wangyunjian@huawei.com \
    --cc=wangzengyuan@huawei.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).