[dpdk-dev,1/2] net/vhost: set the vq consistently
Checks
Commit Message
From: Robert Shearman <robert.shearman@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@dpdk.org
Signed-off-by: Robert Shearman <robert.shearman@att.com>
Signed-off-by: Chas Williams <chas3@att.com>
---
drivers/net/vhost/rte_eth_vhost.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
Comments
On 03/29/2018 06:05 PM, Chas Williams wrote:
> From: Robert Shearman <robert.shearman@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@dpdk.org
>
> Signed-off-by: Robert Shearman <robert.shearman@att.com>
> Signed-off-by: Chas Williams <chas3@att.com>
> ---
> drivers/net/vhost/rte_eth_vhost.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
On 04/11/2018 04:46 PM, Maxime Coquelin wrote:
>
>
> On 03/29/2018 06:05 PM, Chas Williams wrote:
>> From: Robert Shearman <robert.shearman@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@dpdk.org
>>
>> Signed-off-by: Robert Shearman <robert.shearman@att.com>
>> Signed-off-by: Chas Williams <chas3@att.com>
>> ---
>> drivers/net/vhost/rte_eth_vhost.c | 15 +++++++++++++++
>> 1 file changed, 15 insertions(+)
>>
>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
It does not apply because a patch from Junjie seems to address the same
problem:
net/vhost: fix crash when creating vdev dynamically
Can you check dpdk-next-virtio/master and confirm this patch is no more
required?
Thanks,
Maxime
@@ -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;