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) [...] > +int > +rte_eth_dev_is_owned(uint16_t port_id) > +{ > + struct rte_eth_dev_owner owner; > + int ret; > + > + ret = rte_eth_dev_owner_get(port_id, &owner); > + if (ret == 0) > + ret = (owner.id != RTE_ETH_DEV_NO_OWNER); > + return ret; > +}