src/dpdk/lib/librte_eal/common/eal_common_devargs.c
int
rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
{
	struct rte_devargs *devargs = NULL;
	struct rte_bus *bus = NULL;
	const char *dev = devargs_str;

	/* use calloc instead of rte_zmalloc as it's called early at init */
	devargs = calloc(1, sizeof(*devargs));
	if (devargs == NULL)
		goto fail;

	if (rte_devargs_parse(devargs, dev))
		goto fail;
	devargs->type = devtype;
	bus = devargs->bus;
	if (devargs->type == RTE_DEVTYPE_BLOCKED)
		devargs->policy = RTE_DEV_BLOCKED;
	if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
		if (devargs->policy == RTE_DEV_ALLOWED)
			bus->conf.scan_mode = RTE_BUS_SCAN_ALLOWLIST;
		else if (devargs->policy == RTE_DEV_BLOCKED)
			bus->conf.scan_mode = RTE_BUS_SCAN_BLOCKLIST;
	}
	TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
	return 0;

fail:
	if (devargs) {
		free(devargs->args);
		free(devargs);
	}

	return -1;
}
/* store in allowed list parameter for later parsing */
store in allowed list parameter for later parsing
store in allowed list parameter for later parsing
int
rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
{
	struct rte_devargs *devargs = NULL;
	struct rte_bus *bus = NULL;
	const char *dev = devargs_str;
	devargs = calloc(1, sizeof(*devargs));
	if (devargs == NULL)
		goto fail;
	if (rte_devargs_parse(devargs, dev))
		goto fail;
	devargs->type = devtype;
	bus = devargs->bus;
	if (devargs->type == RTE_DEVTYPE_BLOCKED)
		devargs->policy = RTE_DEV_BLOCKED;
	if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
		if (devargs->policy == RTE_DEV_ALLOWED)
			bus->conf.scan_mode = RTE_BUS_SCAN_ALLOWLIST;
		else if (devargs->policy == RTE_DEV_BLOCKED)
			bus->conf.scan_mode = RTE_BUS_SCAN_BLOCKLIST;
	}
	TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
	return 0;
fail:
	if (devargs) {
		free(devargs->args);
		free(devargs);
	}
	return -1;
}
int rte_devargs_add ( enum rte_devtype devtype , const char * devargs_str ) { struct rte_devargs * devargs = NULL ; struct rte_bus * bus = NULL ; const char * dev = devargs_str ; devargs = calloc ( 1 , sizeof ( * devargs ) ) ; if ( devargs == NULL ) goto fail ; if ( rte_devargs_parse ( devargs , dev ) ) goto fail ; devargs -> type = devtype ; bus = devargs -> bus ; if ( devargs -> type == RTE_DEVTYPE_BLOCKED ) devargs -> policy = RTE_DEV_BLOCKED ; if ( bus -> conf . scan_mode == RTE_BUS_SCAN_UNDEFINED ) { if ( devargs -> policy == RTE_DEV_ALLOWED ) bus -> conf . scan_mode = RTE_BUS_SCAN_ALLOWLIST ; else if ( devargs -> policy == RTE_DEV_BLOCKED ) bus -> conf . scan_mode = RTE_BUS_SCAN_BLOCKLIST ; } TAILQ_INSERT_TAIL ( & devargs_list , devargs , next ) ; return 0 ; fail : if ( devargs ) { free ( devargs -> args ) ; free ( devargs ) ; } return -1 ; }
store in allowed list parameter for later parsing
store in allowed list parameter for later parsing
/* use calloc instead of rte_zmalloc as it's called early at init */