bus/vdev: remove probe with driver name option

Virtual device/driver probing done via name.

A new alternative method introduced to probe the device with providing
driver name in devargs as "driver=<driver_name>".

This patch removes alternative method and fixes virtual device usages
with proper device names.

Fixes: 87c3bf29c6 ("test: do not short-circuit null device creation")
Fixes: d39670086a ("eal: parse driver argument before probing drivers")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Ferruh Yigit 2017-05-10 12:01:04 +01:00 committed by Thomas Monjalon
parent 701a64622c
commit 9bf4901d1a
3 changed files with 6 additions and 46 deletions

View File

@ -49,7 +49,6 @@ static unsigned default_packet_copy;
static const char *valid_arguments[] = { static const char *valid_arguments[] = {
ETH_NULL_PACKET_SIZE_ARG, ETH_NULL_PACKET_SIZE_ARG,
ETH_NULL_PACKET_COPY_ARG, ETH_NULL_PACKET_COPY_ARG,
"driver",
NULL NULL
}; };

View File

@ -69,38 +69,6 @@ rte_vdev_unregister(struct rte_vdev_driver *driver)
TAILQ_REMOVE(&vdev_driver_list, driver, next); TAILQ_REMOVE(&vdev_driver_list, driver, next);
} }
/*
* Parse "driver" devargs without adding a dependency on rte_kvargs.h
*/
static char *parse_driver_arg(const char *args)
{
const char *c;
char *str;
if (!args || args[0] == '\0')
return NULL;
c = args;
do {
if (strncmp(c, "driver=", 7) == 0) {
c += 7;
break;
}
c = strchr(c, ',');
if (c)
c++;
} while (c);
if (c)
str = strdup(c);
else
str = NULL;
return str;
}
static int static int
vdev_parse(const char *name, void *addr) vdev_parse(const char *name, void *addr)
{ {
@ -126,26 +94,20 @@ static int
vdev_probe_all_drivers(struct rte_vdev_device *dev) vdev_probe_all_drivers(struct rte_vdev_device *dev)
{ {
const char *name; const char *name;
char *drv_name;
struct rte_vdev_driver *driver; struct rte_vdev_driver *driver;
int ret = 1; int ret;
drv_name = parse_driver_arg(rte_vdev_device_args(dev)); name = rte_vdev_device_name(dev);
name = drv_name ? drv_name : rte_vdev_device_name(dev);
RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name, RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
rte_vdev_device_name(dev)); rte_vdev_device_name(dev));
if (vdev_parse(name, &driver)) { if (vdev_parse(name, &driver))
ret = -1; return -1;
goto out;
}
dev->device.driver = &driver->driver; dev->device.driver = &driver->driver;
ret = driver->probe(dev); ret = driver->probe(dev);
if (ret) if (ret)
dev->device.driver = NULL; dev->device.driver = NULL;
out:
free(drv_name);
return ret; return ret;
} }

View File

@ -62,7 +62,7 @@
#define BONDED_DEV_NAME ("rssconf_bond_dev") #define BONDED_DEV_NAME ("rssconf_bond_dev")
#define SLAVE_DEV_NAME_FMT ("rssconf_slave%d") #define SLAVE_DEV_NAME_FMT ("net_null%d")
#define SLAVE_RXTX_QUEUE_FMT ("rssconf_slave%d_q%d") #define SLAVE_RXTX_QUEUE_FMT ("rssconf_slave%d_q%d")
#define NUM_MBUFS 8191 #define NUM_MBUFS 8191
@ -550,8 +550,7 @@ test_setup(void)
port_id = rte_eth_dev_count(); port_id = rte_eth_dev_count();
snprintf(name, sizeof(name), SLAVE_DEV_NAME_FMT, port_id); snprintf(name, sizeof(name), SLAVE_DEV_NAME_FMT, port_id);
retval = rte_vdev_init(name, retval = rte_vdev_init(name, "size=64,copy=0");
"driver=net_null,size=64,copy=0");
TEST_ASSERT_SUCCESS(retval, "Failed to create null device '%s'\n", TEST_ASSERT_SUCCESS(retval, "Failed to create null device '%s'\n",
name); name);