if_wb.c (48443) | if_wb.c (48645) |
---|---|
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 * $Id: if_wb.c,v 1.10 1999/05/13 20:36:00 wpaul Exp $ | 32 * $Id: if_wb.c,v 1.11 1999/07/02 04:17:16 peter Exp $ |
33 */ 34 35/* 36 * Winbond fast ethernet PCI NIC driver 37 * 38 * Supports various cheap network adapters based on the Winbond W89C840F 39 * fast ethernet controller chip. This includes adapters manufactured by 40 * Winbond itself and some made by Linksys. --- 37 unchanged lines hidden (view full) --- 78 * 79 * Note: the author of the Linux driver for the Winbond chip alludes 80 * to some sort of flaw in the chip's design that seems to mandate some 81 * drastic workaround which signigicantly impairs transmit performance. 82 * I have no idea what he's on about: transmit performance with all 83 * three of my test boards seems fine. 84 */ 85 | 33 */ 34 35/* 36 * Winbond fast ethernet PCI NIC driver 37 * 38 * Supports various cheap network adapters based on the Winbond W89C840F 39 * fast ethernet controller chip. This includes adapters manufactured by 40 * Winbond itself and some made by Linksys. --- 37 unchanged lines hidden (view full) --- 78 * 79 * Note: the author of the Linux driver for the Winbond chip alludes 80 * to some sort of flaw in the chip's design that seems to mandate some 81 * drastic workaround which signigicantly impairs transmit performance. 82 * I have no idea what he's on about: transmit performance with all 83 * three of my test boards seems fine. 84 */ 85 |
86#include "bpfilter.h" | 86#include "bpf.h" |
87 88#include <sys/param.h> 89#include <sys/systm.h> 90#include <sys/sockio.h> 91#include <sys/mbuf.h> 92#include <sys/malloc.h> 93#include <sys/kernel.h> 94#include <sys/socket.h> 95 96#include <net/if.h> 97#include <net/if_arp.h> 98#include <net/ethernet.h> 99#include <net/if_dl.h> 100#include <net/if_media.h> 101 | 87 88#include <sys/param.h> 89#include <sys/systm.h> 90#include <sys/sockio.h> 91#include <sys/mbuf.h> 92#include <sys/malloc.h> 93#include <sys/kernel.h> 94#include <sys/socket.h> 95 96#include <net/if.h> 97#include <net/if_arp.h> 98#include <net/ethernet.h> 99#include <net/if_dl.h> 100#include <net/if_media.h> 101 |
102#if NBPFILTER > 0 | 102#if NBPF > 0 |
103#include <net/bpf.h> 104#endif 105 106#include <vm/vm.h> /* for vtophys */ 107#include <vm/pmap.h> /* for vtophys */ 108#include <machine/clock.h> /* for DELAY */ 109#include <machine/bus_memio.h> 110#include <machine/bus_pio.h> --- 5 unchanged lines hidden (view full) --- 116#define WB_USEIOSPACE 117 118/* #define WB_BACKGROUND_AUTONEG */ 119 120#include <pci/if_wbreg.h> 121 122#ifndef lint 123static const char rcsid[] = | 103#include <net/bpf.h> 104#endif 105 106#include <vm/vm.h> /* for vtophys */ 107#include <vm/pmap.h> /* for vtophys */ 108#include <machine/clock.h> /* for DELAY */ 109#include <machine/bus_memio.h> 110#include <machine/bus_pio.h> --- 5 unchanged lines hidden (view full) --- 116#define WB_USEIOSPACE 117 118/* #define WB_BACKGROUND_AUTONEG */ 119 120#include <pci/if_wbreg.h> 121 122#ifndef lint 123static const char rcsid[] = |
124 "$Id: if_wb.c,v 1.10 1999/05/13 20:36:00 wpaul Exp $"; | 124 "$Id: if_wb.c,v 1.11 1999/07/02 04:17:16 peter Exp $"; |
125#endif 126 127/* 128 * Various supported device vendors/types and their names. 129 */ 130static struct wb_type wb_devs[] = { 131 { WB_VENDORID, WB_DEVICEID_840F, 132 "Winbond W89C840F 10/100BaseTX" }, --- 1090 unchanged lines hidden (view full) --- 1223 ifmedia_set(&sc->ifmedia, media); 1224 1225 /* 1226 * Call MI attach routines. 1227 */ 1228 if_attach(ifp); 1229 ether_ifattach(ifp); 1230 | 125#endif 126 127/* 128 * Various supported device vendors/types and their names. 129 */ 130static struct wb_type wb_devs[] = { 131 { WB_VENDORID, WB_DEVICEID_840F, 132 "Winbond W89C840F 10/100BaseTX" }, --- 1090 unchanged lines hidden (view full) --- 1223 ifmedia_set(&sc->ifmedia, media); 1224 1225 /* 1226 * Call MI attach routines. 1227 */ 1228 if_attach(ifp); 1229 ether_ifattach(ifp); 1230 |
1231#if NBPFILTER > 0 | 1231#if NBPF > 0 |
1232 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); 1233#endif 1234 at_shutdown(wb_shutdown, sc, SHUTDOWN_POST_SYNC); 1235 1236fail: 1237 splx(s); 1238 return; 1239} --- 178 unchanged lines hidden (view full) --- 1418 } 1419 m->m_pkthdr.rcvif = ifp; 1420 m->m_pkthdr.len = m->m_len = total_len; 1421 } 1422 1423 ifp->if_ipackets++; 1424 eh = mtod(m, struct ether_header *); 1425 | 1232 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); 1233#endif 1234 at_shutdown(wb_shutdown, sc, SHUTDOWN_POST_SYNC); 1235 1236fail: 1237 splx(s); 1238 return; 1239} --- 178 unchanged lines hidden (view full) --- 1418 } 1419 m->m_pkthdr.rcvif = ifp; 1420 m->m_pkthdr.len = m->m_len = total_len; 1421 } 1422 1423 ifp->if_ipackets++; 1424 eh = mtod(m, struct ether_header *); 1425 |
1426#if NBPFILTER > 0 | 1426#if NBPF > 0 |
1427 /* 1428 * Handle BPF listeners. Let the BPF user see the packet, but 1429 * don't pass it up to the ether_input() layer unless it's 1430 * a broadcast packet, multicast packet, matches our ethernet 1431 * address or the interface is in promiscuous mode. 1432 */ 1433 if (ifp->if_bpf) { 1434 bpf_mtap(ifp, m); --- 332 unchanged lines hidden (view full) --- 1767 sc->wb_cdata.wb_tx_free = cur_tx->wb_nextdesc; 1768 1769 /* Pack the data into the descriptor. */ 1770 wb_encap(sc, cur_tx, m_head); 1771 1772 if (cur_tx != start_tx) 1773 WB_TXOWN(cur_tx) = WB_TXSTAT_OWN; 1774 | 1427 /* 1428 * Handle BPF listeners. Let the BPF user see the packet, but 1429 * don't pass it up to the ether_input() layer unless it's 1430 * a broadcast packet, multicast packet, matches our ethernet 1431 * address or the interface is in promiscuous mode. 1432 */ 1433 if (ifp->if_bpf) { 1434 bpf_mtap(ifp, m); --- 332 unchanged lines hidden (view full) --- 1767 sc->wb_cdata.wb_tx_free = cur_tx->wb_nextdesc; 1768 1769 /* Pack the data into the descriptor. */ 1770 wb_encap(sc, cur_tx, m_head); 1771 1772 if (cur_tx != start_tx) 1773 WB_TXOWN(cur_tx) = WB_TXSTAT_OWN; 1774 |
1775#if NBPFILTER > 0 | 1775#if NBPF > 0 |
1776 /* 1777 * If there's a BPF listener, bounce a copy of this frame 1778 * to him. 1779 */ 1780 if (ifp->if_bpf) 1781 bpf_mtap(ifp, cur_tx->wb_mbuf); 1782#endif 1783 } --- 368 unchanged lines hidden --- | 1776 /* 1777 * If there's a BPF listener, bounce a copy of this frame 1778 * to him. 1779 */ 1780 if (ifp->if_bpf) 1781 bpf_mtap(ifp, cur_tx->wb_mbuf); 1782#endif 1783 } --- 368 unchanged lines hidden --- |