if_wi.c (50477) | if_wi.c (51583) |
---|---|
1/* 2 * Copyright (c) 1997, 1998, 1999 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, 1999 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/dev/wi/if_wi.c 50477 1999-08-28 01:08:13Z peter $ | 32 * $FreeBSD: head/sys/dev/wi/if_wi.c 51583 1999-09-23 03:32:57Z wpaul $ |
33 */ 34 35/* 36 * Lucent WaveLAN/IEEE 802.11 PCMCIA driver for FreeBSD. 37 * 38 * Written by Bill Paul <wpaul@ctr.columbia.edu> 39 * Electrical Engineering Department 40 * Columbia University, New York City --- 21 unchanged lines hidden (view full) --- 62 * that fits into an ISA slot, into which a PCMCIA WaveLAN card is 63 * inserted. Consequently, you need to use the pccard support for 64 * both the ISA and PCMCIA adapters. 65 */ 66 67#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */ 68#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */ 69 | 33 */ 34 35/* 36 * Lucent WaveLAN/IEEE 802.11 PCMCIA driver for FreeBSD. 37 * 38 * Written by Bill Paul <wpaul@ctr.columbia.edu> 39 * Electrical Engineering Department 40 * Columbia University, New York City --- 21 unchanged lines hidden (view full) --- 62 * that fits into an ISA slot, into which a PCMCIA WaveLAN card is 63 * inserted. Consequently, you need to use the pccard support for 64 * both the ISA and PCMCIA adapters. 65 */ 66 67#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */ 68#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */ 69 |
70#include "bpf.h" | |
71#include "card.h" 72#include "wi.h" 73 74#include <sys/param.h> 75#include <sys/systm.h> 76#include <sys/eventhandler.h> 77#include <sys/sockio.h> 78#include <sys/mbuf.h> --- 11 unchanged lines hidden (view full) --- 90#ifdef INET 91#include <netinet/in.h> 92#include <netinet/in_systm.h> 93#include <netinet/in_var.h> 94#include <netinet/ip.h> 95#include <netinet/if_ether.h> 96#endif 97 | 70#include "card.h" 71#include "wi.h" 72 73#include <sys/param.h> 74#include <sys/systm.h> 75#include <sys/eventhandler.h> 76#include <sys/sockio.h> 77#include <sys/mbuf.h> --- 11 unchanged lines hidden (view full) --- 89#ifdef INET 90#include <netinet/in.h> 91#include <netinet/in_systm.h> 92#include <netinet/in_var.h> 93#include <netinet/ip.h> 94#include <netinet/if_ether.h> 95#endif 96 |
98#if NBPF > 0 | |
99#include <net/bpf.h> | 97#include <net/bpf.h> |
100#endif | |
101 102#include <machine/clock.h> 103#include <machine/md_var.h> 104#include <machine/bus_pio.h> 105#include <machine/bus.h> 106 107#include <i386/isa/isa_device.h> 108#include <i386/isa/icu.h> 109#include <i386/isa/if_wireg.h> 110#include <machine/if_wavelan_ieee.h> 111 112#if NCARD > 0 113#include <sys/select.h> 114#include <pccard/cardinfo.h> 115#include <pccard/slot.h> 116#endif 117 118#if !defined(lint) 119static const char rcsid[] = | 98 99#include <machine/clock.h> 100#include <machine/md_var.h> 101#include <machine/bus_pio.h> 102#include <machine/bus.h> 103 104#include <i386/isa/isa_device.h> 105#include <i386/isa/icu.h> 106#include <i386/isa/if_wireg.h> 107#include <machine/if_wavelan_ieee.h> 108 109#if NCARD > 0 110#include <sys/select.h> 111#include <pccard/cardinfo.h> 112#include <pccard/slot.h> 113#endif 114 115#if !defined(lint) 116static const char rcsid[] = |
120 "$FreeBSD: head/sys/dev/wi/if_wi.c 50477 1999-08-28 01:08:13Z peter $"; | 117 "$FreeBSD: head/sys/dev/wi/if_wi.c 51583 1999-09-23 03:32:57Z wpaul $"; |
121#endif 122 123static struct wi_softc wi_softc[NWI]; 124 125#ifdef foo 126static u_int8_t wi_mcast_addr[6] = { 0x01, 0x60, 0x1D, 0x00, 0x01, 0x00 }; 127#endif 128 --- 230 unchanged lines hidden (view full) --- 359 if (ifunit(ifname) == NULL) { 360 callout_handle_init(&sc->wi_stat_ch); 361 /* 362 * Call MI attach routines. 363 */ 364 if_attach(ifp); 365 ether_ifattach(ifp); 366 | 118#endif 119 120static struct wi_softc wi_softc[NWI]; 121 122#ifdef foo 123static u_int8_t wi_mcast_addr[6] = { 0x01, 0x60, 0x1D, 0x00, 0x01, 0x00 }; 124#endif 125 --- 230 unchanged lines hidden (view full) --- 356 if (ifunit(ifname) == NULL) { 357 callout_handle_init(&sc->wi_stat_ch); 358 /* 359 * Call MI attach routines. 360 */ 361 if_attach(ifp); 362 ether_ifattach(ifp); 363 |
367#if NBPF > 0 | |
368 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); | 364 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); |
369#endif | |
370 371 EVENTHANDLER_REGISTER(shutdown_post_sync, wi_shutdown, sc, 372 SHUTDOWN_PRI_DEFAULT); 373 } 374 375 return(0); 376} 377 --- 82 unchanged lines hidden (view full) --- 460 m_freem(m); 461 ifp->if_ierrors++; 462 return; 463 } 464 } 465 466 ifp->if_ipackets++; 467 | 365 366 EVENTHANDLER_REGISTER(shutdown_post_sync, wi_shutdown, sc, 367 SHUTDOWN_PRI_DEFAULT); 368 } 369 370 return(0); 371} 372 --- 82 unchanged lines hidden (view full) --- 455 m_freem(m); 456 ifp->if_ierrors++; 457 return; 458 } 459 } 460 461 ifp->if_ipackets++; 462 |
468#if NBPF > 0 | |
469 /* Handle BPF listeners. */ 470 if (ifp->if_bpf) { 471 bpf_mtap(ifp, m); 472 if (ifp->if_flags & IFF_PROMISC && 473 (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, 474 ETHER_ADDR_LEN) && (eh->ether_dhost[0] & 1) == 0)) { 475 m_freem(m); 476 return; 477 } 478 } | 463 /* Handle BPF listeners. */ 464 if (ifp->if_bpf) { 465 bpf_mtap(ifp, m); 466 if (ifp->if_flags & IFF_PROMISC && 467 (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, 468 ETHER_ADDR_LEN) && (eh->ether_dhost[0] & 1) == 0)) { 469 m_freem(m); 470 return; 471 } 472 } |
479#endif | |
480 481 /* Receive packet. */ 482 m_adj(m, sizeof(struct ether_header)); 483 ether_input(ifp, eh, m); 484 485 return; 486} 487 --- 748 unchanged lines hidden (view full) --- 1236 m_copydata(m0, 0, m0->m_pkthdr.len, (caddr_t)&sc->wi_txbuf); 1237 1238 wi_write_data(sc, id, 0, (caddr_t)&tx_frame, 1239 sizeof(struct wi_frame)); 1240 wi_write_data(sc, id, WI_802_3_OFFSET, (caddr_t)&sc->wi_txbuf, 1241 m0->m_pkthdr.len + 2); 1242 } 1243 | 473 474 /* Receive packet. */ 475 m_adj(m, sizeof(struct ether_header)); 476 ether_input(ifp, eh, m); 477 478 return; 479} 480 --- 748 unchanged lines hidden (view full) --- 1229 m_copydata(m0, 0, m0->m_pkthdr.len, (caddr_t)&sc->wi_txbuf); 1230 1231 wi_write_data(sc, id, 0, (caddr_t)&tx_frame, 1232 sizeof(struct wi_frame)); 1233 wi_write_data(sc, id, WI_802_3_OFFSET, (caddr_t)&sc->wi_txbuf, 1234 m0->m_pkthdr.len + 2); 1235 } 1236 |
1244#if NBPF > 0 | |
1245 /* 1246 * If there's a BPF listner, bounce a copy of 1247 * this frame to him. 1248 */ 1249 if (ifp->if_bpf) 1250 bpf_mtap(ifp, m0); | 1237 /* 1238 * If there's a BPF listner, bounce a copy of 1239 * this frame to him. 1240 */ 1241 if (ifp->if_bpf) 1242 bpf_mtap(ifp, m0); |
1251#endif | |
1252 1253 m_freem(m0); 1254 1255 if (wi_cmd(sc, WI_CMD_TX|WI_RECLAIM, id)) 1256 printf("wi%d: xmit failed\n", sc->wi_unit); 1257 1258 ifp->if_flags |= IFF_OACTIVE; 1259 --- 92 unchanged lines hidden --- | 1243 1244 m_freem(m0); 1245 1246 if (wi_cmd(sc, WI_CMD_TX|WI_RECLAIM, id)) 1247 printf("wi%d: xmit failed\n", sc->wi_unit); 1248 1249 ifp->if_flags |= IFF_OACTIVE; 1250 --- 92 unchanged lines hidden --- |