[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ytfeu1QFOyP5s+UF@nanopsycho>
Date: Wed, 20 Jul 2022 12:53:47 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Ido Schimmel <idosch@...dia.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
petrm@...dia.com, pabeni@...hat.com, edumazet@...gle.com,
mlxsw@...dia.com, saeedm@...dia.com, snelson@...sando.io
Subject: Re: [patch net-next v2 10/12] mlxsw: core_linecards: Implement line
card device flashing
Wed, Jul 20, 2022 at 12:46:25PM CEST, idosch@...dia.com wrote:
>On Tue, Jul 19, 2022 at 08:48:45AM +0200, Jiri Pirko wrote:
>> From: Jiri Pirko <jiri@...dia.com>
>>
>> Implement flash_update() devlink op for the line card devlink instance
>> to allow user to update line card gearbox FW using MDDT register
>> and mlxfw.
>>
>> Example:
>> $ devlink dev flash auxiliary/mlxsw_core.lc.0 file mellanox/fw-AGB-rel-19_2010_1312-022-EVB.mfa2
>
>Need to mention that this is only possible when line card is
>active/ready
I don't see the need. This is an example. When user issues it and device
is not ready, he gets back an error. As with any other example.
>
>>
>> Signed-off-by: Jiri Pirko <jiri@...dia.com>
>
>[...]
>
>> +int mlxsw_linecard_flash_update(struct devlink *linecard_devlink,
>> + struct mlxsw_linecard *linecard,
>> + const struct firmware *firmware,
>> + struct netlink_ext_ack *extack)
>> +{
>> + struct mlxsw_core *mlxsw_core = linecard->linecards->mlxsw_core;
>> + struct mlxsw_linecard_device_fw_info info = {
>> + .mlxfw_dev = {
>> + .ops = &mlxsw_linecard_device_dev_ops,
>> + .psid = linecard->device.info.psid,
>> + .psid_size = strlen(linecard->device.info.psid),
>> + .devlink = linecard_devlink,
>> + },
>> + .mlxsw_core = mlxsw_core,
>> + .linecard = linecard,
>> + };
>> + int err;
>> +
>> + mutex_lock(&linecard->lock);
>> + if (WARN_ON(!linecard->ready)) {
>
>Can't this be easily triggered from user space when executing the above
>command for a provisioned line card? If so, please remove the WARN_ON()
>and add an extack
Yep, you are correct, this is leftover I missed to fix. Will do.
>
>> + err = -EINVAL;
>> + goto unlock;
>> + }
>> + err = mlxsw_core_fw_flash(mlxsw_core, &info.mlxfw_dev,
>> + firmware, extack);
>> +unlock:
>> + mutex_unlock(&linecard->lock);
>> + return err;
>> +}
Powered by blists - more mailing lists