net/vhost: prevent multiple setups on reconfiguration

Ethdev's .dev_configure callback can be called multiple
time during a device life-time, but Vhost makes the
wrong assumption that it is not the case and try to
setup again the device on reconfiguration.

This patch ensures the device hasn't been already setup
before proceeding.

Fixes: 3d01b759d2 ("net/vhost: delay driver setup")
Cc: stable@dpdk.org

Reported-by: Yinan Wang <yinan.wang@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
This commit is contained in:
Maxime Coquelin 2020-02-18 18:22:40 +01:00 committed by Ferruh Yigit
parent 3e00307549
commit 366a0500f4

View File

@ -876,6 +876,11 @@ vhost_driver_setup(struct rte_eth_dev *eth_dev)
unsigned int numa_node = eth_dev->device->numa_node;
const char *name = eth_dev->device->name;
/* Don't try to setup again if it has already been done. */
list = find_internal_resource(internal->iface_name);
if (list)
return 0;
list = rte_zmalloc_socket(name, sizeof(*list), 0, numa_node);
if (list == NULL)
return -1;