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>
This commit is contained in:
parent
3fd02fbbfa
commit
122b84a126
@ -2801,9 +2801,13 @@ static int virtnet_alloc_queues(struct virtnet_info *vi)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (vi->has_cvq) {
|
||||||
vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
|
vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
|
||||||
if (!vi->ctrl)
|
if (!vi->ctrl)
|
||||||
goto err_ctrl;
|
goto err_ctrl;
|
||||||
|
} else {
|
||||||
|
vi->ctrl = NULL;
|
||||||
|
}
|
||||||
vi->sq = kcalloc(vi->max_queue_pairs, sizeof(*vi->sq), GFP_KERNEL);
|
vi->sq = kcalloc(vi->max_queue_pairs, sizeof(*vi->sq), GFP_KERNEL);
|
||||||
if (!vi->sq)
|
if (!vi->sq)
|
||||||
goto err_sq;
|
goto err_sq;
|
||||||
|
Loading…
Reference in New Issue
Block a user