diff mbox series

[net] pds_core: Fix FW recovery detection

Message ID 20230605195116.49653-1-brett.creeley@amd.com (mailing list archive)
State Accepted
Commit 4f48c30312b7af5365878ab191bb41e7b899e09b
Delegated to: Netdev Maintainers
Headers show
Series [net] pds_core: Fix FW recovery detection | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Brett Creeley June 5, 2023, 7:51 p.m. UTC
Commit 523847df1b37 ("pds_core: add devcmd device interfaces") included
initial support for FW recovery detection. Unfortunately, the ordering
in pdsc_is_fw_good() was incorrect, which was causing FW recovery to be
undetected by the driver. Fix this by making sure to update the cached
fw_status by calling pdsc_is_fw_running() before setting the local FW
gen.

Fixes: 523847df1b37 ("pds_core: add devcmd device interfaces")
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Brett Creeley <brett.creeley@amd.com>
---
 drivers/net/ethernet/amd/pds_core/dev.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Simon Horman June 6, 2023, 9:58 a.m. UTC | #1
On Mon, Jun 05, 2023 at 12:51:16PM -0700, Brett Creeley wrote:
> Commit 523847df1b37 ("pds_core: add devcmd device interfaces") included
> initial support for FW recovery detection. Unfortunately, the ordering
> in pdsc_is_fw_good() was incorrect, which was causing FW recovery to be
> undetected by the driver. Fix this by making sure to update the cached
> fw_status by calling pdsc_is_fw_running() before setting the local FW
> gen.
> 
> Fixes: 523847df1b37 ("pds_core: add devcmd device interfaces")
> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
> Signed-off-by: Brett Creeley <brett.creeley@amd.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>
patchwork-bot+netdevbpf@kernel.org June 7, 2023, 4:20 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 5 Jun 2023 12:51:16 -0700 you wrote:
> Commit 523847df1b37 ("pds_core: add devcmd device interfaces") included
> initial support for FW recovery detection. Unfortunately, the ordering
> in pdsc_is_fw_good() was incorrect, which was causing FW recovery to be
> undetected by the driver. Fix this by making sure to update the cached
> fw_status by calling pdsc_is_fw_running() before setting the local FW
> gen.
> 
> [...]

Here is the summary with links:
  - [net] pds_core: Fix FW recovery detection
    https://git.kernel.org/netdev/net/c/4f48c30312b7

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/amd/pds_core/dev.c b/drivers/net/ethernet/amd/pds_core/dev.c
index f7c597ea5daf..debe5216fe29 100644
--- a/drivers/net/ethernet/amd/pds_core/dev.c
+++ b/drivers/net/ethernet/amd/pds_core/dev.c
@@ -68,9 +68,15 @@  bool pdsc_is_fw_running(struct pdsc *pdsc)
 
 bool pdsc_is_fw_good(struct pdsc *pdsc)
 {
-	u8 gen = pdsc->fw_status & PDS_CORE_FW_STS_F_GENERATION;
+	bool fw_running = pdsc_is_fw_running(pdsc);
+	u8 gen;
 
-	return pdsc_is_fw_running(pdsc) && gen == pdsc->fw_generation;
+	/* Make sure to update the cached fw_status by calling
+	 * pdsc_is_fw_running() before getting the generation
+	 */
+	gen = pdsc->fw_status & PDS_CORE_FW_STS_F_GENERATION;
+
+	return fw_running && gen == pdsc->fw_generation;
 }
 
 static u8 pdsc_devcmd_status(struct pdsc *pdsc)