Re: [PATCH net-next V3 5/5] net/mlx5: nodnic: Add health monitoring

From: netdev-bot+sashiko

Date: Fri Nov 27 2026 - 14:04:00 EST


Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 2

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] When mlx5_nodnic_poll_health()
(drivers/net/ethernet/mellanox/mlx5/nodnic/health.c) detects a fatal…
- [Low] The commit message does not spell out several behaviours.
- [Low] mlx5_nodnic_printk() in
drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic.h is a variadic…

--

net/mlx5: nodnic: Add health monitoring

This commit adds a timer-based health poller to the mlx5 nodnic driver.
The poller reads the health buffer in the initialization segment and
detects fatal PCI/FW conditions, health counter stalls and syndrome
changes. It logs them with a severity and moves the device to
INTERNAL_ERROR on fatal conditions. Polling starts in probe and stops in
remove.

> Detect fatal device conditions, firmware health counter stalls, and
> syndrome changes. Report health errors together with their severity
> and mark the device as unhealthy on fatal conditions.

[Severity: Low]
Could the commit message say more about what "mark the device as
unhealthy" means in practice?

After the first fatal event, mlx5_nodnic_poll_health() returns without
calling mod_timer(), so health polling stops for good.

The INTERNAL_ERROR state is never cleared. From then on,
mlx5_nodnic_open_locked() returns -EIO for the rest of the driver's
lifetime.

The patch also adds a new severity-aware logging helper,
mlx5_nodnic_printk() / mlx5_nodnic_log(), to nodnic.h, and the message
doesn't mention it.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/nodnic/health.c b/drivers/net/ethernet/mellanox/mlx5/nodnic/health.c
> new file mode 100644
> index 0000000000000..a2038eea9717f
> --- /dev/null
> +++ b/drivers/net/ethernet/mellanox/mlx5/nodnic/health.c
> @@ -0,0 +1,303 @@

[ ... ]

> +static void mlx5_nodnic_poll_health(struct timer_list *t)
> +{
> + struct mlx5_nodnic_priv *priv = timer_container_of(priv, t,
> + health.timer);
> + struct mlx5_nodnic_core_dev *dev = priv->core_dev;
> + struct mlx5_nodnic_health *health = &priv->health;
> + struct health_buffer __iomem *h = health->health;
> + u32 fatal_error, count;
> + u8 prev_synd;
> +
> + if (READ_ONCE(dev->state) == NODNIC_DEVICE_STATE_INTERNAL_ERROR)
> + return;
> +
> + fatal_error = mlx5_nodnic_health_check_fatal_sensors(dev);
> +
> + if (fatal_error && !health->fatal_error) {
> + mlx5_nodnic_core_err(dev, "fatal error detected: %s (%u)\n",
> + mlx5_nodnic_fatal_error_str(fatal_error),
> + fatal_error);
> + priv->health.fatal_error = fatal_error;
> + WRITE_ONCE(dev->state, NODNIC_DEVICE_STATE_INTERNAL_ERROR);
> + if (fatal_error != MLX5_NODNIC_SENSOR_PCI_COMM_ERR &&
> + fatal_error != MLX5_NODNIC_SENSOR_PCI_ERR)
> + mlx5_nodnic_print_health_info(dev);
> + return;
> + }

[Severity: Medium]
When a fatal sensor fires, this branch sets dev->state to INTERNAL_ERROR
and returns. Is anything else supposed to happen to an interface that is
already open?

As far as I can see, the only reader of the new state is the check added
to mlx5_nodnic_open_locked(). Carrier stays on, the TX queue is not
stopped and the netdev is not detached.

mlx5_nodnic_xmit() never looks at dev->state, so it keeps building WQEs,
updating the DBR and ringing the UAR doorbell of a device that has just
been declared dead:

drivers/net/ethernet/mellanox/mlx5/nodnic/tx.c:mlx5_nodnic_xmit() {
...
mlx5_write64((__be32 *)ctrl, uar_base + MLX5_BF_OFFSET);
...
}

The close and remove paths also ignore the state:

mlx5_nodnic_close_locked()
-> deactivate/close queue VSC commands

mlx5_nodnic_remove_one()->mlx5_nodnic_dev_cleanup()
-> mlx5_nodnic_write_nic_interface(dev, DISABLED)
-> mlx5_nodnic_wait_fw_init(dev, "teardown")

With all-ones reads, the VSC gateway lock gives up with -EBUSY after
VSC_MAX_RETRIES sleeps, so each access is bounded to a few seconds.

What if config space still works but FW keeps the initializing bit set,
for example during SW_RESET or RFR? Could the teardown wait then run up to
MLX5_NODNIC_FW_INIT_TIMEOUT_MS?

Because the state is never cleared, a down/up cycle then fails in
mlx5_nodnic_open_locked() with -EIO, and only unbind/rebind recovers the
interface.

Should the fatal path drop carrier and stop or detach the netdev? Should
xmit, close and remove also skip device access once the state is
INTERNAL_ERROR?

[ ... ]

> diff --git a/drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic.h b/drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic.h
> index c44b0fdbe601b..6f8677bf1aaef 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic.h
> +++ b/drivers/net/ethernet/mellanox/mlx5/nodnic/nodnic.h
> @@ -78,6 +78,31 @@ struct mlx5_nodnic_core_dev {
> enum mlx5_nodnic_device_state state;
> };
>
> +static inline void mlx5_nodnic_printk(struct mlx5_nodnic_core_dev *dev,
> + int level, const char *format, ...)

[Severity: Low]
This isn't a bug, but could mlx5_nodnic_printk() be annotated with
__printf(3, 4)? Without it, -Wformat can't check the format strings
passed through mlx5_nodnic_log().

All current callers in mlx5_nodnic_print_health_info() use matching
formats and arguments. mlx5_printk() in mlx5/core/mlx5_core.h is declared
the same way without __printf, so this follows the existing pattern.

> +{
> + struct device *device = dev->device;
> + struct va_format vaf;
> + va_list args;

[ ... ]

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126182448.707782-1-tariqt%40nvidia.com