if_wb.c (51533) | if_wb.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_wb.c 51533 1999-09-22 06:08:11Z wpaul $ | 32 * $FreeBSD: head/sys/pci/if_wb.c 51583 1999-09-23 03:32:57Z wpaul $ |
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 "bpf.h" | |
87#include "opt_bdg.h" 88 89#include <sys/param.h> 90#include <sys/systm.h> 91#include <sys/sockio.h> 92#include <sys/mbuf.h> 93#include <sys/malloc.h> 94#include <sys/kernel.h> 95#include <sys/socket.h> 96#include <sys/queue.h> 97 98#include <net/if.h> 99#include <net/if_arp.h> 100#include <net/ethernet.h> 101#include <net/if_dl.h> 102#include <net/if_media.h> 103 | 86#include "opt_bdg.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#include <sys/queue.h> 96 97#include <net/if.h> 98#include <net/if_arp.h> 99#include <net/ethernet.h> 100#include <net/if_dl.h> 101#include <net/if_media.h> 102 |
104#if NBPF > 0 | |
105#include <net/bpf.h> | 103#include <net/bpf.h> |
106#endif | |
107 108#ifdef BRIDGE 109#include <net/bridge.h> 110#endif 111 112#include <vm/vm.h> /* for vtophys */ 113#include <vm/pmap.h> /* for vtophys */ 114#include <machine/clock.h> /* for DELAY */ --- 14 unchanged lines hidden (view full) --- 129#include "miibus_if.h" 130 131#define WB_USEIOSPACE 132 133#include <pci/if_wbreg.h> 134 135#ifndef lint 136static const char rcsid[] = | 104 105#ifdef BRIDGE 106#include <net/bridge.h> 107#endif 108 109#include <vm/vm.h> /* for vtophys */ 110#include <vm/pmap.h> /* for vtophys */ 111#include <machine/clock.h> /* for DELAY */ --- 14 unchanged lines hidden (view full) --- 126#include "miibus_if.h" 127 128#define WB_USEIOSPACE 129 130#include <pci/if_wbreg.h> 131 132#ifndef lint 133static const char rcsid[] = |
137 "$FreeBSD: head/sys/pci/if_wb.c 51533 1999-09-22 06:08:11Z wpaul $"; | 134 "$FreeBSD: head/sys/pci/if_wb.c 51583 1999-09-23 03:32:57Z wpaul $"; |
138#endif 139 140/* 141 * Various supported device vendors/types and their names. 142 */ 143static struct wb_type wb_devs[] = { 144 { WB_VENDORID, WB_DEVICEID_840F, 145 "Winbond W89C840F 10/100BaseTX" }, --- 826 unchanged lines hidden (view full) --- 972 } 973 974 /* 975 * Call MI attach routines. 976 */ 977 if_attach(ifp); 978 ether_ifattach(ifp); 979 | 135#endif 136 137/* 138 * Various supported device vendors/types and their names. 139 */ 140static struct wb_type wb_devs[] = { 141 { WB_VENDORID, WB_DEVICEID_840F, 142 "Winbond W89C840F 10/100BaseTX" }, --- 826 unchanged lines hidden (view full) --- 969 } 970 971 /* 972 * Call MI attach routines. 973 */ 974 if_attach(ifp); 975 ether_ifattach(ifp); 976 |
980#if NBPF > 0 | |
981 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); | 977 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); |
982#endif | |
983 984fail: 985 if (error) 986 device_delete_child(dev, sc->wb_miibus); 987 splx(s); 988 989 return(error); 990} --- 224 unchanged lines hidden (view full) --- 1215 if (((bdg_ifp != BDG_LOCAL) && (bdg_ifp != BDG_BCAST) && 1216 (bdg_ifp != BDG_MCAST)) || bdg_ifp == BDG_DROP) { 1217 m_freem(m); 1218 break; 1219 } 1220 } 1221#endif 1222 | 978 979fail: 980 if (error) 981 device_delete_child(dev, sc->wb_miibus); 982 splx(s); 983 984 return(error); 985} --- 224 unchanged lines hidden (view full) --- 1210 if (((bdg_ifp != BDG_LOCAL) && (bdg_ifp != BDG_BCAST) && 1211 (bdg_ifp != BDG_MCAST)) || bdg_ifp == BDG_DROP) { 1212 m_freem(m); 1213 break; 1214 } 1215 } 1216#endif 1217 |
1223#if NBPF > 0 | |
1224 /* 1225 * Handle BPF listeners. Let the BPF user see the packet, but 1226 * don't pass it up to the ether_input() layer unless it's 1227 * a broadcast packet, multicast packet, matches our ethernet 1228 * address or the interface is in promiscuous mode. 1229 */ 1230 if (ifp->if_bpf) { 1231 bpf_mtap(ifp, m); 1232 if (ifp->if_flags & IFF_PROMISC && 1233 (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, 1234 ETHER_ADDR_LEN) && 1235 (eh->ether_dhost[0] & 1) == 0)) { 1236 m_freem(m); 1237 break; 1238 } 1239 } | 1218 /* 1219 * Handle BPF listeners. Let the BPF user see the packet, but 1220 * don't pass it up to the ether_input() layer unless it's 1221 * a broadcast packet, multicast packet, matches our ethernet 1222 * address or the interface is in promiscuous mode. 1223 */ 1224 if (ifp->if_bpf) { 1225 bpf_mtap(ifp, m); 1226 if (ifp->if_flags & IFF_PROMISC && 1227 (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, 1228 ETHER_ADDR_LEN) && 1229 (eh->ether_dhost[0] & 1) == 0)) { 1230 m_freem(m); 1231 break; 1232 } 1233 } |
1240#endif | 1234 |
1241 /* Remove header from mbuf and pass it on. */ 1242 m_adj(m, sizeof(struct ether_header)); 1243 ether_input(ifp, eh, m); 1244 } 1245 1246 return; 1247} 1248 --- 329 unchanged lines hidden (view full) --- 1578 sc->wb_cdata.wb_tx_free = cur_tx->wb_nextdesc; 1579 1580 /* Pack the data into the descriptor. */ 1581 wb_encap(sc, cur_tx, m_head); 1582 1583 if (cur_tx != start_tx) 1584 WB_TXOWN(cur_tx) = WB_TXSTAT_OWN; 1585 | 1235 /* Remove header from mbuf and pass it on. */ 1236 m_adj(m, sizeof(struct ether_header)); 1237 ether_input(ifp, eh, m); 1238 } 1239 1240 return; 1241} 1242 --- 329 unchanged lines hidden (view full) --- 1572 sc->wb_cdata.wb_tx_free = cur_tx->wb_nextdesc; 1573 1574 /* Pack the data into the descriptor. */ 1575 wb_encap(sc, cur_tx, m_head); 1576 1577 if (cur_tx != start_tx) 1578 WB_TXOWN(cur_tx) = WB_TXSTAT_OWN; 1579 |
1586#if NBPF > 0 | |
1587 /* 1588 * If there's a BPF listener, bounce a copy of this frame 1589 * to him. 1590 */ 1591 if (ifp->if_bpf) 1592 bpf_mtap(ifp, cur_tx->wb_mbuf); | 1580 /* 1581 * If there's a BPF listener, bounce a copy of this frame 1582 * to him. 1583 */ 1584 if (ifp->if_bpf) 1585 bpf_mtap(ifp, cur_tx->wb_mbuf); |
1593#endif | |
1594 } 1595 1596 /* 1597 * If there are no packets queued, bail. 1598 */ 1599 if (cur_tx == NULL) 1600 return; 1601 --- 331 unchanged lines hidden --- | 1586 } 1587 1588 /* 1589 * If there are no packets queued, bail. 1590 */ 1591 if (cur_tx == NULL) 1592 return; 1593 --- 331 unchanged lines hidden --- |