diff options
Diffstat (limited to 'drivers/net/wireless/orinoco/wext.c')
-rw-r--r-- | drivers/net/wireless/orinoco/wext.c | 273 |
1 files changed, 49 insertions, 224 deletions
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c index fbcc6e1a2e1d..5775124e2aee 100644 --- a/drivers/net/wireless/orinoco/wext.c +++ b/drivers/net/wireless/orinoco/wext.c | |||
@@ -458,7 +458,7 @@ static int orinoco_ioctl_setfreq(struct net_device *dev, | |||
458 | if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { | 458 | if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { |
459 | /* Fast channel change - no commit if successful */ | 459 | /* Fast channel change - no commit if successful */ |
460 | hermes_t *hw = &priv->hw; | 460 | hermes_t *hw = &priv->hw; |
461 | err = hermes_docmd_wait(hw, HERMES_CMD_TEST | | 461 | err = hw->ops->cmd_wait(hw, HERMES_CMD_TEST | |
462 | HERMES_TEST_SET_CHANNEL, | 462 | HERMES_TEST_SET_CHANNEL, |
463 | chan, NULL); | 463 | chan, NULL); |
464 | } | 464 | } |
@@ -538,125 +538,6 @@ static int orinoco_ioctl_setsens(struct net_device *dev, | |||
538 | return -EINPROGRESS; /* Call commit handler */ | 538 | return -EINPROGRESS; /* Call commit handler */ |
539 | } | 539 | } |
540 | 540 | ||
541 | static int orinoco_ioctl_setrts(struct net_device *dev, | ||
542 | struct iw_request_info *info, | ||
543 | struct iw_param *rrq, | ||
544 | char *extra) | ||
545 | { | ||
546 | struct orinoco_private *priv = ndev_priv(dev); | ||
547 | int val = rrq->value; | ||
548 | unsigned long flags; | ||
549 | |||
550 | if (rrq->disabled) | ||
551 | val = 2347; | ||
552 | |||
553 | if ((val < 0) || (val > 2347)) | ||
554 | return -EINVAL; | ||
555 | |||
556 | if (orinoco_lock(priv, &flags) != 0) | ||
557 | return -EBUSY; | ||
558 | |||
559 | priv->rts_thresh = val; | ||
560 | orinoco_unlock(priv, &flags); | ||
561 | |||
562 | return -EINPROGRESS; /* Call commit handler */ | ||
563 | } | ||
564 | |||
565 | static int orinoco_ioctl_getrts(struct net_device *dev, | ||
566 | struct iw_request_info *info, | ||
567 | struct iw_param *rrq, | ||
568 | char *extra) | ||
569 | { | ||
570 | struct orinoco_private *priv = ndev_priv(dev); | ||
571 | |||
572 | rrq->value = priv->rts_thresh; | ||
573 | rrq->disabled = (rrq->value == 2347); | ||
574 | rrq->fixed = 1; | ||
575 | |||
576 | return 0; | ||
577 | } | ||
578 | |||
579 | static int orinoco_ioctl_setfrag(struct net_device *dev, | ||
580 | struct iw_request_info *info, | ||
581 | struct iw_param *frq, | ||
582 | char *extra) | ||
583 | { | ||
584 | struct orinoco_private *priv = ndev_priv(dev); | ||
585 | int err = -EINPROGRESS; /* Call commit handler */ | ||
586 | unsigned long flags; | ||
587 | |||
588 | if (orinoco_lock(priv, &flags) != 0) | ||
589 | return -EBUSY; | ||
590 | |||
591 | if (priv->has_mwo) { | ||
592 | if (frq->disabled) | ||
593 | priv->mwo_robust = 0; | ||
594 | else { | ||
595 | if (frq->fixed) | ||
596 | printk(KERN_WARNING "%s: Fixed fragmentation " | ||
597 | "is not supported on this firmware. " | ||
598 | "Using MWO robust instead.\n", | ||
599 | dev->name); | ||
600 | priv->mwo_robust = 1; | ||
601 | } | ||
602 | } else { | ||
603 | if (frq->disabled) | ||
604 | priv->frag_thresh = 2346; | ||
605 | else { | ||
606 | if ((frq->value < 256) || (frq->value > 2346)) | ||
607 | err = -EINVAL; | ||
608 | else | ||
609 | /* must be even */ | ||
610 | priv->frag_thresh = frq->value & ~0x1; | ||
611 | } | ||
612 | } | ||
613 | |||
614 | orinoco_unlock(priv, &flags); | ||
615 | |||
616 | return err; | ||
617 | } | ||
618 | |||
619 | static int orinoco_ioctl_getfrag(struct net_device *dev, | ||
620 | struct iw_request_info *info, | ||
621 | struct iw_param *frq, | ||
622 | char *extra) | ||
623 | { | ||
624 | struct orinoco_private *priv = ndev_priv(dev); | ||
625 | hermes_t *hw = &priv->hw; | ||
626 | int err; | ||
627 | u16 val; | ||
628 | unsigned long flags; | ||
629 | |||
630 | if (orinoco_lock(priv, &flags) != 0) | ||
631 | return -EBUSY; | ||
632 | |||
633 | if (priv->has_mwo) { | ||
634 | err = hermes_read_wordrec(hw, USER_BAP, | ||
635 | HERMES_RID_CNFMWOROBUST_AGERE, | ||
636 | &val); | ||
637 | if (err) | ||
638 | val = 0; | ||
639 | |||
640 | frq->value = val ? 2347 : 0; | ||
641 | frq->disabled = !val; | ||
642 | frq->fixed = 0; | ||
643 | } else { | ||
644 | err = hermes_read_wordrec(hw, USER_BAP, | ||
645 | HERMES_RID_CNFFRAGMENTATIONTHRESHOLD, | ||
646 | &val); | ||
647 | if (err) | ||
648 | val = 0; | ||
649 | |||
650 | frq->value = val; | ||
651 | frq->disabled = (val >= 2346); | ||
652 | frq->fixed = 1; | ||
653 | } | ||
654 | |||
655 | orinoco_unlock(priv, &flags); | ||
656 | |||
657 | return err; | ||
658 | } | ||
659 | |||
660 | static int orinoco_ioctl_setrate(struct net_device *dev, | 541 | static int orinoco_ioctl_setrate(struct net_device *dev, |
661 | struct iw_request_info *info, | 542 | struct iw_request_info *info, |
662 | struct iw_param *rrq, | 543 | struct iw_param *rrq, |
@@ -1201,60 +1082,6 @@ static int orinoco_ioctl_set_mlme(struct net_device *dev, | |||
1201 | return ret; | 1082 | return ret; |
1202 | } | 1083 | } |
1203 | 1084 | ||
1204 | static int orinoco_ioctl_getretry(struct net_device *dev, | ||
1205 | struct iw_request_info *info, | ||
1206 | struct iw_param *rrq, | ||
1207 | char *extra) | ||
1208 | { | ||
1209 | struct orinoco_private *priv = ndev_priv(dev); | ||
1210 | hermes_t *hw = &priv->hw; | ||
1211 | int err = 0; | ||
1212 | u16 short_limit, long_limit, lifetime; | ||
1213 | unsigned long flags; | ||
1214 | |||
1215 | if (orinoco_lock(priv, &flags) != 0) | ||
1216 | return -EBUSY; | ||
1217 | |||
1218 | err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORTRETRYLIMIT, | ||
1219 | &short_limit); | ||
1220 | if (err) | ||
1221 | goto out; | ||
1222 | |||
1223 | err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_LONGRETRYLIMIT, | ||
1224 | &long_limit); | ||
1225 | if (err) | ||
1226 | goto out; | ||
1227 | |||
1228 | err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_MAXTRANSMITLIFETIME, | ||
1229 | &lifetime); | ||
1230 | if (err) | ||
1231 | goto out; | ||
1232 | |||
1233 | rrq->disabled = 0; /* Can't be disabled */ | ||
1234 | |||
1235 | /* Note : by default, display the retry number */ | ||
1236 | if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { | ||
1237 | rrq->flags = IW_RETRY_LIFETIME; | ||
1238 | rrq->value = lifetime * 1000; /* ??? */ | ||
1239 | } else { | ||
1240 | /* By default, display the min number */ | ||
1241 | if ((rrq->flags & IW_RETRY_LONG)) { | ||
1242 | rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; | ||
1243 | rrq->value = long_limit; | ||
1244 | } else { | ||
1245 | rrq->flags = IW_RETRY_LIMIT; | ||
1246 | rrq->value = short_limit; | ||
1247 | if (short_limit != long_limit) | ||
1248 | rrq->flags |= IW_RETRY_SHORT; | ||
1249 | } | ||
1250 | } | ||
1251 | |||
1252 | out: | ||
1253 | orinoco_unlock(priv, &flags); | ||
1254 | |||
1255 | return err; | ||
1256 | } | ||
1257 | |||
1258 | static int orinoco_ioctl_reset(struct net_device *dev, | 1085 | static int orinoco_ioctl_reset(struct net_device *dev, |
1259 | struct iw_request_info *info, | 1086 | struct iw_request_info *info, |
1260 | void *wrqu, | 1087 | void *wrqu, |
@@ -1446,8 +1273,8 @@ static int orinoco_ioctl_getrid(struct net_device *dev, | |||
1446 | if (orinoco_lock(priv, &flags) != 0) | 1273 | if (orinoco_lock(priv, &flags) != 0) |
1447 | return -EBUSY; | 1274 | return -EBUSY; |
1448 | 1275 | ||
1449 | err = hermes_read_ltv(hw, USER_BAP, rid, MAX_RID_LEN, &length, | 1276 | err = hw->ops->read_ltv(hw, USER_BAP, rid, MAX_RID_LEN, &length, |
1450 | extra); | 1277 | extra); |
1451 | if (err) | 1278 | if (err) |
1452 | goto out; | 1279 | goto out; |
1453 | 1280 | ||
@@ -1506,46 +1333,44 @@ static const struct iw_priv_args orinoco_privtab[] = { | |||
1506 | * Structures to export the Wireless Handlers | 1333 | * Structures to export the Wireless Handlers |
1507 | */ | 1334 | */ |
1508 | 1335 | ||
1509 | #define STD_IW_HANDLER(id, func) \ | ||
1510 | [IW_IOCTL_IDX(id)] = (iw_handler) func | ||
1511 | static const iw_handler orinoco_handler[] = { | 1336 | static const iw_handler orinoco_handler[] = { |
1512 | STD_IW_HANDLER(SIOCSIWCOMMIT, orinoco_ioctl_commit), | 1337 | IW_HANDLER(SIOCSIWCOMMIT, (iw_handler)orinoco_ioctl_commit), |
1513 | STD_IW_HANDLER(SIOCGIWNAME, cfg80211_wext_giwname), | 1338 | IW_HANDLER(SIOCGIWNAME, (iw_handler)cfg80211_wext_giwname), |
1514 | STD_IW_HANDLER(SIOCSIWFREQ, orinoco_ioctl_setfreq), | 1339 | IW_HANDLER(SIOCSIWFREQ, (iw_handler)orinoco_ioctl_setfreq), |
1515 | STD_IW_HANDLER(SIOCGIWFREQ, orinoco_ioctl_getfreq), | 1340 | IW_HANDLER(SIOCGIWFREQ, (iw_handler)orinoco_ioctl_getfreq), |
1516 | STD_IW_HANDLER(SIOCSIWMODE, cfg80211_wext_siwmode), | 1341 | IW_HANDLER(SIOCSIWMODE, (iw_handler)cfg80211_wext_siwmode), |
1517 | STD_IW_HANDLER(SIOCGIWMODE, cfg80211_wext_giwmode), | 1342 | IW_HANDLER(SIOCGIWMODE, (iw_handler)cfg80211_wext_giwmode), |
1518 | STD_IW_HANDLER(SIOCSIWSENS, orinoco_ioctl_setsens), | 1343 | IW_HANDLER(SIOCSIWSENS, (iw_handler)orinoco_ioctl_setsens), |
1519 | STD_IW_HANDLER(SIOCGIWSENS, orinoco_ioctl_getsens), | 1344 | IW_HANDLER(SIOCGIWSENS, (iw_handler)orinoco_ioctl_getsens), |
1520 | STD_IW_HANDLER(SIOCGIWRANGE, cfg80211_wext_giwrange), | 1345 | IW_HANDLER(SIOCGIWRANGE, (iw_handler)cfg80211_wext_giwrange), |
1521 | STD_IW_HANDLER(SIOCSIWSPY, iw_handler_set_spy), | 1346 | IW_HANDLER(SIOCSIWSPY, iw_handler_set_spy), |
1522 | STD_IW_HANDLER(SIOCGIWSPY, iw_handler_get_spy), | 1347 | IW_HANDLER(SIOCGIWSPY, iw_handler_get_spy), |
1523 | STD_IW_HANDLER(SIOCSIWTHRSPY, iw_handler_set_thrspy), | 1348 | IW_HANDLER(SIOCSIWTHRSPY, iw_handler_set_thrspy), |
1524 | STD_IW_HANDLER(SIOCGIWTHRSPY, iw_handler_get_thrspy), | 1349 | IW_HANDLER(SIOCGIWTHRSPY, iw_handler_get_thrspy), |
1525 | STD_IW_HANDLER(SIOCSIWAP, orinoco_ioctl_setwap), | 1350 | IW_HANDLER(SIOCSIWAP, (iw_handler)orinoco_ioctl_setwap), |
1526 | STD_IW_HANDLER(SIOCGIWAP, orinoco_ioctl_getwap), | 1351 | IW_HANDLER(SIOCGIWAP, (iw_handler)orinoco_ioctl_getwap), |
1527 | STD_IW_HANDLER(SIOCSIWSCAN, cfg80211_wext_siwscan), | 1352 | IW_HANDLER(SIOCSIWSCAN, (iw_handler)cfg80211_wext_siwscan), |
1528 | STD_IW_HANDLER(SIOCGIWSCAN, cfg80211_wext_giwscan), | 1353 | IW_HANDLER(SIOCGIWSCAN, (iw_handler)cfg80211_wext_giwscan), |
1529 | STD_IW_HANDLER(SIOCSIWESSID, orinoco_ioctl_setessid), | 1354 | IW_HANDLER(SIOCSIWESSID, (iw_handler)orinoco_ioctl_setessid), |
1530 | STD_IW_HANDLER(SIOCGIWESSID, orinoco_ioctl_getessid), | 1355 | IW_HANDLER(SIOCGIWESSID, (iw_handler)orinoco_ioctl_getessid), |
1531 | STD_IW_HANDLER(SIOCSIWRATE, orinoco_ioctl_setrate), | 1356 | IW_HANDLER(SIOCSIWRATE, (iw_handler)orinoco_ioctl_setrate), |
1532 | STD_IW_HANDLER(SIOCGIWRATE, orinoco_ioctl_getrate), | 1357 | IW_HANDLER(SIOCGIWRATE, (iw_handler)orinoco_ioctl_getrate), |
1533 | STD_IW_HANDLER(SIOCSIWRTS, orinoco_ioctl_setrts), | 1358 | IW_HANDLER(SIOCSIWRTS, (iw_handler)cfg80211_wext_siwrts), |
1534 | STD_IW_HANDLER(SIOCGIWRTS, orinoco_ioctl_getrts), | 1359 | IW_HANDLER(SIOCGIWRTS, (iw_handler)cfg80211_wext_giwrts), |
1535 | STD_IW_HANDLER(SIOCSIWFRAG, orinoco_ioctl_setfrag), | 1360 | IW_HANDLER(SIOCSIWFRAG, (iw_handler)cfg80211_wext_siwfrag), |
1536 | STD_IW_HANDLER(SIOCGIWFRAG, orinoco_ioctl_getfrag), | 1361 | IW_HANDLER(SIOCGIWFRAG, (iw_handler)cfg80211_wext_giwfrag), |
1537 | STD_IW_HANDLER(SIOCGIWRETRY, orinoco_ioctl_getretry), | 1362 | IW_HANDLER(SIOCGIWRETRY, (iw_handler)cfg80211_wext_giwretry), |
1538 | STD_IW_HANDLER(SIOCSIWENCODE, orinoco_ioctl_setiwencode), | 1363 | IW_HANDLER(SIOCSIWENCODE, (iw_handler)orinoco_ioctl_setiwencode), |
1539 | STD_IW_HANDLER(SIOCGIWENCODE, orinoco_ioctl_getiwencode), | 1364 | IW_HANDLER(SIOCGIWENCODE, (iw_handler)orinoco_ioctl_getiwencode), |
1540 | STD_IW_HANDLER(SIOCSIWPOWER, orinoco_ioctl_setpower), | 1365 | IW_HANDLER(SIOCSIWPOWER, (iw_handler)orinoco_ioctl_setpower), |
1541 | STD_IW_HANDLER(SIOCGIWPOWER, orinoco_ioctl_getpower), | 1366 | IW_HANDLER(SIOCGIWPOWER, (iw_handler)orinoco_ioctl_getpower), |
1542 | STD_IW_HANDLER(SIOCSIWGENIE, orinoco_ioctl_set_genie), | 1367 | IW_HANDLER(SIOCSIWGENIE, orinoco_ioctl_set_genie), |
1543 | STD_IW_HANDLER(SIOCGIWGENIE, orinoco_ioctl_get_genie), | 1368 | IW_HANDLER(SIOCGIWGENIE, orinoco_ioctl_get_genie), |
1544 | STD_IW_HANDLER(SIOCSIWMLME, orinoco_ioctl_set_mlme), | 1369 | IW_HANDLER(SIOCSIWMLME, orinoco_ioctl_set_mlme), |
1545 | STD_IW_HANDLER(SIOCSIWAUTH, orinoco_ioctl_set_auth), | 1370 | IW_HANDLER(SIOCSIWAUTH, orinoco_ioctl_set_auth), |
1546 | STD_IW_HANDLER(SIOCGIWAUTH, orinoco_ioctl_get_auth), | 1371 | IW_HANDLER(SIOCGIWAUTH, orinoco_ioctl_get_auth), |
1547 | STD_IW_HANDLER(SIOCSIWENCODEEXT, orinoco_ioctl_set_encodeext), | 1372 | IW_HANDLER(SIOCSIWENCODEEXT, orinoco_ioctl_set_encodeext), |
1548 | STD_IW_HANDLER(SIOCGIWENCODEEXT, orinoco_ioctl_get_encodeext), | 1373 | IW_HANDLER(SIOCGIWENCODEEXT, orinoco_ioctl_get_encodeext), |
1549 | }; | 1374 | }; |
1550 | 1375 | ||
1551 | 1376 | ||
@@ -1553,15 +1378,15 @@ static const iw_handler orinoco_handler[] = { | |||
1553 | Added typecasting since we no longer use iwreq_data -- Moustafa | 1378 | Added typecasting since we no longer use iwreq_data -- Moustafa |
1554 | */ | 1379 | */ |
1555 | static const iw_handler orinoco_private_handler[] = { | 1380 | static const iw_handler orinoco_private_handler[] = { |
1556 | [0] = (iw_handler) orinoco_ioctl_reset, | 1381 | [0] = (iw_handler)orinoco_ioctl_reset, |
1557 | [1] = (iw_handler) orinoco_ioctl_reset, | 1382 | [1] = (iw_handler)orinoco_ioctl_reset, |
1558 | [2] = (iw_handler) orinoco_ioctl_setport3, | 1383 | [2] = (iw_handler)orinoco_ioctl_setport3, |
1559 | [3] = (iw_handler) orinoco_ioctl_getport3, | 1384 | [3] = (iw_handler)orinoco_ioctl_getport3, |
1560 | [4] = (iw_handler) orinoco_ioctl_setpreamble, | 1385 | [4] = (iw_handler)orinoco_ioctl_setpreamble, |
1561 | [5] = (iw_handler) orinoco_ioctl_getpreamble, | 1386 | [5] = (iw_handler)orinoco_ioctl_getpreamble, |
1562 | [6] = (iw_handler) orinoco_ioctl_setibssport, | 1387 | [6] = (iw_handler)orinoco_ioctl_setibssport, |
1563 | [7] = (iw_handler) orinoco_ioctl_getibssport, | 1388 | [7] = (iw_handler)orinoco_ioctl_getibssport, |
1564 | [9] = (iw_handler) orinoco_ioctl_getrid, | 1389 | [9] = (iw_handler)orinoco_ioctl_getrid, |
1565 | }; | 1390 | }; |
1566 | 1391 | ||
1567 | const struct iw_handler_def orinoco_handler_def = { | 1392 | const struct iw_handler_def orinoco_handler_def = { |