kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] virtio-net: don't allocate control_buf if not supported
@ 2021-05-02  9:33 Max Gurtovoy
  2021-05-03 17:30 ` Venkatesh Srinivas
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Max Gurtovoy @ 2021-05-02  9:33 UTC (permalink / raw)
  To: mst, kvm, jasowang, virtualization; +Cc: Max Gurtovoy

Not all virtio_net devices support the ctrl queue feature. Thus, there
is no need to allocate unused resources.

Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
---
 drivers/net/virtio_net.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 7fda2ae4c40f..9b6a4a875c55 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2870,9 +2870,13 @@ static int virtnet_alloc_queues(struct virtnet_info *vi)
 {
 	int i;
 
-	vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
-	if (!vi->ctrl)
-		goto err_ctrl;
+	if (vi->has_cvq) {
+		vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
+		if (!vi->ctrl)
+			goto err_ctrl;
+	} else {
+		vi->ctrl = NULL;
+	}
 	vi->sq = kcalloc(vi->max_queue_pairs, sizeof(*vi->sq), GFP_KERNEL);
 	if (!vi->sq)
 		goto err_sq;
-- 
2.18.1


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

* Re: [PATCH 1/1] virtio-net: don't allocate control_buf if not supported
  2021-05-02  9:33 [PATCH 1/1] virtio-net: don't allocate control_buf if not supported Max Gurtovoy
@ 2021-05-03 17:30 ` Venkatesh Srinivas
  2021-05-04  9:05 ` Pankaj Gupta
  2021-05-06  2:22 ` Jason Wang
  2 siblings, 0 replies; 4+ messages in thread
From: Venkatesh Srinivas @ 2021-05-03 17:30 UTC (permalink / raw)
  To: Max Gurtovoy; +Cc: mst, kvm, jasowang, virtualization

On 5/2/21, Max Gurtovoy <mgurtovoy@nvidia.com> wrote:
> Not all virtio_net devices support the ctrl queue feature. Thus, there
> is no need to allocate unused resources.
>
> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>

Reviewed-by: Venkatesh Srinivas <venkateshs@chromium.org>

> ---
>  drivers/net/virtio_net.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 7fda2ae4c40f..9b6a4a875c55 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2870,9 +2870,13 @@ static int virtnet_alloc_queues(struct virtnet_info
> *vi)
>  {
>  	int i;
>
> -	vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
> -	if (!vi->ctrl)
> -		goto err_ctrl;
> +	if (vi->has_cvq) {
> +		vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
> +		if (!vi->ctrl)
> +			goto err_ctrl;
> +	} else {
> +		vi->ctrl = NULL;
> +	}
>  	vi->sq = kcalloc(vi->max_queue_pairs, sizeof(*vi->sq), GFP_KERNEL);
>  	if (!vi->sq)
>  		goto err_sq;
> --
> 2.18.1
>
>

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

* Re: [PATCH 1/1] virtio-net: don't allocate control_buf if not supported
  2021-05-02  9:33 [PATCH 1/1] virtio-net: don't allocate control_buf if not supported Max Gurtovoy
  2021-05-03 17:30 ` Venkatesh Srinivas
@ 2021-05-04  9:05 ` Pankaj Gupta
  2021-05-06  2:22 ` Jason Wang
  2 siblings, 0 replies; 4+ messages in thread
From: Pankaj Gupta @ 2021-05-04  9:05 UTC (permalink / raw)
  To: Max Gurtovoy; +Cc: Michael S . Tsirkin, kvm, Jason Wang, virtualization

> Not all virtio_net devices support the ctrl queue feature. Thus, there
> is no need to allocate unused resources.
>
> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
> ---
>  drivers/net/virtio_net.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 7fda2ae4c40f..9b6a4a875c55 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2870,9 +2870,13 @@ static int virtnet_alloc_queues(struct virtnet_info *vi)
>  {
>         int i;
>
> -       vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
> -       if (!vi->ctrl)
> -               goto err_ctrl;
> +       if (vi->has_cvq) {
> +               vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
> +               if (!vi->ctrl)
> +                       goto err_ctrl;
> +       } else {
> +               vi->ctrl = NULL;
> +       }
>         vi->sq = kcalloc(vi->max_queue_pairs, sizeof(*vi->sq), GFP_KERNEL);
>         if (!vi->sq)
>                 goto err_sq;

Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>

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

* Re: [PATCH 1/1] virtio-net: don't allocate control_buf if not supported
  2021-05-02  9:33 [PATCH 1/1] virtio-net: don't allocate control_buf if not supported Max Gurtovoy
  2021-05-03 17:30 ` Venkatesh Srinivas
  2021-05-04  9:05 ` Pankaj Gupta
@ 2021-05-06  2:22 ` Jason Wang
  2 siblings, 0 replies; 4+ messages in thread
From: Jason Wang @ 2021-05-06  2:22 UTC (permalink / raw)
  To: Max Gurtovoy, mst, kvm, virtualization


在 2021/5/2 下午5:33, Max Gurtovoy 写道:
> Not all virtio_net devices support the ctrl queue feature. Thus, there
> is no need to allocate unused resources.
>
> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>


Acked-by: Jason Wang <jasowang@redhat.com>


> ---
>   drivers/net/virtio_net.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 7fda2ae4c40f..9b6a4a875c55 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2870,9 +2870,13 @@ static int virtnet_alloc_queues(struct virtnet_info *vi)
>   {
>   	int i;
>   
> -	vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
> -	if (!vi->ctrl)
> -		goto err_ctrl;
> +	if (vi->has_cvq) {
> +		vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
> +		if (!vi->ctrl)
> +			goto err_ctrl;
> +	} else {
> +		vi->ctrl = NULL;
> +	}
>   	vi->sq = kcalloc(vi->max_queue_pairs, sizeof(*vi->sq), GFP_KERNEL);
>   	if (!vi->sq)
>   		goto err_sq;


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

end of thread, other threads:[~2021-05-06  2:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-02  9:33 [PATCH 1/1] virtio-net: don't allocate control_buf if not supported Max Gurtovoy
2021-05-03 17:30 ` Venkatesh Srinivas
2021-05-04  9:05 ` Pankaj Gupta
2021-05-06  2:22 ` Jason Wang

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