Subject: Re: [patch net-next 0/7] devlink: sanitize per-port region creation/destruction

From: Jakub Kicinski <[email-masked]>
Date: Thu, 25 Aug 2022 15:01:32 -0700

On Thu, 25 Aug 2022 12:33:53 +0200 Jiri Pirko wrote:
> Currently the only user of per-port devlink regions is DSA. All drivers
> that use regions register them before devlink registration. For DSA,
> this was not possible as the internals of struct devlink_port needed for
> region creation are initialized during port registration.
> 
> This introduced a mismatch in creation flow of devlink and devlink port
> regions. As you can see, it causes the DSA driver to make the port
> init/exit flow a bit cumbersome.
> 
> Fix this by introducing port_init/fini() which could be optionally
> called by drivers like DSA, to prepare struct devlink_port to be used
> for region creation purposes before devlink port register is called.
> 
> Force similar limitation as for devlink params and disallow to create
> regions after devlink or devlink port are registered. That allows to
> simplify the devlink region internal API to not to rely on
> devlink->lock.

The point of exposing the devlink lock was to avoid forcing drivers 
to order object registration in a specific way. I don't like.

Please provide some solid motivation here 'cause if it's you like vs 
I like...

Also the patches don't apply.