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 via email to