02/04/2020 00:24, Stephen Hemminger: > 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.
Indeed this is why I am proposing to extend it and fill this case. > 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. This is not an ABI change. Just manage a case which was crashing previously.