midway.c (108466) | midway.c (109623) |
---|---|
1/* $NetBSD: midway.c,v 1.30 1997/09/29 17:40:38 chuck Exp $ */ 2/* (sync'd to midway.c 1.68) */ 3 4/* 5 * 6 * Copyright (c) 1996 Charles D. Cranor and Washington University. 7 * All rights reserved. 8 * --- 18 unchanged lines hidden (view full) --- 27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 * | 1/* $NetBSD: midway.c,v 1.30 1997/09/29 17:40:38 chuck Exp $ */ 2/* (sync'd to midway.c 1.68) */ 3 4/* 5 * 6 * Copyright (c) 1996 Charles D. Cranor and Washington University. 7 * All rights reserved. 8 * --- 18 unchanged lines hidden (view full) --- 27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sys/dev/en/midway.c 108466 2002-12-30 20:22:40Z sam $ | 35 * $FreeBSD: head/sys/dev/en/midway.c 109623 2003-01-21 08:56:16Z alfred $ |
36 */ 37 38/* 39 * 40 * m i d w a y . c e n i 1 5 5 d r i v e r 41 * 42 * author: Chuck Cranor <chuck@ccrc.wustl.edu> 43 * started: spring, 1996 (written from scratch). --- 552 unchanged lines hidden (view full) --- 596struct en_softc *sc; 597u_int totlen, *drqneed; 598 599{ 600 struct mbuf *m; 601 struct mbuf *top, **mp; 602 *drqneed = 0; 603 | 36 */ 37 38/* 39 * 40 * m i d w a y . c e n i 1 5 5 d r i v e r 41 * 42 * author: Chuck Cranor <chuck@ccrc.wustl.edu> 43 * started: spring, 1996 (written from scratch). --- 552 unchanged lines hidden (view full) --- 596struct en_softc *sc; 597u_int totlen, *drqneed; 598 599{ 600 struct mbuf *m; 601 struct mbuf *top, **mp; 602 *drqneed = 0; 603 |
604 MGETHDR(m, M_DONTWAIT, MT_DATA); | 604 MGETHDR(m, M_NOWAIT, MT_DATA); |
605 if (m == NULL) 606 return(NULL); 607 m->m_pkthdr.rcvif = &sc->enif; 608 m->m_pkthdr.len = totlen; 609 m->m_len = MHLEN; 610 top = NULL; 611 mp = ⊤ 612 613 /* if (top != NULL) then we've already got 1 mbuf on the chain */ 614 while (totlen > 0) { 615 if (top) { | 605 if (m == NULL) 606 return(NULL); 607 m->m_pkthdr.rcvif = &sc->enif; 608 m->m_pkthdr.len = totlen; 609 m->m_len = MHLEN; 610 top = NULL; 611 mp = ⊤ 612 613 /* if (top != NULL) then we've already got 1 mbuf on the chain */ 614 while (totlen > 0) { 615 if (top) { |
616 MGET(m, M_DONTWAIT, MT_DATA); | 616 MGET(m, M_NOWAIT, MT_DATA); |
617 if (!m) { 618 m_freem(top); 619 return(NULL); /* out of mbufs */ 620 } 621 m->m_len = MLEN; 622 } 623 if (totlen >= MINCLSIZE) { | 617 if (!m) { 618 m_freem(top); 619 return(NULL); /* out of mbufs */ 620 } 621 m->m_len = MLEN; 622 } 623 if (totlen >= MINCLSIZE) { |
624 MCLGET(m, M_DONTWAIT); | 624 MCLGET(m, M_NOWAIT); |
625 if ((m->m_flags & M_EXT) == 0) { 626 m_free(m); 627 m_freem(top); 628 return(NULL); /* out of mbuf clusters */ 629 } 630 m->m_len = MCLBYTES; 631 } 632 m->m_len = min(totlen, m->m_len); --- 1132 unchanged lines hidden (view full) --- 1765 1766 if (off) { 1767 if ((m->m_flags & M_EXT) == 0) { 1768 bcopy(d, d - off, m->m_len); /* ALIGN! (with costly data copy...) */ 1769 d -= off; 1770 m->m_data = (caddr_t)d; 1771 } else { 1772 /* can't write to an M_EXT mbuf since it may be shared */ | 625 if ((m->m_flags & M_EXT) == 0) { 626 m_free(m); 627 m_freem(top); 628 return(NULL); /* out of mbuf clusters */ 629 } 630 m->m_len = MCLBYTES; 631 } 632 m->m_len = min(totlen, m->m_len); --- 1132 unchanged lines hidden (view full) --- 1765 1766 if (off) { 1767 if ((m->m_flags & M_EXT) == 0) { 1768 bcopy(d, d - off, m->m_len); /* ALIGN! (with costly data copy...) */ 1769 d -= off; 1770 m->m_data = (caddr_t)d; 1771 } else { 1772 /* can't write to an M_EXT mbuf since it may be shared */ |
1773 MGET(new, M_DONTWAIT, MT_DATA); | 1773 MGET(new, M_NOWAIT, MT_DATA); |
1774 if (!new) { 1775 EN_COUNT(sc->mfixfail); 1776 return(0); 1777 } | 1774 if (!new) { 1775 EN_COUNT(sc->mfixfail); 1776 return(0); 1777 } |
1778 MCLGET(new, M_DONTWAIT); | 1778 MCLGET(new, M_NOWAIT); |
1779 if ((new->m_flags & M_EXT) == 0) { 1780 m_free(new); 1781 EN_COUNT(sc->mfixfail); 1782 return(0); 1783 } 1784 bcopy(d, new->m_data, m->m_len); /* ALIGN! (with costly data copy...) */ 1785 new->m_len = m->m_len; 1786 new->m_next = m->m_next; --- 45 unchanged lines hidden (view full) --- 1832 /* external buffer isn't an ordinary mbuf cluster! */ 1833 printf("%s: mfix: special buffer! can't make a copy!\n", 1834 sc->sc_dev.dv_xname); 1835 return (0); 1836 } 1837 1838 if (MEXT_IS_REF(m)) { 1839 /* make a real copy of the M_EXT mbuf since it is shared */ | 1779 if ((new->m_flags & M_EXT) == 0) { 1780 m_free(new); 1781 EN_COUNT(sc->mfixfail); 1782 return(0); 1783 } 1784 bcopy(d, new->m_data, m->m_len); /* ALIGN! (with costly data copy...) */ 1785 new->m_len = m->m_len; 1786 new->m_next = m->m_next; --- 45 unchanged lines hidden (view full) --- 1832 /* external buffer isn't an ordinary mbuf cluster! */ 1833 printf("%s: mfix: special buffer! can't make a copy!\n", 1834 sc->sc_dev.dv_xname); 1835 return (0); 1836 } 1837 1838 if (MEXT_IS_REF(m)) { 1839 /* make a real copy of the M_EXT mbuf since it is shared */ |
1840 MGET(new, M_DONTWAIT, MT_DATA); | 1840 MGET(new, M_NOWAIT, MT_DATA); |
1841 if (!new) { 1842 EN_COUNT(sc->mfixfail); 1843 return(0); 1844 } 1845 if (m->m_flags & M_PKTHDR) 1846 M_MOVE_PKTHDR(new, m); | 1841 if (!new) { 1842 EN_COUNT(sc->mfixfail); 1843 return(0); 1844 } 1845 if (m->m_flags & M_PKTHDR) 1846 M_MOVE_PKTHDR(new, m); |
1847 MCLGET(new, M_DONTWAIT); | 1847 MCLGET(new, M_NOWAIT); |
1848 if ((new->m_flags & M_EXT) == 0) { 1849 m_free(new); 1850 EN_COUNT(sc->mfixfail); 1851 return(0); 1852 } 1853 bcopy(m->m_data, new->m_data, m->m_len); 1854 new->m_len = m->m_len; 1855 new->m_next = m->m_next; --- 1612 unchanged lines hidden --- | 1848 if ((new->m_flags & M_EXT) == 0) { 1849 m_free(new); 1850 EN_COUNT(sc->mfixfail); 1851 return(0); 1852 } 1853 bcopy(m->m_data, new->m_data, m->m_len); 1854 new->m_len = m->m_len; 1855 new->m_next = m->m_next; --- 1612 unchanged lines hidden --- |