[dpdk-dev] [PATCH] eal: update all buses default scan mode

Dmitry Kozlyuk dmitry.kozliuk at gmail.com
Tue Mar 23 00:32:39 CET 2021


2021-03-16 20:45 (UTC+0800), Xueming Li:
[...]
> diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
> index baa5b532af..ebbb3995f6 100644
> --- a/lib/librte_eal/common/eal_common_bus.c
> +++ b/lib/librte_eal/common/eal_common_bus.c
> @@ -277,3 +277,19 @@ rte_bus_sigbus_handler(const void *failure_addr)
>  
>  	return ret;
>  }
> +
> +static bool mode_set;

Could be function-local if we really want to save list traversals.

> +
> +void
> +rte_bus_scan_mode_update(enum rte_bus_scan_mode mode)
> +{
> +	struct rte_bus *bus;
> +
> +	if (mode_set)
> +		return;
> +	TAILQ_FOREACH(bus, &rte_bus_list, next) {
> +		if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED)
> +			bus->conf.scan_mode = mode;
> +	}
> +	mode_set = true;
> +}

[...]
>  /**
>   * Create the unix channel for primary/secondary communication.
>   *
> diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
> index 474cf123fa..2757f31461 100644
> --- a/lib/librte_eal/rte_eal_exports.def
> +++ b/lib/librte_eal/rte_eal_exports.def
> @@ -11,6 +11,7 @@ EXPORTS
>  	rte_bus_probe
>  	rte_bus_register
>  	rte_bus_scan
> +	rte_bus_scan_mode_update
>  	rte_bus_unregister
>  	rte_calloc
>  	rte_calloc_socket
> diff --git a/lib/librte_eal/version.map b/lib/librte_eal/version.map
> index fce90a112f..171bca478d 100644
> --- a/lib/librte_eal/version.map
> +++ b/lib/librte_eal/version.map
> @@ -417,6 +417,8 @@ EXPERIMENTAL {
>  INTERNAL {
>  	global:
>  
> +	rte_bus_scan_mode_update;
> +
>  	rte_mem_lock;
>  	rte_mem_map;
>  	rte_mem_page_size;

New function is private to EAL, so it doesn't need exporting.


More information about the dev mailing list