Message ID | 20240528-net-2024-05-28-intel-net-fixes-v1-6-dc8593d2bbc6@intel.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Intel Wired LAN Driver Updates 2024-05-28 (e1000e, i40e, ice) | expand |
On Tue, 28 May 2024 15:06:09 -0700 Jacob Keller wrote: > + while (try_cnt < 5) { > + status = ice_aq_download_pkg(hw, bh, ICE_PKG_BUF_SIZE, > + last, &offset, &info, > + NULL); > + if (hw->adminq.sq_last_status != ICE_AQ_RC_ENOSEC && > + hw->adminq.sq_last_status != ICE_AQ_RC_EBADSIG) > + break; > + > + try_cnt++; > + msleep(20); > + } > + > + if (try_cnt) > + dev_dbg(ice_hw_to_dev(hw), > + "ice_aq_download_pkg number of retries: %d\n", > + try_cnt); > That's not a great wait loop. Last iteration sleeps for 20msec and then gives up without checking the condition.
On 5/29/2024 6:51 PM, Jakub Kicinski wrote: > On Tue, 28 May 2024 15:06:09 -0700 Jacob Keller wrote: >> + while (try_cnt < 5) { >> + status = ice_aq_download_pkg(hw, bh, ICE_PKG_BUF_SIZE, >> + last, &offset, &info, >> + NULL); >> + if (hw->adminq.sq_last_status != ICE_AQ_RC_ENOSEC && >> + hw->adminq.sq_last_status != ICE_AQ_RC_EBADSIG) >> + break; >> + >> + try_cnt++; >> + msleep(20); >> + } >> + >> + if (try_cnt) >> + dev_dbg(ice_hw_to_dev(hw), >> + "ice_aq_download_pkg number of retries: %d\n", >> + try_cnt); >> > > That's not a great wait loop. Last iteration sleeps for 20msec and then > gives up without checking the condition. Yea, that seems rather silly. @Wojciech, would you please look into this?
On 30.05.2024 18:50, Jacob Keller wrote: > > > On 5/29/2024 6:51 PM, Jakub Kicinski wrote: >> On Tue, 28 May 2024 15:06:09 -0700 Jacob Keller wrote: >>> + while (try_cnt < 5) { >>> + status = ice_aq_download_pkg(hw, bh, ICE_PKG_BUF_SIZE, >>> + last, &offset, &info, >>> + NULL); >>> + if (hw->adminq.sq_last_status != ICE_AQ_RC_ENOSEC && >>> + hw->adminq.sq_last_status != ICE_AQ_RC_EBADSIG) >>> + break; >>> + >>> + try_cnt++; >>> + msleep(20); >>> + } >>> + >>> + if (try_cnt) >>> + dev_dbg(ice_hw_to_dev(hw), >>> + "ice_aq_download_pkg number of retries: %d\n", >>> + try_cnt); >>> >> >> That's not a great wait loop. Last iteration sleeps for 20msec and then >> gives up without checking the condition. > > Yea, that seems rather silly. > > @Wojciech, would you please look into this? Sure, I'll send next version
diff --git a/drivers/net/ethernet/intel/ice/ice_ddp.c b/drivers/net/ethernet/intel/ice/ice_ddp.c index ce5034ed2b24..77b81e5a5a44 100644 --- a/drivers/net/ethernet/intel/ice/ice_ddp.c +++ b/drivers/net/ethernet/intel/ice/ice_ddp.c @@ -1339,6 +1339,7 @@ ice_dwnld_cfg_bufs_no_lock(struct ice_hw *hw, struct ice_buf *bufs, u32 start, for (i = 0; i < count; i++) { bool last = false; + int try_cnt = 0; int status; bh = (struct ice_buf_hdr *)(bufs + start + i); @@ -1346,8 +1347,22 @@ ice_dwnld_cfg_bufs_no_lock(struct ice_hw *hw, struct ice_buf *bufs, u32 start, if (indicate_last) last = ice_is_last_download_buffer(bh, i, count); - status = ice_aq_download_pkg(hw, bh, ICE_PKG_BUF_SIZE, last, - &offset, &info, NULL); + while (try_cnt < 5) { + status = ice_aq_download_pkg(hw, bh, ICE_PKG_BUF_SIZE, + last, &offset, &info, + NULL); + if (hw->adminq.sq_last_status != ICE_AQ_RC_ENOSEC && + hw->adminq.sq_last_status != ICE_AQ_RC_EBADSIG) + break; + + try_cnt++; + msleep(20); + } + + if (try_cnt) + dev_dbg(ice_hw_to_dev(hw), + "ice_aq_download_pkg number of retries: %d\n", + try_cnt); /* Save AQ status from download package */ if (status) {