DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] vhost: rename number of available entries
@ 2022-06-16  8:20 Maxime Coquelin
  2022-06-17 13:48 ` David Marchand
  2022-06-17 14:08 ` Maxime Coquelin
  0 siblings, 2 replies; 3+ messages in thread
From: Maxime Coquelin @ 2022-06-16  8:20 UTC (permalink / raw)
  To: dev, chenbo.xia, david.marchand; +Cc: Maxime Coquelin

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(-)

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);
 
-- 
2.35.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vhost: rename number of available entries
  2022-06-16  8:20 [PATCH] vhost: rename number of available entries Maxime Coquelin
@ 2022-06-17 13:48 ` David Marchand
  2022-06-17 14:08 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: David Marchand @ 2022-06-17 13:48 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: dev, Xia, Chenbo

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>

-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vhost: rename number of available entries
  2022-06-16  8:20 [PATCH] vhost: rename number of available entries Maxime Coquelin
  2022-06-17 13:48 ` David Marchand
@ 2022-06-17 14:08 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2022-06-17 14:08 UTC (permalink / raw)
  To: dev, chenbo.xia, david.marchand



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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-17 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16  8:20 [PATCH] vhost: rename number of available entries Maxime Coquelin
2022-06-17 13:48 ` David Marchand
2022-06-17 14:08 ` Maxime Coquelin

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).