From b51da36807dd378ca35e7d098d8813bcc73885f3 Mon Sep 17 00:00:00 2001 From: Jun-ichiro itojun Hagino Date: Wed, 1 Oct 1997 05:54:58 +0000 Subject: [PATCH] To obey the traditional practice in mbuf chaining. PR: 4020 Reviewed by: hamada@astec.co.jp --- sys/dev/vx/if_vx.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/sys/dev/vx/if_vx.c b/sys/dev/vx/if_vx.c index 71799bf54256..f1f744f2ec42 100644 --- a/sys/dev/vx/if_vx.c +++ b/sys/dev/vx/if_vx.c @@ -850,6 +850,12 @@ vxget(sc, totlen) */ sh = splhigh(); + /* + * Since we don't set allowLargePackets bit in MacControl register, + * we can assume that totlen <= 1500bytes. + * The while loop will be performed iff we have a packet with + * MLEN < m_len < MINCLSIZE. + */ while (totlen > 0) { if (top) { m = sc->mb[sc->next_mb]; @@ -867,18 +873,17 @@ vxget(sc, totlen) len = MLEN; } if (totlen >= MINCLSIZE) { - MCLGET(m, M_DONTWAIT); - if (m->m_flags & M_EXT) - len = MCLBYTES; + MCLGET(m, M_DONTWAIT); + if (m->m_flags & M_EXT) + len = MCLBYTES; } len = min(totlen, len); - if (len > 3) { - len &= ~3; - insl(BASE + VX_W1_RX_PIO_RD_1, mtod(m, u_int32_t *), - len / 4); - } else - insb(BASE + VX_W1_RX_PIO_RD_1, mtod(m, u_int8_t *), - len); + if (len > 3) + insl(BASE + VX_W1_RX_PIO_RD_1, mtod(m, u_int32_t *), len / 4); + if (len & 3) { + insb(BASE + VX_W1_RX_PIO_RD_1, mtod(m, u_int8_t *) + (len & ~3), + len & 3); + } m->m_len = len; totlen -= len; *mp = m;