summaryrefslogtreecommitdiffstats
path: root/sys/pci
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2008-04-10 01:06:05 +0000
committeryongari <yongari@FreeBSD.org>2008-04-10 01:06:05 +0000
commit549884e502262465ed3c851a9c35efc41f6afba3 (patch)
tree2cd95effdbaf18d86d3300f835979337d309a3dd /sys/pci
parentb65786c8a824a1e9865c7e0083a5212d243f706e (diff)
downloadFreeBSD-src-549884e502262465ed3c851a9c35efc41f6afba3.zip
FreeBSD-src-549884e502262465ed3c851a9c35efc41f6afba3.tar.gz
It seems that RealTek 8129/8139 chip reports invalid length of
received frame under certain conditions. wpaul said the length 0xfff0 is special meaning that indicates hardware is in the process of copying a packet into host memory. But it seems there are other cases that hardware is busy or stuck in bad situation even if the received frame length is not 0xfff0. To work-around this condition, add a check that verifys that recevied frame length is in valid range. If received length is out of range reinitialize hardware to recover from stuck condition. Reported by: Mike Tancsa ( mike AT sentex DOT net ) Tested by: Mike Tancsa Obtained from: OpenBSD MFC after: 1 week
Diffstat (limited to 'sys/pci')
-rw-r--r--sys/pci/if_rl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c
index 96996e7..1a5259f 100644
--- a/sys/pci/if_rl.c
+++ b/sys/pci/if_rl.c
@@ -1117,17 +1117,19 @@ rl_rxeof(struct rl_softc *sc)
* datasheet makes absolutely no mention of this and
* RealTek should be shot for this.
*/
- if ((uint16_t)(rxstat >> 16) == RL_RXSTAT_UNFINISHED)
+ total_len = rxstat >> 16;
+ if (total_len == RL_RXSTAT_UNFINISHED)
break;
- if (!(rxstat & RL_RXSTAT_RXOK)) {
+ if (!(rxstat & RL_RXSTAT_RXOK) ||
+ total_len < ETHER_MIN_LEN ||
+ total_len > ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) {
ifp->if_ierrors++;
rl_init_locked(sc);
return;
}
/* No errors; receive the packet. */
- total_len = rxstat >> 16;
rx_bytes += total_len + 4;
/*
OpenPOWER on IntegriCloud