summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_rl.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2000-05-05 12:47:47 +0000
committerwpaul <wpaul@FreeBSD.org>2000-05-05 12:47:47 +0000
commit63dadfa7b33775d11fd78119b27340accfc52b66 (patch)
tree0b80a1ee9ae0dc43fad19f834def023668b298ef /sys/pci/if_rl.c
parent4e18cad526b8a8ecf1fe4be6e24c1fb18d0253ed (diff)
downloadFreeBSD-src-63dadfa7b33775d11fd78119b27340accfc52b66.zip
FreeBSD-src-63dadfa7b33775d11fd78119b27340accfc52b66.tar.gz
Apply patch to rl_rxeof() to really enforce payload alignment in
the case where we receive a packet that wraps from the end of the RX buffer back to the start. This fixes an unaligned access trap on the alpha with NFS.
Diffstat (limited to 'sys/pci/if_rl.c')
-rw-r--r--sys/pci/if_rl.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c
index e5f4928..b91b57d 100644
--- a/sys/pci/if_rl.c
+++ b/sys/pci/if_rl.c
@@ -913,7 +913,7 @@ static int rl_attach(dev)
goto fail;
}
- sc->rl_cdata.rl_rx_buf = contigmalloc(RL_RXBUFLEN + 32, M_DEVBUF,
+ sc->rl_cdata.rl_rx_buf = contigmalloc(RL_RXBUFLEN + 1518, M_DEVBUF,
M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0);
if (sc->rl_cdata.rl_rx_buf == NULL) {
@@ -1122,8 +1122,13 @@ static void rl_rxeof(sc)
wrap = (sc->rl_cdata.rl_rx_buf + RL_RXBUFLEN) - rxbufpos;
if (total_len > wrap) {
+ /*
+ * Fool m_devget() into thinking we want to copy
+ * the whole buffer so we don't end up fragmenting
+ * the data.
+ */
m = m_devget(rxbufpos - RL_ETHER_ALIGN,
- wrap + RL_ETHER_ALIGN, 0, ifp, NULL);
+ total_len + RL_ETHER_ALIGN, 0, ifp, NULL);
if (m == NULL) {
ifp->if_ierrors++;
printf("rl%d: out of mbufs, tried to "
@@ -1132,14 +1137,6 @@ static void rl_rxeof(sc)
m_adj(m, RL_ETHER_ALIGN);
m_copyback(m, wrap, total_len - wrap,
sc->rl_cdata.rl_rx_buf);
- if (m->m_len < sizeof(struct ether_header))
- m = m_pullup(m,
- sizeof(struct ether_header));
- if (m == NULL) {
- printf("rl%d: m_pullup failed",
- sc->rl_unit);
- ifp->if_ierrors++;
- }
}
cur_rx = (total_len - wrap + ETHER_CRC_LEN);
} else {
OpenPOWER on IntegriCloud