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