diff options
author | Martin Reindl <martin@cvs.openbsd.org> | 2007-01-12 16:31:22 +0000 |
---|---|---|
committer | Martin Reindl <martin@cvs.openbsd.org> | 2007-01-12 16:31:22 +0000 |
commit | 2bebcfa9da8ac1420312c59ac375bbb6c4880cb0 (patch) | |
tree | 6248161bdf93132701d8b69ce2afc4633c729ff4 | |
parent | c7f0db355629855bc89eb442c5d25b4d62adf4b1 (diff) |
fix altq for mc(4); make mbuf functions return NULL instead of 0 while
there
from Brad, tested by me on all three adapters
-rw-r--r-- | sys/arch/mac68k/dev/if_ae.c | 17 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_mc.c | 19 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_sn.c | 18 |
3 files changed, 30 insertions, 24 deletions
diff --git a/sys/arch/mac68k/dev/if_ae.c b/sys/arch/mac68k/dev/if_ae.c index cce17c3240e..7f9556a5af6 100644 --- a/sys/arch/mac68k/dev/if_ae.c +++ b/sys/arch/mac68k/dev/if_ae.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ae.c,v 1.32 2007/01/03 21:17:44 martin Exp $ */ +/* $OpenBSD: if_ae.c,v 1.33 2007/01/12 16:31:21 martin Exp $ */ /* $NetBSD: if_ae.c,v 1.62 1997/04/24 16:52:05 scottr Exp $ */ /* @@ -420,7 +420,7 @@ outloop: return; } IF_DEQUEUE(&ifp->if_snd, m0); - if (m0 == 0) + if (m0 == NULL) return; /* We need to use m->m_pkthdr.len, so require the header */ @@ -856,7 +856,7 @@ aeread(sc, buf, len) /* Pull packet off interface. */ m = aeget(sc, buf, len); - if (m == 0) { + if (m == NULL) { ifp->if_ierrors++; return; } @@ -929,8 +929,9 @@ aeget(sc, src, total_len) int len; MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) - return 0; + if (m == NULL) + return (NULL); + m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = total_len; len = MHLEN; @@ -940,9 +941,9 @@ aeget(sc, src, total_len) while (total_len > 0) { if (top) { MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { + if (m == NULL) { m_freem(top); - return 0; + return (NULL); } len = MLEN; } @@ -951,7 +952,7 @@ aeget(sc, src, total_len) if ((m->m_flags & M_EXT) == 0) { m_free(m); m_freem(top); - return 0; + return (NULL); } len = MCLBYTES; } diff --git a/sys/arch/mac68k/dev/if_mc.c b/sys/arch/mac68k/dev/if_mc.c index 9f2fa230784..7d7a3ba9371 100644 --- a/sys/arch/mac68k/dev/if_mc.c +++ b/sys/arch/mac68k/dev/if_mc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mc.c,v 1.14 2006/03/25 22:41:41 djm Exp $ */ +/* $OpenBSD: if_mc.c,v 1.15 2007/01/12 16:31:21 martin Exp $ */ /* $NetBSD: if_mc.c,v 1.24 2004/10/30 18:08:34 thorpej Exp $ */ /*- @@ -161,6 +161,8 @@ mcsetup(sc, lladdr) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST; ifp->if_watchdog = mcwatchdog; + IFQ_SET_READY(&ifp->if_snd); + if_attach(ifp); ether_ifattach(ifp); @@ -264,8 +266,8 @@ mcstart(ifp) if (ifp->if_flags & IFF_OACTIVE) return; - IF_DEQUEUE(&ifp->if_snd, m); - if (m == 0) + IFQ_DEQUEUE(&ifp->if_snd, m); + if (m == NULL) return; #if NBPFILTER > 0 @@ -633,8 +635,9 @@ mace_get(sc, pkt, totlen) int len; MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) - return (0); + if (m == NULL) + return (NULL); + m->m_pkthdr.rcvif = &sc->sc_if; m->m_pkthdr.len = totlen; len = MHLEN; @@ -644,9 +647,9 @@ mace_get(sc, pkt, totlen) while (totlen > 0) { if (top) { MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { + if (m == NULL) { m_freem(top); - return 0; + return (NULL); } len = MLEN; } @@ -655,7 +658,7 @@ mace_get(sc, pkt, totlen) if ((m->m_flags & M_EXT) == 0) { m_free(m); m_freem(top); - return 0; + return (NULL); } len = MCLBYTES; } diff --git a/sys/arch/mac68k/dev/if_sn.c b/sys/arch/mac68k/dev/if_sn.c index 275f45fb1a9..3ff8b65838b 100644 --- a/sys/arch/mac68k/dev/if_sn.c +++ b/sys/arch/mac68k/dev/if_sn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sn.c,v 1.45 2006/06/24 13:23:27 miod Exp $ */ +/* $OpenBSD: if_sn.c,v 1.46 2007/01/12 16:31:21 martin Exp $ */ /* $NetBSD: if_sn.c,v 1.13 1997/04/25 03:40:10 briggs Exp $ */ /* @@ -349,7 +349,7 @@ outloop: } IF_DEQUEUE(&ifp->if_snd, m); - if (m == 0) + if (m == NULL) return; /* We need the header for m_pkthdr.len. */ @@ -1092,8 +1092,9 @@ sonic_get(struct sn_softc *sc, caddr_t pkt, int datalen) int len; MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) - return (0); + if (m == NULL) + return (NULL); + m->m_pkthdr.rcvif = &sc->sc_if; m->m_pkthdr.len = datalen; len = MHLEN; @@ -1103,17 +1104,18 @@ sonic_get(struct sn_softc *sc, caddr_t pkt, int datalen) while (datalen > 0) { if (top) { MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { + if (m == NULL) { m_freem(top); - return (0); + return (NULL); } len = MLEN; } if (datalen >= MINCLSIZE) { MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { - if (top) m_freem(top); - return (0); + if (top) + m_freem(top); + return (NULL); } len = MCLBYTES; } |