if_an.c (110362) | if_an.c (110531) |
---|---|
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 110362 2003-02-05 03:37:42Z ambrisko $ | 32 * $FreeBSD: head/sys/dev/an/if_an.c 110531 2003-02-08 04:41:17Z ambrisko $ |
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 --- 88 unchanged lines hidden (view full) --- 129 130#include <machine/md_var.h> 131 132#include <dev/an/if_aironet_ieee.h> 133#include <dev/an/if_anreg.h> 134 135#if !defined(lint) 136static 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 --- 88 unchanged lines hidden (view full) --- 129 130#include <machine/md_var.h> 131 132#include <dev/an/if_aironet_ieee.h> 133#include <dev/an/if_anreg.h> 134 135#if !defined(lint) 136static const char rcsid[] = |
137 "$FreeBSD: head/sys/dev/an/if_an.c 110362 2003-02-05 03:37:42Z ambrisko $"; | 137 "$FreeBSD: head/sys/dev/an/if_an.c 110531 2003-02-08 04:41:17Z ambrisko $"; |
138#endif 139 140/* These are global because we need them in sys/pci/if_an_p.c. */ 141static void an_reset (struct an_softc *); 142static int an_init_mpi350_desc (struct an_softc *); 143static int an_ioctl (struct ifnet *, u_long, caddr_t); 144static void an_init (void *); 145static int an_init_tx_ring (struct an_softc *); 146static void an_start (struct ifnet *); 147static void an_watchdog (struct ifnet *); 148static void an_rxeof (struct an_softc *); 149static void an_txeof (struct an_softc *, int); 150 151static void an_promisc (struct an_softc *, int); 152static int an_cmd (struct an_softc *, int, int); 153static int an_cmd_struct (struct an_softc *, struct an_command *, 154 struct an_reply *); 155static int an_read_record (struct an_softc *, struct an_ltv_gen *); 156static int an_write_record (struct an_softc *, struct an_ltv_gen *); | 138#endif 139 140/* These are global because we need them in sys/pci/if_an_p.c. */ 141static void an_reset (struct an_softc *); 142static int an_init_mpi350_desc (struct an_softc *); 143static int an_ioctl (struct ifnet *, u_long, caddr_t); 144static void an_init (void *); 145static int an_init_tx_ring (struct an_softc *); 146static void an_start (struct ifnet *); 147static void an_watchdog (struct ifnet *); 148static void an_rxeof (struct an_softc *); 149static void an_txeof (struct an_softc *, int); 150 151static void an_promisc (struct an_softc *, int); 152static int an_cmd (struct an_softc *, int, int); 153static int an_cmd_struct (struct an_softc *, struct an_command *, 154 struct an_reply *); 155static int an_read_record (struct an_softc *, struct an_ltv_gen *); 156static int an_write_record (struct an_softc *, struct an_ltv_gen *); |
157static void an_kick (struct an_softc *); | |
158static int an_read_data (struct an_softc *, int, int, caddr_t, int); 159static int an_write_data (struct an_softc *, int, int, caddr_t, int); 160static int an_seek (struct an_softc *, int, int, int); 161static int an_alloc_nicmem (struct an_softc *, int, int *); 162static int an_dma_malloc (struct an_softc *, bus_size_t, 163 struct an_dma_alloc *, int); 164static void an_dma_free (struct an_softc *, struct an_dma_alloc *); 165static void an_dma_malloc_cb (void *, bus_dma_segment_t *, int, int); --- 34 unchanged lines hidden (view full) --- 200#define PERCENT 1 201#define RAW 2 202 203static char an_conf[256]; 204static char an_conf_cache[256]; 205 206/* sysctl vars */ 207 | 157static int an_read_data (struct an_softc *, int, int, caddr_t, int); 158static int an_write_data (struct an_softc *, int, int, caddr_t, int); 159static int an_seek (struct an_softc *, int, int, int); 160static int an_alloc_nicmem (struct an_softc *, int, int *); 161static int an_dma_malloc (struct an_softc *, bus_size_t, 162 struct an_dma_alloc *, int); 163static void an_dma_free (struct an_softc *, struct an_dma_alloc *); 164static void an_dma_malloc_cb (void *, bus_dma_segment_t *, int, int); --- 34 unchanged lines hidden (view full) --- 199#define PERCENT 1 200#define RAW 2 201 202static char an_conf[256]; 203static char an_conf_cache[256]; 204 205/* sysctl vars */ 206 |
208SYSCTL_NODE(_machdep, OID_AUTO, an, CTLFLAG_RD, 0, "dump RID"); | 207SYSCTL_NODE(_hw, OID_AUTO, an, CTLFLAG_RD, 0, "Wireless driver parameters"); |
209 210/* XXX violate ethernet/netgraph callback hooks */ 211extern void (*ng_ether_attach_p)(struct ifnet *ifp); 212extern void (*ng_ether_detach_p)(struct ifnet *ifp); 213 214static int 215sysctl_an_dump(SYSCTL_HANDLER_ARGS) 216{ --- 42 unchanged lines hidden (view full) --- 259 an_dump = r; 260 } 261 if (an_dump != last) 262 printf("Sysctl changed for Aironet driver\n"); 263 264 return error; 265} 266 | 208 209/* XXX violate ethernet/netgraph callback hooks */ 210extern void (*ng_ether_attach_p)(struct ifnet *ifp); 211extern void (*ng_ether_detach_p)(struct ifnet *ifp); 212 213static int 214sysctl_an_dump(SYSCTL_HANDLER_ARGS) 215{ --- 42 unchanged lines hidden (view full) --- 258 an_dump = r; 259 } 260 if (an_dump != last) 261 printf("Sysctl changed for Aironet driver\n"); 262 263 return error; 264} 265 |
267SYSCTL_PROC(_machdep, OID_AUTO, an_dump, CTLTYPE_STRING | CTLFLAG_RW, | 266SYSCTL_PROC(_hw_an, OID_AUTO, an_dump, CTLTYPE_STRING | CTLFLAG_RW, |
268 0, sizeof(an_conf), sysctl_an_dump, "A", ""); 269 270static int 271sysctl_an_cache_mode(SYSCTL_HANDLER_ARGS) 272{ 273 int error, last; 274 275 last = an_cache_mode; --- 21 unchanged lines hidden (view full) --- 297 } 298 if (strncmp(an_conf_cache,"raw", 3) == 0) { 299 an_cache_mode = 2; 300 } 301 302 return error; 303} 304 | 267 0, sizeof(an_conf), sysctl_an_dump, "A", ""); 268 269static int 270sysctl_an_cache_mode(SYSCTL_HANDLER_ARGS) 271{ 272 int error, last; 273 274 last = an_cache_mode; --- 21 unchanged lines hidden (view full) --- 296 } 297 if (strncmp(an_conf_cache,"raw", 3) == 0) { 298 an_cache_mode = 2; 299 } 300 301 return error; 302} 303 |
305SYSCTL_PROC(_machdep, OID_AUTO, an_cache_mode, CTLTYPE_STRING | CTLFLAG_RW, | 304SYSCTL_PROC(_hw_an, OID_AUTO, an_cache_mode, CTLTYPE_STRING | CTLFLAG_RW, |
306 0, sizeof(an_conf_cache), sysctl_an_cache_mode, "A", ""); 307 308/* 309 * We probe for an Aironet 4500/4800 card by attempting to 310 * read the default SSID list. On reset, the first entry in 311 * the SSID list will contain the name "tsunami." If we don't 312 * find this, then there's no card present. 313 */ --- 916 unchanged lines hidden (view full) --- 1230 if ((ifp->if_flags & IFF_UP) && (ifp->if_snd.ifq_head != NULL)) 1231 an_start(ifp); 1232 1233 AN_UNLOCK(sc); 1234 1235 return; 1236} 1237 | 305 0, sizeof(an_conf_cache), sysctl_an_cache_mode, "A", ""); 306 307/* 308 * We probe for an Aironet 4500/4800 card by attempting to 309 * read the default SSID list. On reset, the first entry in 310 * the SSID list will contain the name "tsunami." If we don't 311 * find this, then there's no card present. 312 */ --- 916 unchanged lines hidden (view full) --- 1229 if ((ifp->if_flags & IFF_UP) && (ifp->if_snd.ifq_head != NULL)) 1230 an_start(ifp); 1231 1232 AN_UNLOCK(sc); 1233 1234 return; 1235} 1236 |
1238static void 1239an_kick(sc) 1240 struct an_softc *sc; 1241{ 1242 int i; | |
1243 | 1237 |
1244 CSR_WRITE_2(sc, AN_COMMAND(sc->mpi350), AN_CMD_NOOP2); 1245 1246 if (CSR_READ_2(sc, AN_COMMAND(sc->mpi350)) & AN_CMD_BUSY) { 1247 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_CMD); 1248 } else { 1249 for (i = 0; i < AN_TIMEOUT; i++) { 1250 if (CSR_READ_2(sc, AN_EVENT_STAT(sc->mpi350)) 1251 & AN_EV_CMD) 1252 break; 1253 } 1254 if (CSR_READ_2(sc, AN_COMMAND(sc->mpi350)) & AN_CMD_BUSY) { 1255 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_CMD); 1256 } 1257 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_CMD); 1258 if (i == AN_TIMEOUT) { 1259 printf ("COULDN'T CLEAR\n"); 1260 } 1261 } 1262} 1263 | |
1264static int 1265an_cmd_struct(sc, cmd, reply) 1266 struct an_softc *sc; 1267 struct an_command *cmd; 1268 struct an_reply *reply; 1269{ 1270 int i; 1271 1272 for (i = 0; i != AN_TIMEOUT; i++) { 1273 if (CSR_READ_2(sc, AN_COMMAND(sc->mpi350)) & AN_CMD_BUSY) { | 1238static int 1239an_cmd_struct(sc, cmd, reply) 1240 struct an_softc *sc; 1241 struct an_command *cmd; 1242 struct an_reply *reply; 1243{ 1244 int i; 1245 1246 for (i = 0; i != AN_TIMEOUT; i++) { 1247 if (CSR_READ_2(sc, AN_COMMAND(sc->mpi350)) & AN_CMD_BUSY) { |
1274 DELAY(10); | 1248 DELAY(1000); |
1275 } else 1276 break; 1277 } 1278 if( i == AN_TIMEOUT) { 1279 printf("BUSY\n"); 1280 return(ETIMEDOUT); 1281 } 1282 1283 CSR_WRITE_2(sc, AN_PARAM0(sc->mpi350), cmd->an_parm0); 1284 CSR_WRITE_2(sc, AN_PARAM1(sc->mpi350), cmd->an_parm1); 1285 CSR_WRITE_2(sc, AN_PARAM2(sc->mpi350), cmd->an_parm2); 1286 CSR_WRITE_2(sc, AN_COMMAND(sc->mpi350), cmd->an_cmd); 1287 1288 for (i = 0; i < AN_TIMEOUT; i++) { 1289 if (CSR_READ_2(sc, AN_EVENT_STAT(sc->mpi350)) & AN_EV_CMD) 1290 break; | 1249 } else 1250 break; 1251 } 1252 if( i == AN_TIMEOUT) { 1253 printf("BUSY\n"); 1254 return(ETIMEDOUT); 1255 } 1256 1257 CSR_WRITE_2(sc, AN_PARAM0(sc->mpi350), cmd->an_parm0); 1258 CSR_WRITE_2(sc, AN_PARAM1(sc->mpi350), cmd->an_parm1); 1259 CSR_WRITE_2(sc, AN_PARAM2(sc->mpi350), cmd->an_parm2); 1260 CSR_WRITE_2(sc, AN_COMMAND(sc->mpi350), cmd->an_cmd); 1261 1262 for (i = 0; i < AN_TIMEOUT; i++) { 1263 if (CSR_READ_2(sc, AN_EVENT_STAT(sc->mpi350)) & AN_EV_CMD) 1264 break; |
1265 DELAY(1000); |
|
1291 } 1292 | 1266 } 1267 |
1293 if (i == AN_TIMEOUT) 1294 an_kick(sc); 1295 | |
1296 reply->an_resp0 = CSR_READ_2(sc, AN_RESP0(sc->mpi350)); 1297 reply->an_resp1 = CSR_READ_2(sc, AN_RESP1(sc->mpi350)); 1298 reply->an_resp2 = CSR_READ_2(sc, AN_RESP2(sc->mpi350)); 1299 reply->an_status = CSR_READ_2(sc, AN_STATUS(sc->mpi350)); 1300 1301 if (CSR_READ_2(sc, AN_COMMAND(sc->mpi350)) & AN_CMD_BUSY) 1302 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_CLR_STUCK_BUSY); 1303 --- 245 unchanged lines hidden (view full) --- 1549 bzero(&reply,sizeof(reply)); 1550 cmd.an_cmd = AN_CMD_ACCESS|AN_ACCESS_WRITE; 1551 cmd.an_parm0 = ltv->an_type; 1552 1553 for (i = 0; i < sizeof(an_rid_desc) / 4; i++) 1554 CSR_MEM_AUX_WRITE_4(sc, AN_HOST_DESC_OFFSET + i * 4, 1555 ((u_int32_t*)&an_rid_desc)[i]); 1556 | 1268 reply->an_resp0 = CSR_READ_2(sc, AN_RESP0(sc->mpi350)); 1269 reply->an_resp1 = CSR_READ_2(sc, AN_RESP1(sc->mpi350)); 1270 reply->an_resp2 = CSR_READ_2(sc, AN_RESP2(sc->mpi350)); 1271 reply->an_status = CSR_READ_2(sc, AN_STATUS(sc->mpi350)); 1272 1273 if (CSR_READ_2(sc, AN_COMMAND(sc->mpi350)) & AN_CMD_BUSY) 1274 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_CLR_STUCK_BUSY); 1275 --- 245 unchanged lines hidden (view full) --- 1521 bzero(&reply,sizeof(reply)); 1522 cmd.an_cmd = AN_CMD_ACCESS|AN_ACCESS_WRITE; 1523 cmd.an_parm0 = ltv->an_type; 1524 1525 for (i = 0; i < sizeof(an_rid_desc) / 4; i++) 1526 CSR_MEM_AUX_WRITE_4(sc, AN_HOST_DESC_OFFSET + i * 4, 1527 ((u_int32_t*)&an_rid_desc)[i]); 1528 |
1529 DELAY(100000); 1530 |
|
1557 if ((i = an_cmd_struct(sc, &cmd, &reply))) { | 1531 if ((i = an_cmd_struct(sc, &cmd, &reply))) { |
1558 printf("an%d: failed to write RID %x %x %x %x %x, %d\n", | 1532 printf("an%d: failed to write RID 1 %x %x %x %x %x, %d\n", |
1559 sc->an_unit, ltv->an_type, 1560 reply.an_status, 1561 reply.an_resp0, 1562 reply.an_resp1, 1563 reply.an_resp2, 1564 i); 1565 return(EIO); 1566 } 1567 1568 ptr = (u_int16_t *)buf; 1569 1570 if (reply.an_status & AN_CMD_QUAL_MASK) { | 1533 sc->an_unit, ltv->an_type, 1534 reply.an_status, 1535 reply.an_resp0, 1536 reply.an_resp1, 1537 reply.an_resp2, 1538 i); 1539 return(EIO); 1540 } 1541 1542 ptr = (u_int16_t *)buf; 1543 1544 if (reply.an_status & AN_CMD_QUAL_MASK) { |
1571 printf("an%d: failed to write RID %x %x %x %x %x, %d\n", | 1545 printf("an%d: failed to write RID 2 %x %x %x %x %x, %d\n", |
1572 sc->an_unit, ltv->an_type, 1573 reply.an_status, 1574 reply.an_resp0, 1575 reply.an_resp1, 1576 reply.an_resp2, 1577 i); 1578 return(EIO); 1579 } | 1546 sc->an_unit, ltv->an_type, 1547 reply.an_status, 1548 reply.an_resp0, 1549 reply.an_resp1, 1550 reply.an_resp2, 1551 i); 1552 return(EIO); 1553 } |
1554 DELAY(100000); |
|
1580 } 1581 1582 return(0); 1583} 1584 1585static void 1586an_dump_record(sc, ltv, string) 1587 struct an_softc *sc; --- 219 unchanged lines hidden (view full) --- 1807 bzero(cfg->an_rates, sizeof(cfg->an_rates)); 1808 cfg->an_rates[0] = sc->an_tx_rate; 1809 1810 /* Save the new rate */ 1811 sc->an_config.an_type = AN_RID_GENCONFIG; 1812 sc->an_config.an_len = sizeof(struct an_ltv_genconfig); 1813 break; 1814 case AN_RID_WEP_TEMP: | 1555 } 1556 1557 return(0); 1558} 1559 1560static void 1561an_dump_record(sc, ltv, string) 1562 struct an_softc *sc; --- 219 unchanged lines hidden (view full) --- 1782 bzero(cfg->an_rates, sizeof(cfg->an_rates)); 1783 cfg->an_rates[0] = sc->an_tx_rate; 1784 1785 /* Save the new rate */ 1786 sc->an_config.an_type = AN_RID_GENCONFIG; 1787 sc->an_config.an_len = sizeof(struct an_ltv_genconfig); 1788 break; 1789 case AN_RID_WEP_TEMP: |
1790 /* Cache the temp keys */ 1791 bcopy(areq, 1792 &sc->an_temp_keys[((struct an_ltv_key *)areq)->kindex], 1793 sizeof(struct an_ltv_key)); |
|
1815 case AN_RID_WEP_PERM: 1816 case AN_RID_LEAPUSERNAME: 1817 case AN_RID_LEAPPASSWORD: 1818 /* Disable the MAC. */ 1819 an_cmd(sc, AN_CMD_DISABLE, 0); 1820 1821 /* Write the key */ 1822 an_write_record(sc, (struct an_ltv_gen *)areq); --- 487 unchanged lines hidden (view full) --- 2310 AN_AUTHTYPE_ALLOW_UNENCRYPTED; 2311 break; 2312 default: 2313 error = EINVAL; 2314 break; 2315 } 2316 break; 2317 case IEEE80211_IOC_WEPKEY: | 1794 case AN_RID_WEP_PERM: 1795 case AN_RID_LEAPUSERNAME: 1796 case AN_RID_LEAPPASSWORD: 1797 /* Disable the MAC. */ 1798 an_cmd(sc, AN_CMD_DISABLE, 0); 1799 1800 /* Write the key */ 1801 an_write_record(sc, (struct an_ltv_gen *)areq); --- 487 unchanged lines hidden (view full) --- 2289 AN_AUTHTYPE_ALLOW_UNENCRYPTED; 2290 break; 2291 default: 2292 error = EINVAL; 2293 break; 2294 } 2295 break; 2296 case IEEE80211_IOC_WEPKEY: |
2318 if (ireq->i_val < 0 || ireq->i_val > 7 || | 2297 if (ireq->i_val < 0 || ireq->i_val > 8 || |
2319 ireq->i_len > 13) { 2320 error = EINVAL; 2321 break; 2322 } 2323 error = copyin(ireq->i_data, tmpstr, 13); 2324 if (error != 0) 2325 break; | 2298 ireq->i_len > 13) { 2299 error = EINVAL; 2300 break; 2301 } 2302 error = copyin(ireq->i_data, tmpstr, 13); 2303 if (error != 0) 2304 break; |
2305 /* 2306 * Map the 9th key into the home mode 2307 * since that is how it is stored on 2308 * the card 2309 */ |
|
2326 bzero(&sc->areq, sizeof(struct an_ltv_key)); 2327 sc->areq.an_len = sizeof(struct an_ltv_key); 2328 key->mac[0] = 1; /* The others are 0. */ | 2310 bzero(&sc->areq, sizeof(struct an_ltv_key)); 2311 sc->areq.an_len = sizeof(struct an_ltv_key); 2312 key->mac[0] = 1; /* The others are 0. */ |
2329 key->kindex = ireq->i_val % 4; 2330 if (ireq->i_val < 4) | 2313 if (ireq->i_val < 4) { |
2331 sc->areq.an_type = AN_RID_WEP_TEMP; | 2314 sc->areq.an_type = AN_RID_WEP_TEMP; |
2332 else | 2315 key->kindex = ireq->i_val; 2316 } else { |
2333 sc->areq.an_type = AN_RID_WEP_PERM; | 2317 sc->areq.an_type = AN_RID_WEP_PERM; |
2318 key->kindex = ireq->i_val - 4; 2319 } |
|
2334 key->klen = ireq->i_len; 2335 bcopy(tmpstr, key->key, key->klen); 2336 break; 2337 case IEEE80211_IOC_WEPTXKEY: | 2320 key->klen = ireq->i_len; 2321 bcopy(tmpstr, key->key, key->klen); 2322 break; 2323 case IEEE80211_IOC_WEPTXKEY: |
2324 if (ireq->i_val < 0 || ireq->i_val > 4) { 2325 error = EINVAL; 2326 break; 2327 } 2328 |
|
2338 /* 2339 * Map the 5th key into the home mode 2340 * since that is how it is stored on 2341 * the card 2342 */ | 2329 /* 2330 * Map the 5th key into the home mode 2331 * since that is how it is stored on 2332 * the card 2333 */ |
2343 if (ireq->i_val < 0 || ireq->i_val > 4) { 2344 error = EINVAL; 2345 break; 2346 } | |
2347 sc->areq.an_len = sizeof(struct an_ltv_genconfig); 2348 sc->areq.an_type = AN_RID_ACTUALCFG; 2349 if (an_read_record(sc, 2350 (struct an_ltv_gen *)&sc->areq)) { 2351 error = EINVAL; 2352 break; 2353 } 2354 if (ireq->i_val == 4) { 2355 config->an_home_product |= AN_HOME_NETWORK; 2356 ireq->i_val = 0; 2357 } else { 2358 config->an_home_product &= ~AN_HOME_NETWORK; 2359 } 2360 2361 sc->an_config.an_home_product 2362 = config->an_home_product; | 2334 sc->areq.an_len = sizeof(struct an_ltv_genconfig); 2335 sc->areq.an_type = AN_RID_ACTUALCFG; 2336 if (an_read_record(sc, 2337 (struct an_ltv_gen *)&sc->areq)) { 2338 error = EINVAL; 2339 break; 2340 } 2341 if (ireq->i_val == 4) { 2342 config->an_home_product |= AN_HOME_NETWORK; 2343 ireq->i_val = 0; 2344 } else { 2345 config->an_home_product &= ~AN_HOME_NETWORK; 2346 } 2347 2348 sc->an_config.an_home_product 2349 = config->an_home_product; |
2363 an_write_record(sc, (struct an_ltv_gen *)&sc->areq); | |
2364 | 2350 |
2351 /* update configuration */ 2352 an_init(sc); 2353 |
|
2365 bzero(&sc->areq, sizeof(struct an_ltv_key)); 2366 sc->areq.an_len = sizeof(struct an_ltv_key); 2367 sc->areq.an_type = AN_RID_WEP_PERM; 2368 key->kindex = 0xffff; 2369 key->mac[0] = ireq->i_val; 2370 break; 2371 case IEEE80211_IOC_AUTHMODE: 2372 switch (ireq->i_val) { --- 450 unchanged lines hidden (view full) --- 2823void 2824an_shutdown(dev) 2825 device_t dev; 2826{ 2827 struct an_softc *sc; 2828 2829 sc = device_get_softc(dev); 2830 an_stop(sc); | 2354 bzero(&sc->areq, sizeof(struct an_ltv_key)); 2355 sc->areq.an_len = sizeof(struct an_ltv_key); 2356 sc->areq.an_type = AN_RID_WEP_PERM; 2357 key->kindex = 0xffff; 2358 key->mac[0] = ireq->i_val; 2359 break; 2360 case IEEE80211_IOC_AUTHMODE: 2361 switch (ireq->i_val) { --- 450 unchanged lines hidden (view full) --- 2812void 2813an_shutdown(dev) 2814 device_t dev; 2815{ 2816 struct an_softc *sc; 2817 2818 sc = device_get_softc(dev); 2819 an_stop(sc); |
2820 sc->an_gone = 1; |
|
2831 2832 return; 2833} 2834 2835void 2836an_resume(dev) 2837 device_t dev; 2838{ 2839 struct an_softc *sc; 2840 struct ifnet *ifp; | 2821 2822 return; 2823} 2824 2825void 2826an_resume(dev) 2827 device_t dev; 2828{ 2829 struct an_softc *sc; 2830 struct ifnet *ifp; |
2831 int i; 2832 |
|
2841 sc = device_get_softc(dev); | 2833 sc = device_get_softc(dev); |
2834 AN_LOCK(sc); |
|
2842 ifp = &sc->arpcom.ac_if; 2843 | 2835 ifp = &sc->arpcom.ac_if; 2836 |
2837 sc->an_gone = 0; |
|
2844 an_reset(sc); 2845 if (sc->mpi350) 2846 an_init_mpi350_desc(sc); 2847 an_init(sc); 2848 | 2838 an_reset(sc); 2839 if (sc->mpi350) 2840 an_init_mpi350_desc(sc); 2841 an_init(sc); 2842 |
2843 /* Recovery temporary keys */ 2844 for (i = 0; i < 4; i++) { 2845 sc->areq.an_type = AN_RID_WEP_TEMP; 2846 sc->areq.an_len = sizeof(struct an_ltv_key); 2847 bcopy(&sc->an_temp_keys[i], 2848 &sc->areq, sizeof(struct an_ltv_key)); 2849 an_setdef(sc, &sc->areq); 2850 } 2851 |
|
2849 if (ifp->if_flags & IFF_UP) 2850 an_start(ifp); | 2852 if (ifp->if_flags & IFF_UP) 2853 an_start(ifp); |
2854 AN_UNLOCK(sc); |
|
2851 2852 return; 2853} 2854 2855#ifdef ANCACHE 2856/* Aironet signal strength cache code. 2857 * store signal/noise/quality on per MAC src basis in 2858 * a small fixed cache. The cache wraps if > MAX slots --- 35 unchanged lines hidden (view full) --- 2894 * on a pt. to pt. ant. setup. 2895 */ 2896/* set true if you want to limit cache items to broadcast/mcast 2897 * only packets (not unicast). Useful for mobile-ip beacons which 2898 * are broadcast/multicast at network layer. Default is all packets 2899 * so ping/unicast anll work say anth pt. to pt. antennae setup. 2900 */ 2901static int an_cache_mcastonly = 0; | 2855 2856 return; 2857} 2858 2859#ifdef ANCACHE 2860/* Aironet signal strength cache code. 2861 * store signal/noise/quality on per MAC src basis in 2862 * a small fixed cache. The cache wraps if > MAX slots --- 35 unchanged lines hidden (view full) --- 2898 * on a pt. to pt. ant. setup. 2899 */ 2900/* set true if you want to limit cache items to broadcast/mcast 2901 * only packets (not unicast). Useful for mobile-ip beacons which 2902 * are broadcast/multicast at network layer. Default is all packets 2903 * so ping/unicast anll work say anth pt. to pt. antennae setup. 2904 */ 2905static int an_cache_mcastonly = 0; |
2902SYSCTL_INT(_machdep, OID_AUTO, an_cache_mcastonly, CTLFLAG_RW, | 2906SYSCTL_INT(_hw_an, OID_AUTO, an_cache_mcastonly, CTLFLAG_RW, |
2903 &an_cache_mcastonly, 0, ""); 2904 2905/* set true if you want to limit cache items to IP packets only 2906*/ 2907static int an_cache_iponly = 1; | 2907 &an_cache_mcastonly, 0, ""); 2908 2909/* set true if you want to limit cache items to IP packets only 2910*/ 2911static int an_cache_iponly = 1; |
2908SYSCTL_INT(_machdep, OID_AUTO, an_cache_iponly, CTLFLAG_RW, | 2912SYSCTL_INT(_hw_an, OID_AUTO, an_cache_iponly, CTLFLAG_RW, |
2909 &an_cache_iponly, 0, ""); 2910 2911/* 2912 * an_cache_store, per rx packet store signal 2913 * strength in MAC (src) indexed cache. 2914 */ 2915static void 2916an_cache_store (sc, eh, m, rx_rssi, rx_quality) --- 180 unchanged lines hidden (view full) --- 3097 bzero(cfg->an_rates, sizeof(cfg->an_rates)); 3098 cfg->an_rates[0] = sc->an_tx_rate; 3099 3100 /* Save the new rate */ 3101 sc->an_config.an_type = AN_RID_GENCONFIG; 3102 sc->an_config.an_len = sizeof(struct an_ltv_genconfig); 3103 } 3104 | 2913 &an_cache_iponly, 0, ""); 2914 2915/* 2916 * an_cache_store, per rx packet store signal 2917 * strength in MAC (src) indexed cache. 2918 */ 2919static void 2920an_cache_store (sc, eh, m, rx_rssi, rx_quality) --- 180 unchanged lines hidden (view full) --- 3101 bzero(cfg->an_rates, sizeof(cfg->an_rates)); 3102 cfg->an_rates[0] = sc->an_tx_rate; 3103 3104 /* Save the new rate */ 3105 sc->an_config.an_type = AN_RID_GENCONFIG; 3106 sc->an_config.an_len = sizeof(struct an_ltv_genconfig); 3107 } 3108 |
3105 if (otype != sc->an_config.an_opmode 3106 || orate != sc->an_tx_rate) | 3109 if (otype != sc->an_config.an_opmode || 3110 orate != sc->an_tx_rate) |
3107 an_init(sc); 3108 3109 return(0); 3110} 3111 3112static void 3113an_media_status(ifp, imr) 3114 struct ifnet *ifp; --- 544 unchanged lines hidden --- | 3111 an_init(sc); 3112 3113 return(0); 3114} 3115 3116static void 3117an_media_status(ifp, imr) 3118 struct ifnet *ifp; --- 544 unchanged lines hidden --- |