RE: [RFC PATCH net-next 9/9] ethtool: Add ability to flash transceiver modules' firmware

From: Danielle Ratson
Date: Mon Apr 08 2024 - 08:50:51 EST




> -----Original Message-----
> From: Danielle Ratson
> Sent: Wednesday, 31 January 2024 17:53
> To: Andrew Lunn <andrew@xxxxxxx>
> Cc: netdev@xxxxxxxxxxxxxxx; davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx;
> kuba@xxxxxxxxxx; pabeni@xxxxxxxxxx; corbet@xxxxxxx;
> linux@xxxxxxxxxxxxxxx; sdf@xxxxxxxxxx; kory.maincent@xxxxxxxxxxx;
> maxime.chevallier@xxxxxxxxxxx; vladimir.oltean@xxxxxxx;
> przemyslaw.kitszel@xxxxxxxxx; ahmed.zaki@xxxxxxxxx;
> richardcochran@xxxxxxxxx; shayagr@xxxxxxxxxx;
> paul.greenwalt@xxxxxxxxx; jiri@xxxxxxxxxxx; linux-doc@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; mlxsw <mlxsw@xxxxxxxxxx>; Petr Machata
> <petrm@xxxxxxxxxx>; Ido Schimmel <idosch@xxxxxxxxxx>
> Subject: RE: [RFC PATCH net-next 9/9] ethtool: Add ability to flash transceiver
> modules' firmware
>
> > > Subject: Re: [RFC PATCH net-next 9/9] ethtool: Add ability to flash
> > > transceiver modules' firmware
> > >
> > > > +static int
> > > > +module_flash_fw_schedule(struct net_device *dev,
> > > > + struct ethtool_module_fw_flash_params *params,
> > > > + struct netlink_ext_ack *extack) {
> > > > + const struct ethtool_ops *ops = dev->ethtool_ops;
> > > > + struct ethtool_module_fw_flash *module_fw;
> > > > + int err;
> > > > +
> > > > + if (!ops->set_module_eeprom_by_page ||
> > > > + !ops->get_module_eeprom_by_page) {
> > > > + NL_SET_ERR_MSG(extack,
> > > > + "Flashing module firmware is not supported by
> > > this device");
> > > > + return -EOPNOTSUPP;
> > > > + }
> > > > +
> > > > + if (dev->module_fw_flash_in_progress) {
> > > > + NL_SET_ERR_MSG(extack, "Module firmware flashing already
> > > in progress");
> > > > + return -EBUSY;
> > > > + }
> > > > +
> > > > + module_fw = kzalloc(sizeof(*module_fw), GFP_KERNEL);
> > > > + if (!module_fw)
> > > > + return -ENOMEM;
> > > > +
> > > > + module_fw->params = *params;
> > > > + err = request_firmware(&module_fw->fw, module_fw-
> > > >params.file_name,
> > > > + &dev->dev);
> > >
> > > How big are these firmware blobs?
> > >
>
> The largest file I came across is 400K.
>
> > > Ideally we want to be able to use the same API to upgrade things
> > > like GPON modules, which often run an openwrt image, and they are
> > > plugged into a cable modem which does not have too much RAM.
> > >
> > > Given that the interface to the EEPROM is using 128 byte 1/2 pages,
> > > would it be possible to use request_partial_firmware_into_buf() to
> > > read it on demand, rather than all at once?
> > >
> > > Andrew
> >
> > OK, Ill handle that in the actual version.
> > Thanks.

Hi Andrew,

Thanks again for your feedback.
I thought again about you comment, and this patchset adds support for flashing CMIS compliant modules only.
Later on, if it will be expanded to more modules, it will be more reasonable to add support like you have suggested to fit the new supported standard.
So, currently I think it is better to not add it to this specific patchset.

Thanks,
Danielle