Subject: Re: [PATCH net-next 00/11] mlxsw: extend line card model by devices and info

From: Jiri Pirko <[email-masked]>
Date: Thu, 26 May 2022 13:45:49 +0200

Wed, May 25, 2022 at 05:50:54PM CEST, [email-masked] wrote:
>On Wed, 25 May 2022 08:20:45 +0200 Jiri Pirko wrote:
>> >We talked about this earlier in the thread, I think. If you need both
>> >info and flash per LC just make them a separate devlink instance and
>> >let them have all the objects they need. Then just put the instance
>> >name under lc info.  
>> 
>> I don't follow :/ What do you mean be "separate devlink instance" here?
>> Could you draw me an example?
>
>Separate instance:
>
>	for (i = 0; i < sw->num_lcs; i++) {
>		devlink_register(&sw->lc_dl[i]);
>		devlink_line_card_link(&sw->lc[i], &sw->lc_dl[i]);
>	}
>
>then report that under the linecard
>
>	nla_nest_start(msg, DEVLINK_SUBORDINATE_INSTANCE);
>	devlink_nl_put_handle(msg, lc->devlink);
>	nla_nest_end(msg...)
>
>then user can update the linecard like any devlink instance, switch,
>NIC etc. It's better code reuse and I don't see any downside, TBH.

Okay, I was thinking about this a litle bit more, and I would like to
explore extending the components path. Exposing the components in
"devlink dev info" and then using them in "devlink dev flash". LC could
be just one of multiple potential users of components. Will send RFC
soon.