Deleted Added
full compact
if_tl.c (51533) if_tl.c (51583)
1/*
2 * Copyright (c) 1997, 1998
3 * Bill Paul <wpaul@ctr.columbia.edu>. 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

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

24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 *
1/*
2 * Copyright (c) 1997, 1998
3 * Bill Paul <wpaul@ctr.columbia.edu>. 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

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

24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * $FreeBSD: head/sys/pci/if_tl.c 51533 1999-09-22 06:08:11Z wpaul $
32 * $FreeBSD: head/sys/pci/if_tl.c 51583 1999-09-23 03:32:57Z wpaul $
33 */
34
35/*
36 * Texas Instruments ThunderLAN driver for FreeBSD 2.2.6 and 3.x.
37 * Supports many Compaq PCI NICs based on the ThunderLAN ethernet controller,
38 * the National Semiconductor DP83840A physical interface and the
39 * Microchip Technology 24Cxx series serial EEPROM.
40 *

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

173 *
174 * Using these techniques, this driver achieves very high performance
175 * by minimizing the amount of interrupts generated during large
176 * transfers and by completely avoiding buffer copies. Frame transfer
177 * to and from the ThunderLAN chip is performed entirely by the chip
178 * itself thereby reducing the load on the host CPU.
179 */
180
33 */
34
35/*
36 * Texas Instruments ThunderLAN driver for FreeBSD 2.2.6 and 3.x.
37 * Supports many Compaq PCI NICs based on the ThunderLAN ethernet controller,
38 * the National Semiconductor DP83840A physical interface and the
39 * Microchip Technology 24Cxx series serial EEPROM.
40 *

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

173 *
174 * Using these techniques, this driver achieves very high performance
175 * by minimizing the amount of interrupts generated during large
176 * transfers and by completely avoiding buffer copies. Frame transfer
177 * to and from the ThunderLAN chip is performed entirely by the chip
178 * itself thereby reducing the load on the host CPU.
179 */
180
181#include "bpf.h"
182
183#include <sys/param.h>
184#include <sys/systm.h>
185#include <sys/sockio.h>
186#include <sys/mbuf.h>
187#include <sys/malloc.h>
188#include <sys/kernel.h>
189#include <sys/socket.h>
190
191#include <net/if.h>
192#include <net/if_arp.h>
193#include <net/ethernet.h>
194#include <net/if_dl.h>
195#include <net/if_media.h>
196
181#include <sys/param.h>
182#include <sys/systm.h>
183#include <sys/sockio.h>
184#include <sys/mbuf.h>
185#include <sys/malloc.h>
186#include <sys/kernel.h>
187#include <sys/socket.h>
188
189#include <net/if.h>
190#include <net/if_arp.h>
191#include <net/ethernet.h>
192#include <net/if_dl.h>
193#include <net/if_media.h>
194
197#if NBPF > 0
198#include <net/bpf.h>
195#include <net/bpf.h>
199#endif
200
201#include <vm/vm.h> /* for vtophys */
202#include <vm/pmap.h> /* for vtophys */
203#include <machine/clock.h> /* for DELAY */
204#include <machine/bus_memio.h>
205#include <machine/bus_pio.h>
206#include <machine/bus.h>
207#include <machine/resource.h>

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

223
224#include <pci/if_tlreg.h>
225
226/* "controller miibus0" required. See GENERIC if you get errors here. */
227#include "miibus_if.h"
228
229#if !defined(lint)
230static const char rcsid[] =
196
197#include <vm/vm.h> /* for vtophys */
198#include <vm/pmap.h> /* for vtophys */
199#include <machine/clock.h> /* for DELAY */
200#include <machine/bus_memio.h>
201#include <machine/bus_pio.h>
202#include <machine/bus.h>
203#include <machine/resource.h>

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

