diff options
Diffstat (limited to 'drivers/net/wireless/ray_cs.c')
-rw-r--r-- | drivers/net/wireless/ray_cs.c | 866 |
1 files changed, 451 insertions, 415 deletions
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 0e0ba614259a..e9c5ea0f5535 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <pcmcia/ds.h> | 53 | #include <pcmcia/ds.h> |
54 | #include <pcmcia/mem_op.h> | 54 | #include <pcmcia/mem_op.h> |
55 | 55 | ||
56 | #include <net/ieee80211.h> | ||
56 | #include <linux/wireless.h> | 57 | #include <linux/wireless.h> |
57 | 58 | ||
58 | #include <asm/io.h> | 59 | #include <asm/io.h> |
@@ -64,7 +65,6 @@ | |||
64 | #define WIRELESS_SPY /* Enable spying addresses */ | 65 | #define WIRELESS_SPY /* Enable spying addresses */ |
65 | /* Definitions we need for spy */ | 66 | /* Definitions we need for spy */ |
66 | typedef struct iw_statistics iw_stats; | 67 | typedef struct iw_statistics iw_stats; |
67 | typedef struct iw_quality iw_qual; | ||
68 | typedef u_char mac_addr[ETH_ALEN]; /* Hardware address */ | 68 | typedef u_char mac_addr[ETH_ALEN]; /* Hardware address */ |
69 | 69 | ||
70 | #include "rayctl.h" | 70 | #include "rayctl.h" |
@@ -101,7 +101,6 @@ static int ray_dev_close(struct net_device *dev); | |||
101 | static int ray_dev_config(struct net_device *dev, struct ifmap *map); | 101 | static int ray_dev_config(struct net_device *dev, struct ifmap *map); |
102 | static struct net_device_stats *ray_get_stats(struct net_device *dev); | 102 | static struct net_device_stats *ray_get_stats(struct net_device *dev); |
103 | static int ray_dev_init(struct net_device *dev); | 103 | static int ray_dev_init(struct net_device *dev); |
104 | static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); | ||
105 | 104 | ||
106 | static struct ethtool_ops netdev_ethtool_ops; | 105 | static struct ethtool_ops netdev_ethtool_ops; |
107 | 106 | ||
@@ -114,9 +113,8 @@ static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx, | |||
114 | static void ray_build_header(ray_dev_t *local, struct tx_msg __iomem *ptx, UCHAR msg_type, | 113 | static void ray_build_header(ray_dev_t *local, struct tx_msg __iomem *ptx, UCHAR msg_type, |
115 | unsigned char *data); | 114 | unsigned char *data); |
116 | static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len); | 115 | static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len); |
117 | #if WIRELESS_EXT > 7 /* If wireless extension exist in the kernel */ | ||
118 | static iw_stats * ray_get_wireless_stats(struct net_device * dev); | 116 | static iw_stats * ray_get_wireless_stats(struct net_device * dev); |
119 | #endif /* WIRELESS_EXT > 7 */ | 117 | static const struct iw_handler_def ray_handler_def; |
120 | 118 | ||
121 | /***** Prototypes for raylink functions **************************************/ | 119 | /***** Prototypes for raylink functions **************************************/ |
122 | static int asc_to_int(char a); | 120 | static int asc_to_int(char a); |
@@ -373,11 +371,12 @@ static dev_link_t *ray_attach(void) | |||
373 | dev->hard_start_xmit = &ray_dev_start_xmit; | 371 | dev->hard_start_xmit = &ray_dev_start_xmit; |
374 | dev->set_config = &ray_dev_config; | 372 | dev->set_config = &ray_dev_config; |
375 | dev->get_stats = &ray_get_stats; | 373 | dev->get_stats = &ray_get_stats; |
376 | dev->do_ioctl = &ray_dev_ioctl; | ||
377 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 374 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
378 | #if WIRELESS_EXT > 7 /* If wireless extension exist in the kernel */ | 375 | dev->wireless_handlers = &ray_handler_def; |
379 | dev->get_wireless_stats = ray_get_wireless_stats; | 376 | #ifdef WIRELESS_SPY |
380 | #endif | 377 | local->wireless_data.spy_data = &local->spy_data; |
378 | dev->wireless_data = &local->wireless_data; | ||
379 | #endif /* WIRELESS_SPY */ | ||
381 | 380 | ||
382 | dev->set_multicast_list = &set_multicast_list; | 381 | dev->set_multicast_list = &set_multicast_list; |
383 | 382 | ||
@@ -1201,436 +1200,420 @@ static struct ethtool_ops netdev_ethtool_ops = { | |||
1201 | 1200 | ||
1202 | /*====================================================================*/ | 1201 | /*====================================================================*/ |
1203 | 1202 | ||
1204 | static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 1203 | /*------------------------------------------------------------------*/ |
1204 | /* | ||
1205 | * Wireless Handler : get protocol name | ||
1206 | */ | ||
1207 | static int ray_get_name(struct net_device *dev, | ||
1208 | struct iw_request_info *info, | ||
1209 | char *cwrq, | ||
1210 | char *extra) | ||
1205 | { | 1211 | { |
1206 | ray_dev_t *local = (ray_dev_t *)dev->priv; | 1212 | strcpy(cwrq, "IEEE 802.11-FH"); |
1207 | dev_link_t *link = local->finder; | 1213 | return 0; |
1208 | int err = 0; | 1214 | } |
1209 | #if WIRELESS_EXT > 7 | ||
1210 | struct iwreq *wrq = (struct iwreq *) ifr; | ||
1211 | #endif /* WIRELESS_EXT > 7 */ | ||
1212 | #ifdef WIRELESS_SPY | ||
1213 | struct sockaddr address[IW_MAX_SPY]; | ||
1214 | #endif /* WIRELESS_SPY */ | ||
1215 | 1215 | ||
1216 | if (!(link->state & DEV_PRESENT)) { | 1216 | /*------------------------------------------------------------------*/ |
1217 | DEBUG(2,"ray_dev_ioctl - device not present\n"); | 1217 | /* |
1218 | return -1; | 1218 | * Wireless Handler : set frequency |
1219 | } | 1219 | */ |
1220 | DEBUG(2,"ray_cs IOCTL dev=%p, ifr=%p, cmd = 0x%x\n",dev,ifr,cmd); | 1220 | static int ray_set_freq(struct net_device *dev, |
1221 | /* Validate the command */ | 1221 | struct iw_request_info *info, |
1222 | switch (cmd) | 1222 | struct iw_freq *fwrq, |
1223 | { | 1223 | char *extra) |
1224 | #if WIRELESS_EXT > 7 | 1224 | { |
1225 | /* --------------- WIRELESS EXTENSIONS --------------- */ | 1225 | ray_dev_t *local = (ray_dev_t *)dev->priv; |
1226 | /* Get name */ | 1226 | int err = -EINPROGRESS; /* Call commit handler */ |
1227 | case SIOCGIWNAME: | ||
1228 | strcpy(wrq->u.name, "IEEE 802.11-FH"); | ||
1229 | break; | ||
1230 | |||
1231 | /* Get frequency/channel */ | ||
1232 | case SIOCGIWFREQ: | ||
1233 | wrq->u.freq.m = local->sparm.b5.a_hop_pattern; | ||
1234 | wrq->u.freq.e = 0; | ||
1235 | break; | ||
1236 | |||
1237 | /* Set frequency/channel */ | ||
1238 | case SIOCSIWFREQ: | ||
1239 | /* Reject if card is already initialised */ | ||
1240 | if(local->card_status != CARD_AWAITING_PARAM) | ||
1241 | { | ||
1242 | err = -EBUSY; | ||
1243 | break; | ||
1244 | } | ||
1245 | 1227 | ||
1246 | /* Setting by channel number */ | 1228 | /* Reject if card is already initialised */ |
1247 | if ((wrq->u.freq.m > USA_HOP_MOD) || (wrq->u.freq.e > 0)) | 1229 | if(local->card_status != CARD_AWAITING_PARAM) |
1248 | err = -EOPNOTSUPP; | 1230 | return -EBUSY; |
1249 | else | ||
1250 | local->sparm.b5.a_hop_pattern = wrq->u.freq.m; | ||
1251 | break; | ||
1252 | 1231 | ||
1253 | /* Get current network name (ESSID) */ | 1232 | /* Setting by channel number */ |
1254 | case SIOCGIWESSID: | 1233 | if ((fwrq->m > USA_HOP_MOD) || (fwrq->e > 0)) |
1255 | if (wrq->u.data.pointer) | 1234 | err = -EOPNOTSUPP; |
1256 | { | 1235 | else |
1257 | char essid[IW_ESSID_MAX_SIZE + 1]; | 1236 | local->sparm.b5.a_hop_pattern = fwrq->m; |
1258 | /* Get the essid that was set */ | ||
1259 | memcpy(essid, local->sparm.b5.a_current_ess_id, | ||
1260 | IW_ESSID_MAX_SIZE); | ||
1261 | essid[IW_ESSID_MAX_SIZE] = '\0'; | ||
1262 | |||
1263 | /* Push it out ! */ | ||
1264 | wrq->u.data.length = strlen(essid) + 1; | ||
1265 | wrq->u.data.flags = 1; /* active */ | ||
1266 | if (copy_to_user(wrq->u.data.pointer, essid, sizeof(essid))) | ||
1267 | err = -EFAULT; | ||
1268 | } | ||
1269 | break; | ||
1270 | 1237 | ||
1271 | /* Set desired network name (ESSID) */ | 1238 | return err; |
1272 | case SIOCSIWESSID: | 1239 | } |
1273 | /* Reject if card is already initialised */ | 1240 | |
1274 | if(local->card_status != CARD_AWAITING_PARAM) | 1241 | /*------------------------------------------------------------------*/ |
1275 | { | 1242 | /* |
1276 | err = -EBUSY; | 1243 | * Wireless Handler : get frequency |
1277 | break; | 1244 | */ |
1278 | } | 1245 | static int ray_get_freq(struct net_device *dev, |
1246 | struct iw_request_info *info, | ||
1247 | struct iw_freq *fwrq, | ||
1248 | char *extra) | ||
1249 | { | ||
1250 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
1279 | 1251 | ||
1280 | if (wrq->u.data.pointer) | 1252 | fwrq->m = local->sparm.b5.a_hop_pattern; |
1281 | { | 1253 | fwrq->e = 0; |
1282 | char card_essid[IW_ESSID_MAX_SIZE + 1]; | 1254 | return 0; |
1283 | 1255 | } | |
1284 | /* Check if we asked for `any' */ | 1256 | |
1285 | if(wrq->u.data.flags == 0) | 1257 | /*------------------------------------------------------------------*/ |
1286 | { | 1258 | /* |
1259 | * Wireless Handler : set ESSID | ||
1260 | */ | ||
1261 | static int ray_set_essid(struct net_device *dev, | ||
1262 | struct iw_request_info *info, | ||
1263 | struct iw_point *dwrq, | ||
1264 | char *extra) | ||
1265 | { | ||
1266 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
1267 | |||
1268 | /* Reject if card is already initialised */ | ||
1269 | if(local->card_status != CARD_AWAITING_PARAM) | ||
1270 | return -EBUSY; | ||
1271 | |||
1272 | /* Check if we asked for `any' */ | ||
1273 | if(dwrq->flags == 0) { | ||
1287 | /* Corey : can you do that ? */ | 1274 | /* Corey : can you do that ? */ |
1288 | err = -EOPNOTSUPP; | 1275 | return -EOPNOTSUPP; |
1289 | } | 1276 | } else { |
1290 | else | ||
1291 | { | ||
1292 | /* Check the size of the string */ | 1277 | /* Check the size of the string */ |
1293 | if(wrq->u.data.length > | 1278 | if(dwrq->length > IW_ESSID_MAX_SIZE + 1) { |
1294 | IW_ESSID_MAX_SIZE + 1) | 1279 | return -E2BIG; |
1295 | { | ||
1296 | err = -E2BIG; | ||
1297 | break; | ||
1298 | } | ||
1299 | if (copy_from_user(card_essid, | ||
1300 | wrq->u.data.pointer, | ||
1301 | wrq->u.data.length)) { | ||
1302 | err = -EFAULT; | ||
1303 | break; | ||
1304 | } | 1280 | } |
1305 | card_essid[IW_ESSID_MAX_SIZE] = '\0'; | ||
1306 | 1281 | ||
1307 | /* Set the ESSID in the card */ | 1282 | /* Set the ESSID in the card */ |
1308 | memcpy(local->sparm.b5.a_current_ess_id, card_essid, | 1283 | memset(local->sparm.b5.a_current_ess_id, 0, IW_ESSID_MAX_SIZE); |
1309 | IW_ESSID_MAX_SIZE); | 1284 | memcpy(local->sparm.b5.a_current_ess_id, extra, dwrq->length); |
1310 | } | ||
1311 | } | 1285 | } |
1312 | break; | ||
1313 | |||
1314 | /* Get current Access Point (BSSID in our case) */ | ||
1315 | case SIOCGIWAP: | ||
1316 | memcpy(wrq->u.ap_addr.sa_data, local->bss_id, ETH_ALEN); | ||
1317 | wrq->u.ap_addr.sa_family = ARPHRD_ETHER; | ||
1318 | break; | ||
1319 | |||
1320 | /* Get the current bit-rate */ | ||
1321 | case SIOCGIWRATE: | ||
1322 | if(local->net_default_tx_rate == 3) | ||
1323 | wrq->u.bitrate.value = 2000000; /* Hum... */ | ||
1324 | else | ||
1325 | wrq->u.bitrate.value = local->net_default_tx_rate * 500000; | ||
1326 | wrq->u.bitrate.fixed = 0; /* We are in auto mode */ | ||
1327 | break; | ||
1328 | |||
1329 | /* Set the desired bit-rate */ | ||
1330 | case SIOCSIWRATE: | ||
1331 | /* Check if rate is in range */ | ||
1332 | if((wrq->u.bitrate.value != 1000000) && | ||
1333 | (wrq->u.bitrate.value != 2000000)) | ||
1334 | { | ||
1335 | err = -EINVAL; | ||
1336 | break; | ||
1337 | } | ||
1338 | /* Hack for 1.5 Mb/s instead of 2 Mb/s */ | ||
1339 | if((local->fw_ver == 0x55) && /* Please check */ | ||
1340 | (wrq->u.bitrate.value == 2000000)) | ||
1341 | local->net_default_tx_rate = 3; | ||
1342 | else | ||
1343 | local->net_default_tx_rate = wrq->u.bitrate.value/500000; | ||
1344 | break; | ||
1345 | |||
1346 | /* Get the current RTS threshold */ | ||
1347 | case SIOCGIWRTS: | ||
1348 | wrq->u.rts.value = (local->sparm.b5.a_rts_threshold[0] << 8) | ||
1349 | + local->sparm.b5.a_rts_threshold[1]; | ||
1350 | #if WIRELESS_EXT > 8 | ||
1351 | wrq->u.rts.disabled = (wrq->u.rts.value == 32767); | ||
1352 | #endif /* WIRELESS_EXT > 8 */ | ||
1353 | wrq->u.rts.fixed = 1; | ||
1354 | break; | ||
1355 | |||
1356 | /* Set the desired RTS threshold */ | ||
1357 | case SIOCSIWRTS: | ||
1358 | { | ||
1359 | int rthr = wrq->u.rts.value; | ||
1360 | 1286 | ||
1361 | /* Reject if card is already initialised */ | 1287 | return -EINPROGRESS; /* Call commit handler */ |
1362 | if(local->card_status != CARD_AWAITING_PARAM) | 1288 | } |
1363 | { | ||
1364 | err = -EBUSY; | ||
1365 | break; | ||
1366 | } | ||
1367 | 1289 | ||
1368 | /* if(wrq->u.rts.fixed == 0) we should complain */ | 1290 | /*------------------------------------------------------------------*/ |
1369 | #if WIRELESS_EXT > 8 | 1291 | /* |
1370 | if(wrq->u.rts.disabled) | 1292 | * Wireless Handler : get ESSID |
1371 | rthr = 32767; | 1293 | */ |
1294 | static int ray_get_essid(struct net_device *dev, | ||
1295 | struct iw_request_info *info, | ||
1296 | struct iw_point *dwrq, | ||
1297 | char *extra) | ||
1298 | { | ||
1299 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
1300 | |||
1301 | /* Get the essid that was set */ | ||
1302 | memcpy(extra, local->sparm.b5.a_current_ess_id, IW_ESSID_MAX_SIZE); | ||
1303 | extra[IW_ESSID_MAX_SIZE] = '\0'; | ||
1304 | |||
1305 | /* Push it out ! */ | ||
1306 | dwrq->length = strlen(extra) + 1; | ||
1307 | dwrq->flags = 1; /* active */ | ||
1308 | |||
1309 | return 0; | ||
1310 | } | ||
1311 | |||
1312 | /*------------------------------------------------------------------*/ | ||
1313 | /* | ||
1314 | * Wireless Handler : get AP address | ||
1315 | */ | ||
1316 | static int ray_get_wap(struct net_device *dev, | ||
1317 | struct iw_request_info *info, | ||
1318 | struct sockaddr *awrq, | ||
1319 | char *extra) | ||
1320 | { | ||
1321 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
1322 | |||
1323 | memcpy(awrq->sa_data, local->bss_id, ETH_ALEN); | ||
1324 | awrq->sa_family = ARPHRD_ETHER; | ||
1325 | |||
1326 | return 0; | ||
1327 | } | ||
1328 | |||
1329 | /*------------------------------------------------------------------*/ | ||
1330 | /* | ||
1331 | * Wireless Handler : set Bit-Rate | ||
1332 | */ | ||
1333 | static int ray_set_rate(struct net_device *dev, | ||
1334 | struct iw_request_info *info, | ||
1335 | struct iw_param *vwrq, | ||
1336 | char *extra) | ||
1337 | { | ||
1338 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
1339 | |||
1340 | /* Reject if card is already initialised */ | ||
1341 | if(local->card_status != CARD_AWAITING_PARAM) | ||
1342 | return -EBUSY; | ||
1343 | |||
1344 | /* Check if rate is in range */ | ||
1345 | if((vwrq->value != 1000000) && (vwrq->value != 2000000)) | ||
1346 | return -EINVAL; | ||
1347 | |||
1348 | /* Hack for 1.5 Mb/s instead of 2 Mb/s */ | ||
1349 | if((local->fw_ver == 0x55) && /* Please check */ | ||
1350 | (vwrq->value == 2000000)) | ||
1351 | local->net_default_tx_rate = 3; | ||
1372 | else | 1352 | else |
1373 | #endif /* WIRELESS_EXT > 8 */ | 1353 | local->net_default_tx_rate = vwrq->value/500000; |
1374 | if((rthr < 0) || (rthr > 2347)) /* What's the max packet size ??? */ | 1354 | |
1375 | { | 1355 | return 0; |
1376 | err = -EINVAL; | 1356 | } |
1377 | break; | 1357 | |
1378 | } | 1358 | /*------------------------------------------------------------------*/ |
1359 | /* | ||
1360 | * Wireless Handler : get Bit-Rate | ||
1361 | */ | ||
1362 | static int ray_get_rate(struct net_device *dev, | ||
1363 | struct iw_request_info *info, | ||
1364 | struct iw_param *vwrq, | ||
1365 | char *extra) | ||
1366 | { | ||
1367 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
1368 | |||
1369 | if(local->net_default_tx_rate == 3) | ||
1370 | vwrq->value = 2000000; /* Hum... */ | ||
1371 | else | ||
1372 | vwrq->value = local->net_default_tx_rate * 500000; | ||
1373 | vwrq->fixed = 0; /* We are in auto mode */ | ||
1374 | |||
1375 | return 0; | ||
1376 | } | ||
1377 | |||
1378 | /*------------------------------------------------------------------*/ | ||
1379 | /* | ||
1380 | * Wireless Handler : set RTS threshold | ||
1381 | */ | ||
1382 | static int ray_set_rts(struct net_device *dev, | ||
1383 | struct iw_request_info *info, | ||
1384 | struct iw_param *vwrq, | ||
1385 | char *extra) | ||
1386 | { | ||
1387 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
1388 | int rthr = vwrq->value; | ||
1389 | |||
1390 | /* Reject if card is already initialised */ | ||
1391 | if(local->card_status != CARD_AWAITING_PARAM) | ||
1392 | return -EBUSY; | ||
1393 | |||
1394 | /* if(wrq->u.rts.fixed == 0) we should complain */ | ||
1395 | if(vwrq->disabled) | ||
1396 | rthr = 32767; | ||
1397 | else { | ||
1398 | if((rthr < 0) || (rthr > 2347)) /* What's the max packet size ??? */ | ||
1399 | return -EINVAL; | ||
1400 | } | ||
1379 | local->sparm.b5.a_rts_threshold[0] = (rthr >> 8) & 0xFF; | 1401 | local->sparm.b5.a_rts_threshold[0] = (rthr >> 8) & 0xFF; |
1380 | local->sparm.b5.a_rts_threshold[1] = rthr & 0xFF; | 1402 | local->sparm.b5.a_rts_threshold[1] = rthr & 0xFF; |
1381 | } | ||
1382 | break; | ||
1383 | 1403 | ||
1384 | /* Get the current fragmentation threshold */ | 1404 | return -EINPROGRESS; /* Call commit handler */ |
1385 | case SIOCGIWFRAG: | 1405 | } |
1386 | wrq->u.frag.value = (local->sparm.b5.a_frag_threshold[0] << 8) | ||
1387 | + local->sparm.b5.a_frag_threshold[1]; | ||
1388 | #if WIRELESS_EXT > 8 | ||
1389 | wrq->u.frag.disabled = (wrq->u.frag.value == 32767); | ||
1390 | #endif /* WIRELESS_EXT > 8 */ | ||
1391 | wrq->u.frag.fixed = 1; | ||
1392 | break; | ||
1393 | 1406 | ||
1394 | /* Set the desired fragmentation threshold */ | ||
1395 | case SIOCSIWFRAG: | ||
1396 | { | ||
1397 | int fthr = wrq->u.frag.value; | ||
1398 | 1407 | ||
1399 | /* Reject if card is already initialised */ | 1408 | /*------------------------------------------------------------------*/ |
1400 | if(local->card_status != CARD_AWAITING_PARAM) | 1409 | /* |
1401 | { | 1410 | * Wireless Handler : get RTS threshold |
1402 | err = -EBUSY; | 1411 | */ |
1403 | break; | 1412 | static int ray_get_rts(struct net_device *dev, |
1404 | } | 1413 | struct iw_request_info *info, |
1414 | struct iw_param *vwrq, | ||
1415 | char *extra) | ||
1416 | { | ||
1417 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
1418 | |||
1419 | vwrq->value = (local->sparm.b5.a_rts_threshold[0] << 8) | ||
1420 | + local->sparm.b5.a_rts_threshold[1]; | ||
1421 | vwrq->disabled = (vwrq->value == 32767); | ||
1422 | vwrq->fixed = 1; | ||
1423 | |||
1424 | return 0; | ||
1425 | } | ||
1426 | |||
1427 | /*------------------------------------------------------------------*/ | ||
1428 | /* | ||
1429 | * Wireless Handler : set Fragmentation threshold | ||
1430 | */ | ||
1431 | static int ray_set_frag(struct net_device *dev, | ||
1432 | struct iw_request_info *info, | ||
1433 | struct iw_param *vwrq, | ||
1434 | char *extra) | ||
1435 | { | ||
1436 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
1437 | int fthr = vwrq->value; | ||
1438 | |||
1439 | /* Reject if card is already initialised */ | ||
1440 | if(local->card_status != CARD_AWAITING_PARAM) | ||
1441 | return -EBUSY; | ||
1405 | 1442 | ||
1406 | /* if(wrq->u.frag.fixed == 0) should complain */ | 1443 | /* if(wrq->u.frag.fixed == 0) should complain */ |
1407 | #if WIRELESS_EXT > 8 | 1444 | if(vwrq->disabled) |
1408 | if(wrq->u.frag.disabled) | 1445 | fthr = 32767; |
1409 | fthr = 32767; | 1446 | else { |
1410 | else | 1447 | if((fthr < 256) || (fthr > 2347)) /* To check out ! */ |
1411 | #endif /* WIRELESS_EXT > 8 */ | 1448 | return -EINVAL; |
1412 | if((fthr < 256) || (fthr > 2347)) /* To check out ! */ | 1449 | } |
1413 | { | ||
1414 | err = -EINVAL; | ||
1415 | break; | ||
1416 | } | ||
1417 | local->sparm.b5.a_frag_threshold[0] = (fthr >> 8) & 0xFF; | 1450 | local->sparm.b5.a_frag_threshold[0] = (fthr >> 8) & 0xFF; |
1418 | local->sparm.b5.a_frag_threshold[1] = fthr & 0xFF; | 1451 | local->sparm.b5.a_frag_threshold[1] = fthr & 0xFF; |
1419 | } | ||
1420 | break; | ||
1421 | 1452 | ||
1422 | #endif /* WIRELESS_EXT > 7 */ | 1453 | return -EINPROGRESS; /* Call commit handler */ |
1423 | #if WIRELESS_EXT > 8 | 1454 | } |
1424 | 1455 | ||
1425 | /* Get the current mode of operation */ | 1456 | /*------------------------------------------------------------------*/ |
1426 | case SIOCGIWMODE: | 1457 | /* |
1427 | if(local->sparm.b5.a_network_type) | 1458 | * Wireless Handler : get Fragmentation threshold |
1428 | wrq->u.mode = IW_MODE_INFRA; | 1459 | */ |
1429 | else | 1460 | static int ray_get_frag(struct net_device *dev, |
1430 | wrq->u.mode = IW_MODE_ADHOC; | 1461 | struct iw_request_info *info, |
1431 | break; | 1462 | struct iw_param *vwrq, |
1463 | char *extra) | ||
1464 | { | ||
1465 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
1432 | 1466 | ||
1433 | /* Set the current mode of operation */ | 1467 | vwrq->value = (local->sparm.b5.a_frag_threshold[0] << 8) |
1434 | case SIOCSIWMODE: | 1468 | + local->sparm.b5.a_frag_threshold[1]; |
1435 | { | 1469 | vwrq->disabled = (vwrq->value == 32767); |
1470 | vwrq->fixed = 1; | ||
1471 | |||
1472 | return 0; | ||
1473 | } | ||
1474 | |||
1475 | /*------------------------------------------------------------------*/ | ||
1476 | /* | ||
1477 | * Wireless Handler : set Mode of Operation | ||
1478 | */ | ||
1479 | static int ray_set_mode(struct net_device *dev, | ||
1480 | struct iw_request_info *info, | ||
1481 | __u32 *uwrq, | ||
1482 | char *extra) | ||
1483 | { | ||
1484 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
1485 | int err = -EINPROGRESS; /* Call commit handler */ | ||
1436 | char card_mode = 1; | 1486 | char card_mode = 1; |
1437 | |||
1438 | /* Reject if card is already initialised */ | ||
1439 | if(local->card_status != CARD_AWAITING_PARAM) | ||
1440 | { | ||
1441 | err = -EBUSY; | ||
1442 | break; | ||
1443 | } | ||
1444 | 1487 | ||
1445 | switch (wrq->u.mode) | 1488 | /* Reject if card is already initialised */ |
1489 | if(local->card_status != CARD_AWAITING_PARAM) | ||
1490 | return -EBUSY; | ||
1491 | |||
1492 | switch (*uwrq) | ||
1446 | { | 1493 | { |
1447 | case IW_MODE_ADHOC: | 1494 | case IW_MODE_ADHOC: |
1448 | card_mode = 0; | 1495 | card_mode = 0; |
1449 | // Fall through | 1496 | // Fall through |
1450 | case IW_MODE_INFRA: | 1497 | case IW_MODE_INFRA: |
1451 | local->sparm.b5.a_network_type = card_mode; | 1498 | local->sparm.b5.a_network_type = card_mode; |
1452 | break; | 1499 | break; |
1453 | default: | 1500 | default: |
1454 | err = -EINVAL; | 1501 | err = -EINVAL; |
1455 | } | 1502 | } |
1456 | } | ||
1457 | break; | ||
1458 | 1503 | ||
1459 | #endif /* WIRELESS_EXT > 8 */ | 1504 | return err; |
1460 | #if WIRELESS_EXT > 7 | 1505 | } |
1461 | /* ------------------ IWSPY SUPPORT ------------------ */ | ||
1462 | /* Define the range (variations) of above parameters */ | ||
1463 | case SIOCGIWRANGE: | ||
1464 | /* Basic checking... */ | ||
1465 | if(wrq->u.data.pointer != (caddr_t) 0) | ||
1466 | { | ||
1467 | struct iw_range range; | ||
1468 | memset((char *) &range, 0, sizeof(struct iw_range)); | ||
1469 | |||
1470 | /* Set the length (very important for backward compatibility) */ | ||
1471 | wrq->u.data.length = sizeof(struct iw_range); | ||
1472 | |||
1473 | #if WIRELESS_EXT > 10 | ||
1474 | /* Set the Wireless Extension versions */ | ||
1475 | range.we_version_compiled = WIRELESS_EXT; | ||
1476 | range.we_version_source = 9; | ||
1477 | #endif /* WIRELESS_EXT > 10 */ | ||
1478 | |||
1479 | /* Set information in the range struct */ | ||
1480 | range.throughput = 1.1 * 1000 * 1000; /* Put the right number here */ | ||
1481 | range.num_channels = hop_pattern_length[(int)country]; | ||
1482 | range.num_frequency = 0; | ||
1483 | range.max_qual.qual = 0; | ||
1484 | range.max_qual.level = 255; /* What's the correct value ? */ | ||
1485 | range.max_qual.noise = 255; /* Idem */ | ||
1486 | range.num_bitrates = 2; | ||
1487 | range.bitrate[0] = 1000000; /* 1 Mb/s */ | ||
1488 | range.bitrate[1] = 2000000; /* 2 Mb/s */ | ||
1489 | |||
1490 | /* Copy structure to the user buffer */ | ||
1491 | if(copy_to_user(wrq->u.data.pointer, &range, | ||
1492 | sizeof(struct iw_range))) | ||
1493 | err = -EFAULT; | ||
1494 | } | ||
1495 | break; | ||
1496 | 1506 | ||
1497 | #ifdef WIRELESS_SPY | 1507 | /*------------------------------------------------------------------*/ |
1498 | /* Set addresses to spy */ | 1508 | /* |
1499 | case SIOCSIWSPY: | 1509 | * Wireless Handler : get Mode of Operation |
1500 | /* Check the number of addresses */ | 1510 | */ |
1501 | if(wrq->u.data.length > IW_MAX_SPY) | 1511 | static int ray_get_mode(struct net_device *dev, |
1502 | { | 1512 | struct iw_request_info *info, |
1503 | err = -E2BIG; | 1513 | __u32 *uwrq, |
1504 | break; | 1514 | char *extra) |
1505 | } | 1515 | { |
1506 | local->spy_number = wrq->u.data.length; | 1516 | ray_dev_t *local = (ray_dev_t *)dev->priv; |
1507 | 1517 | ||
1508 | /* If there is some addresses to copy */ | 1518 | if(local->sparm.b5.a_network_type) |
1509 | if(local->spy_number > 0) | 1519 | *uwrq = IW_MODE_INFRA; |
1510 | { | 1520 | else |
1511 | int i; | 1521 | *uwrq = IW_MODE_ADHOC; |
1512 | |||
1513 | /* Copy addresses to the driver */ | ||
1514 | if(copy_from_user(address, wrq->u.data.pointer, | ||
1515 | sizeof(struct sockaddr) * local->spy_number)) | ||
1516 | { | ||
1517 | err = -EFAULT; | ||
1518 | break; | ||
1519 | } | ||
1520 | |||
1521 | /* Copy addresses to the lp structure */ | ||
1522 | for(i = 0; i < local->spy_number; i++) | ||
1523 | memcpy(local->spy_address[i], address[i].sa_data, ETH_ALEN); | ||
1524 | |||
1525 | /* Reset structure... */ | ||
1526 | memset(local->spy_stat, 0x00, sizeof(iw_qual) * IW_MAX_SPY); | ||
1527 | |||
1528 | #ifdef DEBUG_IOCTL_INFO | ||
1529 | printk(KERN_DEBUG "SetSpy - Set of new addresses is :\n"); | ||
1530 | for(i = 0; i < local->spy_number; i++) | ||
1531 | printk(KERN_DEBUG "%02X:%02X:%02X:%02X:%02X:%02X\n", | ||
1532 | local->spy_address[i][0], | ||
1533 | local->spy_address[i][1], | ||
1534 | local->spy_address[i][2], | ||
1535 | local->spy_address[i][3], | ||
1536 | local->spy_address[i][4], | ||
1537 | local->spy_address[i][5]); | ||
1538 | #endif /* DEBUG_IOCTL_INFO */ | ||
1539 | } | ||
1540 | break; | ||
1541 | 1522 | ||
1542 | /* Get the spy list and spy stats */ | 1523 | return 0; |
1543 | case SIOCGIWSPY: | 1524 | } |
1544 | /* Set the number of addresses */ | ||
1545 | wrq->u.data.length = local->spy_number; | ||
1546 | 1525 | ||
1547 | /* If the user want to have the addresses back... */ | 1526 | /*------------------------------------------------------------------*/ |
1548 | if((local->spy_number > 0) && (wrq->u.data.pointer != (caddr_t) 0)) | 1527 | /* |
1549 | { | 1528 | * Wireless Handler : get range info |
1550 | int i; | 1529 | */ |
1551 | 1530 | static int ray_get_range(struct net_device *dev, | |
1552 | /* Copy addresses from the lp structure */ | 1531 | struct iw_request_info *info, |
1553 | for(i = 0; i < local->spy_number; i++) | 1532 | struct iw_point *dwrq, |
1554 | { | 1533 | char *extra) |
1555 | memcpy(address[i].sa_data, local->spy_address[i], ETH_ALEN); | 1534 | { |
1556 | address[i].sa_family = ARPHRD_ETHER; | 1535 | struct iw_range *range = (struct iw_range *) extra; |
1557 | } | 1536 | |
1558 | 1537 | memset((char *) range, 0, sizeof(struct iw_range)); | |
1559 | /* Copy addresses to the user buffer */ | 1538 | |
1560 | if(copy_to_user(wrq->u.data.pointer, address, | 1539 | /* Set the length (very important for backward compatibility) */ |
1561 | sizeof(struct sockaddr) * local->spy_number)) | 1540 | dwrq->length = sizeof(struct iw_range); |
1562 | { | 1541 | |
1563 | err = -EFAULT; | 1542 | /* Set the Wireless Extension versions */ |
1564 | break; | 1543 | range->we_version_compiled = WIRELESS_EXT; |
1565 | } | 1544 | range->we_version_source = 9; |
1566 | 1545 | ||
1567 | /* Copy stats to the user buffer (just after) */ | 1546 | /* Set information in the range struct */ |
1568 | if(copy_to_user(wrq->u.data.pointer + | 1547 | range->throughput = 1.1 * 1000 * 1000; /* Put the right number here */ |
1569 | (sizeof(struct sockaddr) * local->spy_number), | 1548 | range->num_channels = hop_pattern_length[(int)country]; |
1570 | local->spy_stat, sizeof(iw_qual) * local->spy_number)) | 1549 | range->num_frequency = 0; |
1571 | { | 1550 | range->max_qual.qual = 0; |
1572 | err = -EFAULT; | 1551 | range->max_qual.level = 255; /* What's the correct value ? */ |
1573 | break; | 1552 | range->max_qual.noise = 255; /* Idem */ |
1574 | } | 1553 | range->num_bitrates = 2; |
1575 | 1554 | range->bitrate[0] = 1000000; /* 1 Mb/s */ | |
1576 | /* Reset updated flags */ | 1555 | range->bitrate[1] = 2000000; /* 2 Mb/s */ |
1577 | for(i = 0; i < local->spy_number; i++) | 1556 | return 0; |
1578 | local->spy_stat[i].updated = 0x0; | 1557 | } |
1579 | } /* if(pointer != NULL) */ | ||
1580 | |||
1581 | break; | ||
1582 | #endif /* WIRELESS_SPY */ | ||
1583 | 1558 | ||
1584 | /* ------------------ PRIVATE IOCTL ------------------ */ | 1559 | /*------------------------------------------------------------------*/ |
1585 | #ifndef SIOCIWFIRSTPRIV | 1560 | /* |
1586 | #define SIOCIWFIRSTPRIV SIOCDEVPRIVATE | 1561 | * Wireless Private Handler : set framing mode |
1587 | #endif /* SIOCIWFIRSTPRIV */ | 1562 | */ |
1588 | #define SIOCSIPFRAMING SIOCIWFIRSTPRIV /* Set framing mode */ | 1563 | static int ray_set_framing(struct net_device *dev, |
1589 | #define SIOCGIPFRAMING SIOCIWFIRSTPRIV + 1 /* Get framing mode */ | 1564 | struct iw_request_info *info, |
1590 | #define SIOCGIPCOUNTRY SIOCIWFIRSTPRIV + 3 /* Get country code */ | 1565 | union iwreq_data *wrqu, |
1591 | case SIOCSIPFRAMING: | 1566 | char *extra) |
1592 | if(!capable(CAP_NET_ADMIN)) /* For private IOCTLs, we need to check permissions */ | 1567 | { |
1593 | { | 1568 | translate = *(extra); /* Set framing mode */ |
1594 | err = -EPERM; | ||
1595 | break; | ||
1596 | } | ||
1597 | translate = *(wrq->u.name); /* Set framing mode */ | ||
1598 | break; | ||
1599 | case SIOCGIPFRAMING: | ||
1600 | *(wrq->u.name) = translate; | ||
1601 | break; | ||
1602 | case SIOCGIPCOUNTRY: | ||
1603 | *(wrq->u.name) = country; | ||
1604 | break; | ||
1605 | case SIOCGIWPRIV: | ||
1606 | /* Export our "private" intercace */ | ||
1607 | if(wrq->u.data.pointer != (caddr_t) 0) | ||
1608 | { | ||
1609 | struct iw_priv_args priv[] = | ||
1610 | { /* cmd, set_args, get_args, name */ | ||
1611 | { SIOCSIPFRAMING, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, "set_framing" }, | ||
1612 | { SIOCGIPFRAMING, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "get_framing" }, | ||
1613 | { SIOCGIPCOUNTRY, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "get_country" }, | ||
1614 | }; | ||
1615 | /* Set the number of ioctl available */ | ||
1616 | wrq->u.data.length = 3; | ||
1617 | /* Copy structure to the user buffer */ | ||
1618 | if(copy_to_user(wrq->u.data.pointer, (u_char *) priv, | ||
1619 | sizeof(priv))) | ||
1620 | err = -EFAULT; | ||
1621 | } | ||
1622 | break; | ||
1623 | #endif /* WIRELESS_EXT > 7 */ | ||
1624 | 1569 | ||
1570 | return 0; | ||
1571 | } | ||
1625 | 1572 | ||
1626 | default: | 1573 | /*------------------------------------------------------------------*/ |
1627 | DEBUG(0,"ray_dev_ioctl cmd = 0x%x\n", cmd); | 1574 | /* |
1628 | err = -EOPNOTSUPP; | 1575 | * Wireless Private Handler : get framing mode |
1629 | } | 1576 | */ |
1630 | return err; | 1577 | static int ray_get_framing(struct net_device *dev, |
1631 | } /* end ray_dev_ioctl */ | 1578 | struct iw_request_info *info, |
1632 | /*===========================================================================*/ | 1579 | union iwreq_data *wrqu, |
1633 | #if WIRELESS_EXT > 7 /* If wireless extension exist in the kernel */ | 1580 | char *extra) |
1581 | { | ||
1582 | *(extra) = translate; | ||
1583 | |||
1584 | return 0; | ||
1585 | } | ||
1586 | |||
1587 | /*------------------------------------------------------------------*/ | ||
1588 | /* | ||
1589 | * Wireless Private Handler : get country | ||
1590 | */ | ||
1591 | static int ray_get_country(struct net_device *dev, | ||
1592 | struct iw_request_info *info, | ||
1593 | union iwreq_data *wrqu, | ||
1594 | char *extra) | ||
1595 | { | ||
1596 | *(extra) = country; | ||
1597 | |||
1598 | return 0; | ||
1599 | } | ||
1600 | |||
1601 | /*------------------------------------------------------------------*/ | ||
1602 | /* | ||
1603 | * Commit handler : called after a bunch of SET operations | ||
1604 | */ | ||
1605 | static int ray_commit(struct net_device *dev, | ||
1606 | struct iw_request_info *info, /* NULL */ | ||
1607 | void *zwrq, /* NULL */ | ||
1608 | char *extra) /* NULL */ | ||
1609 | { | ||
1610 | return 0; | ||
1611 | } | ||
1612 | |||
1613 | /*------------------------------------------------------------------*/ | ||
1614 | /* | ||
1615 | * Stats handler : return Wireless Stats | ||
1616 | */ | ||
1634 | static iw_stats * ray_get_wireless_stats(struct net_device * dev) | 1617 | static iw_stats * ray_get_wireless_stats(struct net_device * dev) |
1635 | { | 1618 | { |
1636 | ray_dev_t * local = (ray_dev_t *) dev->priv; | 1619 | ray_dev_t * local = (ray_dev_t *) dev->priv; |
@@ -1642,13 +1625,13 @@ static iw_stats * ray_get_wireless_stats(struct net_device * dev) | |||
1642 | 1625 | ||
1643 | local->wstats.status = local->card_status; | 1626 | local->wstats.status = local->card_status; |
1644 | #ifdef WIRELESS_SPY | 1627 | #ifdef WIRELESS_SPY |
1645 | if((local->spy_number > 0) && (local->sparm.b5.a_network_type == 0)) | 1628 | if((local->spy_data.spy_number > 0) && (local->sparm.b5.a_network_type == 0)) |
1646 | { | 1629 | { |
1647 | /* Get it from the first node in spy list */ | 1630 | /* Get it from the first node in spy list */ |
1648 | local->wstats.qual.qual = local->spy_stat[0].qual; | 1631 | local->wstats.qual.qual = local->spy_data.spy_stat[0].qual; |
1649 | local->wstats.qual.level = local->spy_stat[0].level; | 1632 | local->wstats.qual.level = local->spy_data.spy_stat[0].level; |
1650 | local->wstats.qual.noise = local->spy_stat[0].noise; | 1633 | local->wstats.qual.noise = local->spy_data.spy_stat[0].noise; |
1651 | local->wstats.qual.updated = local->spy_stat[0].updated; | 1634 | local->wstats.qual.updated = local->spy_data.spy_stat[0].updated; |
1652 | } | 1635 | } |
1653 | #endif /* WIRELESS_SPY */ | 1636 | #endif /* WIRELESS_SPY */ |
1654 | 1637 | ||
@@ -1659,7 +1642,65 @@ static iw_stats * ray_get_wireless_stats(struct net_device * dev) | |||
1659 | 1642 | ||
1660 | return &local->wstats; | 1643 | return &local->wstats; |
1661 | } /* end ray_get_wireless_stats */ | 1644 | } /* end ray_get_wireless_stats */ |
1662 | #endif /* WIRELESS_EXT > 7 */ | 1645 | |
1646 | /*------------------------------------------------------------------*/ | ||
1647 | /* | ||
1648 | * Structures to export the Wireless Handlers | ||
1649 | */ | ||
1650 | |||
1651 | static const iw_handler ray_handler[] = { | ||
1652 | [SIOCSIWCOMMIT-SIOCIWFIRST] (iw_handler) ray_commit, | ||
1653 | [SIOCGIWNAME -SIOCIWFIRST] (iw_handler) ray_get_name, | ||
1654 | [SIOCSIWFREQ -SIOCIWFIRST] (iw_handler) ray_set_freq, | ||
1655 | [SIOCGIWFREQ -SIOCIWFIRST] (iw_handler) ray_get_freq, | ||
1656 | [SIOCSIWMODE -SIOCIWFIRST] (iw_handler) ray_set_mode, | ||
1657 | [SIOCGIWMODE -SIOCIWFIRST] (iw_handler) ray_get_mode, | ||
1658 | [SIOCGIWRANGE -SIOCIWFIRST] (iw_handler) ray_get_range, | ||
1659 | #ifdef WIRELESS_SPY | ||
1660 | [SIOCSIWSPY -SIOCIWFIRST] (iw_handler) iw_handler_set_spy, | ||
1661 | [SIOCGIWSPY -SIOCIWFIRST] (iw_handler) iw_handler_get_spy, | ||
1662 | [SIOCSIWTHRSPY-SIOCIWFIRST] (iw_handler) iw_handler_set_thrspy, | ||
1663 | [SIOCGIWTHRSPY-SIOCIWFIRST] (iw_handler) iw_handler_get_thrspy, | ||
1664 | #endif /* WIRELESS_SPY */ | ||
1665 | [SIOCGIWAP -SIOCIWFIRST] (iw_handler) ray_get_wap, | ||
1666 | [SIOCSIWESSID -SIOCIWFIRST] (iw_handler) ray_set_essid, | ||
1667 | [SIOCGIWESSID -SIOCIWFIRST] (iw_handler) ray_get_essid, | ||
1668 | [SIOCSIWRATE -SIOCIWFIRST] (iw_handler) ray_set_rate, | ||
1669 | [SIOCGIWRATE -SIOCIWFIRST] (iw_handler) ray_get_rate, | ||
1670 | [SIOCSIWRTS -SIOCIWFIRST] (iw_handler) ray_set_rts, | ||
1671 | [SIOCGIWRTS -SIOCIWFIRST] (iw_handler) ray_get_rts, | ||
1672 | [SIOCSIWFRAG -SIOCIWFIRST] (iw_handler) ray_set_frag, | ||
1673 | [SIOCGIWFRAG -SIOCIWFIRST] (iw_handler) ray_get_frag, | ||
1674 | }; | ||
1675 | |||
1676 | #define SIOCSIPFRAMING SIOCIWFIRSTPRIV /* Set framing mode */ | ||
1677 | #define SIOCGIPFRAMING SIOCIWFIRSTPRIV + 1 /* Get framing mode */ | ||
1678 | #define SIOCGIPCOUNTRY SIOCIWFIRSTPRIV + 3 /* Get country code */ | ||
1679 | |||
1680 | static const iw_handler ray_private_handler[] = { | ||
1681 | [0] (iw_handler) ray_set_framing, | ||
1682 | [1] (iw_handler) ray_get_framing, | ||
1683 | [3] (iw_handler) ray_get_country, | ||
1684 | }; | ||
1685 | |||
1686 | static const struct iw_priv_args ray_private_args[] = { | ||
1687 | /* cmd, set_args, get_args, name */ | ||
1688 | { SIOCSIPFRAMING, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, "set_framing" }, | ||
1689 | { SIOCGIPFRAMING, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "get_framing" }, | ||
1690 | { SIOCGIPCOUNTRY, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "get_country" }, | ||
1691 | }; | ||
1692 | |||
1693 | static const struct iw_handler_def ray_handler_def = | ||
1694 | { | ||
1695 | .num_standard = sizeof(ray_handler)/sizeof(iw_handler), | ||
1696 | .num_private = sizeof(ray_private_handler)/sizeof(iw_handler), | ||
1697 | .num_private_args = sizeof(ray_private_args)/sizeof(struct iw_priv_args), | ||
1698 | .standard = ray_handler, | ||
1699 | .private = ray_private_handler, | ||
1700 | .private_args = ray_private_args, | ||
1701 | .get_wireless_stats = ray_get_wireless_stats, | ||
1702 | }; | ||
1703 | |||
1663 | /*===========================================================================*/ | 1704 | /*===========================================================================*/ |
1664 | static int ray_open(struct net_device *dev) | 1705 | static int ray_open(struct net_device *dev) |
1665 | { | 1706 | { |
@@ -2392,20 +2433,15 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, unsigned i | |||
2392 | /*local->wstats.qual.noise = none ? */ | 2433 | /*local->wstats.qual.noise = none ? */ |
2393 | local->wstats.qual.updated = 0x2; | 2434 | local->wstats.qual.updated = 0x2; |
2394 | } | 2435 | } |
2395 | /* Now, for the addresses in the spy list */ | 2436 | /* Now, update the spy stuff */ |
2396 | { | 2437 | { |
2397 | int i; | 2438 | struct iw_quality wstats; |
2398 | /* Look all addresses */ | 2439 | wstats.level = siglev; |
2399 | for(i = 0; i < local->spy_number; i++) | 2440 | /* wstats.noise = none ? */ |
2400 | /* If match */ | 2441 | /* wstats.qual = none ? */ |
2401 | if(!memcmp(linksrcaddr, local->spy_address[i], ETH_ALEN)) | 2442 | wstats.updated = 0x2; |
2402 | { | 2443 | /* Update spy records */ |
2403 | /* Update statistics */ | 2444 | wireless_spy_update(dev, linksrcaddr, &wstats); |
2404 | /*local->spy_stat[i].qual = none ? */ | ||
2405 | local->spy_stat[i].level = siglev; | ||
2406 | /*local->spy_stat[i].noise = none ? */ | ||
2407 | local->spy_stat[i].updated = 0x2; | ||
2408 | } | ||
2409 | } | 2445 | } |
2410 | #endif /* WIRELESS_SPY */ | 2446 | #endif /* WIRELESS_SPY */ |
2411 | } /* end rx_data */ | 2447 | } /* end rx_data */ |