aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wext.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-04-20 12:39:05 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:57:17 -0400
commitb9a5f8cab751d362f7c2d94899ca788c22fcd1ef (patch)
treee769e2f59ef845cf7c7cc93b64d33eeed49bb9f7 /net/mac80211/wext.c
parent9e52b0623c6eb49c3f23a326c1fb97bdecc49ba1 (diff)
nl80211: Add set/get for frag/rts threshold and retry limits
Add new nl80211 attributes that can be used with NL80211_CMD_SET_WIPHY and NL80211_CMD_GET_WIPHY to manage fragmentation/RTS threshold and retry limits. Since these values are stored in struct wiphy, remove the local copy from mac80211 where feasible (frag & rts threshold). The retry limits are currently needed in struct ieee80211_conf, but these could be eventually removed since the driver should have access to the values in struct wiphy. Signed-off-by: Jouni Malinen <j@w1.fi> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r--net/mac80211/wext.c138
1 files changed, 6 insertions, 132 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index eb63fc148019..1eb6d8642a77 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -472,132 +472,6 @@ static int ieee80211_ioctl_giwtxpower(struct net_device *dev,
472 return 0; 472 return 0;
473} 473}
474 474
475static int ieee80211_ioctl_siwrts(struct net_device *dev,
476 struct iw_request_info *info,
477 struct iw_param *rts, char *extra)
478{
479 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
480
481 if (rts->disabled)
482 local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
483 else if (!rts->fixed)
484 /* if the rts value is not fixed, then take default */
485 local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
486 else if (rts->value < 0 || rts->value > IEEE80211_MAX_RTS_THRESHOLD)
487 return -EINVAL;
488 else
489 local->rts_threshold = rts->value;
490
491 /* If the wlan card performs RTS/CTS in hardware/firmware,
492 * configure it here */
493
494 if (local->ops->set_rts_threshold)
495 local->ops->set_rts_threshold(local_to_hw(local),
496 local->rts_threshold);
497
498 return 0;
499}
500
501static int ieee80211_ioctl_giwrts(struct net_device *dev,
502 struct iw_request_info *info,
503 struct iw_param *rts, char *extra)
504{
505 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
506
507 rts->value = local->rts_threshold;
508 rts->disabled = (rts->value >= IEEE80211_MAX_RTS_THRESHOLD);
509 rts->fixed = 1;
510
511 return 0;
512}
513
514
515static int ieee80211_ioctl_siwfrag(struct net_device *dev,
516 struct iw_request_info *info,
517 struct iw_param *frag, char *extra)
518{
519 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
520
521 if (frag->disabled)
522 local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
523 else if (!frag->fixed)
524 local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
525 else if (frag->value < 256 ||
526 frag->value > IEEE80211_MAX_FRAG_THRESHOLD)
527 return -EINVAL;
528 else {
529 /* Fragment length must be even, so strip LSB. */
530 local->fragmentation_threshold = frag->value & ~0x1;
531 }
532
533 return 0;
534}
535
536static int ieee80211_ioctl_giwfrag(struct net_device *dev,
537 struct iw_request_info *info,
538 struct iw_param *frag, char *extra)
539{
540 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
541
542 frag->value = local->fragmentation_threshold;
543 frag->disabled = (frag->value >= IEEE80211_MAX_FRAG_THRESHOLD);
544 frag->fixed = 1;
545
546 return 0;
547}
548
549
550static int ieee80211_ioctl_siwretry(struct net_device *dev,
551 struct iw_request_info *info,
552 struct iw_param *retry, char *extra)
553{
554 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
555
556 if (retry->disabled ||
557 (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
558 return -EINVAL;
559
560 if (retry->flags & IW_RETRY_MAX) {
561 local->hw.conf.long_frame_max_tx_count = retry->value;
562 } else if (retry->flags & IW_RETRY_MIN) {
563 local->hw.conf.short_frame_max_tx_count = retry->value;
564 } else {
565 local->hw.conf.long_frame_max_tx_count = retry->value;
566 local->hw.conf.short_frame_max_tx_count = retry->value;
567 }
568
569 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_RETRY_LIMITS);
570
571 return 0;
572}
573
574
575static int ieee80211_ioctl_giwretry(struct net_device *dev,
576 struct iw_request_info *info,
577 struct iw_param *retry, char *extra)
578{
579 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
580
581 retry->disabled = 0;
582 if (retry->flags == 0 || retry->flags & IW_RETRY_MIN) {
583 /* first return min value, iwconfig will ask max value
584 * later if needed */
585 retry->flags |= IW_RETRY_LIMIT;
586 retry->value = local->hw.conf.short_frame_max_tx_count;
587 if (local->hw.conf.long_frame_max_tx_count !=
588 local->hw.conf.short_frame_max_tx_count)
589 retry->flags |= IW_RETRY_MIN;
590 return 0;
591 }
592 if (retry->flags & IW_RETRY_MAX) {
593 retry->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
594 retry->value = local->hw.conf.long_frame_max_tx_count;
595 }
596
597 return 0;
598}
599
600
601static int ieee80211_ioctl_siwencode(struct net_device *dev, 475static int ieee80211_ioctl_siwencode(struct net_device *dev,
602 struct iw_request_info *info, 476 struct iw_request_info *info,
603 struct iw_point *erq, char *keybuf) 477 struct iw_point *erq, char *keybuf)
@@ -1050,14 +924,14 @@ static const iw_handler ieee80211_handler[] =
1050 (iw_handler) NULL, /* -- hole -- */ 924 (iw_handler) NULL, /* -- hole -- */
1051 (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */ 925 (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */
1052 (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */ 926 (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */
1053 (iw_handler) ieee80211_ioctl_siwrts, /* SIOCSIWRTS */ 927 (iw_handler) cfg80211_wext_siwrts, /* SIOCSIWRTS */
1054 (iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */ 928 (iw_handler) cfg80211_wext_giwrts, /* SIOCGIWRTS */
1055 (iw_handler) ieee80211_ioctl_siwfrag, /* SIOCSIWFRAG */ 929 (iw_handler) cfg80211_wext_siwfrag, /* SIOCSIWFRAG */
1056 (iw_handler) ieee80211_ioctl_giwfrag, /* SIOCGIWFRAG */ 930 (iw_handler) cfg80211_wext_giwfrag, /* SIOCGIWFRAG */
1057 (iw_handler) ieee80211_ioctl_siwtxpower, /* SIOCSIWTXPOW */ 931 (iw_handler) ieee80211_ioctl_siwtxpower, /* SIOCSIWTXPOW */
1058 (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */ 932 (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */
1059 (iw_handler) ieee80211_ioctl_siwretry, /* SIOCSIWRETRY */ 933 (iw_handler) cfg80211_wext_siwretry, /* SIOCSIWRETRY */
1060 (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */ 934 (iw_handler) cfg80211_wext_giwretry, /* SIOCGIWRETRY */
1061 (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */ 935 (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
1062 (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */ 936 (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
1063 (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */ 937 (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */