On Fri, 15 Feb 2019 11:17:13 +0100, Jiri Pirko wrote: > >> static int __init devlink_module_init(void) > >> { > >> return genl_register_family(&devlink_nl_family); > > > >We already have similar lookup in devlink_compat_running_version() (the > >only difference seems to be that we keep holding devlink_mutex until the > >end there) and it's likely the net_device -> devlink lookup will be > >needed in more places in the future. How about having a helper for it?
That's the last one that's on my radar, info and flashing are the big per-ASIC items. If we need more hopefully we can put the compat in the shiny new ethnl user space :) > >I also wonder how does the lookup scale. But I don't have clear idea > >how long the lists can become in real life and the ethtool operations > >are not really time critical. > > Another thing is, that you don't really have to do the lookup. If you > have struct net_device *dev inside the driver, you can get the devlink > instance according to that. So it is just a matter of another ndo I > guess. Sounds like more repetitive per driver code to get to information the core already has. We can do a rhashtable if it really ever becomes an issue (which is unlikely, how many ports are you going to have on a box.. and this is not a dump - one call one lookup).