if_an.c (74144) | if_an.c (74698) |
---|---|
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/an/if_an.c 74144 2001-03-12 06:13:39Z assar $ | 32 * $FreeBSD: head/sys/dev/an/if_an.c 74698 2001-03-23 17:46:32Z archie $ |
33 */ 34 35/* 36 * Aironet 4500/4800 802.11 PCMCIA/ISA/PCI driver for FreeBSD. 37 * 38 * Written by Bill Paul <wpaul@ctr.columbia.edu> 39 * Electrical Engineering Department 40 * Columbia University, New York City --- 84 unchanged lines hidden (view full) --- 125 126#include <machine/md_var.h> 127 128#include <dev/an/if_aironet_ieee.h> 129#include <dev/an/if_anreg.h> 130 131#if !defined(lint) 132static const char rcsid[] = | 33 */ 34 35/* 36 * Aironet 4500/4800 802.11 PCMCIA/ISA/PCI driver for FreeBSD. 37 * 38 * Written by Bill Paul <wpaul@ctr.columbia.edu> 39 * Electrical Engineering Department 40 * Columbia University, New York City --- 84 unchanged lines hidden (view full) --- 125 126#include <machine/md_var.h> 127 128#include <dev/an/if_aironet_ieee.h> 129#include <dev/an/if_anreg.h> 130 131#if !defined(lint) 132static const char rcsid[] = |
133 "$FreeBSD: head/sys/dev/an/if_an.c 74144 2001-03-12 06:13:39Z assar $"; | 133 "$FreeBSD: head/sys/dev/an/if_an.c 74698 2001-03-23 17:46:32Z archie $"; |
134#endif 135 136/* These are global because we need them in sys/pci/if_an_p.c. */ 137static void an_reset __P((struct an_softc *)); 138static int an_ioctl __P((struct ifnet *, u_long, caddr_t)); 139static void an_init __P((void *)); 140static int an_init_tx_ring __P((struct an_softc *)); 141static void an_start __P((struct ifnet *)); --- 423 unchanged lines hidden (view full) --- 565 566 if (sc->an_gone) { 567 AN_UNLOCK(sc); 568 return; 569 } 570 571 ifp = &sc->arpcom.ac_if; 572 | 134#endif 135 136/* These are global because we need them in sys/pci/if_an_p.c. */ 137static void an_reset __P((struct an_softc *)); 138static int an_ioctl __P((struct ifnet *, u_long, caddr_t)); 139static void an_init __P((void *)); 140static int an_init_tx_ring __P((struct an_softc *)); 141static void an_start __P((struct ifnet *)); --- 423 unchanged lines hidden (view full) --- 565 566 if (sc->an_gone) { 567 AN_UNLOCK(sc); 568 return; 569 } 570 571 ifp = &sc->arpcom.ac_if; 572 |
573 if (!(ifp->if_flags & IFF_UP)) { 574 CSR_WRITE_2(sc, AN_EVENT_ACK, 0xFFFF); 575 CSR_WRITE_2(sc, AN_INT_EN, 0); 576 AN_UNLOCK(sc); 577 return; 578 } 579 | |
580 /* Disable interrupts. */ 581 CSR_WRITE_2(sc, AN_INT_EN, 0); 582 583 status = CSR_READ_2(sc, AN_EVENT_STAT); 584 CSR_WRITE_2(sc, AN_EVENT_ACK, ~AN_INTRS); 585 586 if (status & AN_EV_AWAKE) { 587 CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_AWAKE); --- 23 unchanged lines hidden (view full) --- 611 } 612 613 if (status & AN_EV_ALLOC) 614 CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_ALLOC); 615 616 /* Re-enable interrupts. */ 617 CSR_WRITE_2(sc, AN_INT_EN, AN_INTRS); 618 | 573 /* Disable interrupts. */ 574 CSR_WRITE_2(sc, AN_INT_EN, 0); 575 576 status = CSR_READ_2(sc, AN_EVENT_STAT); 577 CSR_WRITE_2(sc, AN_EVENT_ACK, ~AN_INTRS); 578 579 if (status & AN_EV_AWAKE) { 580 CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_AWAKE); --- 23 unchanged lines hidden (view full) --- 604 } 605 606 if (status & AN_EV_ALLOC) 607 CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_ALLOC); 608 609 /* Re-enable interrupts. */ 610 CSR_WRITE_2(sc, AN_INT_EN, AN_INTRS); 611 |
619 if (ifp->if_snd.ifq_head != NULL) | 612 if ((ifp->if_flags & IFF_UP) && (ifp->if_snd.ifq_head != NULL)) |
620 an_start(ifp); 621 622 AN_UNLOCK(sc); 623 624 return; 625} 626 627static int an_cmd(sc, cmd, val) --- 329 unchanged lines hidden (view full) --- 957 default: 958 printf("an%d: unknown RID: %x\n", sc->an_unit, areq->an_type); 959 return; 960 break; 961 } 962 963 964 /* Reinitialize the card. */ | 613 an_start(ifp); 614 615 AN_UNLOCK(sc); 616 617 return; 618} 619 620static int an_cmd(sc, cmd, val) --- 329 unchanged lines hidden (view full) --- 950 default: 951 printf("an%d: unknown RID: %x\n", sc->an_unit, areq->an_type); 952 return; 953 break; 954 } 955 956 957 /* Reinitialize the card. */ |
965 if (ifp->if_flags & IFF_UP) | 958 if (ifp->if_flags) |
966 an_init(sc); 967 968 return; 969} 970 971/* 972 * We can't change the NIC configuration while the MAC is enabled, 973 * so in order to turn on RX monitor mode, we have to turn the MAC 974 * off first. 975 */ 976static void an_promisc(sc, promisc) 977 struct an_softc *sc; 978 int promisc; 979{ | 959 an_init(sc); 960 961 return; 962} 963 964/* 965 * We can't change the NIC configuration while the MAC is enabled, 966 * so in order to turn on RX monitor mode, we have to turn the MAC 967 * off first. 968 */ 969static void an_promisc(sc, promisc) 970 struct an_softc *sc; 971 int promisc; 972{ |
980 /* Disable the MAC. */ 981 an_cmd(sc, AN_CMD_DISABLE, 0); | 973 an_cmd(sc, AN_CMD_SET_MODE, promisc ? 0xffff : 0); |
982 | 974 |
983 /* Set RX mode. */ 984 if (promisc && 985 !(sc->an_config.an_rxmode & AN_RXMODE_LAN_MONITOR_CURBSS) 986 ) { 987 sc->an_rxmode = sc->an_config.an_rxmode; 988 /* kills card DJA, if in sniff mode can't TX packets 989 sc->an_config.an_rxmode |= 990 AN_RXMODE_LAN_MONITOR_CURBSS; 991 */ 992 } else { 993 sc->an_config.an_rxmode = sc->an_rxmode; 994 } 995 996 /* Transfer the configuration to the NIC */ 997 sc->an_config.an_len = sizeof(struct an_ltv_genconfig); 998 sc->an_config.an_type = AN_RID_GENCONFIG; 999 if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_config)) { 1000 printf("an%d: failed to set configuration\n", sc->an_unit); 1001 return; 1002 } 1003 /* Turn the MAC back on. */ 1004 an_cmd(sc, AN_CMD_ENABLE, 0); 1005 | |
1006 return; 1007} 1008 1009static int an_ioctl(ifp, command, data) 1010 struct ifnet *ifp; 1011 u_long command; 1012 caddr_t data; 1013{ --- 187 unchanged lines hidden (view full) --- 1201 1202 /* Enable the MAC */ 1203 if (an_cmd(sc, AN_CMD_ENABLE, 0)) { 1204 printf("an%d: failed to enable MAC\n", sc->an_unit); 1205 AN_UNLOCK(sc); 1206 return; 1207 } 1208 | 975 return; 976} 977 978static int an_ioctl(ifp, command, data) 979 struct ifnet *ifp; 980 u_long command; 981 caddr_t data; 982{ --- 187 unchanged lines hidden (view full) --- 1170 1171 /* Enable the MAC */ 1172 if (an_cmd(sc, AN_CMD_ENABLE, 0)) { 1173 printf("an%d: failed to enable MAC\n", sc->an_unit); 1174 AN_UNLOCK(sc); 1175 return; 1176 } 1177 |
1178 if (ifp->if_flags & IFF_PROMISC) 1179 an_cmd(sc, AN_CMD_SET_MODE, 0xffff); 1180 |
|
1209 /* enable interrupts */ 1210 CSR_WRITE_2(sc, AN_INT_EN, AN_INTRS); 1211 1212 ifp->if_flags |= IFF_RUNNING; 1213 ifp->if_flags &= ~IFF_OACTIVE; 1214 1215 sc->an_stat_ch = timeout(an_stats_update, sc, hz); 1216 AN_UNLOCK(sc); --- 64 unchanged lines hidden (view full) --- 1281 * this frame to him. 1282 */ 1283 if (ifp->if_bpf) 1284 bpf_mtap(ifp, m0); 1285 1286 m_freem(m0); 1287 m0 = NULL; 1288 | 1181 /* enable interrupts */ 1182 CSR_WRITE_2(sc, AN_INT_EN, AN_INTRS); 1183 1184 ifp->if_flags |= IFF_RUNNING; 1185 ifp->if_flags &= ~IFF_OACTIVE; 1186 1187 sc->an_stat_ch = timeout(an_stats_update, sc, hz); 1188 AN_UNLOCK(sc); --- 64 unchanged lines hidden (view full) --- 1253 * this frame to him. 1254 */ 1255 if (ifp->if_bpf) 1256 bpf_mtap(ifp, m0); 1257 1258 m_freem(m0); 1259 m0 = NULL; 1260 |
1289 /* TX START disable lan monitor ? DJA 1290 an_disable_sniff(): 1291 */ | |
1292 sc->an_rdata.an_tx_ring[idx] = id; 1293 if (an_cmd(sc, AN_CMD_TX, id)) 1294 printf("an%d: xmit failed\n", sc->an_unit); 1295 1296 AN_INC(idx, AN_TX_RING_CNT); 1297 } 1298 1299 if (m0 != NULL) --- 257 unchanged lines hidden --- | 1261 sc->an_rdata.an_tx_ring[idx] = id; 1262 if (an_cmd(sc, AN_CMD_TX, id)) 1263 printf("an%d: xmit failed\n", sc->an_unit); 1264 1265 AN_INC(idx, AN_TX_RING_CNT); 1266 } 1267 1268 if (m0 != NULL) --- 257 unchanged lines hidden --- |