diff options
author | David S. Miller <davem@davemloft.net> | 2010-03-29 16:50:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-03-29 16:50:10 -0400 |
commit | 7905e357ebe67a26d9dc8caa1a0b8346431b5f0d (patch) | |
tree | 134442df2f062caa6cebda1b352948b8209efcec /net | |
parent | 083ba279d52bcad20f1dfa3cefd4255cbe82d521 (diff) | |
parent | 76232ebf898c4d5e657f2b663fbf7108bca80ded (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/cfg.c | 27 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 4 | ||||
-rw-r--r-- | net/mac80211/iface.c | 2 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 79 | ||||
-rw-r--r-- | net/mac80211/tx.c | 2 | ||||
-rw-r--r-- | net/wireless/mlme.c | 13 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 131 | ||||
-rw-r--r-- | net/wireless/nl80211.h | 6 | ||||
-rw-r--r-- | net/wireless/wext-core.c | 134 |
9 files changed, 319 insertions, 79 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index b7116ef84a3b..c8f520529eec 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1402,6 +1402,32 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
1402 | return 0; | 1402 | return 0; |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | static int ieee80211_set_cqm_rssi_config(struct wiphy *wiphy, | ||
1406 | struct net_device *dev, | ||
1407 | s32 rssi_thold, u32 rssi_hyst) | ||
1408 | { | ||
1409 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1410 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
1411 | struct ieee80211_vif *vif = &sdata->vif; | ||
1412 | struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; | ||
1413 | |||
1414 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_CQM_RSSI)) | ||
1415 | return -EOPNOTSUPP; | ||
1416 | |||
1417 | if (rssi_thold == bss_conf->cqm_rssi_thold && | ||
1418 | rssi_hyst == bss_conf->cqm_rssi_hyst) | ||
1419 | return 0; | ||
1420 | |||
1421 | bss_conf->cqm_rssi_thold = rssi_thold; | ||
1422 | bss_conf->cqm_rssi_hyst = rssi_hyst; | ||
1423 | |||
1424 | /* tell the driver upon association, unless already associated */ | ||
1425 | if (sdata->u.mgd.associated) | ||
1426 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_CQM); | ||
1427 | |||
1428 | return 0; | ||
1429 | } | ||
1430 | |||
1405 | static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, | 1431 | static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, |
1406 | struct net_device *dev, | 1432 | struct net_device *dev, |
1407 | const u8 *addr, | 1433 | const u8 *addr, |
@@ -1506,4 +1532,5 @@ struct cfg80211_ops mac80211_config_ops = { | |||
1506 | .remain_on_channel = ieee80211_remain_on_channel, | 1532 | .remain_on_channel = ieee80211_remain_on_channel, |
1507 | .cancel_remain_on_channel = ieee80211_cancel_remain_on_channel, | 1533 | .cancel_remain_on_channel = ieee80211_cancel_remain_on_channel, |
1508 | .action = ieee80211_action, | 1534 | .action = ieee80211_action, |
1535 | .set_cqm_rssi_config = ieee80211_set_cqm_rssi_config, | ||
1509 | }; | 1536 | }; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index b84126491ab1..ab369e2a5282 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -327,7 +327,7 @@ struct ieee80211_if_managed { | |||
327 | struct work_struct work; | 327 | struct work_struct work; |
328 | struct work_struct monitor_work; | 328 | struct work_struct monitor_work; |
329 | struct work_struct chswitch_work; | 329 | struct work_struct chswitch_work; |
330 | struct work_struct beacon_loss_work; | 330 | struct work_struct beacon_connection_loss_work; |
331 | 331 | ||
332 | unsigned long probe_timeout; | 332 | unsigned long probe_timeout; |
333 | int probe_send_count; | 333 | int probe_send_count; |
@@ -1156,7 +1156,7 @@ void ieee80211_send_nullfunc(struct ieee80211_local *local, | |||
1156 | int powersave); | 1156 | int powersave); |
1157 | void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, | 1157 | void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, |
1158 | struct ieee80211_hdr *hdr); | 1158 | struct ieee80211_hdr *hdr); |
1159 | void ieee80211_beacon_loss_work(struct work_struct *work); | 1159 | void ieee80211_beacon_connection_loss_work(struct work_struct *work); |
1160 | 1160 | ||
1161 | void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, | 1161 | void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, |
1162 | enum queue_stop_reason reason); | 1162 | enum queue_stop_reason reason); |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index d5571b9420cd..b4ec59a8dc03 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -486,7 +486,7 @@ static int ieee80211_stop(struct net_device *dev) | |||
486 | cancel_work_sync(&sdata->u.mgd.work); | 486 | cancel_work_sync(&sdata->u.mgd.work); |
487 | cancel_work_sync(&sdata->u.mgd.chswitch_work); | 487 | cancel_work_sync(&sdata->u.mgd.chswitch_work); |
488 | cancel_work_sync(&sdata->u.mgd.monitor_work); | 488 | cancel_work_sync(&sdata->u.mgd.monitor_work); |
489 | cancel_work_sync(&sdata->u.mgd.beacon_loss_work); | 489 | cancel_work_sync(&sdata->u.mgd.beacon_connection_loss_work); |
490 | 490 | ||
491 | /* | 491 | /* |
492 | * When we get here, the interface is marked down. | 492 | * When we get here, the interface is marked down. |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index be5f723d643a..34e0650e9ef8 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -753,6 +753,11 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
753 | /* And the BSSID changed - we're associated now */ | 753 | /* And the BSSID changed - we're associated now */ |
754 | bss_info_changed |= BSS_CHANGED_BSSID; | 754 | bss_info_changed |= BSS_CHANGED_BSSID; |
755 | 755 | ||
756 | /* Tell the driver to monitor connection quality (if supported) */ | ||
757 | if ((local->hw.flags & IEEE80211_HW_SUPPORTS_CQM_RSSI) && | ||
758 | sdata->vif.bss_conf.cqm_rssi_thold) | ||
759 | bss_info_changed |= BSS_CHANGED_CQM; | ||
760 | |||
756 | ieee80211_bss_info_change_notify(sdata, bss_info_changed); | 761 | ieee80211_bss_info_change_notify(sdata, bss_info_changed); |
757 | 762 | ||
758 | mutex_lock(&local->iflist_mtx); | 763 | mutex_lock(&local->iflist_mtx); |
@@ -854,6 +859,9 @@ void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, | |||
854 | if (is_multicast_ether_addr(hdr->addr1)) | 859 | if (is_multicast_ether_addr(hdr->addr1)) |
855 | return; | 860 | return; |
856 | 861 | ||
862 | if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) | ||
863 | return; | ||
864 | |||
857 | mod_timer(&sdata->u.mgd.conn_mon_timer, | 865 | mod_timer(&sdata->u.mgd.conn_mon_timer, |
858 | round_jiffies_up(jiffies + IEEE80211_CONNECTION_IDLE_TIME)); | 866 | round_jiffies_up(jiffies + IEEE80211_CONNECTION_IDLE_TIME)); |
859 | } | 867 | } |
@@ -931,23 +939,68 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata, | |||
931 | mutex_unlock(&ifmgd->mtx); | 939 | mutex_unlock(&ifmgd->mtx); |
932 | } | 940 | } |
933 | 941 | ||
934 | void ieee80211_beacon_loss_work(struct work_struct *work) | 942 | static void __ieee80211_connection_loss(struct ieee80211_sub_if_data *sdata) |
943 | { | ||
944 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | ||
945 | struct ieee80211_local *local = sdata->local; | ||
946 | u8 bssid[ETH_ALEN]; | ||
947 | |||
948 | mutex_lock(&ifmgd->mtx); | ||
949 | if (!ifmgd->associated) { | ||
950 | mutex_unlock(&ifmgd->mtx); | ||
951 | return; | ||
952 | } | ||
953 | |||
954 | memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); | ||
955 | |||
956 | printk(KERN_DEBUG "Connection to AP %pM lost.\n", bssid); | ||
957 | |||
958 | ieee80211_set_disassoc(sdata); | ||
959 | ieee80211_recalc_idle(local); | ||
960 | mutex_unlock(&ifmgd->mtx); | ||
961 | /* | ||
962 | * must be outside lock due to cfg80211, | ||
963 | * but that's not a problem. | ||
964 | */ | ||
965 | ieee80211_send_deauth_disassoc(sdata, bssid, | ||
966 | IEEE80211_STYPE_DEAUTH, | ||
967 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, | ||
968 | NULL); | ||
969 | } | ||
970 | |||
971 | void ieee80211_beacon_connection_loss_work(struct work_struct *work) | ||
935 | { | 972 | { |
936 | struct ieee80211_sub_if_data *sdata = | 973 | struct ieee80211_sub_if_data *sdata = |
937 | container_of(work, struct ieee80211_sub_if_data, | 974 | container_of(work, struct ieee80211_sub_if_data, |
938 | u.mgd.beacon_loss_work); | 975 | u.mgd.beacon_connection_loss_work); |
939 | 976 | ||
940 | ieee80211_mgd_probe_ap(sdata, true); | 977 | if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) |
978 | __ieee80211_connection_loss(sdata); | ||
979 | else | ||
980 | ieee80211_mgd_probe_ap(sdata, true); | ||
941 | } | 981 | } |
942 | 982 | ||
943 | void ieee80211_beacon_loss(struct ieee80211_vif *vif) | 983 | void ieee80211_beacon_loss(struct ieee80211_vif *vif) |
944 | { | 984 | { |
945 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | 985 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); |
986 | struct ieee80211_hw *hw = &sdata->local->hw; | ||
946 | 987 | ||
947 | ieee80211_queue_work(&sdata->local->hw, &sdata->u.mgd.beacon_loss_work); | 988 | WARN_ON(hw->flags & IEEE80211_HW_CONNECTION_MONITOR); |
989 | ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work); | ||
948 | } | 990 | } |
949 | EXPORT_SYMBOL(ieee80211_beacon_loss); | 991 | EXPORT_SYMBOL(ieee80211_beacon_loss); |
950 | 992 | ||
993 | void ieee80211_connection_loss(struct ieee80211_vif *vif) | ||
994 | { | ||
995 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | ||
996 | struct ieee80211_hw *hw = &sdata->local->hw; | ||
997 | |||
998 | WARN_ON(!(hw->flags & IEEE80211_HW_CONNECTION_MONITOR)); | ||
999 | ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work); | ||
1000 | } | ||
1001 | EXPORT_SYMBOL(ieee80211_connection_loss); | ||
1002 | |||
1003 | |||
951 | static enum rx_mgmt_action __must_check | 1004 | static enum rx_mgmt_action __must_check |
952 | ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, | 1005 | ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, |
953 | struct ieee80211_mgmt *mgmt, size_t len) | 1006 | struct ieee80211_mgmt *mgmt, size_t len) |
@@ -1637,7 +1690,8 @@ static void ieee80211_sta_bcn_mon_timer(unsigned long data) | |||
1637 | if (local->quiescing) | 1690 | if (local->quiescing) |
1638 | return; | 1691 | return; |
1639 | 1692 | ||
1640 | ieee80211_queue_work(&sdata->local->hw, &sdata->u.mgd.beacon_loss_work); | 1693 | ieee80211_queue_work(&sdata->local->hw, |
1694 | &sdata->u.mgd.beacon_connection_loss_work); | ||
1641 | } | 1695 | } |
1642 | 1696 | ||
1643 | static void ieee80211_sta_conn_mon_timer(unsigned long data) | 1697 | static void ieee80211_sta_conn_mon_timer(unsigned long data) |
@@ -1689,7 +1743,7 @@ void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata) | |||
1689 | */ | 1743 | */ |
1690 | 1744 | ||
1691 | cancel_work_sync(&ifmgd->work); | 1745 | cancel_work_sync(&ifmgd->work); |
1692 | cancel_work_sync(&ifmgd->beacon_loss_work); | 1746 | cancel_work_sync(&ifmgd->beacon_connection_loss_work); |
1693 | if (del_timer_sync(&ifmgd->timer)) | 1747 | if (del_timer_sync(&ifmgd->timer)) |
1694 | set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running); | 1748 | set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running); |
1695 | 1749 | ||
@@ -1723,7 +1777,8 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata) | |||
1723 | INIT_WORK(&ifmgd->work, ieee80211_sta_work); | 1777 | INIT_WORK(&ifmgd->work, ieee80211_sta_work); |
1724 | INIT_WORK(&ifmgd->monitor_work, ieee80211_sta_monitor_work); | 1778 | INIT_WORK(&ifmgd->monitor_work, ieee80211_sta_monitor_work); |
1725 | INIT_WORK(&ifmgd->chswitch_work, ieee80211_chswitch_work); | 1779 | INIT_WORK(&ifmgd->chswitch_work, ieee80211_chswitch_work); |
1726 | INIT_WORK(&ifmgd->beacon_loss_work, ieee80211_beacon_loss_work); | 1780 | INIT_WORK(&ifmgd->beacon_connection_loss_work, |
1781 | ieee80211_beacon_connection_loss_work); | ||
1727 | setup_timer(&ifmgd->timer, ieee80211_sta_timer, | 1782 | setup_timer(&ifmgd->timer, ieee80211_sta_timer, |
1728 | (unsigned long) sdata); | 1783 | (unsigned long) sdata); |
1729 | setup_timer(&ifmgd->bcn_mon_timer, ieee80211_sta_bcn_mon_timer, | 1784 | setup_timer(&ifmgd->bcn_mon_timer, ieee80211_sta_bcn_mon_timer, |
@@ -2135,3 +2190,13 @@ int ieee80211_mgd_action(struct ieee80211_sub_if_data *sdata, | |||
2135 | *cookie = (unsigned long) skb; | 2190 | *cookie = (unsigned long) skb; |
2136 | return 0; | 2191 | return 0; |
2137 | } | 2192 | } |
2193 | |||
2194 | void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, | ||
2195 | enum nl80211_cqm_rssi_threshold_event rssi_event, | ||
2196 | gfp_t gfp) | ||
2197 | { | ||
2198 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | ||
2199 | |||
2200 | cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, gfp); | ||
2201 | } | ||
2202 | EXPORT_SYMBOL(ieee80211_cqm_rssi_notify); | ||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index cbe53ed4fb0b..08e1f17a4226 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -2010,14 +2010,12 @@ void ieee80211_tx_pending(unsigned long data) | |||
2010 | while (!skb_queue_empty(&local->pending[i])) { | 2010 | while (!skb_queue_empty(&local->pending[i])) { |
2011 | struct sk_buff *skb = __skb_dequeue(&local->pending[i]); | 2011 | struct sk_buff *skb = __skb_dequeue(&local->pending[i]); |
2012 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 2012 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
2013 | struct ieee80211_sub_if_data *sdata; | ||
2014 | 2013 | ||
2015 | if (WARN_ON(!info->control.vif)) { | 2014 | if (WARN_ON(!info->control.vif)) { |
2016 | kfree_skb(skb); | 2015 | kfree_skb(skb); |
2017 | continue; | 2016 | continue; |
2018 | } | 2017 | } |
2019 | 2018 | ||
2020 | sdata = vif_to_sdata(info->control.vif); | ||
2021 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, | 2019 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, |
2022 | flags); | 2020 | flags); |
2023 | 2021 | ||
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 62bc8855e123..0855f0d32349 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -894,3 +894,16 @@ void cfg80211_action_tx_status(struct net_device *dev, u64 cookie, | |||
894 | nl80211_send_action_tx_status(rdev, dev, cookie, buf, len, ack, gfp); | 894 | nl80211_send_action_tx_status(rdev, dev, cookie, buf, len, ack, gfp); |
895 | } | 895 | } |
896 | EXPORT_SYMBOL(cfg80211_action_tx_status); | 896 | EXPORT_SYMBOL(cfg80211_action_tx_status); |
897 | |||
898 | void cfg80211_cqm_rssi_notify(struct net_device *dev, | ||
899 | enum nl80211_cqm_rssi_threshold_event rssi_event, | ||
900 | gfp_t gfp) | ||
901 | { | ||
902 | struct wireless_dev *wdev = dev->ieee80211_ptr; | ||
903 | struct wiphy *wiphy = wdev->wiphy; | ||
904 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | ||
905 | |||
906 | /* Indicate roaming trigger event to user space */ | ||
907 | nl80211_send_cqm_rssi_notify(rdev, dev, rssi_event, gfp); | ||
908 | } | ||
909 | EXPORT_SYMBOL(cfg80211_cqm_rssi_notify); | ||
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index e447db04cf76..a7fc3d83f5f6 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -149,6 +149,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
149 | .len = IEEE80211_MAX_DATA_LEN }, | 149 | .len = IEEE80211_MAX_DATA_LEN }, |
150 | [NL80211_ATTR_FRAME_MATCH] = { .type = NLA_BINARY, }, | 150 | [NL80211_ATTR_FRAME_MATCH] = { .type = NLA_BINARY, }, |
151 | [NL80211_ATTR_PS_STATE] = { .type = NLA_U32 }, | 151 | [NL80211_ATTR_PS_STATE] = { .type = NLA_U32 }, |
152 | [NL80211_ATTR_CQM] = { .type = NLA_NESTED, }, | ||
152 | }; | 153 | }; |
153 | 154 | ||
154 | /* policy for the attributes */ | 155 | /* policy for the attributes */ |
@@ -4778,6 +4779,84 @@ unlock_rtnl: | |||
4778 | return err; | 4779 | return err; |
4779 | } | 4780 | } |
4780 | 4781 | ||
4782 | static struct nla_policy | ||
4783 | nl80211_attr_cqm_policy[NL80211_ATTR_CQM_MAX + 1] __read_mostly = { | ||
4784 | [NL80211_ATTR_CQM_RSSI_THOLD] = { .type = NLA_U32 }, | ||
4785 | [NL80211_ATTR_CQM_RSSI_HYST] = { .type = NLA_U32 }, | ||
4786 | [NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT] = { .type = NLA_U32 }, | ||
4787 | }; | ||
4788 | |||
4789 | static int nl80211_set_cqm_rssi(struct genl_info *info, | ||
4790 | s32 threshold, u32 hysteresis) | ||
4791 | { | ||
4792 | struct cfg80211_registered_device *rdev; | ||
4793 | struct wireless_dev *wdev; | ||
4794 | struct net_device *dev; | ||
4795 | int err; | ||
4796 | |||
4797 | if (threshold > 0) | ||
4798 | return -EINVAL; | ||
4799 | |||
4800 | rtnl_lock(); | ||
4801 | |||
4802 | err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); | ||
4803 | if (err) | ||
4804 | goto unlock_rdev; | ||
4805 | |||
4806 | wdev = dev->ieee80211_ptr; | ||
4807 | |||
4808 | if (!rdev->ops->set_cqm_rssi_config) { | ||
4809 | err = -EOPNOTSUPP; | ||
4810 | goto unlock_rdev; | ||
4811 | } | ||
4812 | |||
4813 | if (wdev->iftype != NL80211_IFTYPE_STATION) { | ||
4814 | err = -EOPNOTSUPP; | ||
4815 | goto unlock_rdev; | ||
4816 | } | ||
4817 | |||
4818 | err = rdev->ops->set_cqm_rssi_config(wdev->wiphy, dev, | ||
4819 | threshold, hysteresis); | ||
4820 | |||
4821 | unlock_rdev: | ||
4822 | cfg80211_unlock_rdev(rdev); | ||
4823 | dev_put(dev); | ||
4824 | rtnl_unlock(); | ||
4825 | |||
4826 | return err; | ||
4827 | } | ||
4828 | |||
4829 | static int nl80211_set_cqm(struct sk_buff *skb, struct genl_info *info) | ||
4830 | { | ||
4831 | struct nlattr *attrs[NL80211_ATTR_CQM_MAX + 1]; | ||
4832 | struct nlattr *cqm; | ||
4833 | int err; | ||
4834 | |||
4835 | cqm = info->attrs[NL80211_ATTR_CQM]; | ||
4836 | if (!cqm) { | ||
4837 | err = -EINVAL; | ||
4838 | goto out; | ||
4839 | } | ||
4840 | |||
4841 | err = nla_parse_nested(attrs, NL80211_ATTR_CQM_MAX, cqm, | ||
4842 | nl80211_attr_cqm_policy); | ||
4843 | if (err) | ||
4844 | goto out; | ||
4845 | |||
4846 | if (attrs[NL80211_ATTR_CQM_RSSI_THOLD] && | ||
4847 | attrs[NL80211_ATTR_CQM_RSSI_HYST]) { | ||
4848 | s32 threshold; | ||
4849 | u32 hysteresis; | ||
4850 | threshold = nla_get_u32(attrs[NL80211_ATTR_CQM_RSSI_THOLD]); | ||
4851 | hysteresis = nla_get_u32(attrs[NL80211_ATTR_CQM_RSSI_HYST]); | ||
4852 | err = nl80211_set_cqm_rssi(info, threshold, hysteresis); | ||
4853 | } else | ||
4854 | err = -EINVAL; | ||
4855 | |||
4856 | out: | ||
4857 | return err; | ||
4858 | } | ||
4859 | |||
4781 | static struct genl_ops nl80211_ops[] = { | 4860 | static struct genl_ops nl80211_ops[] = { |
4782 | { | 4861 | { |
4783 | .cmd = NL80211_CMD_GET_WIPHY, | 4862 | .cmd = NL80211_CMD_GET_WIPHY, |
@@ -5082,6 +5161,12 @@ static struct genl_ops nl80211_ops[] = { | |||
5082 | .policy = nl80211_policy, | 5161 | .policy = nl80211_policy, |
5083 | /* can be retrieved by unprivileged users */ | 5162 | /* can be retrieved by unprivileged users */ |
5084 | }, | 5163 | }, |
5164 | { | ||
5165 | .cmd = NL80211_CMD_SET_CQM, | ||
5166 | .doit = nl80211_set_cqm, | ||
5167 | .policy = nl80211_policy, | ||
5168 | .flags = GENL_ADMIN_PERM, | ||
5169 | }, | ||
5085 | }; | 5170 | }; |
5086 | 5171 | ||
5087 | static struct genl_multicast_group nl80211_mlme_mcgrp = { | 5172 | static struct genl_multicast_group nl80211_mlme_mcgrp = { |
@@ -5832,6 +5917,52 @@ void nl80211_send_action_tx_status(struct cfg80211_registered_device *rdev, | |||
5832 | nlmsg_free(msg); | 5917 | nlmsg_free(msg); |
5833 | } | 5918 | } |
5834 | 5919 | ||
5920 | void | ||
5921 | nl80211_send_cqm_rssi_notify(struct cfg80211_registered_device *rdev, | ||
5922 | struct net_device *netdev, | ||
5923 | enum nl80211_cqm_rssi_threshold_event rssi_event, | ||
5924 | gfp_t gfp) | ||
5925 | { | ||
5926 | struct sk_buff *msg; | ||
5927 | struct nlattr *pinfoattr; | ||
5928 | void *hdr; | ||
5929 | |||
5930 | msg = nlmsg_new(NLMSG_GOODSIZE, gfp); | ||
5931 | if (!msg) | ||
5932 | return; | ||
5933 | |||
5934 | hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_NOTIFY_CQM); | ||
5935 | if (!hdr) { | ||
5936 | nlmsg_free(msg); | ||
5937 | return; | ||
5938 | } | ||
5939 | |||
5940 | NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); | ||
5941 | NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); | ||
5942 | |||
5943 | pinfoattr = nla_nest_start(msg, NL80211_ATTR_CQM); | ||
5944 | if (!pinfoattr) | ||
5945 | goto nla_put_failure; | ||
5946 | |||
5947 | NLA_PUT_U32(msg, NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT, | ||
5948 | rssi_event); | ||
5949 | |||
5950 | nla_nest_end(msg, pinfoattr); | ||
5951 | |||
5952 | if (genlmsg_end(msg, hdr) < 0) { | ||
5953 | nlmsg_free(msg); | ||
5954 | return; | ||
5955 | } | ||
5956 | |||
5957 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, | ||
5958 | nl80211_mlme_mcgrp.id, gfp); | ||
5959 | return; | ||
5960 | |||
5961 | nla_put_failure: | ||
5962 | genlmsg_cancel(msg, hdr); | ||
5963 | nlmsg_free(msg); | ||
5964 | } | ||
5965 | |||
5835 | static int nl80211_netlink_notify(struct notifier_block * nb, | 5966 | static int nl80211_netlink_notify(struct notifier_block * nb, |
5836 | unsigned long state, | 5967 | unsigned long state, |
5837 | void *_notify) | 5968 | void *_notify) |
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h index 4ca511102c6c..2ad7fbc7d9f1 100644 --- a/net/wireless/nl80211.h +++ b/net/wireless/nl80211.h | |||
@@ -82,4 +82,10 @@ void nl80211_send_action_tx_status(struct cfg80211_registered_device *rdev, | |||
82 | const u8 *buf, size_t len, bool ack, | 82 | const u8 *buf, size_t len, bool ack, |
83 | gfp_t gfp); | 83 | gfp_t gfp); |
84 | 84 | ||
85 | void | ||
86 | nl80211_send_cqm_rssi_notify(struct cfg80211_registered_device *rdev, | ||
87 | struct net_device *netdev, | ||
88 | enum nl80211_cqm_rssi_threshold_event rssi_event, | ||
89 | gfp_t gfp); | ||
90 | |||
85 | #endif /* __NET_WIRELESS_NL80211_H */ | 91 | #endif /* __NET_WIRELESS_NL80211_H */ |
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c index 5e1656bdf23b..bfcbeee23f9c 100644 --- a/net/wireless/wext-core.c +++ b/net/wireless/wext-core.c | |||
@@ -28,226 +28,226 @@ typedef int (*wext_ioctl_func)(struct net_device *, struct iwreq *, | |||
28 | * know about. | 28 | * know about. |
29 | */ | 29 | */ |
30 | static const struct iw_ioctl_description standard_ioctl[] = { | 30 | static const struct iw_ioctl_description standard_ioctl[] = { |
31 | [SIOCSIWCOMMIT - SIOCIWFIRST] = { | 31 | [IW_IOCTL_IDX(SIOCSIWCOMMIT)] = { |
32 | .header_type = IW_HEADER_TYPE_NULL, | 32 | .header_type = IW_HEADER_TYPE_NULL, |
33 | }, | 33 | }, |
34 | [SIOCGIWNAME - SIOCIWFIRST] = { | 34 | [IW_IOCTL_IDX(SIOCGIWNAME)] = { |
35 | .header_type = IW_HEADER_TYPE_CHAR, | 35 | .header_type = IW_HEADER_TYPE_CHAR, |
36 | .flags = IW_DESCR_FLAG_DUMP, | 36 | .flags = IW_DESCR_FLAG_DUMP, |
37 | }, | 37 | }, |
38 | [SIOCSIWNWID - SIOCIWFIRST] = { | 38 | [IW_IOCTL_IDX(SIOCSIWNWID)] = { |
39 | .header_type = IW_HEADER_TYPE_PARAM, | 39 | .header_type = IW_HEADER_TYPE_PARAM, |
40 | .flags = IW_DESCR_FLAG_EVENT, | 40 | .flags = IW_DESCR_FLAG_EVENT, |
41 | }, | 41 | }, |
42 | [SIOCGIWNWID - SIOCIWFIRST] = { | 42 | [IW_IOCTL_IDX(SIOCGIWNWID)] = { |
43 | .header_type = IW_HEADER_TYPE_PARAM, | 43 | .header_type = IW_HEADER_TYPE_PARAM, |
44 | .flags = IW_DESCR_FLAG_DUMP, | 44 | .flags = IW_DESCR_FLAG_DUMP, |
45 | }, | 45 | }, |
46 | [SIOCSIWFREQ - SIOCIWFIRST] = { | 46 | [IW_IOCTL_IDX(SIOCSIWFREQ)] = { |
47 | .header_type = IW_HEADER_TYPE_FREQ, | 47 | .header_type = IW_HEADER_TYPE_FREQ, |
48 | .flags = IW_DESCR_FLAG_EVENT, | 48 | .flags = IW_DESCR_FLAG_EVENT, |
49 | }, | 49 | }, |
50 | [SIOCGIWFREQ - SIOCIWFIRST] = { | 50 | [IW_IOCTL_IDX(SIOCGIWFREQ)] = { |
51 | .header_type = IW_HEADER_TYPE_FREQ, | 51 | .header_type = IW_HEADER_TYPE_FREQ, |
52 | .flags = IW_DESCR_FLAG_DUMP, | 52 | .flags = IW_DESCR_FLAG_DUMP, |
53 | }, | 53 | }, |
54 | [SIOCSIWMODE - SIOCIWFIRST] = { | 54 | [IW_IOCTL_IDX(SIOCSIWMODE)] = { |
55 | .header_type = IW_HEADER_TYPE_UINT, | 55 | .header_type = IW_HEADER_TYPE_UINT, |
56 | .flags = IW_DESCR_FLAG_EVENT, | 56 | .flags = IW_DESCR_FLAG_EVENT, |
57 | }, | 57 | }, |
58 | [SIOCGIWMODE - SIOCIWFIRST] = { | 58 | [IW_IOCTL_IDX(SIOCGIWMODE)] = { |
59 | .header_type = IW_HEADER_TYPE_UINT, | 59 | .header_type = IW_HEADER_TYPE_UINT, |
60 | .flags = IW_DESCR_FLAG_DUMP, | 60 | .flags = IW_DESCR_FLAG_DUMP, |
61 | }, | 61 | }, |
62 | [SIOCSIWSENS - SIOCIWFIRST] = { | 62 | [IW_IOCTL_IDX(SIOCSIWSENS)] = { |
63 | .header_type = IW_HEADER_TYPE_PARAM, | 63 | .header_type = IW_HEADER_TYPE_PARAM, |
64 | }, | 64 | }, |
65 | [SIOCGIWSENS - SIOCIWFIRST] = { | 65 | [IW_IOCTL_IDX(SIOCGIWSENS)] = { |
66 | .header_type = IW_HEADER_TYPE_PARAM, | 66 | .header_type = IW_HEADER_TYPE_PARAM, |
67 | }, | 67 | }, |
68 | [SIOCSIWRANGE - SIOCIWFIRST] = { | 68 | [IW_IOCTL_IDX(SIOCSIWRANGE)] = { |
69 | .header_type = IW_HEADER_TYPE_NULL, | 69 | .header_type = IW_HEADER_TYPE_NULL, |
70 | }, | 70 | }, |
71 | [SIOCGIWRANGE - SIOCIWFIRST] = { | 71 | [IW_IOCTL_IDX(SIOCGIWRANGE)] = { |
72 | .header_type = IW_HEADER_TYPE_POINT, | 72 | .header_type = IW_HEADER_TYPE_POINT, |
73 | .token_size = 1, | 73 | .token_size = 1, |
74 | .max_tokens = sizeof(struct iw_range), | 74 | .max_tokens = sizeof(struct iw_range), |
75 | .flags = IW_DESCR_FLAG_DUMP, | 75 | .flags = IW_DESCR_FLAG_DUMP, |
76 | }, | 76 | }, |
77 | [SIOCSIWPRIV - SIOCIWFIRST] = { | 77 | [IW_IOCTL_IDX(SIOCSIWPRIV)] = { |
78 | .header_type = IW_HEADER_TYPE_NULL, | 78 | .header_type = IW_HEADER_TYPE_NULL, |
79 | }, | 79 | }, |
80 | [SIOCGIWPRIV - SIOCIWFIRST] = { /* (handled directly by us) */ | 80 | [IW_IOCTL_IDX(SIOCGIWPRIV)] = { /* (handled directly by us) */ |
81 | .header_type = IW_HEADER_TYPE_POINT, | 81 | .header_type = IW_HEADER_TYPE_POINT, |
82 | .token_size = sizeof(struct iw_priv_args), | 82 | .token_size = sizeof(struct iw_priv_args), |
83 | .max_tokens = 16, | 83 | .max_tokens = 16, |
84 | .flags = IW_DESCR_FLAG_NOMAX, | 84 | .flags = IW_DESCR_FLAG_NOMAX, |
85 | }, | 85 | }, |
86 | [SIOCSIWSTATS - SIOCIWFIRST] = { | 86 | [IW_IOCTL_IDX(SIOCSIWSTATS)] = { |
87 | .header_type = IW_HEADER_TYPE_NULL, | 87 | .header_type = IW_HEADER_TYPE_NULL, |
88 | }, | 88 | }, |
89 | [SIOCGIWSTATS - SIOCIWFIRST] = { /* (handled directly by us) */ | 89 | [IW_IOCTL_IDX(SIOCGIWSTATS)] = { /* (handled directly by us) */ |
90 | .header_type = IW_HEADER_TYPE_POINT, | 90 | .header_type = IW_HEADER_TYPE_POINT, |
91 | .token_size = 1, | 91 | .token_size = 1, |
92 | .max_tokens = sizeof(struct iw_statistics), | 92 | .max_tokens = sizeof(struct iw_statistics), |
93 | .flags = IW_DESCR_FLAG_DUMP, | 93 | .flags = IW_DESCR_FLAG_DUMP, |
94 | }, | 94 | }, |
95 | [SIOCSIWSPY - SIOCIWFIRST] = { | 95 | [IW_IOCTL_IDX(SIOCSIWSPY)] = { |
96 | .header_type = IW_HEADER_TYPE_POINT, | 96 | .header_type = IW_HEADER_TYPE_POINT, |
97 | .token_size = sizeof(struct sockaddr), | 97 | .token_size = sizeof(struct sockaddr), |
98 | .max_tokens = IW_MAX_SPY, | 98 | .max_tokens = IW_MAX_SPY, |
99 | }, | 99 | }, |
100 | [SIOCGIWSPY - SIOCIWFIRST] = { | 100 | [IW_IOCTL_IDX(SIOCGIWSPY)] = { |
101 | .header_type = IW_HEADER_TYPE_POINT, | 101 | .header_type = IW_HEADER_TYPE_POINT, |
102 | .token_size = sizeof(struct sockaddr) + | 102 | .token_size = sizeof(struct sockaddr) + |
103 | sizeof(struct iw_quality), | 103 | sizeof(struct iw_quality), |
104 | .max_tokens = IW_MAX_SPY, | 104 | .max_tokens = IW_MAX_SPY, |
105 | }, | 105 | }, |
106 | [SIOCSIWTHRSPY - SIOCIWFIRST] = { | 106 | [IW_IOCTL_IDX(SIOCSIWTHRSPY)] = { |
107 | .header_type = IW_HEADER_TYPE_POINT, | 107 | .header_type = IW_HEADER_TYPE_POINT, |
108 | .token_size = sizeof(struct iw_thrspy), | 108 | .token_size = sizeof(struct iw_thrspy), |
109 | .min_tokens = 1, | 109 | .min_tokens = 1, |
110 | .max_tokens = 1, | 110 | .max_tokens = 1, |
111 | }, | 111 | }, |
112 | [SIOCGIWTHRSPY - SIOCIWFIRST] = { | 112 | [IW_IOCTL_IDX(SIOCGIWTHRSPY)] = { |
113 | .header_type = IW_HEADER_TYPE_POINT, | 113 | .header_type = IW_HEADER_TYPE_POINT, |
114 | .token_size = sizeof(struct iw_thrspy), | 114 | .token_size = sizeof(struct iw_thrspy), |
115 | .min_tokens = 1, | 115 | .min_tokens = 1, |
116 | .max_tokens = 1, | 116 | .max_tokens = 1, |
117 | }, | 117 | }, |
118 | [SIOCSIWAP - SIOCIWFIRST] = { | 118 | [IW_IOCTL_IDX(SIOCSIWAP)] = { |
119 | .header_type = IW_HEADER_TYPE_ADDR, | 119 | .header_type = IW_HEADER_TYPE_ADDR, |
120 | }, | 120 | }, |
121 | [SIOCGIWAP - SIOCIWFIRST] = { | 121 | [IW_IOCTL_IDX(SIOCGIWAP)] = { |
122 | .header_type = IW_HEADER_TYPE_ADDR, | 122 | .header_type = IW_HEADER_TYPE_ADDR, |
123 | .flags = IW_DESCR_FLAG_DUMP, | 123 | .flags = IW_DESCR_FLAG_DUMP, |
124 | }, | 124 | }, |
125 | [SIOCSIWMLME - SIOCIWFIRST] = { | 125 | [IW_IOCTL_IDX(SIOCSIWMLME)] = { |
126 | .header_type = IW_HEADER_TYPE_POINT, | 126 | .header_type = IW_HEADER_TYPE_POINT, |
127 | .token_size = 1, | 127 | .token_size = 1, |
128 | .min_tokens = sizeof(struct iw_mlme), | 128 | .min_tokens = sizeof(struct iw_mlme), |
129 | .max_tokens = sizeof(struct iw_mlme), | 129 | .max_tokens = sizeof(struct iw_mlme), |
130 | }, | 130 | }, |
131 | [SIOCGIWAPLIST - SIOCIWFIRST] = { | 131 | [IW_IOCTL_IDX(SIOCGIWAPLIST)] = { |
132 | .header_type = IW_HEADER_TYPE_POINT, | 132 | .header_type = IW_HEADER_TYPE_POINT, |
133 | .token_size = sizeof(struct sockaddr) + | 133 | .token_size = sizeof(struct sockaddr) + |
134 | sizeof(struct iw_quality), | 134 | sizeof(struct iw_quality), |
135 | .max_tokens = IW_MAX_AP, | 135 | .max_tokens = IW_MAX_AP, |
136 | .flags = IW_DESCR_FLAG_NOMAX, | 136 | .flags = IW_DESCR_FLAG_NOMAX, |
137 | }, | 137 | }, |
138 | [SIOCSIWSCAN - SIOCIWFIRST] = { | 138 | [IW_IOCTL_IDX(SIOCSIWSCAN)] = { |
139 | .header_type = IW_HEADER_TYPE_POINT, | 139 | .header_type = IW_HEADER_TYPE_POINT, |
140 | .token_size = 1, | 140 | .token_size = 1, |
141 | .min_tokens = 0, | 141 | .min_tokens = 0, |
142 | .max_tokens = sizeof(struct iw_scan_req), | 142 | .max_tokens = sizeof(struct iw_scan_req), |
143 | }, | 143 | }, |
144 | [SIOCGIWSCAN - SIOCIWFIRST] = { | 144 | [IW_IOCTL_IDX(SIOCGIWSCAN)] = { |
145 | .header_type = IW_HEADER_TYPE_POINT, | 145 | .header_type = IW_HEADER_TYPE_POINT, |
146 | .token_size = 1, | 146 | .token_size = 1, |
147 | .max_tokens = IW_SCAN_MAX_DATA, | 147 | .max_tokens = IW_SCAN_MAX_DATA, |
148 | .flags = IW_DESCR_FLAG_NOMAX, | 148 | .flags = IW_DESCR_FLAG_NOMAX, |
149 | }, | 149 | }, |
150 | [SIOCSIWESSID - SIOCIWFIRST] = { | 150 | [IW_IOCTL_IDX(SIOCSIWESSID)] = { |
151 | .header_type = IW_HEADER_TYPE_POINT, | 151 | .header_type = IW_HEADER_TYPE_POINT, |
152 | .token_size = 1, | 152 | .token_size = 1, |
153 | .max_tokens = IW_ESSID_MAX_SIZE, | 153 | .max_tokens = IW_ESSID_MAX_SIZE, |
154 | .flags = IW_DESCR_FLAG_EVENT, | 154 | .flags = IW_DESCR_FLAG_EVENT, |
155 | }, | 155 | }, |
156 | [SIOCGIWESSID - SIOCIWFIRST] = { | 156 | [IW_IOCTL_IDX(SIOCGIWESSID)] = { |
157 | .header_type = IW_HEADER_TYPE_POINT, | 157 | .header_type = IW_HEADER_TYPE_POINT, |
158 | .token_size = 1, | 158 | .token_size = 1, |
159 | .max_tokens = IW_ESSID_MAX_SIZE, | 159 | .max_tokens = IW_ESSID_MAX_SIZE, |
160 | .flags = IW_DESCR_FLAG_DUMP, | 160 | .flags = IW_DESCR_FLAG_DUMP, |
161 | }, | 161 | }, |
162 | [SIOCSIWNICKN - SIOCIWFIRST] = { | 162 | [IW_IOCTL_IDX(SIOCSIWNICKN)] = { |
163 | .header_type = IW_HEADER_TYPE_POINT, | 163 | .header_type = IW_HEADER_TYPE_POINT, |
164 | .token_size = 1, | 164 | .token_size = 1, |
165 | .max_tokens = IW_ESSID_MAX_SIZE, | 165 | .max_tokens = IW_ESSID_MAX_SIZE, |
166 | }, | 166 | }, |
167 | [SIOCGIWNICKN - SIOCIWFIRST] = { | 167 | [IW_IOCTL_IDX(SIOCGIWNICKN)] = { |
168 | .header_type = IW_HEADER_TYPE_POINT, | 168 | .header_type = IW_HEADER_TYPE_POINT, |
169 | .token_size = 1, | 169 | .token_size = 1, |
170 | .max_tokens = IW_ESSID_MAX_SIZE, | 170 | .max_tokens = IW_ESSID_MAX_SIZE, |
171 | }, | 171 | }, |
172 | [SIOCSIWRATE - SIOCIWFIRST] = { | 172 | [IW_IOCTL_IDX(SIOCSIWRATE)] = { |
173 | .header_type = IW_HEADER_TYPE_PARAM, | 173 | .header_type = IW_HEADER_TYPE_PARAM, |
174 | }, | 174 | }, |
175 | [SIOCGIWRATE - SIOCIWFIRST] = { | 175 | [IW_IOCTL_IDX(SIOCGIWRATE)] = { |
176 | .header_type = IW_HEADER_TYPE_PARAM, | 176 | .header_type = IW_HEADER_TYPE_PARAM, |
177 | }, | 177 | }, |
178 | [SIOCSIWRTS - SIOCIWFIRST] = { | 178 | [IW_IOCTL_IDX(SIOCSIWRTS)] = { |
179 | .header_type = IW_HEADER_TYPE_PARAM, | 179 | .header_type = IW_HEADER_TYPE_PARAM, |
180 | }, | 180 | }, |
181 | [SIOCGIWRTS - SIOCIWFIRST] = { | 181 | [IW_IOCTL_IDX(SIOCGIWRTS)] = { |
182 | .header_type = IW_HEADER_TYPE_PARAM, | 182 | .header_type = IW_HEADER_TYPE_PARAM, |
183 | }, | 183 | }, |
184 | [SIOCSIWFRAG - SIOCIWFIRST] = { | 184 | [IW_IOCTL_IDX(SIOCSIWFRAG)] = { |
185 | .header_type = IW_HEADER_TYPE_PARAM, | 185 | .header_type = IW_HEADER_TYPE_PARAM, |
186 | }, | 186 | }, |
187 | [SIOCGIWFRAG - SIOCIWFIRST] = { | 187 | [IW_IOCTL_IDX(SIOCGIWFRAG)] = { |
188 | .header_type = IW_HEADER_TYPE_PARAM, | 188 | .header_type = IW_HEADER_TYPE_PARAM, |
189 | }, | 189 | }, |
190 | [SIOCSIWTXPOW - SIOCIWFIRST] = { | 190 | [IW_IOCTL_IDX(SIOCSIWTXPOW)] = { |
191 | .header_type = IW_HEADER_TYPE_PARAM, | 191 | .header_type = IW_HEADER_TYPE_PARAM, |
192 | }, | 192 | }, |
193 | [SIOCGIWTXPOW - SIOCIWFIRST] = { | 193 | [IW_IOCTL_IDX(SIOCGIWTXPOW)] = { |
194 | .header_type = IW_HEADER_TYPE_PARAM, | 194 | .header_type = IW_HEADER_TYPE_PARAM, |
195 | }, | 195 | }, |
196 | [SIOCSIWRETRY - SIOCIWFIRST] = { | 196 | [IW_IOCTL_IDX(SIOCSIWRETRY)] = { |
197 | .header_type = IW_HEADER_TYPE_PARAM, | 197 | .header_type = IW_HEADER_TYPE_PARAM, |
198 | }, | 198 | }, |
199 | [SIOCGIWRETRY - SIOCIWFIRST] = { | 199 | [IW_IOCTL_IDX(SIOCGIWRETRY)] = { |
200 | .header_type = IW_HEADER_TYPE_PARAM, | 200 | .header_type = IW_HEADER_TYPE_PARAM, |
201 | }, | 201 | }, |
202 | [SIOCSIWENCODE - SIOCIWFIRST] = { | 202 | [IW_IOCTL_IDX(SIOCSIWENCODE)] = { |
203 | .header_type = IW_HEADER_TYPE_POINT, | 203 | .header_type = IW_HEADER_TYPE_POINT, |
204 | .token_size = 1, | 204 | .token_size = 1, |
205 | .max_tokens = IW_ENCODING_TOKEN_MAX, | 205 | .max_tokens = IW_ENCODING_TOKEN_MAX, |
206 | .flags = IW_DESCR_FLAG_EVENT | IW_DESCR_FLAG_RESTRICT, | 206 | .flags = IW_DESCR_FLAG_EVENT | IW_DESCR_FLAG_RESTRICT, |
207 | }, | 207 | }, |
208 | [SIOCGIWENCODE - SIOCIWFIRST] = { | 208 | [IW_IOCTL_IDX(SIOCGIWENCODE)] = { |
209 | .header_type = IW_HEADER_TYPE_POINT, | 209 | .header_type = IW_HEADER_TYPE_POINT, |
210 | .token_size = 1, | 210 | .token_size = 1, |
211 | .max_tokens = IW_ENCODING_TOKEN_MAX, | 211 | .max_tokens = IW_ENCODING_TOKEN_MAX, |
212 | .flags = IW_DESCR_FLAG_DUMP | IW_DESCR_FLAG_RESTRICT, | 212 | .flags = IW_DESCR_FLAG_DUMP | IW_DESCR_FLAG_RESTRICT, |
213 | }, | 213 | }, |
214 | [SIOCSIWPOWER - SIOCIWFIRST] = { | 214 | [IW_IOCTL_IDX(SIOCSIWPOWER)] = { |
215 | .header_type = IW_HEADER_TYPE_PARAM, | 215 | .header_type = IW_HEADER_TYPE_PARAM, |
216 | }, | 216 | }, |
217 | [SIOCGIWPOWER - SIOCIWFIRST] = { | 217 | [IW_IOCTL_IDX(SIOCGIWPOWER)] = { |
218 | .header_type = IW_HEADER_TYPE_PARAM, | 218 | .header_type = IW_HEADER_TYPE_PARAM, |
219 | }, | 219 | }, |
220 | [SIOCSIWGENIE - SIOCIWFIRST] = { | 220 | [IW_IOCTL_IDX(SIOCSIWGENIE)] = { |
221 | .header_type = IW_HEADER_TYPE_POINT, | 221 | .header_type = IW_HEADER_TYPE_POINT, |
222 | .token_size = 1, | 222 | .token_size = 1, |
223 | .max_tokens = IW_GENERIC_IE_MAX, | 223 | .max_tokens = IW_GENERIC_IE_MAX, |
224 | }, | 224 | }, |
225 | [SIOCGIWGENIE - SIOCIWFIRST] = { | 225 | [IW_IOCTL_IDX(SIOCGIWGENIE)] = { |
226 | .header_type = IW_HEADER_TYPE_POINT, | 226 | .header_type = IW_HEADER_TYPE_POINT, |
227 | .token_size = 1, | 227 | .token_size = 1, |
228 | .max_tokens = IW_GENERIC_IE_MAX, | 228 | .max_tokens = IW_GENERIC_IE_MAX, |
229 | }, | 229 | }, |
230 | [SIOCSIWAUTH - SIOCIWFIRST] = { | 230 | [IW_IOCTL_IDX(SIOCSIWAUTH)] = { |
231 | .header_type = IW_HEADER_TYPE_PARAM, | 231 | .header_type = IW_HEADER_TYPE_PARAM, |
232 | }, | 232 | }, |
233 | [SIOCGIWAUTH - SIOCIWFIRST] = { | 233 | [IW_IOCTL_IDX(SIOCGIWAUTH)] = { |
234 | .header_type = IW_HEADER_TYPE_PARAM, | 234 | .header_type = IW_HEADER_TYPE_PARAM, |
235 | }, | 235 | }, |
236 | [SIOCSIWENCODEEXT - SIOCIWFIRST] = { | 236 | [IW_IOCTL_IDX(SIOCSIWENCODEEXT)] = { |
237 | .header_type = IW_HEADER_TYPE_POINT, | 237 | .header_type = IW_HEADER_TYPE_POINT, |
238 | .token_size = 1, | 238 | .token_size = 1, |
239 | .min_tokens = sizeof(struct iw_encode_ext), | 239 | .min_tokens = sizeof(struct iw_encode_ext), |
240 | .max_tokens = sizeof(struct iw_encode_ext) + | 240 | .max_tokens = sizeof(struct iw_encode_ext) + |
241 | IW_ENCODING_TOKEN_MAX, | 241 | IW_ENCODING_TOKEN_MAX, |
242 | }, | 242 | }, |
243 | [SIOCGIWENCODEEXT - SIOCIWFIRST] = { | 243 | [IW_IOCTL_IDX(SIOCGIWENCODEEXT)] = { |
244 | .header_type = IW_HEADER_TYPE_POINT, | 244 | .header_type = IW_HEADER_TYPE_POINT, |
245 | .token_size = 1, | 245 | .token_size = 1, |
246 | .min_tokens = sizeof(struct iw_encode_ext), | 246 | .min_tokens = sizeof(struct iw_encode_ext), |
247 | .max_tokens = sizeof(struct iw_encode_ext) + | 247 | .max_tokens = sizeof(struct iw_encode_ext) + |
248 | IW_ENCODING_TOKEN_MAX, | 248 | IW_ENCODING_TOKEN_MAX, |
249 | }, | 249 | }, |
250 | [SIOCSIWPMKSA - SIOCIWFIRST] = { | 250 | [IW_IOCTL_IDX(SIOCSIWPMKSA)] = { |
251 | .header_type = IW_HEADER_TYPE_POINT, | 251 | .header_type = IW_HEADER_TYPE_POINT, |
252 | .token_size = 1, | 252 | .token_size = 1, |
253 | .min_tokens = sizeof(struct iw_pmksa), | 253 | .min_tokens = sizeof(struct iw_pmksa), |
@@ -261,44 +261,44 @@ static const unsigned standard_ioctl_num = ARRAY_SIZE(standard_ioctl); | |||
261 | * we know about. | 261 | * we know about. |
262 | */ | 262 | */ |
263 | static const struct iw_ioctl_description standard_event[] = { | 263 | static const struct iw_ioctl_description standard_event[] = { |
264 | [IWEVTXDROP - IWEVFIRST] = { | 264 | [IW_EVENT_IDX(IWEVTXDROP)] = { |
265 | .header_type = IW_HEADER_TYPE_ADDR, | 265 | .header_type = IW_HEADER_TYPE_ADDR, |
266 | }, | 266 | }, |
267 | [IWEVQUAL - IWEVFIRST] = { | 267 | [IW_EVENT_IDX(IWEVQUAL)] = { |
268 | .header_type = IW_HEADER_TYPE_QUAL, | 268 | .header_type = IW_HEADER_TYPE_QUAL, |
269 | }, | 269 | }, |
270 | [IWEVCUSTOM - IWEVFIRST] = { | 270 | [IW_EVENT_IDX(IWEVCUSTOM)] = { |
271 | .header_type = IW_HEADER_TYPE_POINT, | 271 | .header_type = IW_HEADER_TYPE_POINT, |
272 | .token_size = 1, | 272 | .token_size = 1, |
273 | .max_tokens = IW_CUSTOM_MAX, | 273 | .max_tokens = IW_CUSTOM_MAX, |
274 | }, | 274 | }, |
275 | [IWEVREGISTERED - IWEVFIRST] = { | 275 | [IW_EVENT_IDX(IWEVREGISTERED)] = { |
276 | .header_type = IW_HEADER_TYPE_ADDR, | 276 | .header_type = IW_HEADER_TYPE_ADDR, |
277 | }, | 277 | }, |
278 | [IWEVEXPIRED - IWEVFIRST] = { | 278 | [IW_EVENT_IDX(IWEVEXPIRED)] = { |
279 | .header_type = IW_HEADER_TYPE_ADDR, | 279 | .header_type = IW_HEADER_TYPE_ADDR, |
280 | }, | 280 | }, |
281 | [IWEVGENIE - IWEVFIRST] = { | 281 | [IW_EVENT_IDX(IWEVGENIE)] = { |
282 | .header_type = IW_HEADER_TYPE_POINT, | 282 | .header_type = IW_HEADER_TYPE_POINT, |
283 | .token_size = 1, | 283 | .token_size = 1, |
284 | .max_tokens = IW_GENERIC_IE_MAX, | 284 | .max_tokens = IW_GENERIC_IE_MAX, |
285 | }, | 285 | }, |
286 | [IWEVMICHAELMICFAILURE - IWEVFIRST] = { | 286 | [IW_EVENT_IDX(IWEVMICHAELMICFAILURE)] = { |
287 | .header_type = IW_HEADER_TYPE_POINT, | 287 | .header_type = IW_HEADER_TYPE_POINT, |
288 | .token_size = 1, | 288 | .token_size = 1, |
289 | .max_tokens = sizeof(struct iw_michaelmicfailure), | 289 | .max_tokens = sizeof(struct iw_michaelmicfailure), |
290 | }, | 290 | }, |
291 | [IWEVASSOCREQIE - IWEVFIRST] = { | 291 | [IW_EVENT_IDX(IWEVASSOCREQIE)] = { |
292 | .header_type = IW_HEADER_TYPE_POINT, | 292 | .header_type = IW_HEADER_TYPE_POINT, |
293 | .token_size = 1, | 293 | .token_size = 1, |
294 | .max_tokens = IW_GENERIC_IE_MAX, | 294 | .max_tokens = IW_GENERIC_IE_MAX, |
295 | }, | 295 | }, |
296 | [IWEVASSOCRESPIE - IWEVFIRST] = { | 296 | [IW_EVENT_IDX(IWEVASSOCRESPIE)] = { |
297 | .header_type = IW_HEADER_TYPE_POINT, | 297 | .header_type = IW_HEADER_TYPE_POINT, |
298 | .token_size = 1, | 298 | .token_size = 1, |
299 | .max_tokens = IW_GENERIC_IE_MAX, | 299 | .max_tokens = IW_GENERIC_IE_MAX, |
300 | }, | 300 | }, |
301 | [IWEVPMKIDCAND - IWEVFIRST] = { | 301 | [IW_EVENT_IDX(IWEVPMKIDCAND)] = { |
302 | .header_type = IW_HEADER_TYPE_POINT, | 302 | .header_type = IW_HEADER_TYPE_POINT, |
303 | .token_size = 1, | 303 | .token_size = 1, |
304 | .max_tokens = sizeof(struct iw_pmkid_cand), | 304 | .max_tokens = sizeof(struct iw_pmkid_cand), |
@@ -449,11 +449,11 @@ void wireless_send_event(struct net_device * dev, | |||
449 | 449 | ||
450 | /* Get the description of the Event */ | 450 | /* Get the description of the Event */ |
451 | if (cmd <= SIOCIWLAST) { | 451 | if (cmd <= SIOCIWLAST) { |
452 | cmd_index = cmd - SIOCIWFIRST; | 452 | cmd_index = IW_IOCTL_IDX(cmd); |
453 | if (cmd_index < standard_ioctl_num) | 453 | if (cmd_index < standard_ioctl_num) |
454 | descr = &(standard_ioctl[cmd_index]); | 454 | descr = &(standard_ioctl[cmd_index]); |
455 | } else { | 455 | } else { |
456 | cmd_index = cmd - IWEVFIRST; | 456 | cmd_index = IW_EVENT_IDX(cmd); |
457 | if (cmd_index < standard_event_num) | 457 | if (cmd_index < standard_event_num) |
458 | descr = &(standard_event[cmd_index]); | 458 | descr = &(standard_event[cmd_index]); |
459 | } | 459 | } |
@@ -662,7 +662,7 @@ static iw_handler get_handler(struct net_device *dev, unsigned int cmd) | |||
662 | return NULL; | 662 | return NULL; |
663 | 663 | ||
664 | /* Try as a standard command */ | 664 | /* Try as a standard command */ |
665 | index = cmd - SIOCIWFIRST; | 665 | index = IW_IOCTL_IDX(cmd); |
666 | if (index < handlers->num_standard) | 666 | if (index < handlers->num_standard) |
667 | return handlers->standard[index]; | 667 | return handlers->standard[index]; |
668 | 668 | ||
@@ -954,9 +954,9 @@ static int ioctl_standard_call(struct net_device * dev, | |||
954 | int ret = -EINVAL; | 954 | int ret = -EINVAL; |
955 | 955 | ||
956 | /* Get the description of the IOCTL */ | 956 | /* Get the description of the IOCTL */ |
957 | if ((cmd - SIOCIWFIRST) >= standard_ioctl_num) | 957 | if (IW_IOCTL_IDX(cmd) >= standard_ioctl_num) |
958 | return -EOPNOTSUPP; | 958 | return -EOPNOTSUPP; |
959 | descr = &(standard_ioctl[cmd - SIOCIWFIRST]); | 959 | descr = &(standard_ioctl[IW_IOCTL_IDX(cmd)]); |
960 | 960 | ||
961 | /* Check if we have a pointer to user space data or not */ | 961 | /* Check if we have a pointer to user space data or not */ |
962 | if (descr->header_type != IW_HEADER_TYPE_POINT) { | 962 | if (descr->header_type != IW_HEADER_TYPE_POINT) { |
@@ -1012,7 +1012,7 @@ static int compat_standard_call(struct net_device *dev, | |||
1012 | struct iw_point iwp; | 1012 | struct iw_point iwp; |
1013 | int err; | 1013 | int err; |
1014 | 1014 | ||
1015 | descr = standard_ioctl + (cmd - SIOCIWFIRST); | 1015 | descr = standard_ioctl + IW_IOCTL_IDX(cmd); |
1016 | 1016 | ||
1017 | if (descr->header_type != IW_HEADER_TYPE_POINT) | 1017 | if (descr->header_type != IW_HEADER_TYPE_POINT) |
1018 | return ioctl_standard_call(dev, iwr, cmd, info, handler); | 1018 | return ioctl_standard_call(dev, iwr, cmd, info, handler); |