Re: [PATCH v2] ice: Fix wrong dsn read in ice_adapter_put
From: Simon Horman
Date: Wed May 20 2026 - 15:55:21 EST
On Mon, May 18, 2026 at 05:36:17PM +0300, Cyrill Gorcunov wrote:
> On Mon, May 18, 2026 at 01:02:32PM +0300, Cyrill Gorcunov wrote:
> ...
> >
> > Thinking more I think I got what sashiko meant here: the pullout of the
> > adapter when it been in recovery mode already, and reading register state
> > is obviously incorrect here too, instead we have to save the state upon
> > probing in some flag and use it later. I'll update the patch.
>
> Here is an updated. Actually even in recovery mode the ice_deinit_devlink()
> may call for rd32() with undefined result as
>
> | ice_health_deinit
> | ice_config_health_events
> | ice_sq_send_cmd_retry
> | ice_sq_send_cmd
>
> unless I miss something obvious... (i don't address this in the patch).
> Please take a look once time permits.
>
> ---
> From: Cyrill Gorcunov <gorcunov@xxxxxxxxx>
> Subject: [PATCH v3] ice: Fix wrong dsn read in ice_adapter_put
>
> When registering an adapter instance, we read the PCI configuration
> space to fetch the DSN and generate an adapter index for lookups.
>
> However, if the adapter has been physically unplugged, the PCI space
> is no longer accessible. Reading it returns a zero value, which results
> in either an incorrect adapter instance being put or the proper instance
> not being put at all. To fix this, we will use the previously known
> index instead.
>
> Similar applies to recovery mode detection -- if card has been in
> recovery mode and physically removed we're not allowed to read its
> state from hardware registers but rather provide state flag for
> this.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxx>
Thanks Cyrill,
I agree that this is a good approach.
I might suggest splitting the patch in two:s
1. introduce and use ICE_FW_RECOVERY_MODE
2. Address dns nread in ice_adapter_put