mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
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>
This commit is contained in:
parent
7b581a0fa8
commit
2090dee420
1 changed files with 21 additions and 10 deletions
|
@ -501,6 +501,10 @@ int t3b2_mac_watchdog_task(struct cmac *mac)
|
||||||
unsigned int rx_xcnt;
|
unsigned int rx_xcnt;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
status = 0;
|
||||||
|
tx_xcnt = 1; /* By default tx_xcnt is making progress */
|
||||||
|
tx_tcnt = mac->tx_tcnt; /* If tx_mcnt is progressing ignore tx_tcnt */
|
||||||
|
rx_xcnt = 1; /* By default rx_xcnt is making progress */
|
||||||
if (tx_mcnt == mac->tx_mcnt) {
|
if (tx_mcnt == mac->tx_mcnt) {
|
||||||
tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
|
tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
|
||||||
A_XGM_TX_SPI4_SOP_EOP_CNT +
|
A_XGM_TX_SPI4_SOP_EOP_CNT +
|
||||||
|
@ -511,37 +515,44 @@ int t3b2_mac_watchdog_task(struct cmac *mac)
|
||||||
tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
|
tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
|
||||||
A_TP_PIO_DATA)));
|
A_TP_PIO_DATA)));
|
||||||
} else {
|
} else {
|
||||||
mac->toggle_cnt = 0;
|
goto rxcheck;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mac->toggle_cnt = 0;
|
mac->toggle_cnt = 0;
|
||||||
return 0;
|
goto rxcheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((tx_tcnt != mac->tx_tcnt) &&
|
if (((tx_tcnt != mac->tx_tcnt) &&
|
||||||
(tx_xcnt == 0) && (mac->tx_xcnt == 0)) ||
|
(tx_xcnt == 0) && (mac->tx_xcnt == 0)) ||
|
||||||
((mac->tx_mcnt == tx_mcnt) &&
|
((mac->tx_mcnt == tx_mcnt) &&
|
||||||
(tx_xcnt != 0) && (mac->tx_xcnt != 0))) {
|
(tx_xcnt != 0) && (mac->tx_xcnt != 0))) {
|
||||||
if (mac->toggle_cnt > 4)
|
if (mac->toggle_cnt > 4) {
|
||||||
status = 2;
|
status = 2;
|
||||||
else
|
goto out;
|
||||||
|
} else {
|
||||||
status = 1;
|
status = 1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mac->toggle_cnt = 0;
|
mac->toggle_cnt = 0;
|
||||||
return 0;
|
goto rxcheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rxcheck:
|
||||||
if (rx_mcnt != mac->rx_mcnt)
|
if (rx_mcnt != mac->rx_mcnt)
|
||||||
rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
|
rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
|
||||||
A_XGM_RX_SPI4_SOP_EOP_CNT +
|
A_XGM_RX_SPI4_SOP_EOP_CNT +
|
||||||
mac->offset)));
|
mac->offset)));
|
||||||
else
|
else
|
||||||
return 0;
|
goto out;
|
||||||
|
|
||||||
if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 && mac->rx_xcnt == 0)
|
if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 &&
|
||||||
|
mac->rx_xcnt == 0) {
|
||||||
status = 2;
|
status = 2;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
mac->tx_tcnt = tx_tcnt;
|
mac->tx_tcnt = tx_tcnt;
|
||||||
mac->tx_xcnt = tx_xcnt;
|
mac->tx_xcnt = tx_xcnt;
|
||||||
mac->tx_mcnt = s->tx_frames;
|
mac->tx_mcnt = s->tx_frames;
|
||||||
|
|
Loading…
Reference in a new issue