DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: call rte_vhost_enable_guest_notification only on enabled queues
@ 2016-04-07  0:29 Rich Lane
  2016-04-07 10:40 ` Loftus, Ciara
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Rich Lane @ 2016-04-07  0:29 UTC (permalink / raw)
  To: dev; +Cc: Tetsuya Mukawa, Yuanhan Liu

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 <rich.lane@bigswitch.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index b1eb082..310cbef 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;
-- 
1.9.1

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

end of thread, other threads:[~2016-04-08  7:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-07  0:29 [dpdk-dev] [PATCH] vhost: call rte_vhost_enable_guest_notification only on enabled queues Rich Lane
2016-04-07 10:40 ` Loftus, Ciara
2016-04-07 11:48 ` Tan, Jianfeng
2016-04-07 15:29   ` Loftus, Ciara
2016-04-07 15:42     ` Yuanhan Liu
2016-04-07 16:13     ` Tan, Jianfeng
2016-04-07 15:42 ` Yuanhan Liu
2016-04-07 17:20   ` Thomas Monjalon
2016-04-08  1:45     ` Tetsuya Mukawa
2016-04-08  6:14       ` Yuanhan Liu
2016-04-08  7:03         ` Tetsuya Mukawa

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