]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ice: reintroduce retry mechanism for indirect AQ
authorJakub Staniszewski <jakub.staniszewski@linux.intel.com>
Tue, 13 Jan 2026 19:38:16 +0000 (20:38 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 3 Mar 2026 21:06:04 +0000 (13:06 -0800)
Add retry mechanism for indirect Admin Queue (AQ) commands. To do so we
need to keep the command buffer.

This technically reverts commit 43a630e37e25
("ice: remove unused buffer copy code in ice_sq_send_cmd_retry()"),
but combines it with a fix in the logic by using a kmemdup() call,
making it more robust and less likely to break in the future due to
programmer error.

Cc: Michal Schmidt <mschmidt@redhat.com>
Cc: stable@vger.kernel.org
Fixes: 3056df93f7a8 ("ice: Re-send some AQ commands, as result of EBUSY AQ error")
Signed-off-by: Jakub Staniszewski <jakub.staniszewski@linux.intel.com>
Co-developed-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_common.c

index 74fe74225277f7a02e6ca7d688ea93e9cfc2e9c9..fd32c318d3f50432735f6e487bff8fe17dea28a1 100644 (file)
@@ -1841,6 +1841,7 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 {
        struct libie_aq_desc desc_cpy;
        bool is_cmd_for_retry;
+       u8 *buf_cpy = NULL;
        u8 idx = 0;
        u16 opcode;
        int status;
@@ -1850,8 +1851,11 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
        memset(&desc_cpy, 0, sizeof(desc_cpy));
 
        if (is_cmd_for_retry) {
-               /* All retryable cmds are direct, without buf. */
-               WARN_ON(buf);
+               if (buf) {
+                       buf_cpy = kmemdup(buf, buf_size, GFP_KERNEL);
+                       if (!buf_cpy)
+                               return -ENOMEM;
+               }
 
                memcpy(&desc_cpy, desc, sizeof(desc_cpy));
        }
@@ -1863,12 +1867,14 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
                    hw->adminq.sq_last_status != LIBIE_AQ_RC_EBUSY)
                        break;
 
+               if (buf_cpy)
+                       memcpy(buf, buf_cpy, buf_size);
                memcpy(desc, &desc_cpy, sizeof(desc_cpy));
-
                msleep(ICE_SQ_SEND_DELAY_TIME_MS);
 
        } while (++idx < ICE_SQ_SEND_MAX_EXECUTE);
 
+       kfree(buf_cpy);
        return status;
 }