virtio-net: don't allocate control_buf if not supported
Subsystems (4)
PATCH 1/1 virtio-net: don't allocate control_buf if not supported
Not all virtio_net devices support the ctrl queue feature. Thus, there is no need to allocate unused resources.
Signed-off-by Max Gurtovoy <[email protected]>
--- drivers/net/virtio_net.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/virtio_net.c +7 -3
@@ -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;
Signature · 1 line
2.18.1
Quoted 4 lines · Max Gurtovoy
Not all
virtio_netdevices support the ctrl queue feature. Thus, there is no need to allocate unused resources.Signed-off-by Max Gurtovoy <[email protected]>
Reviewed-by Venkatesh Srinivas <[email protected]>
Quoted 30 lines
--- drivers/net/virtio_net.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/net/virtio_net.c +7
-3@@ -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
Quoted 19 lines
Not all
virtio_netdevices support the ctrl queue feature. Thus, there is no need to allocate unused resources.Signed-off-by Max Gurtovoy <[email protected]>--- drivers/net/virtio_net.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/net/virtio_net.c +0
-3@@ -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;
drivers/net/virtio_net.c static int virtnet_alloc_queues(struct virtnet_info *vi) · line 2882
Quoted 10 lines
drivers/net/virtio_net.c +7
-0+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 <[email protected]>
Quoted 4 lines · Max Gurtovoy
Not all
virtio_netdevices support the ctrl queue feature. Thus, there is no need to allocate unused resources.Signed-off-by Max Gurtovoy <[email protected]>
Acked-by Jason Wang <[email protected]>
Quoted 25 lines
--- drivers/net/virtio_net.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/net/virtio_net.c +7
-3@@ -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;