Deleted Added
sdiff udiff text old ( 74698 ) new ( 77217 )
full compact
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 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

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

108#include <sys/mutex.h>
109#include <machine/resource.h>
110
111#include <net/if.h>
112#include <net/if_arp.h>
113#include <net/ethernet.h>
114#include <net/if_dl.h>
115#include <net/if_types.h>
116
117#ifdef INET
118#include <netinet/in.h>
119#include <netinet/in_systm.h>
120#include <netinet/in_var.h>
121#include <netinet/ip.h>
122#endif
123
124#include <net/bpf.h>
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 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 *));

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

155static int an_alloc_nicmem __P((struct an_softc *, int, int *));
156static void an_stats_update __P((void *));
157static void an_setdef __P((struct an_softc *, struct an_req *));
158#ifdef ANCACHE
159static void an_cache_store __P((struct an_softc *, struct ether_header *,
160 struct mbuf *, unsigned short));
161#endif
162
163/*
164 * We probe for an Aironet 4500/4800 card by attempting to
165 * read the default SSID list. On reset, the first entry in
166 * the SSID list will contain the name "tsunami." If we don't
167 * find this, then there's no card present.
168 */
169int an_probe(dev)
170 device_t dev;

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

375 sc->an_ssidlist.an_ssid1_len = strlen(AN_DEFAULT_NETNAME);
376
377 sc->an_config.an_opmode =
378 AN_OPMODE_INFRASTRUCTURE_STATION;
379
380 sc->an_tx_rate = 0;
381 bzero((char *)&sc->an_stats, sizeof(sc->an_stats));
382
383 /*
384 * Call MI attach routine.
385 */
386 ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
387 callout_handle_init(&sc->an_stat_ch);
388 AN_UNLOCK(sc);
389
390 return(0);

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

708 }
709
710 /*
711 * Read the length and record type and make sure they
712 * match what we expect (this verifies that we have enough
713 * room to hold all of the returned data).
714 */
715 len = CSR_READ_2(sc, AN_DATA1);
716 if (len > ltv->an_len) {
717 printf("an%d: record length mismatch -- expected %d, "
718 "got %d\n", sc->an_unit, ltv->an_len, len);
719 return(ENOSPC);
720 }
721
722 ltv->an_len = len;
723
724 /* Now read the data. */
725 ptr = &ltv->an_val;
726 for (i = 0; i < (ltv->an_len - 2) >> 1; i++)
727 ptr[i] = CSR_READ_2(sc, AN_DATA1);

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

976}
977
978static int an_ioctl(ifp, command, data)
979 struct ifnet *ifp;
980 u_long command;
981 caddr_t data;
982{
983 int error = 0;
984 struct an_softc *sc;
985 struct an_req areq;
986 struct ifreq *ifr;
987 struct proc *p = curproc;
988
989 sc = ifp->if_softc;
990 AN_LOCK(sc);
991 ifr = (struct ifreq *)data;
992
993 if (sc->an_gone) {
994 error = ENODEV;
995 goto out;
996 }
997
998 switch(command) {
999 case SIOCSIFADDR:
1000 case SIOCGIFADDR:

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

1015 an_init(sc);
1016 } else {
1017 if (ifp->if_flags & IFF_RUNNING)
1018 an_stop(sc);
1019 }
1020 sc->an_if_flags = ifp->if_flags;
1021 error = 0;
1022 break;
1023 case SIOCADDMULTI:
1024 case SIOCDELMULTI:
1025 /* The Aironet has no multicast filter. */
1026 error = 0;
1027 break;
1028 case SIOCGAIRONET:
1029 error = copyin(ifr->ifr_data, &areq, sizeof(areq));
1030 if (error)

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

1054 case SIOCSAIRONET:
1055 if ((error = suser(p)))
1056 goto out;
1057 error = copyin(ifr->ifr_data, &areq, sizeof(areq));
1058 if (error)
1059 break;
1060 an_setdef(sc, &areq);
1061 break;
1062 default:
1063 error = EINVAL;
1064 break;
1065 }
1066out:
1067 AN_UNLOCK(sc);
1068
1069 return(error);

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

1411 struct mbuf *m;
1412 unsigned short rx_quality;
1413{
1414 struct ip *ip = 0;
1415 int i;
1416 static int cache_slot = 0; /* use this cache entry */
1417 static int wrapindex = 0; /* next "free" cache entry */
1418 int saanp=0;
1419
1420 /* filters:
1421 * 1. ip only
1422 * 2. configurable filter to throw out unicast packets,
1423 * keep multicast only.
1424 */
1425
1426 if ((ntohs(eh->ether_type) == 0x800)) {

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

1518 }
1519 bcopy( eh->ether_shost, sc->an_sigcache[cache_slot].macsrc, 6);
1520
1521 sc->an_sigcache[cache_slot].signal = rx_quality;
1522
1523 return;
1524}
1525#endif