diff options
author | Max Gurtovoy <mgurtovoy@nvidia.com> | 2021-05-02 12:33:19 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2021-05-03 11:55:51 +0300 |
commit | 122b84a1267aec28ab929edae1ac700a03fb65e0 (patch) | |
tree | c833ffc67dc6b298fa46189845193fdd21d464ea /drivers/net/virtio_net.c | |
parent | 3fd02fbbfac0dabb624606d1303d309f34ec15d4 (diff) | |
download | linux-122b84a1267aec28ab929edae1ac700a03fb65e0.tar.xz |
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 <mgurtovoy@nvidia.com>
Link: https://lore.kernel.org/r/20210502093319.61313-1-mgurtovoy@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 0824e6999e49..ac0c143f97b4 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2801,9 +2801,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; |