[dpdk-dev] [PATCH 1/2] net/vhost: set the vq consistently
Chas Williams
3chas3 at gmail.com
Thu Mar 29 18:05:06 CEST 2018
From: Robert Shearman <robert.shearman at att.com>
The vid and port of the vq were only set on queues created during initial
device setup.
Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
Cc: stable at dpdk.org
Signed-off-by: Robert Shearman <robert.shearman at att.com>
Signed-off-by: Chas Williams <chas3 at att.com>
---
drivers/net/vhost/rte_eth_vhost.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 3aae01c39..453d9bee1 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -118,6 +118,7 @@ struct pmd_internal {
char *iface_name;
uint16_t max_queues;
rte_atomic32_t started;
+ int vid;
};
struct internal_list {
@@ -573,6 +574,7 @@ new_device(int vid)
eth_dev = list->eth_dev;
internal = eth_dev->data->dev_private;
+ internal->vid = vid;
#ifdef RTE_LIBRTE_VHOST_NUMA
newnode = rte_vhost_get_numa_node(vid);
@@ -633,6 +635,7 @@ destroy_device(int vid)
}
eth_dev = list->eth_dev;
internal = eth_dev->data->dev_private;
+ internal->vid = -1;
rte_atomic32_set(&internal->dev_attached, 0);
update_queuing_status(eth_dev);
@@ -834,6 +837,9 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
struct rte_mempool *mb_pool)
{
struct vhost_queue *vq;
+ struct pmd_internal *internal;
+
+ internal = dev->data->dev_private;
vq = rte_zmalloc_socket(NULL, sizeof(struct vhost_queue),
RTE_CACHE_LINE_SIZE, socket_id);
@@ -844,6 +850,9 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
vq->mb_pool = mb_pool;
vq->virtqueue_id = rx_queue_id * VIRTIO_QNUM + VIRTIO_TXQ;
+ vq->internal = internal;
+ vq->vid = internal->vid;
+ vq->port = dev->data->port_id;
dev->data->rx_queues[rx_queue_id] = vq;
return 0;
@@ -856,6 +865,9 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
const struct rte_eth_txconf *tx_conf __rte_unused)
{
struct vhost_queue *vq;
+ struct pmd_internal *internal;
+
+ internal = dev->data->dev_private;
vq = rte_zmalloc_socket(NULL, sizeof(struct vhost_queue),
RTE_CACHE_LINE_SIZE, socket_id);
@@ -865,6 +877,9 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
}
vq->virtqueue_id = tx_queue_id * VIRTIO_QNUM + VIRTIO_RXQ;
+ vq->internal = internal;
+ vq->vid = internal->vid;
+ vq->port = dev->data->port_id;
dev->data->tx_queues[tx_queue_id] = vq;
return 0;
--
2.13.6
More information about the dev
mailing list