Re: [PATCH net-next v4 1/3] net: devlink: let the core report the driver name instead of the drivers

Ido Schimmel
2022-11-28T11:49:38Z

On Mon, Nov 28, 2022 at 01:15:43PM +0900, Vincent Mailhol wrote:
> The driver name is available in device_driver::name. Right now,
> drivers still have to report this piece of information themselves in
> their devlink_ops::info_get callback function.
>
> In order to factorize code, make devlink_nl_info_fill() add the driver
> name attribute.
>
> nla_put() does not check if an attribute already exists and
> unconditionally reserves new space, c.f. [1]. To avoid attribute
> duplication, clean-up all the drivers which are currently reporting
> the driver name in their callback.
>
> [1] __nla_put() from lib/nlattr.c
> Link: https://elixir.bootlin.com/linux/v6.0/source/lib/nlattr.c#L993
>
> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>

For mlxsw:

Tested-by: Ido Schimmel <idosch@nvidia.com>

I don't see a difference in "devlink dev info" output before and after
the patchset. Tested with mlxsw_spectrum and mlxsw_minimal.