aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2011-04-13 07:05:05 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-13 20:10:06 -0400
commite64de4e6c660dae6d6370b3acb59d5d5cc9ecf20 (patch)
treebbe7e74f51c2085ce0a3c9e8536a48061647d3b8 /drivers/net/tg3.c
parent97bd8e491d1786f0020372a5a470bb8b3184856f (diff)
tg3: Dump registers when status block shows errors
This patch monitors the error bit of the status word within the status block. If it is set, the driver will dump the driver state after validating the error and then reset the chip. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 72744353b1cb..b61b52f0a9fb 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -5259,6 +5259,40 @@ tx_recovery:
5259 return work_done; 5259 return work_done;
5260} 5260}
5261 5261
5262static void tg3_process_error(struct tg3 *tp)
5263{
5264 u32 val;
5265 bool real_error = false;
5266
5267 if (tp->tg3_flags & TG3_FLAG_ERROR_PROCESSED)
5268 return;
5269
5270 /* Check Flow Attention register */
5271 val = tr32(HOSTCC_FLOW_ATTN);
5272 if (val & ~HOSTCC_FLOW_ATTN_MBUF_LWM) {
5273 netdev_err(tp->dev, "FLOW Attention error. Resetting chip.\n");
5274 real_error = true;
5275 }
5276
5277 if (tr32(MSGINT_STATUS) & ~MSGINT_STATUS_MSI_REQ) {
5278 netdev_err(tp->dev, "MSI Status error. Resetting chip.\n");
5279 real_error = true;
5280 }
5281
5282 if (tr32(RDMAC_STATUS) || tr32(WDMAC_STATUS)) {
5283 netdev_err(tp->dev, "DMA Status error. Resetting chip.\n");
5284 real_error = true;
5285 }
5286
5287 if (!real_error)
5288 return;
5289
5290 tg3_dump_state(tp);
5291
5292 tp->tg3_flags |= TG3_FLAG_ERROR_PROCESSED;
5293 schedule_work(&tp->reset_task);
5294}
5295
5262static int tg3_poll(struct napi_struct *napi, int budget) 5296static int tg3_poll(struct napi_struct *napi, int budget)
5263{ 5297{
5264 struct tg3_napi *tnapi = container_of(napi, struct tg3_napi, napi); 5298 struct tg3_napi *tnapi = container_of(napi, struct tg3_napi, napi);
@@ -5267,6 +5301,9 @@ static int tg3_poll(struct napi_struct *napi, int budget)
5267 struct tg3_hw_status *sblk = tnapi->hw_status; 5301 struct tg3_hw_status *sblk = tnapi->hw_status;
5268 5302
5269 while (1) { 5303 while (1) {
5304 if (sblk->status & SD_STATUS_ERROR)
5305 tg3_process_error(tp);
5306
5270 tg3_poll_link(tp); 5307 tg3_poll_link(tp);
5271 5308
5272 work_done = tg3_poll_work(tnapi, work_done, budget); 5309 work_done = tg3_poll_work(tnapi, work_done, budget);
@@ -7316,7 +7353,8 @@ static int tg3_chip_reset(struct tg3 *tp)
7316 7353
7317 tg3_restore_pci_state(tp); 7354 tg3_restore_pci_state(tp);
7318 7355
7319 tp->tg3_flags &= ~TG3_FLAG_CHIP_RESETTING; 7356 tp->tg3_flags &= ~(TG3_FLAG_CHIP_RESETTING |
7357 TG3_FLAG_ERROR_PROCESSED);
7320 7358
7321 val = 0; 7359 val = 0;
7322 if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) 7360 if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)