src/dpdk/lib/librte_eal/common/eal_common_dev.c
int
local_dev_probe(const char *devargs, struct rte_device **new_dev)
{
	struct rte_device *dev;
	struct rte_devargs *da;
	int ret;

	*new_dev = NULL;
	da = calloc(1, sizeof(*da));
	if (da == NULL)
		return -ENOMEM;

	ret = rte_devargs_parse(da, devargs);
	if (ret)
		goto err_devarg;

	if (da->bus->plug == NULL) {
		RTE_LOG(ERR, EAL, "Function plug not supported by bus (%s)\n",
			da->bus->name);
		ret = -ENOTSUP;
		goto err_devarg;
	}

	ret = rte_devargs_insert(&da);
	if (ret)
		goto err_devarg;

	/* the rte_devargs will be referenced in the matching rte_device */
	ret = da->bus->scan();
	if (ret)
		goto err_devarg;

	dev = da->bus->find_device(NULL, cmp_dev_name, da->name);
	if (dev == NULL) {
		RTE_LOG(ERR, EAL, "Cannot find device (%s)\n",
			da->name);
		ret = -ENODEV;
		goto err_devarg;
	}
	/* Since there is a matching device, it is now its responsibility
	 * to manage the devargs we've just inserted. From this point
	 * those devargs shouldn't be removed manually anymore.
	 */

	ret = dev->bus->plug(dev);
	if (ret > 0)
		ret = -ENOTSUP;

	if (ret && !rte_dev_is_probed(dev)) { /* if hasn't ever succeeded */
		RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n",
			dev->name);
		return ret;
	}

	*new_dev = dev;
	return ret;

err_devarg:
	if (rte_devargs_remove(da) != 0) {
		free(da->args);
		free(da);
	}
	return ret;
}
/* probe device at local process. */
probe device at local process.
probe device at local process .
int
local_dev_probe(const char *devargs, struct rte_device **new_dev)
{
	struct rte_device *dev;
	struct rte_devargs *da;
	int ret;
	*new_dev = NULL;
	da = calloc(1, sizeof(*da));
	if (da == NULL)
		return -ENOMEM;
	ret = rte_devargs_parse(da, devargs);
	if (ret)
		goto err_devarg;
	if (da->bus->plug == NULL) {
		RTE_LOG(ERR, EAL, "Function plug not supported by bus (%s)\n",
			da->bus->name);
		ret = -ENOTSUP;
		goto err_devarg;
	}
	ret = rte_devargs_insert(&da);
	if (ret)
		goto err_devarg;
	ret = da->bus->scan();
	if (ret)
		goto err_devarg;
	dev = da->bus->find_device(NULL, cmp_dev_name, da->name);
	if (dev == NULL) {
		RTE_LOG(ERR, EAL, "Cannot find device (%s)\n",
			da->name);
		ret = -ENODEV;
		goto err_devarg;
	}
	ret = dev->bus->plug(dev);
	if (ret > 0)
		ret = -ENOTSUP;
	if (ret && !rte_dev_is_probed(dev)) { 
		RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n",
			dev->name);
		return ret;
	}
	*new_dev = dev;
	return ret;
err_devarg:
	if (rte_devargs_remove(da) != 0) {
		free(da->args);
		free(da);
	}
	return ret;
}
int local_dev_probe ( const char * devargs , struct rte_device * * new_dev ) { struct rte_device * dev ; struct rte_devargs * da ; int ret ; * new_dev = NULL ; da = calloc ( 1 , sizeof ( * da ) ) ; if ( da == NULL ) return - ENOMEM ; ret = rte_devargs_parse ( da , devargs ) ; if ( ret ) goto err_devarg ; if ( da -> bus -> plug == NULL ) { RTE_LOG ( ERR , EAL , " \n " , da -> bus -> name ) ; ret = - ENOTSUP ; goto err_devarg ; } ret = rte_devargs_insert ( & da ) ; if ( ret ) goto err_devarg ; ret = da -> bus -> scan ( ) ; if ( ret ) goto err_devarg ; dev = da -> bus -> find_device ( NULL , cmp_dev_name , da -> name ) ; if ( dev == NULL ) { RTE_LOG ( ERR , EAL , " \n " , da -> name ) ; ret = - ENODEV ; goto err_devarg ; } ret = dev -> bus -> plug ( dev ) ; if ( ret > 0 ) ret = - ENOTSUP ; if ( ret && ! rte_dev_is_probed ( dev ) ) { RTE_LOG ( ERR , EAL , " \n " , dev -> name ) ; return ret ; } * new_dev = dev ; return ret ; err_devarg : if ( rte_devargs_remove ( da ) != 0 ) { free ( da -> args ) ; free ( da ) ; } return ret ; }
probe device at local process.
probe device at local process .
/* the rte_devargs will be referenced in the matching rte_device */ /* Since there is a matching device, it is now its responsibility
	 * to manage the devargs we've just inserted. From this point
	 * those devargs shouldn't be removed manually anymore.
	 */ /* if hasn't ever succeeded */