]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ionic: Prevent driver/fw getting out of sync on devcmd(s)
authorBrett Creeley <brett.creeley@amd.com>
Mon, 9 Jun 2025 21:28:27 +0000 (14:28 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 13 Jun 2025 01:09:51 +0000 (18:09 -0700)
Some stress/negative firmware testing around devcmd(s) returning
EAGAIN found that the done bit could get out of sync in the
firmware when it wasn't cleared in a retry case.

While here, change the type of the local done variable to a bool
to match the return type from ionic_dev_cmd_done().

Fixes: ec8ee714736e ("ionic: stretch heartbeat detection")
Signed-off-by: Brett Creeley <brett.creeley@amd.com>
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250609212827.53842-1-shannon.nelson@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/pensando/ionic/ionic_main.c

index daf1e82cb76b34e5cc4ba40816f9072a9e5ff3fd..0e60a6bef99a3e79bf4351a3e58a187d95cb2893 100644 (file)
@@ -516,9 +516,9 @@ static int __ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds,
        unsigned long start_time;
        unsigned long max_wait;
        unsigned long duration;
-       int done = 0;
        bool fw_up;
        int opcode;
+       bool done;
        int err;
 
        /* Wait for dev cmd to complete, retrying if we get EAGAIN,
@@ -526,6 +526,7 @@ static int __ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds,
         */
        max_wait = jiffies + (max_seconds * HZ);
 try_again:
+       done = false;
        opcode = idev->opcode;
        start_time = jiffies;
        for (fw_up = ionic_is_fw_running(idev);