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.
Best regards,
Zengyuan Wang