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

From: Jiri Pirko <[email-masked]>
Date: Fri, 27 May 2022 09:27:47 +0200

Thu, May 26, 2022 at 07:35:39PM CEST, [email-masked] wrote:
>On Thu, 26 May 2022 13:45:49 +0200 Jiri Pirko wrote:
>> >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.
>
>Feel free to send a mockup of the devlink user space outputs.
>The core code for devlink is just meaningless marshaling anyway.

Okay. So the output of devlink dev info would be extended by
"components" nest. This nest would carry array of components which
contain versions. The name of the component is openin each array member
nest:

$ devlink dev info
pci/0000:01:00.0:
  driver mlxsw_spectrum2
  versions:
      fixed:
        hw.revision A0
        fw.psid MT_0000000199
      running:
        fw.version 29.2010.2302
        fw 29.2010.2302
  components:
    lc1:
      versions:
        fixed:
          hw.revision 0
          fw.psid MT_0000000111
        running:
          fw 19.2010.1310
          ini.version 4
    lc2:
      versions:
        fixed:
          hw.revision 0
          fw.psid MT_0000000111
        running:
          fw 19.2010.1310
          ini.version 4
    someothercomponentname:
      versions:
        running:
	   fw: 888

Now on top of exsisting "devlink dev flash" cmd without component, user
may specify the component name from the array above:

$ devlink dev flash pci/0000:01:00.0 component lc1 file mellanox/fw-AGB-rel-19_2010_1312-022-EVB.mfa2

$ devlink dev flash pci/0000:01:00.0 component someothercomponentname file foo.bin

Note this is generic vehicle, line cards would benefit but it is usable
for multiple ASIC FW partitions for example.

Note that on "devlink dev flash" there is no change. This is implemented
currently. Only "devlink dev info" is extended to show the component
list.