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

Jiri Pirko
2022-08-26T08:21:33Z

Fri, Aug 26, 2022 at 12:01:32AM CEST, kuba@kernel.org wrote:
>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.

Well for params, we are also forcing them in a specific way. The
regions, with the DSA exception which is not voluntary, don't need to be
created/destroyed during devlink/port being registered.

I try to bring some order to the a bit messy devlink world. The
intention is to make everyone's live happier :)

>
>Please provide some solid motivation here 'cause if it's you like vs
>I like...
>
>Also the patches don't apply.