if_an.c (116951) | if_an.c (119156) |
---|---|
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 --- 66 unchanged lines hidden (view full) --- 75 * mode. Typically, when programmed for station mode, the card can be set 76 * to automatically perform encapsulation/decapsulation of Ethernet II 77 * and 802.3 frames within 802.11 frames so that the host doesn't have 78 * to do it itself. This driver doesn't program the card that way: the 79 * driver handles all of the encapsulation/decapsulation itself. 80 */ 81 82#include <sys/cdefs.h> | 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 --- 66 unchanged lines hidden (view full) --- 75 * mode. Typically, when programmed for station mode, the card can be set 76 * to automatically perform encapsulation/decapsulation of Ethernet II 77 * and 802.3 frames within 802.11 frames so that the host doesn't have 78 * to do it itself. This driver doesn't program the card that way: the 79 * driver handles all of the encapsulation/decapsulation itself. 80 */ 81 82#include <sys/cdefs.h> |
83__FBSDID("$FreeBSD: head/sys/dev/an/if_an.c 116951 2003-06-28 06:17:26Z sam $"); | 83__FBSDID("$FreeBSD: head/sys/dev/an/if_an.c 119156 2003-08-20 03:46:05Z ambrisko $"); |
84 85#include "opt_inet.h" 86 87#ifdef INET 88#define ANCACHE /* enable signal strength cache */ 89#endif 90 91#include <sys/param.h> --- 216 unchanged lines hidden (view full) --- 308 * the SSID list will contain the name "tsunami." If we don't 309 * find this, then there's no card present. 310 */ 311int 312an_probe(dev) 313 device_t dev; 314{ 315 struct an_softc *sc = device_get_softc(dev); | 84 85#include "opt_inet.h" 86 87#ifdef INET 88#define ANCACHE /* enable signal strength cache */ 89#endif 90 91#include <sys/param.h> --- 216 unchanged lines hidden (view full) --- 308 * the SSID list will contain the name "tsunami." If we don't 309 * find this, then there's no card present. 310 */ 311int 312an_probe(dev) 313 device_t dev; 314{ 315 struct an_softc *sc = device_get_softc(dev); |
316 struct an_ltv_ssidlist ssid; | 316 struct an_ltv_ssidlist_new ssid; |
317 int error; 318 319 bzero((char *)&ssid, sizeof(ssid)); 320 321 error = an_alloc_port(dev, 0, AN_IOSIZ); 322 if (error != 0) 323 return (0); 324 --- 9 unchanged lines hidden (view full) --- 334 sc->an_bhandle = rman_get_bushandle(sc->port_res); 335 sc->an_btag = rman_get_bustag(sc->port_res); 336 sc->an_unit = device_get_unit(dev); 337 338 ssid.an_len = sizeof(ssid); 339 ssid.an_type = AN_RID_SSIDLIST; 340 341 /* Make sure interrupts are disabled. */ | 317 int error; 318 319 bzero((char *)&ssid, sizeof(ssid)); 320 321 error = an_alloc_port(dev, 0, AN_IOSIZ); 322 if (error != 0) 323 return (0); 324 --- 9 unchanged lines hidden (view full) --- 334 sc->an_bhandle = rman_get_bushandle(sc->port_res); 335 sc->an_btag = rman_get_bustag(sc->port_res); 336 sc->an_unit = device_get_unit(dev); 337 338 ssid.an_len = sizeof(ssid); 339 ssid.an_type = AN_RID_SSIDLIST; 340 341 /* Make sure interrupts are disabled. */ |
342 sc->mpi350 = 0; |
|
342 CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), 0); 343 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), 0xFFFF); 344 345 an_reset(sc); | 343 CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), 0); 344 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), 0xFFFF); 345 346 an_reset(sc); |
346 /* No need for an_init_mpi350_desc since it will be done in attach */ | |
347 348 if (an_cmd(sc, AN_CMD_READCFG, 0)) 349 return(0); 350 351 if (an_read_record(sc, (struct an_ltv_gen *)&ssid)) 352 return(0); 353 354 /* See if the ssid matches what we expect ... but doesn't have to */ | 347 348 if (an_cmd(sc, AN_CMD_READCFG, 0)) 349 return(0); 350 351 if (an_read_record(sc, (struct an_ltv_gen *)&ssid)) 352 return(0); 353 354 /* See if the ssid matches what we expect ... but doesn't have to */ |
355 if (strcmp(ssid.an_ssid1, AN_DEF_SSID)) | 355 if (strcmp(ssid.an_entry[0].an_ssid, AN_DEF_SSID)) |
356 return(0); 357 358 return(AN_IOSIZ); 359} 360 361/* 362 * Allocate a port resource with the given resource id. 363 */ --- 346 unchanged lines hidden (view full) --- 710 sc->an_caps.an_len = sizeof(struct an_ltv_caps); 711 if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_caps)) { 712 printf("an%d: read record failed\n", sc->an_unit); 713 goto fail; 714 } 715 716 /* Read ssid list */ 717 sc->an_ssidlist.an_type = AN_RID_SSIDLIST; | 356 return(0); 357 358 return(AN_IOSIZ); 359} 360 361/* 362 * Allocate a port resource with the given resource id. 363 */ --- 346 unchanged lines hidden (view full) --- 710 sc->an_caps.an_len = sizeof(struct an_ltv_caps); 711 if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_caps)) { 712 printf("an%d: read record failed\n", sc->an_unit); 713 goto fail; 714 } 715 716 /* Read ssid list */ 717 sc->an_ssidlist.an_type = AN_RID_SSIDLIST; |
718 sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist); | 718 sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist_new); |
719 if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) { 720 printf("an%d: read record failed\n", sc->an_unit); 721 goto fail; 722 } 723 724 /* Read AP list */ 725 sc->an_aplist.an_type = AN_RID_APLIST; 726 sc->an_aplist.an_len = sizeof(struct an_ltv_aplist); --- 37 unchanged lines hidden (view full) --- 764 ifp->if_init = an_init; 765 ifp->if_baudrate = 10000000; 766 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; 767 768 bzero(sc->an_config.an_nodename, sizeof(sc->an_config.an_nodename)); 769 bcopy(AN_DEFAULT_NODENAME, sc->an_config.an_nodename, 770 sizeof(AN_DEFAULT_NODENAME) - 1); 771 | 719 if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) { 720 printf("an%d: read record failed\n", sc->an_unit); 721 goto fail; 722 } 723 724 /* Read AP list */ 725 sc->an_aplist.an_type = AN_RID_APLIST; 726 sc->an_aplist.an_len = sizeof(struct an_ltv_aplist); --- 37 unchanged lines hidden (view full) --- 764 ifp->if_init = an_init; 765 ifp->if_baudrate = 10000000; 766 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; 767 768 bzero(sc->an_config.an_nodename, sizeof(sc->an_config.an_nodename)); 769 bcopy(AN_DEFAULT_NODENAME, sc->an_config.an_nodename, 770 sizeof(AN_DEFAULT_NODENAME) - 1); 771 |
772 bzero(sc->an_ssidlist.an_ssid1, sizeof(sc->an_ssidlist.an_ssid1)); 773 bcopy(AN_DEFAULT_NETNAME, sc->an_ssidlist.an_ssid1, | 772 bzero(sc->an_ssidlist.an_entry[0].an_ssid, 773 sizeof(sc->an_ssidlist.an_entry[0].an_ssid)); 774 bcopy(AN_DEFAULT_NETNAME, sc->an_ssidlist.an_entry[0].an_ssid, |
774 sizeof(AN_DEFAULT_NETNAME) - 1); | 775 sizeof(AN_DEFAULT_NETNAME) - 1); |
775 sc->an_ssidlist.an_ssid1_len = strlen(AN_DEFAULT_NETNAME); | 776 sc->an_ssidlist.an_entry[0].an_len = strlen(AN_DEFAULT_NETNAME); |
776 777 sc->an_config.an_opmode = 778 AN_OPMODE_INFRASTRUCTURE_STATION; 779 780 sc->an_tx_rate = 0; 781 bzero((char *)&sc->an_stats, sizeof(sc->an_stats)); 782 783 nrate = 8; --- 299 unchanged lines hidden (view full) --- 1083 int id, i; 1084 1085 ifp = &sc->arpcom.ac_if; 1086 1087 ifp->if_timer = 0; 1088 ifp->if_flags &= ~IFF_OACTIVE; 1089 1090 if (!sc->mpi350) { | 777 778 sc->an_config.an_opmode = 779 AN_OPMODE_INFRASTRUCTURE_STATION; 780 781 sc->an_tx_rate = 0; 782 bzero((char *)&sc->an_stats, sizeof(sc->an_stats)); 783 784 nrate = 8; --- 299 unchanged lines hidden (view full) --- 1084 int id, i; 1085 1086 ifp = &sc->arpcom.ac_if; 1087 1088 ifp->if_timer = 0; 1089 ifp->if_flags &= ~IFF_OACTIVE; 1090 1091 if (!sc->mpi350) { |
1091 id = CSR_READ_2(sc, AN_TX_CMP_FID); | 1092 id = CSR_READ_2(sc, AN_TX_CMP_FID(sc->mpi350)); |
1092 1093 if (status & AN_EV_TX_EXC) { 1094 ifp->if_oerrors++; 1095 } else 1096 ifp->if_opackets++; 1097 1098 for (i = 0; i < AN_TX_RING_CNT; i++) { 1099 if (id == sc->an_rdata.an_tx_ring[i]) { 1100 sc->an_rdata.an_tx_ring[i] = 0; 1101 break; 1102 } 1103 } 1104 1105 AN_INC(sc->an_rdata.an_tx_cons, AN_TX_RING_CNT); 1106 } else { /* MPI 350 */ | 1093 1094 if (status & AN_EV_TX_EXC) { 1095 ifp->if_oerrors++; 1096 } else 1097 ifp->if_opackets++; 1098 1099 for (i = 0; i < AN_TX_RING_CNT; i++) { 1100 if (id == sc->an_rdata.an_tx_ring[i]) { 1101 sc->an_rdata.an_tx_ring[i] = 0; 1102 break; 1103 } 1104 } 1105 1106 AN_INC(sc->an_rdata.an_tx_cons, AN_TX_RING_CNT); 1107 } else { /* MPI 350 */ |
1107 AN_INC(sc->an_rdata.an_tx_cons, AN_MAX_TX_DESC); 1108 if (sc->an_rdata.an_tx_prod == 1109 sc->an_rdata.an_tx_cons) 1110 sc->an_rdata.an_tx_empty = 1; | 1108 id = CSR_READ_2(sc, AN_TX_CMP_FID(sc->mpi350)); 1109 if (!sc->an_rdata.an_tx_empty){ 1110 if (status & AN_EV_TX_EXC) { 1111 ifp->if_oerrors++; 1112 } else 1113 ifp->if_opackets++; 1114 AN_INC(sc->an_rdata.an_tx_cons, AN_MAX_TX_DESC); 1115 if (sc->an_rdata.an_tx_prod == 1116 sc->an_rdata.an_tx_cons) 1117 sc->an_rdata.an_tx_empty = 1; 1118 } |
1111 } 1112 1113 return; 1114} 1115 1116/* 1117 * We abuse the stats updater to check the current NIC status. This 1118 * is important because we don't want to allow transmissions until --- 55 unchanged lines hidden (view full) --- 1174 } 1175 1176 ifp = &sc->arpcom.ac_if; 1177 1178 /* Disable interrupts. */ 1179 CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), 0); 1180 1181 status = CSR_READ_2(sc, AN_EVENT_STAT(sc->mpi350)); | 1119 } 1120 1121 return; 1122} 1123 1124/* 1125 * We abuse the stats updater to check the current NIC status. This 1126 * is important because we don't want to allow transmissions until --- 55 unchanged lines hidden (view full) --- 1182 } 1183 1184 ifp = &sc->arpcom.ac_if; 1185 1186 /* Disable interrupts. */ 1187 CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), 0); 1188 1189 status = CSR_READ_2(sc, AN_EVENT_STAT(sc->mpi350)); |
1182 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), ~AN_INTRS); | 1190 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), ~AN_INTRS(sc->mpi350)); |
1183 | 1191 |
1184 if (status & AN_EV_AWAKE) { 1185 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_AWAKE); | 1192 if (status & AN_EV_MIC) { 1193 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_MIC); |
1186 } 1187 1188 if (status & AN_EV_LINKSTAT) { 1189 if (CSR_READ_2(sc, AN_LINKSTAT(sc->mpi350)) 1190 == AN_LINKSTAT_ASSOCIATED) 1191 sc->an_associated = 1; 1192 else 1193 sc->an_associated = 0; 1194 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_LINKSTAT); 1195 } 1196 1197 if (status & AN_EV_RX) { 1198 an_rxeof(sc); 1199 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_RX); 1200 } 1201 | 1194 } 1195 1196 if (status & AN_EV_LINKSTAT) { 1197 if (CSR_READ_2(sc, AN_LINKSTAT(sc->mpi350)) 1198 == AN_LINKSTAT_ASSOCIATED) 1199 sc->an_associated = 1; 1200 else 1201 sc->an_associated = 0; 1202 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_LINKSTAT); 1203 } 1204 1205 if (status & AN_EV_RX) { 1206 an_rxeof(sc); 1207 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_RX); 1208 } 1209 |
1210 if (sc->mpi350 && status & AN_EV_TX_CPY) { 1211 an_txeof(sc, status); 1212 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), 1213 AN_EV_TX_CPY); 1214 } 1215 |
|
1202 if (status & AN_EV_TX) { 1203 an_txeof(sc, status); | 1216 if (status & AN_EV_TX) { 1217 an_txeof(sc, status); |
1204 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_TX); | 1218 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), 1219 AN_EV_TX); |
1205 } 1206 1207 if (status & AN_EV_TX_EXC) { 1208 an_txeof(sc, status); 1209 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_TX_EXC); 1210 } 1211 1212 if (status & AN_EV_ALLOC) 1213 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_ALLOC); 1214 1215 /* Re-enable interrupts. */ | 1220 } 1221 1222 if (status & AN_EV_TX_EXC) { 1223 an_txeof(sc, status); 1224 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_TX_EXC); 1225 } 1226 1227 if (status & AN_EV_ALLOC) 1228 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_ALLOC); 1229 1230 /* Re-enable interrupts. */ |
1216 CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS); | 1231 CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS(sc->mpi350)); |
1217 1218 if ((ifp->if_flags & IFF_UP) && (ifp->if_snd.ifq_head != NULL)) 1219 an_start(ifp); 1220 1221 AN_UNLOCK(sc); 1222 1223 return; 1224} --- 8 unchanged lines hidden (view full) --- 1233 int i; 1234 1235 for (i = 0; i != AN_TIMEOUT; i++) { 1236 if (CSR_READ_2(sc, AN_COMMAND(sc->mpi350)) & AN_CMD_BUSY) { 1237 DELAY(1000); 1238 } else 1239 break; 1240 } | 1232 1233 if ((ifp->if_flags & IFF_UP) && (ifp->if_snd.ifq_head != NULL)) 1234 an_start(ifp); 1235 1236 AN_UNLOCK(sc); 1237 1238 return; 1239} --- 8 unchanged lines hidden (view full) --- 1248 int i; 1249 1250 for (i = 0; i != AN_TIMEOUT; i++) { 1251 if (CSR_READ_2(sc, AN_COMMAND(sc->mpi350)) & AN_CMD_BUSY) { 1252 DELAY(1000); 1253 } else 1254 break; 1255 } |
1256 |
|
1241 if( i == AN_TIMEOUT) { 1242 printf("BUSY\n"); 1243 return(ETIMEDOUT); 1244 } 1245 1246 CSR_WRITE_2(sc, AN_PARAM0(sc->mpi350), cmd->an_parm0); 1247 CSR_WRITE_2(sc, AN_PARAM1(sc->mpi350), cmd->an_parm1); 1248 CSR_WRITE_2(sc, AN_PARAM2(sc->mpi350), cmd->an_parm2); --- 6 unchanged lines hidden (view full) --- 1255 } 1256 1257 reply->an_resp0 = CSR_READ_2(sc, AN_RESP0(sc->mpi350)); 1258 reply->an_resp1 = CSR_READ_2(sc, AN_RESP1(sc->mpi350)); 1259 reply->an_resp2 = CSR_READ_2(sc, AN_RESP2(sc->mpi350)); 1260 reply->an_status = CSR_READ_2(sc, AN_STATUS(sc->mpi350)); 1261 1262 if (CSR_READ_2(sc, AN_COMMAND(sc->mpi350)) & AN_CMD_BUSY) | 1257 if( i == AN_TIMEOUT) { 1258 printf("BUSY\n"); 1259 return(ETIMEDOUT); 1260 } 1261 1262 CSR_WRITE_2(sc, AN_PARAM0(sc->mpi350), cmd->an_parm0); 1263 CSR_WRITE_2(sc, AN_PARAM1(sc->mpi350), cmd->an_parm1); 1264 CSR_WRITE_2(sc, AN_PARAM2(sc->mpi350), cmd->an_parm2); --- 6 unchanged lines hidden (view full) --- 1271 } 1272 1273 reply->an_resp0 = CSR_READ_2(sc, AN_RESP0(sc->mpi350)); 1274 reply->an_resp1 = CSR_READ_2(sc, AN_RESP1(sc->mpi350)); 1275 reply->an_resp2 = CSR_READ_2(sc, AN_RESP2(sc->mpi350)); 1276 reply->an_status = CSR_READ_2(sc, AN_STATUS(sc->mpi350)); 1277 1278 if (CSR_READ_2(sc, AN_COMMAND(sc->mpi350)) & AN_CMD_BUSY) |
1263 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_CLR_STUCK_BUSY); | 1279 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), 1280 AN_EV_CLR_STUCK_BUSY); |
1264 1265 /* Ack the command */ 1266 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_CMD); 1267 1268 if (i == AN_TIMEOUT) 1269 return(ETIMEDOUT); 1270 1271 return(0); --- 451 unchanged lines hidden (view full) --- 1723an_setdef(sc, areq) 1724 struct an_softc *sc; 1725 struct an_req *areq; 1726{ 1727 struct sockaddr_dl *sdl; 1728 struct ifaddr *ifa; 1729 struct ifnet *ifp; 1730 struct an_ltv_genconfig *cfg; | 1281 1282 /* Ack the command */ 1283 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_CMD); 1284 1285 if (i == AN_TIMEOUT) 1286 return(ETIMEDOUT); 1287 1288 return(0); --- 451 unchanged lines hidden (view full) --- 1740an_setdef(sc, areq) 1741 struct an_softc *sc; 1742 struct an_req *areq; 1743{ 1744 struct sockaddr_dl *sdl; 1745 struct ifaddr *ifa; 1746 struct ifnet *ifp; 1747 struct an_ltv_genconfig *cfg; |
1731 struct an_ltv_ssidlist *ssid; | 1748 struct an_ltv_ssidlist_new *ssid; |
1732 struct an_ltv_aplist *ap; 1733 struct an_ltv_gen *sp; 1734 1735 ifp = &sc->arpcom.ac_if; 1736 1737 switch (areq->an_type) { 1738 case AN_RID_GENCONFIG: 1739 cfg = (struct an_ltv_genconfig *)areq; 1740 1741 ifa = ifaddr_byindex(ifp->if_index); 1742 sdl = (struct sockaddr_dl *)ifa->ifa_addr; 1743 bcopy((char *)&cfg->an_macaddr, (char *)&sc->arpcom.ac_enaddr, 1744 ETHER_ADDR_LEN); 1745 bcopy((char *)&cfg->an_macaddr, LLADDR(sdl), ETHER_ADDR_LEN); 1746 1747 bcopy((char *)cfg, (char *)&sc->an_config, 1748 sizeof(struct an_ltv_genconfig)); 1749 break; 1750 case AN_RID_SSIDLIST: | 1749 struct an_ltv_aplist *ap; 1750 struct an_ltv_gen *sp; 1751 1752 ifp = &sc->arpcom.ac_if; 1753 1754 switch (areq->an_type) { 1755 case AN_RID_GENCONFIG: 1756 cfg = (struct an_ltv_genconfig *)areq; 1757 1758 ifa = ifaddr_byindex(ifp->if_index); 1759 sdl = (struct sockaddr_dl *)ifa->ifa_addr; 1760 bcopy((char *)&cfg->an_macaddr, (char *)&sc->arpcom.ac_enaddr, 1761 ETHER_ADDR_LEN); 1762 bcopy((char *)&cfg->an_macaddr, LLADDR(sdl), ETHER_ADDR_LEN); 1763 1764 bcopy((char *)cfg, (char *)&sc->an_config, 1765 sizeof(struct an_ltv_genconfig)); 1766 break; 1767 case AN_RID_SSIDLIST: |
1751 ssid = (struct an_ltv_ssidlist *)areq; | 1768 ssid = (struct an_ltv_ssidlist_new *)areq; |
1752 bcopy((char *)ssid, (char *)&sc->an_ssidlist, | 1769 bcopy((char *)ssid, (char *)&sc->an_ssidlist, |
1753 sizeof(struct an_ltv_ssidlist)); | 1770 sizeof(struct an_ltv_ssidlist_new)); |
1754 break; 1755 case AN_RID_APLIST: 1756 ap = (struct an_ltv_aplist *)areq; 1757 bcopy((char *)ap, (char *)&sc->an_aplist, 1758 sizeof(struct an_ltv_aplist)); 1759 break; 1760 case AN_RID_TX_SPEED: 1761 sp = (struct an_ltv_gen *)areq; --- 16 unchanged lines hidden (view full) --- 1778 case AN_RID_WEP_TEMP: 1779 /* Cache the temp keys */ 1780 bcopy(areq, 1781 &sc->an_temp_keys[((struct an_ltv_key *)areq)->kindex], 1782 sizeof(struct an_ltv_key)); 1783 case AN_RID_WEP_PERM: 1784 case AN_RID_LEAPUSERNAME: 1785 case AN_RID_LEAPPASSWORD: | 1771 break; 1772 case AN_RID_APLIST: 1773 ap = (struct an_ltv_aplist *)areq; 1774 bcopy((char *)ap, (char *)&sc->an_aplist, 1775 sizeof(struct an_ltv_aplist)); 1776 break; 1777 case AN_RID_TX_SPEED: 1778 sp = (struct an_ltv_gen *)areq; --- 16 unchanged lines hidden (view full) --- 1795 case AN_RID_WEP_TEMP: 1796 /* Cache the temp keys */ 1797 bcopy(areq, 1798 &sc->an_temp_keys[((struct an_ltv_key *)areq)->kindex], 1799 sizeof(struct an_ltv_key)); 1800 case AN_RID_WEP_PERM: 1801 case AN_RID_LEAPUSERNAME: 1802 case AN_RID_LEAPPASSWORD: |
1803 an_init(sc); 1804 |
|
1786 /* Disable the MAC. */ 1787 an_cmd(sc, AN_CMD_DISABLE, 0); 1788 1789 /* Write the key */ 1790 an_write_record(sc, (struct an_ltv_gen *)areq); 1791 1792 /* Turn the MAC back on. */ 1793 an_cmd(sc, AN_CMD_ENABLE, 0); --- 60 unchanged lines hidden (view full) --- 1854static int 1855an_ioctl(ifp, command, data) 1856 struct ifnet *ifp; 1857 u_long command; 1858 caddr_t data; 1859{ 1860 int error = 0; 1861 int len; | 1805 /* Disable the MAC. */ 1806 an_cmd(sc, AN_CMD_DISABLE, 0); 1807 1808 /* Write the key */ 1809 an_write_record(sc, (struct an_ltv_gen *)areq); 1810 1811 /* Turn the MAC back on. */ 1812 an_cmd(sc, AN_CMD_ENABLE, 0); --- 60 unchanged lines hidden (view full) --- 1873static int 1874an_ioctl(ifp, command, data) 1875 struct ifnet *ifp; 1876 u_long command; 1877 caddr_t data; 1878{ 1879 int error = 0; 1880 int len; |
1862 int i; | 1881 int i, max; |
1863 struct an_softc *sc; 1864 struct ifreq *ifr; 1865 struct thread *td = curthread; 1866 struct ieee80211req *ireq; 1867 u_int8_t tmpstr[IEEE80211_NWID_LEN*2]; 1868 u_int8_t *tmpptr; 1869 struct an_ltv_genconfig *config; 1870 struct an_ltv_key *key; 1871 struct an_ltv_status *status; | 1882 struct an_softc *sc; 1883 struct ifreq *ifr; 1884 struct thread *td = curthread; 1885 struct ieee80211req *ireq; 1886 u_int8_t tmpstr[IEEE80211_NWID_LEN*2]; 1887 u_int8_t *tmpptr; 1888 struct an_ltv_genconfig *config; 1889 struct an_ltv_key *key; 1890 struct an_ltv_status *status; |
1872 struct an_ltv_ssidlist *ssids; | 1891 struct an_ltv_ssidlist_new *ssids; |
1873 int mode; 1874 struct aironet_ioctl l_ioctl; 1875 1876 sc = ifp->if_softc; 1877 AN_LOCK(sc); 1878 ifr = (struct ifreq *)data; 1879 ireq = (struct ieee80211req *)data; 1880 1881 config = (struct an_ltv_genconfig *)&sc->areq; 1882 key = (struct an_ltv_key *)&sc->areq; 1883 status = (struct an_ltv_status *)&sc->areq; | 1892 int mode; 1893 struct aironet_ioctl l_ioctl; 1894 1895 sc = ifp->if_softc; 1896 AN_LOCK(sc); 1897 ifr = (struct ifreq *)data; 1898 ireq = (struct ieee80211req *)data; 1899 1900 config = (struct an_ltv_genconfig *)&sc->areq; 1901 key = (struct an_ltv_key *)&sc->areq; 1902 status = (struct an_ltv_status *)&sc->areq; |
1884 ssids = (struct an_ltv_ssidlist *)&sc->areq; | 1903 ssids = (struct an_ltv_ssidlist_new *)&sc->areq; |
1885 1886 if (sc->an_gone) { 1887 error = ENODEV; 1888 goto out; 1889 } 1890 1891 switch (command) { 1892 case SIOCSIFFLAGS: --- 106 unchanged lines hidden (view full) --- 1999 tmpptr = status->an_ssid; 2000 } else if (ireq->i_val >= 0) { 2001 sc->areq.an_type = AN_RID_SSIDLIST; 2002 if (an_read_record(sc, 2003 (struct an_ltv_gen *)&sc->areq)) { 2004 error = EINVAL; 2005 break; 2006 } | 1904 1905 if (sc->an_gone) { 1906 error = ENODEV; 1907 goto out; 1908 } 1909 1910 switch (command) { 1911 case SIOCSIFFLAGS: --- 106 unchanged lines hidden (view full) --- 2018 tmpptr = status->an_ssid; 2019 } else if (ireq->i_val >= 0) { 2020 sc->areq.an_type = AN_RID_SSIDLIST; 2021 if (an_read_record(sc, 2022 (struct an_ltv_gen *)&sc->areq)) { 2023 error = EINVAL; 2024 break; 2025 } |
2007 if (ireq->i_val == 0) { 2008 len = ssids->an_ssid1_len; 2009 tmpptr = ssids->an_ssid1; 2010 } else if (ireq->i_val == 1) { 2011 len = ssids->an_ssid2_len; 2012 tmpptr = ssids->an_ssid2; 2013 } else if (ireq->i_val == 2) { 2014 len = ssids->an_ssid3_len; 2015 tmpptr = ssids->an_ssid3; 2016 } else { | 2026 max = (sc->areq.an_len - 4) 2027 / sizeof(struct an_ltv_ssid_entry); 2028 if ( max > MAX_SSIDS ) { 2029 printf("To many SSIDs only using " 2030 "%d of %d\n", 2031 MAX_SSIDS, max); 2032 max = MAX_SSIDS; 2033 } 2034 if (ireq->i_val > max) { |
2017 error = EINVAL; 2018 break; | 2035 error = EINVAL; 2036 break; |
2037 } else { 2038 len = ssids->an_entry[ireq->i_val].an_len; 2039 tmpptr = ssids->an_entry[ireq->i_val].an_ssid; |
|
2019 } 2020 } else { 2021 error = EINVAL; 2022 break; 2023 } 2024 if (len > IEEE80211_NWID_LEN) { 2025 error = EINVAL; 2026 break; 2027 } 2028 ireq->i_len = len; 2029 bzero(tmpstr, IEEE80211_NWID_LEN); 2030 bcopy(tmpptr, tmpstr, len); 2031 error = copyout(tmpstr, ireq->i_data, 2032 IEEE80211_NWID_LEN); 2033 break; 2034 case IEEE80211_IOC_NUMSSIDS: | 2040 } 2041 } else { 2042 error = EINVAL; 2043 break; 2044 } 2045 if (len > IEEE80211_NWID_LEN) { 2046 error = EINVAL; 2047 break; 2048 } 2049 ireq->i_len = len; 2050 bzero(tmpstr, IEEE80211_NWID_LEN); 2051 bcopy(tmpptr, tmpstr, len); 2052 error = copyout(tmpstr, ireq->i_data, 2053 IEEE80211_NWID_LEN); 2054 break; 2055 case IEEE80211_IOC_NUMSSIDS: |
2035 ireq->i_val = 3; | 2056 sc->areq.an_len = sizeof(sc->areq); 2057 sc->areq.an_type = AN_RID_SSIDLIST; 2058 if (an_read_record(sc, 2059 (struct an_ltv_gen *)&sc->areq)) { 2060 error = EINVAL; 2061 break; 2062 } 2063 max = (sc->areq.an_len - 4) 2064 / sizeof(struct an_ltv_ssid_entry); 2065 if ( max > MAX_SSIDS ) { 2066 printf("To many SSIDs only using " 2067 "%d of %d\n", 2068 MAX_SSIDS, max); 2069 max = MAX_SSIDS; 2070 } 2071 ireq->i_val = max; |
2036 break; 2037 case IEEE80211_IOC_WEP: 2038 sc->areq.an_type = AN_RID_ACTUALCFG; 2039 if (an_read_record(sc, 2040 (struct an_ltv_gen *)&sc->areq)) { 2041 error = EINVAL; 2042 break; 2043 } --- 179 unchanged lines hidden (view full) --- 2223 if (an_read_record(sc, 2224 (struct an_ltv_gen *)&sc->areq)) { 2225 error = EINVAL; 2226 break; 2227 } 2228 } 2229 switch (ireq->i_type) { 2230 case IEEE80211_IOC_SSID: | 2072 break; 2073 case IEEE80211_IOC_WEP: 2074 sc->areq.an_type = AN_RID_ACTUALCFG; 2075 if (an_read_record(sc, 2076 (struct an_ltv_gen *)&sc->areq)) { 2077 error = EINVAL; 2078 break; 2079 } --- 179 unchanged lines hidden (view full) --- 2259 if (an_read_record(sc, 2260 (struct an_ltv_gen *)&sc->areq)) { 2261 error = EINVAL; 2262 break; 2263 } 2264 } 2265 switch (ireq->i_type) { 2266 case IEEE80211_IOC_SSID: |
2267 sc->areq.an_len = sizeof(sc->areq); |
|
2231 sc->areq.an_type = AN_RID_SSIDLIST; 2232 if (an_read_record(sc, 2233 (struct an_ltv_gen *)&sc->areq)) { 2234 error = EINVAL; 2235 break; 2236 } 2237 if (ireq->i_len > IEEE80211_NWID_LEN) { 2238 error = EINVAL; 2239 break; 2240 } | 2268 sc->areq.an_type = AN_RID_SSIDLIST; 2269 if (an_read_record(sc, 2270 (struct an_ltv_gen *)&sc->areq)) { 2271 error = EINVAL; 2272 break; 2273 } 2274 if (ireq->i_len > IEEE80211_NWID_LEN) { 2275 error = EINVAL; 2276 break; 2277 } |
2241 switch (ireq->i_val) { 2242 case 0: 2243 error = copyin(ireq->i_data, 2244 ssids->an_ssid1, ireq->i_len); 2245 ssids->an_ssid1_len = ireq->i_len; | 2278 max = (sc->areq.an_len - 4) 2279 / sizeof(struct an_ltv_ssid_entry); 2280 if ( max > MAX_SSIDS ) { 2281 printf("To many SSIDs only using " 2282 "%d of %d\n", 2283 MAX_SSIDS, max); 2284 max = MAX_SSIDS; 2285 } 2286 if (ireq->i_val > max) { 2287 error = EINVAL; |
2246 break; | 2288 break; |
2247 case 1: | 2289 } else { |
2248 error = copyin(ireq->i_data, | 2290 error = copyin(ireq->i_data, |
2249 ssids->an_ssid2, ireq->i_len); 2250 ssids->an_ssid2_len = ireq->i_len; | 2291 ssids->an_entry[ireq->i_val].an_ssid, 2292 ireq->i_len); 2293 ssids->an_entry[ireq->i_val].an_len 2294 = ireq->i_len; |
2251 break; | 2295 break; |
2252 case 2: 2253 error = copyin(ireq->i_data, 2254 ssids->an_ssid3, ireq->i_len); 2255 ssids->an_ssid3_len = ireq->i_len; 2256 break; 2257 default: 2258 error = EINVAL; 2259 break; | |
2260 } 2261 break; 2262 case IEEE80211_IOC_WEP: 2263 switch (ireq->i_val) { 2264 case IEEE80211_WEP_OFF: 2265 config->an_authtype &= 2266 ~(AN_AUTHTYPE_PRIVACY_IN_USE | 2267 AN_AUTHTYPE_ALLOW_UNENCRYPTED); --- 239 unchanged lines hidden (view full) --- 2507 } 2508 } 2509 2510 if (sc->an_have_rssimap) 2511 sc->an_config.an_rxmode |= AN_RXMODE_NORMALIZED_RSSI; 2512 2513 /* Set the ssid list */ 2514 sc->an_ssidlist.an_type = AN_RID_SSIDLIST; | 2296 } 2297 break; 2298 case IEEE80211_IOC_WEP: 2299 switch (ireq->i_val) { 2300 case IEEE80211_WEP_OFF: 2301 config->an_authtype &= 2302 ~(AN_AUTHTYPE_PRIVACY_IN_USE | 2303 AN_AUTHTYPE_ALLOW_UNENCRYPTED); --- 239 unchanged lines hidden (view full) --- 2543 } 2544 } 2545 2546 if (sc->an_have_rssimap) 2547 sc->an_config.an_rxmode |= AN_RXMODE_NORMALIZED_RSSI; 2548 2549 /* Set the ssid list */ 2550 sc->an_ssidlist.an_type = AN_RID_SSIDLIST; |
2515 sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist); | 2551 sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist_new); |
2516 if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) { 2517 printf("an%d: failed to set ssid list\n", sc->an_unit); 2518 AN_UNLOCK(sc); 2519 return; 2520 } 2521 2522 /* Set the AP list */ 2523 sc->an_aplist.an_type = AN_RID_APLIST; --- 19 unchanged lines hidden (view full) --- 2543 AN_UNLOCK(sc); 2544 return; 2545 } 2546 2547 if (ifp->if_flags & IFF_PROMISC) 2548 an_cmd(sc, AN_CMD_SET_MODE, 0xffff); 2549 2550 /* enable interrupts */ | 2552 if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) { 2553 printf("an%d: failed to set ssid list\n", sc->an_unit); 2554 AN_UNLOCK(sc); 2555 return; 2556 } 2557 2558 /* Set the AP list */ 2559 sc->an_aplist.an_type = AN_RID_APLIST; --- 19 unchanged lines hidden (view full) --- 2579 AN_UNLOCK(sc); 2580 return; 2581 } 2582 2583 if (ifp->if_flags & IFF_PROMISC) 2584 an_cmd(sc, AN_CMD_SET_MODE, 0xffff); 2585 2586 /* enable interrupts */ |
2551 CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS); | 2587 CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS(sc->mpi350)); |
2552 2553 ifp->if_flags |= IFF_RUNNING; 2554 ifp->if_flags &= ~IFF_OACTIVE; 2555 2556 sc->an_stat_ch = timeout(an_stats_update, sc, hz); 2557 AN_UNLOCK(sc); 2558 2559 return; --- 5 unchanged lines hidden (view full) --- 2565{ 2566 struct an_softc *sc; 2567 struct mbuf *m0 = NULL; 2568 struct an_txframe_802_3 tx_frame_802_3; 2569 struct ether_header *eh; 2570 int id, idx, i; 2571 unsigned char txcontrol; 2572 struct an_card_tx_desc an_tx_desc; | 2588 2589 ifp->if_flags |= IFF_RUNNING; 2590 ifp->if_flags &= ~IFF_OACTIVE; 2591 2592 sc->an_stat_ch = timeout(an_stats_update, sc, hz); 2593 AN_UNLOCK(sc); 2594 2595 return; --- 5 unchanged lines hidden (view full) --- 2601{ 2602 struct an_softc *sc; 2603 struct mbuf *m0 = NULL; 2604 struct an_txframe_802_3 tx_frame_802_3; 2605 struct ether_header *eh; 2606 int id, idx, i; 2607 unsigned char txcontrol; 2608 struct an_card_tx_desc an_tx_desc; |
2573 u_int8_t *ptr; | |
2574 u_int8_t *buf; 2575 2576 sc = ifp->if_softc; 2577 2578 if (sc->an_gone) 2579 return; 2580 2581 if (ifp->if_flags & IFF_OACTIVE) --- 63 unchanged lines hidden (view full) --- 2645 m_freem(m0); 2646 m0 = NULL; 2647 2648 sc->an_rdata.an_tx_ring[idx] = id; 2649 if (an_cmd(sc, AN_CMD_TX, id)) 2650 printf("an%d: xmit failed\n", sc->an_unit); 2651 2652 AN_INC(idx, AN_TX_RING_CNT); | 2609 u_int8_t *buf; 2610 2611 sc = ifp->if_softc; 2612 2613 if (sc->an_gone) 2614 return; 2615 2616 if (ifp->if_flags & IFF_OACTIVE) --- 63 unchanged lines hidden (view full) --- 2680 m_freem(m0); 2681 m0 = NULL; 2682 2683 sc->an_rdata.an_tx_ring[idx] = id; 2684 if (an_cmd(sc, AN_CMD_TX, id)) 2685 printf("an%d: xmit failed\n", sc->an_unit); 2686 2687 AN_INC(idx, AN_TX_RING_CNT); |
2688 2689 /* 2690 * Set a timeout in case the chip goes out to lunch. 2691 */ 2692 ifp->if_timer = 5; |
|
2653 } 2654 } else { /* MPI-350 */ | 2693 } 2694 } else { /* MPI-350 */ |
2695/* HACK */ 2696 { 2697 struct an_command cmd_struct; 2698 struct an_reply reply; 2699 /* 2700 * Allocate TX descriptor 2701 */ 2702 2703 bzero(&reply,sizeof(reply)); 2704 cmd_struct.an_cmd = AN_CMD_ALLOC_DESC; 2705 cmd_struct.an_parm0 = AN_DESCRIPTOR_TX; 2706 cmd_struct.an_parm1 = AN_TX_DESC_OFFSET; 2707 cmd_struct.an_parm2 = AN_MAX_TX_DESC; 2708 if (an_cmd_struct(sc, &cmd_struct, &reply)) { 2709 printf("an%d: failed to allocate TX " 2710 "descriptor\n", 2711 sc->an_unit); 2712 return; 2713 } 2714 } 2715/* HACK */ |
|
2655 while (sc->an_rdata.an_tx_empty || 2656 idx != sc->an_rdata.an_tx_cons) { 2657 IF_DEQUEUE(&ifp->if_snd, m0); 2658 if (m0 == NULL) { 2659 break; 2660 } 2661 buf = sc->an_tx_buffer[idx].an_dma_vaddr; 2662 --- 29 unchanged lines hidden (view full) --- 2692 tx_frame_802_3.an_tx_802_3_payload_len); 2693 2694 2695 bzero(&an_tx_desc, sizeof(an_tx_desc)); 2696 an_tx_desc.an_offset = 0; 2697 an_tx_desc.an_eoc = 1; 2698 an_tx_desc.an_valid = 1; 2699 an_tx_desc.an_len = 0x44 + | 2716 while (sc->an_rdata.an_tx_empty || 2717 idx != sc->an_rdata.an_tx_cons) { 2718 IF_DEQUEUE(&ifp->if_snd, m0); 2719 if (m0 == NULL) { 2720 break; 2721 } 2722 buf = sc->an_tx_buffer[idx].an_dma_vaddr; 2723 --- 29 unchanged lines hidden (view full) --- 2753 tx_frame_802_3.an_tx_802_3_payload_len); 2754 2755 2756 bzero(&an_tx_desc, sizeof(an_tx_desc)); 2757 an_tx_desc.an_offset = 0; 2758 an_tx_desc.an_eoc = 1; 2759 an_tx_desc.an_valid = 1; 2760 an_tx_desc.an_len = 0x44 + |
2700 tx_frame_802_3.an_tx_802_3_payload_len; 2701 an_tx_desc.an_phys = sc->an_tx_buffer[idx].an_dma_paddr; 2702 ptr = (u_int8_t*)&an_tx_desc; 2703 for (i = 0; i < sizeof(an_tx_desc); i++) { 2704 CSR_MEM_AUX_WRITE_1(sc, AN_TX_DESC_OFFSET + i, 2705 ptr[i]); | 2761 tx_frame_802_3.an_tx_802_3_payload_len; 2762 an_tx_desc.an_phys 2763 = sc->an_tx_buffer[idx].an_dma_paddr; 2764 for (i = 0; i < sizeof(an_tx_desc) / 4 ; i++) { 2765 CSR_MEM_AUX_WRITE_4(sc, AN_TX_DESC_OFFSET 2766 /* zero for now */ 2767 + (0 * sizeof(an_tx_desc)) 2768 + (i * 4), 2769 ((u_int32_t*)&an_tx_desc)[i]); |
2706 } 2707 2708 /* 2709 * If there's a BPF listner, bounce a copy of 2710 * this frame to him. 2711 */ 2712 BPF_MTAP(ifp, m0); 2713 2714 m_freem(m0); 2715 m0 = NULL; | 2770 } 2771 2772 /* 2773 * If there's a BPF listner, bounce a copy of 2774 * this frame to him. 2775 */ 2776 BPF_MTAP(ifp, m0); 2777 2778 m_freem(m0); 2779 m0 = NULL; |
2716 2717 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_ALLOC); 2718 | |
2719 AN_INC(idx, AN_MAX_TX_DESC); 2720 sc->an_rdata.an_tx_empty = 0; | 2780 AN_INC(idx, AN_MAX_TX_DESC); 2781 sc->an_rdata.an_tx_empty = 0; |
2782 CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_ALLOC); 2783 2784 /* 2785 * Set a timeout in case the chip goes out to lunch. 2786 */ 2787 ifp->if_timer = 5; |
|
2721 } 2722 } 2723 2724 if (m0 != NULL) 2725 ifp->if_flags |= IFF_OACTIVE; 2726 2727 sc->an_rdata.an_tx_prod = idx; 2728 | 2788 } 2789 } 2790 2791 if (m0 != NULL) 2792 ifp->if_flags |= IFF_OACTIVE; 2793 2794 sc->an_rdata.an_tx_prod = idx; 2795 |
2729 /* 2730 * Set a timeout in case the chip goes out to lunch. 2731 */ 2732 ifp->if_timer = 5; 2733 | |
2734 return; 2735} 2736 2737void 2738an_stop(sc) 2739 struct an_softc *sc; 2740{ 2741 struct ifnet *ifp; --- 322 unchanged lines hidden (view full) --- 3064an_media_change(ifp) 3065 struct ifnet *ifp; 3066{ 3067 struct an_softc *sc = ifp->if_softc; 3068 struct an_ltv_genconfig *cfg; 3069 int otype = sc->an_config.an_opmode; 3070 int orate = sc->an_tx_rate; 3071 | 2796 return; 2797} 2798 2799void 2800an_stop(sc) 2801 struct an_softc *sc; 2802{ 2803 struct ifnet *ifp; --- 322 unchanged lines hidden (view full) --- 3126an_media_change(ifp) 3127 struct ifnet *ifp; 3128{ 3129 struct an_softc *sc = ifp->if_softc; 3130 struct an_ltv_genconfig *cfg; 3131 int otype = sc->an_config.an_opmode; 3132 int orate = sc->an_tx_rate; 3133 |
3072 if ((sc->an_ifmedia.ifm_cur->ifm_media & IFM_IEEE80211_ADHOC) != 0) 3073 sc->an_config.an_opmode = AN_OPMODE_IBSS_ADHOC; 3074 else 3075 sc->an_config.an_opmode = AN_OPMODE_INFRASTRUCTURE_STATION; 3076 | |
3077 sc->an_tx_rate = ieee80211_media2rate( 3078 IFM_SUBTYPE(sc->an_ifmedia.ifm_cur->ifm_media)); | 3134 sc->an_tx_rate = ieee80211_media2rate( 3135 IFM_SUBTYPE(sc->an_ifmedia.ifm_cur->ifm_media)); |
3136 if (sc->an_tx_rate < 0) 3137 sc->an_tx_rate = 0; |
|
3079 3080 if (orate != sc->an_tx_rate) { 3081 /* Read the current configuration */ 3082 sc->an_config.an_type = AN_RID_GENCONFIG; 3083 sc->an_config.an_len = sizeof(struct an_ltv_genconfig); 3084 an_read_record(sc, (struct an_ltv_gen *)&sc->an_config); 3085 cfg = &sc->an_config; 3086 3087 /* clear other rates and set the only one we want */ 3088 bzero(cfg->an_rates, sizeof(cfg->an_rates)); 3089 cfg->an_rates[0] = sc->an_tx_rate; 3090 3091 /* Save the new rate */ 3092 sc->an_config.an_type = AN_RID_GENCONFIG; 3093 sc->an_config.an_len = sizeof(struct an_ltv_genconfig); 3094 } 3095 | 3138 3139 if (orate != sc->an_tx_rate) { 3140 /* Read the current configuration */ 3141 sc->an_config.an_type = AN_RID_GENCONFIG; 3142 sc->an_config.an_len = sizeof(struct an_ltv_genconfig); 3143 an_read_record(sc, (struct an_ltv_gen *)&sc->an_config); 3144 cfg = &sc->an_config; 3145 3146 /* clear other rates and set the only one we want */ 3147 bzero(cfg->an_rates, sizeof(cfg->an_rates)); 3148 cfg->an_rates[0] = sc->an_tx_rate; 3149 3150 /* Save the new rate */ 3151 sc->an_config.an_type = AN_RID_GENCONFIG; 3152 sc->an_config.an_len = sizeof(struct an_ltv_genconfig); 3153 } 3154 |
3155 if ((sc->an_ifmedia.ifm_cur->ifm_media & IFM_IEEE80211_ADHOC) != 0) 3156 sc->an_config.an_opmode &= ~AN_OPMODE_INFRASTRUCTURE_STATION; 3157 else 3158 sc->an_config.an_opmode |= AN_OPMODE_INFRASTRUCTURE_STATION; 3159 |
|
3096 if (otype != sc->an_config.an_opmode || 3097 orate != sc->an_tx_rate) 3098 an_init(sc); 3099 3100 return(0); 3101} 3102 3103static void --- 546 unchanged lines hidden --- | 3160 if (otype != sc->an_config.an_opmode || 3161 orate != sc->an_tx_rate) 3162 an_init(sc); 3163 3164 return(0); 3165} 3166 3167static void --- 546 unchanged lines hidden --- |