Re: [PATCH net-next v2 3/3] ionic: add devlink param for command timeout

From: Rao, Nikhil

Date: Wed Nov 18 2026 - 18:56:51 EST




On 11/10/2026 4:14 AM, netdev-bot+sashiko@xxxxxxxxxx wrote:
+static int ionic_dl_cmd_timeout_get(struct devlink *dl, u32 id,
+ struct devlink_param_gset_ctx *ctx,
+ struct netlink_ext_ack *extack)
+{
+ struct ionic *ionic = devlink_priv(dl);
+
+ /* devlink fills PARAM_DEL with this on PCI reset; no FW_RESET check */
+ return ionic_dev_getattr_cmd_timeout(ionic, &ctx->val.vu8);

[Severity: Medium]
Is the comment above accurate for every caller that reaches this getter
through PARAM_DEL?

When a devlink monitor is listening, the unregister path calls this getter
to fill the notification:

ionic_lif_handle_fw_down()
ionic_devlink_params_unregister()
devl_params_unregister()
devlink_param_unregister()
devlink_param_notify(DEVLINK_CMD_PARAM_DEL)
devlink_nl_param_fill()
devlink_param_get()
ionic_dl_cmd_timeout_get()
ionic_dev_getattr_cmd_timeout()

On the watchdog path, ionic_lif_handle_fw_down() only runs after fw_status
has lost IONIC_FW_STS_F_RUNNING. ionic_reset_prepare() is also reached from
ionic_pci_error_detected() for io_frozen, where MMIO reads return 0xff. In
both cases the firmware cannot answer the GETATTR.

__ionic_dev_cmd_wait() then prints the warning and returns -ENXIO. do_msg
does not gate this warning, so the _nomsg variant still prints it:

if (!done && !fw_up) {
ionic_dev_cmd_clean(ionic);
dev_warn(ionic->dev, "DEVCMD %s (%d) interrupted - FW is down\n",
ionic_opcode_to_str(opcode), opcode);
return -ENXIO;
}

devlink_param_notify() drops the message on that error:

err = devlink_nl_param_fill(msg, devlink, port_index, param_item, cmd,
0, 0, 0, NULL);
if (err) {
nlmsg_free(msg);
return;
}

So no PARAM_DEL is sent, but ionic_restart_lif() sends PARAM_NEW again on
FW-up. Monitors would see two PARAM_NEW events with no PARAM_DEL between
them, and a spurious warning is logged on every FW-down.

There is also the case where FW-down starts while fw_status still reads
running (a generation change, or IONIC_EVENT_RESET) and the restarted
firmware does not complete the command. Could the getter then block the
deferred FW-down work for up to ionic->cmd_timeout? This patch raises that
limit to as much as 255 seconds.

Fixed in v3: the parameter is registered once at probe and no longer
unregistered on FW-down or PCI reset, so no PARAM_DEL is sent on reset,
and get no longer sends a device command

[Severity: Medium]
Can an unprivileged user use this getter to tie up the device command
mailbox?

Fixed in v3: get returns the value read at the last probe or reset,
or stored by a later set, without a device command.

[ ... ]

+void ionic_devlink_params_unregister(struct ionic *ionic)
+{
+ struct devlink *dl = priv_to_devlink(ionic);
+
+ devl_lock(dl);
+ if (ionic->dl_params_registered) {
+ devl_params_unregister(dl, ionic_dl_params,
+ ARRAY_SIZE(ionic_dl_params));
+ ionic->dl_params_registered = false;
+ }
+ devl_unlock(dl);
+}

[Severity: Low]
This adds devl_lock to two paths that did not take it before:

Fixed in v3: the reset paths no longer register or unregister the
parameter
[ ... ]

[Severity: Low]

The new documentation only says:

The value is stored in device NVM and takes effect on the next driver
probe or device reset. Only available when the device firmware supports
it.

The design may be reasonable, since the capability can change after a
firmware update. Should the commit message and ionic.rst say that the
parameter is absent while a reset is in progress, and stays absent if
recovery fails?

In v3, the parameter is registered once at probe and not unregistered on reset, so a reset, including one whose recovery fails,
does not remove it. While a reset is in progress or after it failed,
set returns -EBUSY and get reports the last value read.

Nikhil