From: Rich Lane Date: Thu, 7 Apr 2016 00:29:06 +0000 (-0700) Subject: vhost: enable guest notification only on enabled queues X-Git-Tag: spdx-start~7047 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6fe9e03c380dae686b1610e5fd6ae8921d0bca78;p=dpdk.git vhost: enable guest notification only on enabled queues If the vhost PMD were configured with more queues than the guest, the old code would segfault in rte_vhost_enable_guest_notification due to a NULL virtqueue pointer. Fixes: ee584e9710b9 ("vhost: add driver on top of the library") Signed-off-by: Rich Lane Tested-by: Ciara Loftus Acked-by: Yuanhan Liu --- diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index b1eb08262c..310cbefcf2 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -265,7 +265,6 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; - rte_vhost_enable_guest_notification(dev, vq->virtqueue_id, 0); } for (i = 0; i < eth_dev->data->nb_tx_queues; i++) { vq = eth_dev->data->tx_queues[i]; @@ -274,9 +273,11 @@ new_device(struct virtio_net *dev) vq->device = dev; vq->internal = internal; vq->port = eth_dev->data->port_id; - rte_vhost_enable_guest_notification(dev, vq->virtqueue_id, 0); } + for (i = 0; i < dev->virt_qp_nb * VIRTIO_QNUM; i++) + rte_vhost_enable_guest_notification(dev, i, 0); + dev->flags |= VIRTIO_DEV_RUNNING; dev->priv = eth_dev; eth_dev->data->dev_link.link_status = ETH_LINK_UP;