DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/virtio-user: fix number of vrings calculation
@ 2023-02-10 15:10 Maxime Coquelin
  2023-02-10 15:23 ` David Marchand
  2023-02-10 15:28 ` Maxime Coquelin
  0 siblings, 2 replies; 3+ messages in thread
From: Maxime Coquelin @ 2023-02-10 15:10 UTC (permalink / raw)
  To: dev, chenbo.xia, david.marchand, eperezma; +Cc: Maxime Coquelin

When moving to dynamic allocation of vrings metadata, the
number of vrings to allocate was incremented if the backend
supports control queue.

The problem is that the control queue metadata have to be
allocated even if the backend does not use it directly,
since the control queue is managed by the Virtio-user layer
as soon as multiqueue is negotiated..

This patch fixes this by incrementing the number of vrings
as soon as the device features have VIRTIO_NET_F_MQ.

Fixes: d57c3a601e44 ("net/virtio-user: remove max queues limitation")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---

I plan to squash it with faulty commit in the Virtio branch
since it has not been pulled yet by Thomas once acked and
if no objection.

 drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index cf58b63029..ccb4d7326b 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -575,7 +575,7 @@ virtio_user_alloc_vrings(struct virtio_user_dev *dev)
 	bool packed_ring = !!(dev->device_features & (1ull << VIRTIO_F_RING_PACKED));
 
 	nr_vrings = dev->max_queue_pairs * 2;
-	if (dev->hw_cvq)
+	if (dev->device_features & (1ull << VIRTIO_NET_F_MQ))
 		nr_vrings++;
 
 	dev->callfds = rte_zmalloc("virtio_user_dev", nr_vrings * sizeof(*dev->callfds), 0);
-- 
2.39.1


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

* Re: [PATCH] net/virtio-user: fix number of vrings calculation
  2023-02-10 15:10 [PATCH] net/virtio-user: fix number of vrings calculation Maxime Coquelin
@ 2023-02-10 15:23 ` David Marchand
  2023-02-10 15:28 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: David Marchand @ 2023-02-10 15:23 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: dev, chenbo.xia, eperezma

On Fri, Feb 10, 2023 at 4:10 PM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> When moving to dynamic allocation of vrings metadata, the
> number of vrings to allocate was incremented if the backend
> supports control queue.
>
> The problem is that the control queue metadata have to be
> allocated even if the backend does not use it directly,
> since the control queue is managed by the Virtio-user layer
> as soon as multiqueue is negotiated..
>
> This patch fixes this by incrementing the number of vrings
> as soon as the device features have VIRTIO_NET_F_MQ.
>
> Fixes: d57c3a601e44 ("net/virtio-user: remove max queues limitation")
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Acked-by: David Marchand <david.marchand@redhat.com>

> ---
>
> I plan to squash it with faulty commit in the Virtio branch
> since it has not been pulled yet by Thomas once acked and
> if no objection.

No objection from me.


-- 
David Marchand


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

* Re: [PATCH] net/virtio-user: fix number of vrings calculation
  2023-02-10 15:10 [PATCH] net/virtio-user: fix number of vrings calculation Maxime Coquelin
  2023-02-10 15:23 ` David Marchand
@ 2023-02-10 15:28 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2023-02-10 15:28 UTC (permalink / raw)
  To: dev, chenbo.xia, david.marchand, eperezma



On 2/10/23 16:10, Maxime Coquelin wrote:
> When moving to dynamic allocation of vrings metadata, the
> number of vrings to allocate was incremented if the backend
> supports control queue.
> 
> The problem is that the control queue metadata have to be
> allocated even if the backend does not use it directly,
> since the control queue is managed by the Virtio-user layer
> as soon as multiqueue is negotiated..
> 
> This patch fixes this by incrementing the number of vrings
> as soon as the device features have VIRTIO_NET_F_MQ.
> 
> Fixes: d57c3a601e44 ("net/virtio-user: remove max queues limitation")
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> 
> I plan to squash it with faulty commit in the Virtio branch
> since it has not been pulled yet by Thomas once acked and
> if no objection.
> 
>   drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> index cf58b63029..ccb4d7326b 100644
> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> @@ -575,7 +575,7 @@ virtio_user_alloc_vrings(struct virtio_user_dev *dev)
>   	bool packed_ring = !!(dev->device_features & (1ull << VIRTIO_F_RING_PACKED));
>   
>   	nr_vrings = dev->max_queue_pairs * 2;
> -	if (dev->hw_cvq)
> +	if (dev->device_features & (1ull << VIRTIO_NET_F_MQ))
>   		nr_vrings++;
>   
>   	dev->callfds = rte_zmalloc("virtio_user_dev", nr_vrings * sizeof(*dev->callfds), 0);

Squashed with d57c3a601e44 and pushed to next-virtio.

Thanks,
Maxime


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

end of thread, other threads:[~2023-02-10 15:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10 15:10 [PATCH] net/virtio-user: fix number of vrings calculation Maxime Coquelin
2023-02-10 15:23 ` David Marchand
2023-02-10 15:28 ` 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).