Deleted Added
full compact
if_de.c (108533) if_de.c (109623)
1/* $NetBSD: if_de.c,v 1.86 1999/06/01 19:17:59 thorpej Exp $ */
2
1/* $NetBSD: if_de.c,v 1.86 1999/06/01 19:17:59 thorpej Exp $ */
2
3/* $FreeBSD: head/sys/dev/de/if_de.c 108533 2003-01-01 18:49:04Z schweikh $ */
3/* $FreeBSD: head/sys/dev/de/if_de.c 109623 2003-01-21 08:56:16Z alfred $ */
4
5/*-
6 * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com)
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:

--- 178 unchanged lines hidden (view full) ---

190 struct mbuf *m;
191 /*
192 * Before we are sure this is the right media we need
193 * to send a small packet to make sure there's carrier.
194 * Strangely, BNC and AUI will "see" receive data if
195 * either is connected so the transmit is the only way
196 * to verify the connectivity.
197 */
4
5/*-
6 * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com)
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:

--- 178 unchanged lines hidden (view full) ---

190 struct mbuf *m;
191 /*
192 * Before we are sure this is the right media we need
193 * to send a small packet to make sure there's carrier.
194 * Strangely, BNC and AUI will "see" receive data if
195 * either is connected so the transmit is the only way
196 * to verify the connectivity.
197 */
198 MGETHDR(m, M_DONTWAIT, MT_DATA);
198 MGETHDR(m, M_NOWAIT, MT_DATA);
199 if (m == NULL)
200 return 0;
201 /*
202 * Construct a LLC TEST message which will point to ourselves.
203 */
204 bcopy(sc->tulip_enaddr, mtod(m, struct ether_header *)->ether_dhost, 6);
205 bcopy(sc->tulip_enaddr, mtod(m, struct ether_header *)->ether_shost, 6);
206 mtod(m, struct ether_header *)->ether_type = htons(3);

--- 3333 unchanged lines hidden (view full) ---

