[dpdk-dev] [RFC] lib/ethdev: add dev configured flag

Thomas Monjalon thomas at monjalon.net
Mon Jul 5 08:07:48 CEST 2021


05/07/2021 05:18, Huisong Li:
> 在 2021/7/5 4:05, Thomas Monjalon 写道:
> > 08/05/2021 10:00, Huisong Li:
> >> Currently, if dev_configure is not invoked or fails to be invoked, users
> >> can still invoke dev_start successfully. This patch adds a "dev_configured"
> >> flag in "rte_eth_dev_data" to control whether dev_start can be invoked.
> > [...]
> >> --- a/lib/ethdev/rte_ethdev_core.h
> >> +++ b/lib/ethdev/rte_ethdev_core.h
> >> @@ -167,7 +167,11 @@ struct rte_eth_dev_data {
> >>   		scattered_rx : 1,  /**< RX of scattered packets is ON(1) / OFF(0) */
> >>   		all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
> >>   		dev_started : 1,   /**< Device state: STARTED(1) / STOPPED(0). */
> >> -		lro         : 1;   /**< RX LRO is ON(1) / OFF(0) */
> >> +		lro         : 1,  /**< RX LRO is ON(1) / OFF(0) */
> >> +		dev_configured : 1;
> >> +		/**< Device configuration state:
> >> +		 * CONFIGURED(1) / NOT CONFIGURED(0).
> >> +		 */
> > Why not using "enum rte_eth_dev_state"?
> > Because rte_eth_dev.state is not shared between processes?
> 
> It doesn't feel right. "enum rte_eth_dev_state" is private to the 
> primary and secondary processes and can be independently controlled.
> 
> However, the secondary process does not make resource allocations and 
> does not call dev_configure().
> 
> These are done by the primary process and  can be obtained or used by 
> the secondary process.
> 
> Like "dev_started" in struct rte_eth_dev_data.

That's a good reason, thanks.




More information about the dev mailing list