On Wed, 01 Apr 2020 23:42:44 +0200
Thomas Monjalon <tho...@monjalon.net> wrote:

> 16/03/2020 17:09, Stephen Hemminger:
> > This is a simple helper function to check if device is owned
> > (being used as a sub-device).  
> 
> I would suggest not restricting ownership to sub-device case.
> 
> > It is more convienent than having
> > applications call rte_eth_dev_owner_get and check the result.  
> 
> Yes it is more convenient but I don't like adding such simple wrapper.
> 
> I propose to extend rte_eth_dev_owner_get() behaviour:
> if the owner pointer is NULL, the function returns 0 only
> if an owner (not RTE_ETH_DEV_NO_OWNER) is found.
> 
> So instead of using your wrapper:
>       if (rte_eth_dev_is_owned(port_id))
> you can use:
>       if (rte_eth_dev_owner_get(port_id, NULL) == 0)

That is not how rte_eth_dev_owner_get works now.
Passing NULL to it would crash.

And if devices is not owned rte_eth_dev_owner_get() returns 0
and owner is set to a magic value. We could change the ABI for this 
since it is marked experimental. But that seems more risky.

Reply via email to