219
220#include <pci/if_tlreg.h>
221
222/* "controller miibus0" required. See GENERIC if you get errors here. */
223#include "miibus_if.h"
224
225#if !defined(lint)
226static const char rcsid[] =
231 "$FreeBSD: head/sys/pci/if_tl.c 51533 1999-09-22 06:08:11Z wpaul $";
227 "$FreeBSD: head/sys/pci/if_tl.c 51583 1999-09-23 03:32:57Z wpaul $";
232#endif
233
234/*
235 * Various supported device vendors/types and their names.
236 */
237
238static struct tl_type tl_devs[] = {
239 { TI_VENDORID, TI_DEVICEID_THUNDERLAN,

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

1337 }
1338
1339 /*
1340 * Call MI attach routines.
1341 */
1342 if_attach(ifp);
1343 ether_ifattach(ifp);
1344
228#endif
229
230/*
231 * Various supported device vendors/types and their names.
232 */
233
234static struct tl_type tl_devs[] = {
235 { TI_VENDORID, TI_DEVICEID_THUNDERLAN,

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

1333 }
1334
1335 /*
1336 * Call MI attach routines.
1337 */
1338 if_attach(ifp);
1339 ether_ifattach(ifp);
1340
1345#if NBPF > 0
1346 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
1341 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
1347#endif
1348
1349fail:
1350 splx(s);
1351 return(error);
1352}
1353
1354static int tl_detach(dev)
1355 device_t dev;

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

1546 */
1547 /*if (ifp->if_flags & IFF_PROMISC && */
1548 if (!bcmp(eh->ether_shost, sc->arpcom.ac_enaddr,
1549 ETHER_ADDR_LEN)) {
1550 m_freem(m);
1551 continue;
1552 }
1553
1342
1343fail:
1344 splx(s);
1345 return(error);
1346}
1347
1348static int tl_detach(dev)
1349 device_t dev;

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

1540 */
1541 /*if (ifp->if_flags & IFF_PROMISC && */
1542 if (!bcmp(eh->ether_shost, sc->arpcom.ac_enaddr,
1543 ETHER_ADDR_LEN)) {
1544 m_freem(m);
1545 continue;
1546 }
1547
1554#if NBPF > 0
1555 /*
1556 * Handle BPF listeners. Let the BPF user see the packet, but
1557 * don't pass it up to the ether_input() layer unless it's
1558 * a broadcast packet, multicast packet, matches our ethernet
1559 * address or the interface is in promiscuous mode. If we don't
1560 * want the packet, just forget it. We leave the mbuf in place
1561 * since it can be used again later.
1562 */
1563 if (ifp->if_bpf) {
1564 m->m_pkthdr.len = m->m_len = total_len;
1565 bpf_mtap(ifp, m);
1566 if (ifp->if_flags & IFF_PROMISC &&
1567 (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
1568 ETHER_ADDR_LEN) &&
1569 (eh->ether_dhost[0] & 1) == 0)) {
1570 m_freem(m);
1571 continue;
1572 }
1573 }
1548 /*
1549 * Handle BPF listeners. Let the BPF user see the packet, but
1550 * don't pass it up to the ether_input() layer unless it's
1551 * a broadcast packet, multicast packet, matches our ethernet
1552 * address or the interface is in promiscuous mode. If we don't
1553 * want the packet, just forget it. We leave the mbuf in place
1554 * since it can be used again later.
1555 */
1556 if (ifp->if_bpf) {
1557 m->m_pkthdr.len = m->m_len = total_len;
1558 bpf_mtap(ifp, m);
1559 if (ifp->if_flags & IFF_PROMISC &&
1560 (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
1561 ETHER_ADDR_LEN) &&
1562 (eh->ether_dhost[0] & 1) == 0)) {
1563 m_freem(m);
1564 continue;
1565 }
1566 }
1574#endif
1567
1575 /* Remove header from mbuf and pass it on. */
1576 m->m_pkthdr.len = m->m_len =
1577 total_len - sizeof(struct ether_header);
1578 m->m_data += sizeof(struct ether_header);
1579 ether_input(ifp, eh, m);
1580 }
1581
1582 return(r);

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

2006 prev->tl_ptr->tlist_fptr = vtophys(cur_tx->tl_ptr);
2007 }
2008 prev = cur_tx;
2009
2010 /*
2011 * If there's a BPF listener, bounce a copy of this frame
2012 * to him.
2013 */
1568 /* Remove header from mbuf and pass it on. */
1569 m->m_pkthdr.len = m->m_len =
1570 total_len - sizeof(struct ether_header);
1571 m->m_data += sizeof(struct ether_header);
1572 ether_input(ifp, eh, m);
1573 }
1574
1575 return(r);

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

1999 prev->tl_ptr->tlist_fptr = vtophys(cur_tx->tl_ptr);
2000 }
2001 prev = cur_tx;
2002
2003 /*
2004 * If there's a BPF listener, bounce a copy of this frame
2005 * to him.
2006 */
2014#if NBPF > 0
2015 if (ifp->if_bpf)
2016 bpf_mtap(ifp, cur_tx->tl_mbuf);
2007 if (ifp->if_bpf)
2008 bpf_mtap(ifp, cur_tx->tl_mbuf);
2017#endif
2018 }
2019
2020 /*
2021 * If there are no packets queued, bail.
2022 */
2023 if (cur_tx == NULL)
2024 return;
2025

--- 335 unchanged lines hidden ---
2009 }
2010
2011 /*
2012 * If there are no packets queued, bail.
2013 */
2014 if (cur_tx == NULL)
2015 return;
2016

--- 335 unchanged lines hidden ---