diff options
author | Divy Le Ray <divy@chelsio.com> | 2007-05-30 13:01:50 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-06-20 19:16:59 -0400 |
commit | 2090dee420911045258d50239dc2c527e4b1dd06 (patch) | |
tree | 5b7f0c7cddca53ae8710df8cf4fae84f49f61948 /drivers | |
parent | 7b581a0fa85464f7f765b9a66f612e7ec4ab17f9 (diff) |
cxgb3 - MAC watchdog update
Fix variables initialization and usage in the MAC watchdog.
Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/cxgb3/xgmac.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c index 16cadba88ed5..b261be147e7b 100644 --- a/drivers/net/cxgb3/xgmac.c +++ b/drivers/net/cxgb3/xgmac.c | |||
@@ -501,6 +501,10 @@ int t3b2_mac_watchdog_task(struct cmac *mac) | |||
501 | unsigned int rx_xcnt; | 501 | unsigned int rx_xcnt; |
502 | int status; | 502 | int status; |
503 | 503 | ||
504 | status = 0; | ||
505 | tx_xcnt = 1; /* By default tx_xcnt is making progress */ | ||
506 | tx_tcnt = mac->tx_tcnt; /* If tx_mcnt is progressing ignore tx_tcnt */ | ||
507 | rx_xcnt = 1; /* By default rx_xcnt is making progress */ | ||
504 | if (tx_mcnt == mac->tx_mcnt) { | 508 | if (tx_mcnt == mac->tx_mcnt) { |
505 | tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, | 509 | tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, |
506 | A_XGM_TX_SPI4_SOP_EOP_CNT + | 510 | A_XGM_TX_SPI4_SOP_EOP_CNT + |
@@ -511,37 +515,44 @@ int t3b2_mac_watchdog_task(struct cmac *mac) | |||
511 | tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, | 515 | tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, |
512 | A_TP_PIO_DATA))); | 516 | A_TP_PIO_DATA))); |
513 | } else { | 517 | } else { |
514 | mac->toggle_cnt = 0; | 518 | goto rxcheck; |
515 | return 0; | ||
516 | } | 519 | } |
517 | } else { | 520 | } else { |
518 | mac->toggle_cnt = 0; | 521 | mac->toggle_cnt = 0; |
519 | return 0; | 522 | goto rxcheck; |
520 | } | 523 | } |
521 | 524 | ||
522 | if (((tx_tcnt != mac->tx_tcnt) && | 525 | if (((tx_tcnt != mac->tx_tcnt) && |
523 | (tx_xcnt == 0) && (mac->tx_xcnt == 0)) || | 526 | (tx_xcnt == 0) && (mac->tx_xcnt == 0)) || |
524 | ((mac->tx_mcnt == tx_mcnt) && | 527 | ((mac->tx_mcnt == tx_mcnt) && |
525 | (tx_xcnt != 0) && (mac->tx_xcnt != 0))) { | 528 | (tx_xcnt != 0) && (mac->tx_xcnt != 0))) { |
526 | if (mac->toggle_cnt > 4) | 529 | if (mac->toggle_cnt > 4) { |
527 | status = 2; | 530 | status = 2; |
528 | else | 531 | goto out; |
532 | } else { | ||
529 | status = 1; | 533 | status = 1; |
534 | goto out; | ||
535 | } | ||
530 | } else { | 536 | } else { |
531 | mac->toggle_cnt = 0; | 537 | mac->toggle_cnt = 0; |
532 | return 0; | 538 | goto rxcheck; |
533 | } | 539 | } |
534 | 540 | ||
541 | rxcheck: | ||
535 | if (rx_mcnt != mac->rx_mcnt) | 542 | if (rx_mcnt != mac->rx_mcnt) |
536 | rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, | 543 | rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, |
537 | A_XGM_RX_SPI4_SOP_EOP_CNT + | 544 | A_XGM_RX_SPI4_SOP_EOP_CNT + |
538 | mac->offset))); | 545 | mac->offset))); |
539 | else | 546 | else |
540 | return 0; | 547 | goto out; |
541 | 548 | ||
542 | if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 && mac->rx_xcnt == 0) | 549 | if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 && |
550 | mac->rx_xcnt == 0) { | ||
543 | status = 2; | 551 | status = 2; |
544 | 552 | goto out; | |
553 | } | ||
554 | |||
555 | out: | ||
545 | mac->tx_tcnt = tx_tcnt; | 556 | mac->tx_tcnt = tx_tcnt; |
546 | mac->tx_xcnt = tx_xcnt; | 557 | mac->tx_xcnt = tx_xcnt; |
547 | mac->tx_mcnt = s->tx_frames; | 558 | mac->tx_mcnt = s->tx_frames; |