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.
This commit is contained in:
parent
97de15e7ce
commit
af020b6e13
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user