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>

authored by Divy Le Ray and committed by Jeff Garzik 2090dee4 7b581a0f

+21 -10
+21 -10
drivers/net/cxgb3/xgmac.c
··· 501 unsigned int rx_xcnt; 502 int status; 503 504 if (tx_mcnt == mac->tx_mcnt) { 505 tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, 506 A_XGM_TX_SPI4_SOP_EOP_CNT + ··· 515 tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, 516 A_TP_PIO_DATA))); 517 } else { 518 - mac->toggle_cnt = 0; 519 - return 0; 520 } 521 } else { 522 mac->toggle_cnt = 0; 523 - return 0; 524 } 525 526 if (((tx_tcnt != mac->tx_tcnt) && 527 (tx_xcnt == 0) && (mac->tx_xcnt == 0)) || 528 ((mac->tx_mcnt == tx_mcnt) && 529 (tx_xcnt != 0) && (mac->tx_xcnt != 0))) { 530 - if (mac->toggle_cnt > 4) 531 status = 2; 532 - else 533 status = 1; 534 } else { 535 mac->toggle_cnt = 0; 536 - return 0; 537 } 538 539 if (rx_mcnt != mac->rx_mcnt) 540 rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, 541 A_XGM_RX_SPI4_SOP_EOP_CNT + 542 mac->offset))); 543 - else 544 - return 0; 545 546 - if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 && mac->rx_xcnt == 0) 547 status = 2; 548 - 549 mac->tx_tcnt = tx_tcnt; 550 mac->tx_xcnt = tx_xcnt; 551 mac->tx_mcnt = s->tx_frames;
··· 501 unsigned int rx_xcnt; 502 int status; 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 */ 508 if (tx_mcnt == mac->tx_mcnt) { 509 tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, 510 A_XGM_TX_SPI4_SOP_EOP_CNT + ··· 511 tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, 512 A_TP_PIO_DATA))); 513 } else { 514 + goto rxcheck; 515 } 516 } else { 517 mac->toggle_cnt = 0; 518 + goto rxcheck; 519 } 520 521 if (((tx_tcnt != mac->tx_tcnt) && 522 (tx_xcnt == 0) && (mac->tx_xcnt == 0)) || 523 ((mac->tx_mcnt == tx_mcnt) && 524 (tx_xcnt != 0) && (mac->tx_xcnt != 0))) { 525 + if (mac->toggle_cnt > 4) { 526 status = 2; 527 + goto out; 528 + } else { 529 status = 1; 530 + goto out; 531 + } 532 } else { 533 mac->toggle_cnt = 0; 534 + goto rxcheck; 535 } 536 537 + rxcheck: 538 if (rx_mcnt != mac->rx_mcnt) 539 rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, 540 A_XGM_RX_SPI4_SOP_EOP_CNT + 541 mac->offset))); 542 + else 543 + goto out; 544 545 + if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 && 546 + mac->rx_xcnt == 0) { 547 status = 2; 548 + goto out; 549 + } 550 + 551 + out: 552 mac->tx_tcnt = tx_tcnt; 553 mac->tx_xcnt = tx_xcnt; 554 mac->tx_mcnt = s->tx_frames;