ice: fix AQ command 0x06EE usage by retrying
Subsystems (4)
cover ice: fix AQ command 0x06EE usage by retrying
The Admin Queue (AQ) command 0x06EE can return EBUSY when firmware link management holds the i2c bus used to communicate with the module.
According to Intel(R) Ethernet Controller E810 Datasheet Rev 2.8 [1] Section 3.3.10.4 Read/Write SFF EEPROM (0x06EE)
request should be retried upon receiving EBUSY from firmware.
Instead of relying on the caller of ice_aq_sff_eeprom() to implement retrying, use the existing retry infrastructure in ice_sq_send_cmd_retry() to always attempt retry on receiving EBUSY.
Reproduction steps
------------------
# ethtool -m <interface_name> netlink error: Input/output error
Jakub Staniszewski (2):
ice: reintroduce retry mechanism for indirect AQ
ice: fix retry for AQ command 0x06EE
drivers/net/ethernet/intel/ice/ice_common.c | 13 ++++++-- drivers/net/ethernet/intel/ice/ice_ethtool.c | 35 ++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-)
base-commit: 855e576f30278714c7ca067005f46807aca2e6d4
Signature · 1 line
2.51.0
PATCH 1/2 ice: reintroduce retry mechanism for indirect AQ
From: Jakub Staniszewski <[email protected]>
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.
---
Ccing Michal, given they are the author of the "reverted" commit.
drivers/net/ethernet/intel/ice/ice_common.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +9 -3
@@ -1879,34 +1879,40 @@ 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; opcode =le16_to_cpu (desc->opcode); is_cmd_for_retry =ice_should_retry_sq_send_cmd (opcode);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)); }do { status =ice_sq_send_cmd (hw, cq, desc, buf, buf_size, cd);if (!is_cmd_for_retry || !status || 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; }
Signature · 1 line
2.51.0
Re: [Intel-wired-lan] [PATCH iwl-net 1/2] ice: reintroduce retry mechanism for indirect AQ
[Cc: +Michal]
Dear Dawid, dear Jakub,
Am 13.01.26 um 20:38 schrieb Dawid Osuchowski:
Quoted 19 lines
From: Jakub Staniszewski <[email protected]>
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 inice_sq_send_cmd_retry()"), but combines it with a fix in the logic by using akmemdup()call, making it more robust and less likely to break in the future due to programmer error.Cc Michal Schmidt <[email protected]>Fixes 3056df93f7a8 ("ice: Re-send some AQ commands, as result of EBUSY AQ error")Signed-off-by Jakub Staniszewski <[email protected]>Co-developed-by Dawid Osuchowski <[email protected]>Signed-off-by Dawid Osuchowski <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>
Quoted 2 lines
---
Ccing Michal, given they are the author of the "reverted" commit.
At least Michal was not in the (visible) Cc: list
Quoted 33 lines
drivers/net/ethernet/intel/ice/ice_common.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)drivers/net/ethernet/intel/ice/ice_common.c +6
-2@@ -1879,34 +1879,40 @@ 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; opcode =le16_to_cpu (desc->opcode); is_cmd_for_retry =ice_should_retry_sq_send_cmd (opcode);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)); } do {
drivers/net/ethernet/intel/ice/ice_common.c ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq, · line 1905
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_common.c +2
-1status =ice_sq_send_cmd (hw, cq, desc, buf, buf_size, cd);if (!is_cmd_for_retry || !status || 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)); -
Unrelated change?
drivers/net/ethernet/intel/ice/ice_common.c ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq, · line 1917
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_common.c +1
-0msleep (ICE_SQ_SEND_DELAY_TIME_MS ); }while (++idx <ICE_SQ_SEND_MAX_EXECUTE ); +kfree (buf_cpy);return status; }
The diff looks good otherwise.
Kind regards,
Paul
Re: [Intel-wired-lan] [PATCH iwl-net 1/2] ice: reintroduce retry mechanism for indirect AQ
Hey Paul,
Quoted 4 lines · Paul Menzel
[Cc: +Michal]
Dear Dawid, dear Jakub,
...
Quoted 4 lines
Am 13.01.26 um 20:38 schrieb Dawid Osuchowski:
Quoted 1 line
Ccing Michal, given they are the author of the "reverted" commit.
At least Michal was not in the (visible) Cc: list
Interesting. I was using 'git send-email' without any suppression of Cc or similar options. In the direct email sent from me Michal is in Cc, seems the mailing list for some reason stripped him...
Quoted 3 lines
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_common.c| 12 +++++++++---1 file changed, 9 insertions(+), 3 deletions(-)
...
Quoted 10 lines
Quoted 9 lines
do {
status =ice_sq_send_cmd(hw, cq, desc, buf, buf_size, cd); if (!is_cmd_for_retry || !status ||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));
-
Quoted 2 lines
Unrelated change?
During internal review it was pointed out that this function contains a lot of empty lines, this was my feeble attempt to at least partially reduce their count.
Quoted 6 lines
Quoted 5 lines
msleep(ICE_SQ_SEND_DELAY_TIME_MS);
} while (++idx <ICE_SQ_SEND_MAX_EXECUTE);
+kfree(buf_cpy);
return status;
}
Quoted 8 lines
The diff looks good otherwise.
Reviewed-by Paul Menzel <[email protected]>Kind regards,
Paul
Thanks,
Dawid
RE: [Intel-wired-lan] [PATCH iwl-net 1/2] ice: reintroduce retry mechanism for indirect AQ
In reply to Dawid OsuchowskiQuoted 22 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Dawid Osuchowski
Sent: 14 January 2026 01:08
To: [email protected]
Cc: [email protected]; [email protected]; Loktionov, Aleksandr <[email protected]>; Jakub Staniszewski <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Dawid Osuchowski <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-net 1/2] ice: reintroduce retry mechanism for indirect AQFrom: Jakub Staniszewski <[email protected]>
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 inice_sq_send_cmd_retry()"), but combines it with a fix in the logic by using akmemdup()call, making it more robust and less likely to break in the future due to programmer error.Cc Michal Schmidt <[email protected]>Fixes 3056df93f7a8 ("ice: Re-send some AQ commands, as result of EBUSY AQ error")Signed-off-by Jakub Staniszewski <[email protected]>Co-developed-by Dawid Osuchowski <[email protected]>Signed-off-by Dawid Osuchowski <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>
Quoted 6 lines
---
Ccing Michal, given they are the author of the "reverted" commit.
drivers/net/ethernet/intel/ice/ice_common.c| 12 +++++++++---1 file changed, 9 insertions(+), 3 deletions(-)
PATCH 2/2 ice: fix retry for AQ command 0x06EE
In reply to Dawid OsuchowskiFrom: Jakub Staniszewski <[email protected]>
Executing ethtool -m can fail reporting a netlink I/O error while firmware link management holds the i2c bus used to communicate with the module.
According to Intel(R) Ethernet Controller E810 Datasheet Rev 2.8 [1] Section 3.3.10.4 Read/Write SFF EEPROM (0x06EE)
request should to be retried upon receiving EBUSY from firmware.
Commit e9c9692c8a81 ("ice: Reimplement module reads used by ethtool") implemented it only for part of ice_get_module_eeprom(), leaving all other calls to ice_aq_sff_eeprom() vulnerable to returning early on getting EBUSY without retrying.
Remove the retry loop from ice_get_module_eeprom() and add Admin Queue (AQ) command with opcode 0x06EE to the list of commands that should be retried on receiving EBUSY from firmware.
--- drivers/net/ethernet/intel/ice/ice_common.c | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 35 ++++++++------------ 2 files changed, 15 insertions(+), 21 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +1 -0
@@ -1854,6 +1854,7 @@ static bool ice_should_retry_sq_send_cmd(u16 opcode)case ice_aqc_opc_lldp_stop:case ice_aqc_opc_lldp_start:case ice_aqc_opc_lldp_filter_ctrl: +case ice_aqc_opc_sff_eeprom:return true; }
drivers/net/ethernet/intel/ice/ice_ethtool.c +14 -21
@@ -4496,7 +4496,7 @@ ice_get_module_eeprom(struct net_device *netdev,u8 addr =ICE_I2C_EEPROM_DEV_ADDR ;struct ice_hw *hw = &pf->hw;bool is_sfp = false; -unsigned int i, j; +unsigned int i;u16 offset =0 ;u8 page =0 ;int status;
@@ -4538,26 +4538,19 @@ ice_get_module_eeprom(struct net_device *netdev,if (page ==0 || !(data[0x2 ] &0x4 )) {u32 copy_len; -/* If i2c bus is busy due to slow page change or -* link management access, call can fail. This is normal. -* So we retry this a few times. -*/ -for (j =0 ; j <4 ; j++) { - status =ice_aq_sff_eeprom (hw,0 , addr, offset, page, - !is_sfp, value, -SFF_READ_BLOCK_SIZE , -0 ,NULL ); -netdev_dbg (netdev,"SFF %02X %02X %02X %X = %02X%02X%02X%02X.%02X%02X%02X%02X (%X)\n" , - addr, offset, page, is_sfp, - value[0 ], value[1 ], value[2 ], value[3 ], - value[4 ], value[5 ], value[6 ], value[7 ], - status); -if (status) { -usleep_range (1500 ,2500 ); -memset (value,0 ,SFF_READ_BLOCK_SIZE ); -continue ; - } -break ; + status =ice_aq_sff_eeprom (hw,0 , addr, offset, page, + !is_sfp, value, +SFF_READ_BLOCK_SIZE , +0 ,NULL ); +netdev_dbg (netdev,"SFF %02X %02X %02X %X = %02X%02X%02X%02X.%02X%02X%02X%02X (%pe)\n" , + addr, offset, page, is_sfp, + value[0 ], value[1 ], value[2 ], value[3 ], + value[4 ], value[5 ], value[6 ], value[7 ], +ERR_PTR (status)); +if (status) { +netdev_err (netdev,"%s: error reading module EEPROM: status %pe\n" , + __func__,ERR_PTR (status)); +return status; }/* Make sure we have enough room for the new block */
Signature · 1 line
2.51.0
Re: [Intel-wired-lan] [PATCH iwl-net 2/2] ice: fix retry for AQ command 0x06EE
Dear Dawid, dear Jakub,
Thank you for your patch.
Am 13.01.26 um 20:38 schrieb Dawid Osuchowski:
Quoted 86 lines
From: Jakub Staniszewski <[email protected]>
Executing ethtool -m can fail reporting a netlink I/O error while firmware link management holds the i2c bus used to communicate with the module.
According to Intel(R) Ethernet Controller E810 Datasheet Rev 2.8 [1] Section 3.3.10.4 Read/Write SFF EEPROM (
0x06EE)
request should to be retried upon receiving EBUSY from firmware.Commit
e9c9692c8a81("ice: Reimplement module reads used by ethtool") implemented it only for part ofice_get_module_eeprom(), leaving all other calls toice_aq_sff_eeprom()vulnerable to returning early on getting EBUSY without retrying.Remove the retry loop from
ice_get_module_eeprom()and add Admin Queue (AQ) command with opcode0x06EEto the list of commands that should be retried on receiving EBUSY from firmware.Fixes e9c9692c8a81 ("ice: Reimplement module reads used by ethtool")Signed-off-by Jakub Staniszewski <[email protected]>Co-developed-by Dawid Osuchowski <[email protected]>Signed-off-by Dawid Osuchowski <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>--- drivers/net/ethernet/intel/ice/ice_common.c | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 35 ++++++++------------ 2 files changed, 15 insertions(+), 21 deletions(-)drivers/net/ethernet/intel/ice/ice_common.c +1
-0@@ -1854,6 +1854,7 @@ static bool ice_should_retry_sq_send_cmd(u16 opcode)case ice_aqc_opc_lldp_stop:case ice_aqc_opc_lldp_start:case ice_aqc_opc_lldp_filter_ctrl: +case ice_aqc_opc_sff_eeprom:return true; }drivers/net/ethernet/intel/ice/ice_ethtool.c +7
-21@@ -4496,7 +4496,7 @@ ice_get_module_eeprom(struct net_device *netdev,u8 addr =ICE_I2C_EEPROM_DEV_ADDR ;struct ice_hw *hw = &pf->hw;bool is_sfp = false; -unsigned int i, j; +unsigned int i;u16 offset =0 ;u8 page =0 ;int status;@@ -4538,26 +4538,19 @@ ice_get_module_eeprom(struct net_device *netdev,if (page ==0 || !(data[0x2 ] &0x4 )) {u32 copy_len; -/* If i2c bus is busy due to slow page change or -* link management access, call can fail. This is normal. -* So we retry this a few times. -*/ -for (j =0 ; j <4 ; j++) { - status =ice_aq_sff_eeprom (hw,0 , addr, offset, page, - !is_sfp, value, -SFF_READ_BLOCK_SIZE , -0 ,NULL ); -netdev_dbg (netdev,"SFF %02X %02X %02X %X = %02X%02X%02X%02X.%02X%02X%02X%02X (%X)\n" , - addr, offset, page, is_sfp, - value[0 ], value[1 ], value[2 ], value[3 ], - value[4 ], value[5 ], value[6 ], value[7 ], - status); -if (status) { -usleep_range (1500 ,2500 ); -memset (value,0 ,SFF_READ_BLOCK_SIZE ); -continue ; - } -break ; + status =ice_aq_sff_eeprom (hw,0 , addr, offset, page, + !is_sfp, value, +SFF_READ_BLOCK_SIZE , +0 ,NULL ); + netdev_dbg(netdev, "SFF %02X %02X %02X %X = %02X%02X%02X%02X.%02X%02X%02X%02X (%pe)\n", + addr, offset, page, is_sfp,
drivers/net/ethernet/intel/ice/ice_ethtool.c ice_get_module_eeprom(struct net_device *netdev, · line 4556
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +7
-0+ value[0 ], value[1 ], value[2 ], value[3 ], + value[4 ], value[5 ], value[6 ], value[7 ], + ERR_PTR(status)); +if (status) { +netdev_err (netdev,"%s: error reading module EEPROM: status %pe\n" , + __func__,ERR_PTR (status)); +return status; }/* Make sure we have enough room for the new block */
Kind regards,
Paul
RE: [Intel-wired-lan] [PATCH iwl-net 2/2] ice: fix retry for AQ command 0x06EE
In reply to Dawid OsuchowskiQuoted 9 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Dawid Osuchowski
Sent: 14 January 2026 01:08
To: [email protected]
Cc: [email protected]; Jakub Staniszewski <[email protected]>; [email protected]; Dawid Osuchowski <[email protected]>; Loktionov, Aleksandr <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-net 2/2] ice: fix retry for AQ command0x06EEFrom: Jakub Staniszewski <[email protected]>
Quoted 7 lines
Executing ethtool -m can fail reporting a netlink I/O error while firmware link management holds the i2c bus used to communicate with the module.
According to Intel(R) Ethernet Controller E810 Datasheet Rev 2.8 [1] Section 3.3.10.4 Read/Write SFF EEPROM (
0x06EE) request should to be retried upon receiving EBUSY from firmware.Commit
e9c9692c8a81("ice: Reimplement module reads used by ethtool") implemented it only for part ofice_get_module_eeprom(), leaving all other calls toice_aq_sff_eeprom()vulnerable to returning early on getting EBUSY without retrying.Remove the retry loop from
ice_get_module_eeprom()and add Admin Queue
(AQ) command with opcode 0x06EE to the list of commands that should be retried on receiving EBUSY from firmware.
Quoted 9 lines
Fixes e9c9692c8a81 ("ice: Reimplement module reads used by ethtool")Signed-off-by Jakub Staniszewski <[email protected]>Co-developed-by Dawid Osuchowski <[email protected]>Signed-off-by Dawid Osuchowski <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>
Quoted 4 lines
---
drivers/net/ethernet/intel/ice/ice_common.c| 1 +drivers/net/ethernet/intel/ice/ice_ethtool.c| 35 ++++++++------------2 files changed, 15 insertions(+), 21 deletions(-)