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

From: Jakub Kicinski <[email-masked]>
Date: Wed, 25 May 2022 08:50:54 -0700

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.