diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2009-10-05 02:34:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-06 17:59:21 -0400 |
commit | 3272686c98da64d6eeaa2434782f42270b110758 (patch) | |
tree | 81950a9dfaaa5b446fd3deccd1a31d7f12843b7b /drivers/net | |
parent | 0acb6fde5fc84009be1c7efc0aaa8e69e394a2e2 (diff) |
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: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/igb/e1000_mbx.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/net/igb/e1000_mbx.c b/drivers/net/igb/e1000_mbx.c index ef645f604d8..c474cdb7004 100644 --- a/drivers/net/igb/e1000_mbx.c +++ b/drivers/net/igb/e1000_mbx.c | |||
@@ -143,12 +143,16 @@ static s32 igb_poll_for_msg(struct e1000_hw *hw, u16 mbx_id) | |||
143 | if (!countdown || !mbx->ops.check_for_msg) | 143 | if (!countdown || !mbx->ops.check_for_msg) |
144 | goto out; | 144 | goto out; |
145 | 145 | ||
146 | while (mbx->ops.check_for_msg(hw, mbx_id)) { | 146 | while (countdown && mbx->ops.check_for_msg(hw, mbx_id)) { |
147 | countdown--; | 147 | countdown--; |
148 | if (!countdown) | 148 | if (!countdown) |
149 | break; | 149 | break; |
150 | udelay(mbx->usec_delay); | 150 | udelay(mbx->usec_delay); |
151 | } | 151 | } |
152 | |||
153 | /* if we failed, all future posted messages fail until reset */ | ||
154 | if (!countdown) | ||
155 | mbx->timeout = 0; | ||
152 | out: | 156 | out: |
153 | return countdown ? 0 : -E1000_ERR_MBX; | 157 | return countdown ? 0 : -E1000_ERR_MBX; |
154 | } | 158 | } |
@@ -168,12 +172,16 @@ static s32 igb_poll_for_ack(struct e1000_hw *hw, u16 mbx_id) | |||
168 | if (!countdown || !mbx->ops.check_for_ack) | 172 | if (!countdown || !mbx->ops.check_for_ack) |
169 | goto out; | 173 | goto out; |
170 | 174 | ||
171 | while (mbx->ops.check_for_ack(hw, mbx_id)) { | 175 | while (countdown && mbx->ops.check_for_ack(hw, mbx_id)) { |
172 | countdown--; | 176 | countdown--; |
173 | if (!countdown) | 177 | if (!countdown) |
174 | break; | 178 | break; |
175 | udelay(mbx->usec_delay); | 179 | udelay(mbx->usec_delay); |
176 | } | 180 | } |
181 | |||
182 | /* if we failed, all future posted messages fail until reset */ | ||
183 | if (!countdown) | ||
184 | mbx->timeout = 0; | ||
177 | out: | 185 | out: |
178 | return countdown ? 0 : -E1000_ERR_MBX; | 186 | return countdown ? 0 : -E1000_ERR_MBX; |
179 | } | 187 | } |
@@ -217,12 +225,13 @@ out: | |||
217 | static s32 igb_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) | 225 | static s32 igb_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) |
218 | { | 226 | { |
219 | struct e1000_mbx_info *mbx = &hw->mbx; | 227 | struct e1000_mbx_info *mbx = &hw->mbx; |
220 | s32 ret_val = 0; | 228 | s32 ret_val = -E1000_ERR_MBX; |
221 | 229 | ||
222 | if (!mbx->ops.write) | 230 | /* exit if either we can't write or there isn't a defined timeout */ |
231 | if (!mbx->ops.write || !mbx->timeout) | ||
223 | goto out; | 232 | goto out; |
224 | 233 | ||
225 | /* send msg*/ | 234 | /* send msg */ |
226 | ret_val = mbx->ops.write(hw, msg, size, mbx_id); | 235 | ret_val = mbx->ops.write(hw, msg, size, mbx_id); |
227 | 236 | ||
228 | /* if msg sent wait until we receive an ack */ | 237 | /* if msg sent wait until we receive an ack */ |