Commit 3272686c authored by Alexander Duyck's avatar Alexander Duyck Committed by David S. Miller

igb: fix a few items where weren't correctly setup for mbx timeout

The mailbox timeout routines need to be updated as they were not correctly
handling the case of a mailbox timeout and could cause issues with long
delays when used.
Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0acb6fde
...@@ -143,12 +143,16 @@ static s32 igb_poll_for_msg(struct e1000_hw *hw, u16 mbx_id) ...@@ -143,12 +143,16 @@ static s32 igb_poll_for_msg(struct e1000_hw *hw, u16 mbx_id)
if (!countdown || !mbx->ops.check_for_msg) if (!countdown || !mbx->ops.check_for_msg)
goto out; goto out;
while (mbx->ops.check_for_msg(hw, mbx_id)) { while (countdown && mbx->ops.check_for_msg(hw, mbx_id)) {
countdown--; countdown--;
if (!countdown) if (!countdown)
break; break;
udelay(mbx->usec_delay); udelay(mbx->usec_delay);
} }
/* if we failed, all future posted messages fail until reset */
if (!countdown)
mbx->timeout = 0;
out: out:
return countdown ? 0 : -E1000_ERR_MBX; return countdown ? 0 : -E1000_ERR_MBX;
} }
...@@ -168,12 +172,16 @@ static s32 igb_poll_for_ack(struct e1000_hw *hw, u16 mbx_id) ...@@ -168,12 +172,16 @@ static s32 igb_poll_for_ack(struct e1000_hw *hw, u16 mbx_id)
if (!countdown || !mbx->ops.check_for_ack) if (!countdown || !mbx->ops.check_for_ack)
goto out; goto out;
while (mbx->ops.check_for_ack(hw, mbx_id)) { while (countdown && mbx->ops.check_for_ack(hw, mbx_id)) {
countdown--; countdown--;
if (!countdown) if (!countdown)
break; break;
udelay(mbx->usec_delay); udelay(mbx->usec_delay);
} }
/* if we failed, all future posted messages fail until reset */
if (!countdown)
mbx->timeout = 0;
out: out:
return countdown ? 0 : -E1000_ERR_MBX; return countdown ? 0 : -E1000_ERR_MBX;
} }
...@@ -217,12 +225,13 @@ static s32 igb_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_ ...@@ -217,12 +225,13 @@ static s32 igb_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_
static s32 igb_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) static s32 igb_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
{ {
struct e1000_mbx_info *mbx = &hw->mbx; struct e1000_mbx_info *mbx = &hw->mbx;
s32 ret_val = 0; s32 ret_val = -E1000_ERR_MBX;
if (!mbx->ops.write) /* exit if either we can't write or there isn't a defined timeout */
if (!mbx->ops.write || !mbx->timeout)
goto out; goto out;
/* send msg*/ /* send msg */
ret_val = mbx->ops.write(hw, msg, size, mbx_id); ret_val = mbx->ops.write(hw, msg, size, mbx_id);
/* if msg sent wait until we receive an ack */ /* if msg sent wait until we receive an ack */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment