[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221123190649.6c35b93d@kernel.org>
Date: Wed, 23 Nov 2022 19:06:49 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Vincent MAILHOL <mailhol.vincent@...adoo.fr>
Cc: Jiri Pirko <jiri@...dia.com>, netdev@...r.kernel.org,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] net: devlink: devlink_nl_info_fill: populate
default information
On Wed, 23 Nov 2022 18:42:41 +0900 Vincent MAILHOL wrote:
> I see three solutions:
>
> 1/ Do it in the core, clean up all drivers using
> devlink_info_driver_name_put() and make the function static (i.e.
> forbid the drivers to set the driver name themselves).
> N.B. This first solution does not work for
> devlink_info_serial_number_put() because the core will not always be
> able to provide a default value (e.g. my code only covers USB
> devices).
>
> 2/ Keep track of which attribute is already set (as you suggested).
>
> 3/ Do a function devlink_nl_info_fill_default() and let the drivers
> choose to either call that function or set the attributes themselves.
>
> I would tend to go with a mix of 1/ and 2/.
I think 2/ is best because it will generalize to serial numbers while
1/ will likely not. 3/ is a smaller gain.
Jiri already plumbed thru the struct devlink_info_req which is on the
stack of the caller, per request, so we can add the bool / bitmap for
already reported items there quite easily.
Powered by blists - more mailing lists