[dpdk-dev] [PATCH 07/11] vdev: allow external registration of virtual device drivers

Thomas Monjalon thomas.monjalon at 6wind.com
Thu Apr 10 16:55:01 CEST 2014


2014-02-28 18:25, Olivier Matz:
> Instead of having a list of virtual device drivers in EAL code, add an
> API to register drivers. Thanks to this change:
> - we don't need to reference pmd_ring, pmd_pcap and pmd_xenvirt in EAL code
> - it is now possible to provide a virtual device driver as a shared
>   library.
> 
> The registration is done in an init function flaged with
> __attribute__((constructor)). The new convention is to name this
> function rte_pmd_xyz_init(). The per-device init function is renamed
> rte_pmd_xyz_devinit().
> 
> By the way the internal PMDs are now also .so/standalone ready. Let's do
> it later on. It will be required to ease maintenance.
> 
> Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>

> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -1039,10 +1039,8 @@ rte_eal_init(int argc, char **argv)
> 
>  	rte_eal_mcfg_complete();
> 
> -	if (rte_eal_vdev_init() < 0)
> -		rte_panic("Cannot init virtual devices\n");
> -
>  	TAILQ_FOREACH(solib, &solib_list, next) {
> +		RTE_LOG(INFO, EAL, "open shared lib %s\n", solib->name);
>  		solib->lib_handle = dlopen(solib->name, RTLD_NOW);
>  		if ((solib->lib_handle == NULL) && (solib->name[0] != '/')) {
>  			/* relative path: try again with "./" prefix */
> @@ -1054,6 +1052,9 @@ rte_eal_init(int argc, char **argv)
>  			RTE_LOG(WARNING, EAL, "%s\n", dlerror());
>  	}
> 
> +	if (rte_eal_vdev_init() < 0)
> +		rte_panic("Cannot init virtual devices\n");
> +
>  	RTE_LOG(DEBUG, EAL, "Master core %u is ready (tid=%x)\n",
>  		rte_config.master_lcore, (int)thread_id);
> 

Could you explain this move?
It seems allowing vdev as external library.
Maybe it should be in another commit.

> --- a/lib/librte_pmd_pcap/rte_eth_pcap.h
> +++ b/lib/librte_pmd_pcap/rte_eth_pcap.h
> @@ -45,8 +45,6 @@ extern "C" {
>  #undef PCAP_CAN_SEND
>  #endif
> 
> -#define RTE_ETH_PCAP_PARAM_NAME "eth_pcap"
> -
>  /* struct args_dict is declared in rte_eth_pcap_args_parser.h */
>  struct args_dict;
> 
> @@ -64,12 +62,6 @@ int rte_eth_from_pcaps_n_dumpers(pcap_t * const
> rx_queues[], const unsigned numa_node,
>  		struct args_dict *dict);
> 
> -/**
> - * For use by the EAL only. Called as part of EAL init to set up any dummy
> NICs - * configured on command line.
> - */
> -int rte_pmd_pcap_init(const char *name, const char *params);
> -
>  #ifdef __cplusplus
>  }
>  #endif

After having rebased on HEAD, do we still need a header file for pmd_pcap?

Thanks
-- 
Thomas


More information about the dev mailing list