3540 *
3541 * Note that if this packet crossed multiple descriptors
3542 * we don't even try to reallocate all the mbufs here.
3543 * Instead we rely on the test of the beginning of
3544 * the loop to refill for the extra consumed mbufs.
3545 */
3546 if (accept || ms == NULL) {
3547 struct mbuf *m0;
199 if (m == NULL)
200 return 0;
201 /*
202 * Construct a LLC TEST message which will point to ourselves.
203 */
204 bcopy(sc->tulip_enaddr, mtod(m, struct ether_header *)->ether_dhost, 6);
205 bcopy(sc->tulip_enaddr, mtod(m, struct ether_header *)->ether_shost, 6);
206 mtod(m, struct ether_header *)->ether_type = htons(3);

--- 3333 unchanged lines hidden (view full) ---

3540 *
3541 * Note that if this packet crossed multiple descriptors
3542 * we don't even try to reallocate all the mbufs here.
3543 * Instead we rely on the test of the beginning of
3544 * the loop to refill for the extra consumed mbufs.
3545 */
3546 if (accept || ms == NULL) {
3547 struct mbuf *m0;
3548 MGETHDR(m0, M_DONTWAIT, MT_DATA);
3548 MGETHDR(m0, M_NOWAIT, MT_DATA);
3549 if (m0 != NULL) {
3550#if defined(TULIP_COPY_RXDATA)
3551 if (!accept || total_len >= (MHLEN - 2)) {
3552#endif
3549 if (m0 != NULL) {
3550#if defined(TULIP_COPY_RXDATA)
3551 if (!accept || total_len >= (MHLEN - 2)) {
3552#endif
3553 MCLGET(m0, M_DONTWAIT);
3553 MCLGET(m0, M_NOWAIT);
3554 if ((m0->m_flags & M_EXT) == 0) {
3555 m_freem(m0);
3556 m0 = NULL;
3557 }
3558#if defined(TULIP_COPY_RXDATA)
3559 }
3560#endif
3561 }

--- 494 unchanged lines hidden (view full) ---

4056}
4057
4058static struct mbuf *
4059tulip_mbuf_compress(
4060 struct mbuf *m)
4061{
4062 struct mbuf *m0;
4063#if MCLBYTES >= ETHERMTU + 18 && !defined(BIG_PACKET)
3554 if ((m0->m_flags & M_EXT) == 0) {
3555 m_freem(m0);
3556 m0 = NULL;
3557 }
3558#if defined(TULIP_COPY_RXDATA)
3559 }
3560#endif
3561 }

--- 494 unchanged lines hidden (view full) ---

4056}
4057
4058static struct mbuf *
4059tulip_mbuf_compress(
4060 struct mbuf *m)
4061{
4062 struct mbuf *m0;
4063#if MCLBYTES >= ETHERMTU + 18 && !defined(BIG_PACKET)
4064 MGETHDR(m0, M_DONTWAIT, MT_DATA);
4064 MGETHDR(m0, M_NOWAIT, MT_DATA);
4065 if (m0 != NULL) {
4066 if (m->m_pkthdr.len > MHLEN) {
4065 if (m0 != NULL) {
4066 if (m->m_pkthdr.len > MHLEN) {
4067 MCLGET(m0, M_DONTWAIT);
4067 MCLGET(m0, M_NOWAIT);
4068 if ((m0->m_flags & M_EXT) == 0) {
4069 m_freem(m);
4070 m_freem(m0);
4071 return NULL;
4072 }
4073 }
4074 m_copydata(m, 0, m->m_pkthdr.len, mtod(m0, caddr_t));
4075 m0->m_pkthdr.len = m0->m_len = m->m_pkthdr.len;
4076 }
4077#else
4078 int mlen = MHLEN;
4079 int len = m->m_pkthdr.len;
4080 struct mbuf **mp = &m0;
4081
4082 while (len > 0) {
4083 if (mlen == MHLEN) {
4068 if ((m0->m_flags & M_EXT) == 0) {
4069 m_freem(m);
4070 m_freem(m0);
4071 return NULL;
4072 }
4073 }
4074 m_copydata(m, 0, m->m_pkthdr.len, mtod(m0, caddr_t));
4075 m0->m_pkthdr.len = m0->m_len = m->m_pkthdr.len;
4076 }
4077#else
4078 int mlen = MHLEN;
4079 int len = m->m_pkthdr.len;
4080 struct mbuf **mp = &m0;
4081
4082 while (len > 0) {
4083 if (mlen == MHLEN) {
4084 MGETHDR(*mp, M_DONTWAIT, MT_DATA);
4084 MGETHDR(*mp, M_NOWAIT, MT_DATA);
4085 } else {
4085 } else {
4086 MGET(*mp, M_DONTWAIT, MT_DATA);
4086 MGET(*mp, M_NOWAIT, MT_DATA);
4087 }
4088 if (*mp == NULL) {
4089 m_freem(m0);
4090 m0 = NULL;
4091 break;
4092 }
4093 if (len > MLEN) {
4087 }
4088 if (*mp == NULL) {
4089 m_freem(m0);
4090 m0 = NULL;
4091 break;
4092 }
4093 if (len > MLEN) {
4094 MCLGET(*mp, M_DONTWAIT);
4094 MCLGET(*mp, M_NOWAIT);
4095 if (((*mp)->m_flags & M_EXT) == 0) {
4096 m_freem(m0);
4097 m0 = NULL;
4098 break;
4099 }
4100 (*mp)->m_len = len <= MCLBYTES ? len : MCLBYTES;
4101 } else {
4102 (*mp)->m_len = len <= mlen ? len : mlen;

--- 1160 unchanged lines hidden ---
4095 if (((*mp)->m_flags & M_EXT) == 0) {
4096 m_freem(m0);
4097 m0 = NULL;
4098 break;
4099 }
4100 (*mp)->m_len = len <= MCLBYTES ? len : MCLBYTES;
4101 } else {
4102 (*mp)->m_len = len <= mlen ? len : mlen;

--- 1160 unchanged lines hidden ---