Re: [Intel-wired-lan] [PATCH iwl-next 5/10] ice: improve Add/Update VSI error messages in ice_vsi_init()

Simon Horman
2026-04-14T09:30:36Z

From: 'Simon Horman' <horms@kernel.org>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev
---
ice: improve Add/Update VSI error messages in ice_vsi_init()

The error messages emitted when Add VSI or Update VSI Admin
Queue commands fail are missing the VSI index and the last AQ
error code. Add both to match the pattern used elsewhere in
the driver for AQ-command failures, which helps narrow down
firmware issues without requiring debug logs.

> diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
> index 689c6025ea82e..0e79d66959d4f 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
> @@ -1320,14 +1320,18 @@ static int ice_vsi_init(struct ice_vsi *vsi, u32 vsi_flags)
> if (vsi_flags & ICE_VSI_FLAG_INIT) {
> ret = ice_add_vsi(hw, vsi->idx, ctxt, NULL);
> if (ret) {
> - dev_err(dev, "Add VSI failed, err %d\n", ret);
> + dev_err(dev, "Add VSI %d failed, err %d aq_err %s\n",
> + vsi->idx, ret,
> + libie_aq_str(hw->adminq.sq_last_status));

Will this print a misleading "aq_err OK" if ice_add_vsi() fails for software
reasons?

For instance, if devm_kzalloc() fails inside ice_add_vsi(), it calls
ice_aq_free_vsi() to clean up before returning -ENOMEM:

int ice_add_vsi(...)
{
...
tmp_vsi_ctx = devm_kzalloc(ice_hw_to_dev(hw), ...
if (!tmp_vsi_ctx) {
ice_aq_free_vsi(hw, vsi_ctx, false, cd);
return -ENOMEM;
}
...
}

The successful ice_aq_free_vsi() call resets hw->adminq.sq_last_status to OK.
Since the log unconditionally prints sq_last_status, it will display the
-ENOMEM error alongside "aq_err OK".

Additionally, could reading hw->adminq.sq_last_status outside the Admin Queue
lock be racy? Could a concurrent AQ command overwrite the status before it
is printed?

> ret = -EIO;
> goto out;
> }
> } else {
> ret = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
> if (ret) {
> - dev_err(dev, "Update VSI failed, err %d\n", ret);
> + dev_err(dev, "Update VSI %d failed, err %d aq_err %s\n",
> + vsi->idx, ret,
> + libie_aq_str(hw->adminq.sq_last_status));

A similar situation applies here. If ice_update_vsi() returns early due to an
invalid VSI handle, it returns -EINVAL without executing an AQ command. This
would result in printing whatever AQ status was left behind from a previous
command.

> ret = -EIO;
> goto out;
> }