if_my.c (106937) | if_my.c (109623) |
---|---|
1/* 2 * Copyright (c) 2002 Myson Technology Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * Written by: yen_cw@myson.com.tw available at: http://www.myson.com.tw/ 27 * | 1/* 2 * Copyright (c) 2002 Myson Technology Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * Written by: yen_cw@myson.com.tw available at: http://www.myson.com.tw/ 27 * |
28 * $FreeBSD: head/sys/dev/my/if_my.c 106937 2002-11-14 23:54:55Z sam $ | 28 * $FreeBSD: head/sys/dev/my/if_my.c 109623 2003-01-21 08:56:16Z alfred $ |
29 * 30 * Myson fast ethernet PCI NIC driver 31 */ 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/sockio.h> 35#include <sys/mbuf.h> 36#include <sys/malloc.h> --- 1137 unchanged lines hidden (view full) --- 1174 * Initialize an RX descriptor and attach an MBUF cluster. 1175 */ 1176static int 1177my_newbuf(struct my_softc * sc, struct my_chain_onefrag * c) 1178{ 1179 struct mbuf *m_new = NULL; 1180 1181 MY_LOCK(sc); | 29 * 30 * Myson fast ethernet PCI NIC driver 31 */ 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/sockio.h> 35#include <sys/mbuf.h> 36#include <sys/malloc.h> --- 1137 unchanged lines hidden (view full) --- 1174 * Initialize an RX descriptor and attach an MBUF cluster. 1175 */ 1176static int 1177my_newbuf(struct my_softc * sc, struct my_chain_onefrag * c) 1178{ 1179 struct mbuf *m_new = NULL; 1180 1181 MY_LOCK(sc); |
1182 MGETHDR(m_new, M_DONTWAIT, MT_DATA); | 1182 MGETHDR(m_new, M_NOWAIT, MT_DATA); |
1183 if (m_new == NULL) { 1184 printf("my%d: no memory for rx list -- packet dropped!\n", 1185 sc->my_unit); 1186 MY_UNLOCK(sc); 1187 return (ENOBUFS); 1188 } | 1183 if (m_new == NULL) { 1184 printf("my%d: no memory for rx list -- packet dropped!\n", 1185 sc->my_unit); 1186 MY_UNLOCK(sc); 1187 return (ENOBUFS); 1188 } |
1189 MCLGET(m_new, M_DONTWAIT); | 1189 MCLGET(m_new, M_NOWAIT); |
1190 if (!(m_new->m_flags & M_EXT)) { 1191 printf("my%d: no memory for rx list -- packet dropped!\n", 1192 sc->my_unit); 1193 m_freem(m_new); 1194 MY_UNLOCK(sc); 1195 return (ENOBUFS); 1196 } 1197 c->my_mbuf = m_new; --- 248 unchanged lines hidden (view full) --- 1446 for (m = m_head; m != NULL; m = m->m_next) 1447 total_len += m->m_len; 1448 /* 1449 * Start packing the mbufs in this chain into the fragment pointers. 1450 * Stop when we run out of fragments or hit the end of the mbuf 1451 * chain. 1452 */ 1453 m = m_head; | 1190 if (!(m_new->m_flags & M_EXT)) { 1191 printf("my%d: no memory for rx list -- packet dropped!\n", 1192 sc->my_unit); 1193 m_freem(m_new); 1194 MY_UNLOCK(sc); 1195 return (ENOBUFS); 1196 } 1197 c->my_mbuf = m_new; --- 248 unchanged lines hidden (view full) --- 1446 for (m = m_head; m != NULL; m = m->m_next) 1447 total_len += m->m_len; 1448 /* 1449 * Start packing the mbufs in this chain into the fragment pointers. 1450 * Stop when we run out of fragments or hit the end of the mbuf 1451 * chain. 1452 */ 1453 m = m_head; |
1454 MGETHDR(m_new, M_DONTWAIT, MT_DATA); | 1454 MGETHDR(m_new, M_NOWAIT, MT_DATA); |
1455 if (m_new == NULL) { 1456 printf("my%d: no memory for tx list", sc->my_unit); 1457 MY_UNLOCK(sc); 1458 return (1); 1459 } 1460 if (m_head->m_pkthdr.len > MHLEN) { | 1455 if (m_new == NULL) { 1456 printf("my%d: no memory for tx list", sc->my_unit); 1457 MY_UNLOCK(sc); 1458 return (1); 1459 } 1460 if (m_head->m_pkthdr.len > MHLEN) { |
1461 MCLGET(m_new, M_DONTWAIT); | 1461 MCLGET(m_new, M_NOWAIT); |
1462 if (!(m_new->m_flags & M_EXT)) { 1463 m_freem(m_new); 1464 printf("my%d: no memory for tx list", sc->my_unit); 1465 MY_UNLOCK(sc); 1466 return (1); 1467 } 1468 } 1469 m_copydata(m_head, 0, m_head->m_pkthdr.len, mtod(m_new, caddr_t)); --- 406 unchanged lines hidden --- | 1462 if (!(m_new->m_flags & M_EXT)) { 1463 m_freem(m_new); 1464 printf("my%d: no memory for tx list", sc->my_unit); 1465 MY_UNLOCK(sc); 1466 return (1); 1467 } 1468 } 1469 m_copydata(m_head, 0, m_head->m_pkthdr.len, mtod(m_new, caddr_t)); --- 406 unchanged lines hidden --- |