diff options
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_common.c')
| -rw-r--r-- | drivers/net/ethernet/intel/ice/ice_common.c | 31 | 
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index c2fda4fa4188..eb2dc0983776 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c @@ -1619,7 +1619,6 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,  {  	struct ice_aq_desc desc_cpy;  	bool is_cmd_for_retry; -	u8 *buf_cpy = NULL;  	u8 idx = 0;  	u16 opcode;  	int status; @@ -1629,11 +1628,8 @@ 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) { -		if (buf) { -			buf_cpy = kzalloc(buf_size, GFP_KERNEL); -			if (!buf_cpy) -				return -ENOMEM; -		} +		/* All retryable cmds are direct, without buf. */ +		WARN_ON(buf);  		memcpy(&desc_cpy, desc, sizeof(desc_cpy));  	} @@ -1645,17 +1641,12 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,  		    hw->adminq.sq_last_status != ICE_AQ_RC_EBUSY)  			break; -		if (buf_cpy) -			memcpy(buf, buf_cpy, buf_size); -  		memcpy(desc, &desc_cpy, sizeof(desc_cpy)); -		mdelay(ICE_SQ_SEND_DELAY_TIME_MS); +		msleep(ICE_SQ_SEND_DELAY_TIME_MS);  	} while (++idx < ICE_SQ_SEND_MAX_EXECUTE); -	kfree(buf_cpy); -  	return status;  } @@ -1992,19 +1983,19 @@ ice_acquire_res_exit:   */  void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res)  { -	u32 total_delay = 0; +	unsigned long timeout;  	int status; -	status = ice_aq_release_res(hw, res, 0, NULL); -  	/* there are some rare cases when trying to release the resource  	 * results in an admin queue timeout, so handle them correctly  	 */ -	while ((status == -EIO) && (total_delay < hw->adminq.sq_cmd_timeout)) { -		mdelay(1); +	timeout = jiffies + 10 * ICE_CTL_Q_SQ_CMD_TIMEOUT; +	do {  		status = ice_aq_release_res(hw, res, 0, NULL); -		total_delay++; -	} +		if (status != -EIO) +			break; +		usleep_range(1000, 2000); +	} while (time_before(jiffies, timeout));  }  /** @@ -5169,7 +5160,7 @@ ice_aq_read_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr,   */  int  ice_aq_write_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr, -		 u16 bus_addr, __le16 addr, u8 params, u8 *data, +		 u16 bus_addr, __le16 addr, u8 params, const u8 *data,  		 struct ice_sq_cd *cd)  {  	struct ice_aq_desc desc = { 0 };  |