vhost: rename number of available entries

Message ID 20220616082031.5005-1-maxime.coquelin@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series vhost: rename number of available entries |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance fail Performance Testing issues
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Maxime Coquelin June 16, 2022, 8:20 a.m. UTC
  This patchs renames the local variables free_entries to
avail_entries in the dequeue path.

Indeed, this variable represents the number of new packets
available in the Virtio transmit queue, so these entries
are actually used, not free.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/vhost/virtio_net.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
  

Comments

David Marchand June 17, 2022, 1:48 p.m. UTC | #1
On Thu, Jun 16, 2022 at 10:20 AM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> This patchs renames the local variables free_entries to
> avail_entries in the dequeue path.
>
> Indeed, this variable represents the number of new packets
> available in the Virtio transmit queue, so these entries
> are actually used, not free.
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
  
Maxime Coquelin June 17, 2022, 2:08 p.m. UTC | #2
On 6/16/22 10:20, Maxime Coquelin wrote:
> This patchs renames the local variables free_entries to
> avail_entries in the dequeue path.
> 
> Indeed, this variable represents the number of new packets
> available in the Virtio transmit queue, so these entries
> are actually used, not free.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>   lib/vhost/virtio_net.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 

Applied to dpdk-next-virtio/main.

Thanks,
Maxime
  

Patch

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 68a26eb17d..84cdf7e3b1 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -2774,7 +2774,7 @@  virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 	bool legacy_ol_flags)
 {
 	uint16_t i;
-	uint16_t free_entries;
+	uint16_t avail_entries;
 	uint16_t dropped = 0;
 	static bool allocerr_warned;
 
@@ -2782,9 +2782,9 @@  virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 	 * The ordering between avail index and
 	 * desc reads needs to be enforced.
 	 */
-	free_entries = __atomic_load_n(&vq->avail->idx, __ATOMIC_ACQUIRE) -
+	avail_entries = __atomic_load_n(&vq->avail->idx, __ATOMIC_ACQUIRE) -
 			vq->last_avail_idx;
-	if (free_entries == 0)
+	if (avail_entries == 0)
 		return 0;
 
 	rte_prefetch0(&vq->avail->ring[vq->last_avail_idx & (vq->size - 1)]);
@@ -2792,7 +2792,7 @@  virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 	VHOST_LOG_DATA(DEBUG, "(%s) %s\n", dev->ifname, __func__);
 
 	count = RTE_MIN(count, MAX_PKT_BURST);
-	count = RTE_MIN(count, free_entries);
+	count = RTE_MIN(count, avail_entries);
 	VHOST_LOG_DATA(DEBUG, "(%s) about to dequeue %u buffers\n",
 			dev->ifname, count);
 
@@ -3288,7 +3288,7 @@  virtio_dev_tx_async_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 {
 	static bool allocerr_warned;
 	bool dropped = false;
-	uint16_t free_entries;
+	uint16_t avail_entries;
 	uint16_t pkt_idx, slot_idx = 0;
 	uint16_t nr_done_pkts = 0;
 	uint16_t pkt_err = 0;
@@ -3302,9 +3302,9 @@  virtio_dev_tx_async_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 	 * The ordering between avail index and
 	 * desc reads needs to be enforced.
 	 */
-	free_entries = __atomic_load_n(&vq->avail->idx, __ATOMIC_ACQUIRE) -
+	avail_entries = __atomic_load_n(&vq->avail->idx, __ATOMIC_ACQUIRE) -
 			vq->last_avail_idx;
-	if (free_entries == 0)
+	if (avail_entries == 0)
 		goto out;
 
 	rte_prefetch0(&vq->avail->ring[vq->last_avail_idx & (vq->size - 1)]);
@@ -3312,7 +3312,7 @@  virtio_dev_tx_async_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 	async_iter_reset(async);
 
 	count = RTE_MIN(count, MAX_PKT_BURST);
-	count = RTE_MIN(count, free_entries);
+	count = RTE_MIN(count, avail_entries);
 	VHOST_LOG_DATA(DEBUG, "(%s) about to dequeue %u buffers\n",
 			dev->ifname, count);