net/vhost: initialise device as inactive

rte_eth_vhost_get_vid_from_port_id returns a value of 0 if
called before the first call to the new_device callback.
A vid value >=0 suggests the device is active which is not
the case in this instance. Initialise vid to a negative
value to prevent this.

Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
Cc: stable@dpdk.org

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
Ciara Loftus 2018-05-03 14:17:03 +01:00 committed by Ferruh Yigit
parent dc3530ec0d
commit aee6c97f00

View File

@ -94,7 +94,7 @@ struct pmd_internal {
char *dev_name;
char *iface_name;
uint16_t max_queues;
uint16_t vid;
int vid;
rte_atomic32_t started;
uint8_t vlan_strip;
};
@ -1259,6 +1259,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name,
data->nb_rx_queues = queues;
data->nb_tx_queues = queues;
internal->max_queues = queues;
internal->vid = -1;
data->dev_link = pmd_link;
data->mac_addrs = eth_addr;
data->dev_flags = RTE_ETH_DEV_INTR_LSC;