diff options
author | Lukáš Turek <8an@praha12.net> | 2009-12-21 16:50:47 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-12 13:49:17 -0500 |
commit | 81077e82c3f591578625805dd6464a27a9ff56ec (patch) | |
tree | cb1e502c54b4e2f052f129b80a47190de7e22b62 | |
parent | 14acdde6e527950f66c084dbf19bad6fbfcaeedc (diff) |
nl80211: Add new WIPHY attribute COVERAGE_CLASS
The new attribute NL80211_ATTR_WIPHY_COVERAGE_CLASS sets IEEE 802.11
Coverage Class, which depends on maximum distance of nodes in a
wireless network. It's required for long distance links (more than a few
hundred meters).
The attribute is now ignored by two non-mac80211 drivers, rndis and
iwmc3200wifi, together with WIPHY_PARAM_RETRY_SHORT and
WIPHY_PARAM_RETRY_LONG. If it turns out to be a problem, we could split
set_wiphy_params callback or add new capability bits.
Signed-off-by: Lukas Turek <8an@praha12.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/linux/nl80211.h | 4 | ||||
-rw-r--r-- | include/net/cfg80211.h | 2 | ||||
-rw-r--r-- | net/wireless/core.c | 1 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 15 |
4 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 2bfbe88837ef..d4c556de7170 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -430,6 +430,8 @@ enum nl80211_commands { | |||
430 | * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length | 430 | * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length |
431 | * larger than or equal to this use RTS/CTS handshake); allowed range: | 431 | * larger than or equal to this use RTS/CTS handshake); allowed range: |
432 | * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32 | 432 | * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32 |
433 | * @NL80211_ATTR_WIPHY_COVERAGE_CLASS: Coverage Class as defined by IEEE 802.11 | ||
434 | * section 7.3.2.9; dot11CoverageClass; u8 | ||
433 | * | 435 | * |
434 | * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on | 436 | * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on |
435 | * @NL80211_ATTR_IFNAME: network interface name | 437 | * @NL80211_ATTR_IFNAME: network interface name |
@@ -779,6 +781,8 @@ enum nl80211_attrs { | |||
779 | 781 | ||
780 | NL80211_ATTR_COOKIE, | 782 | NL80211_ATTR_COOKIE, |
781 | 783 | ||
784 | NL80211_ATTR_WIPHY_COVERAGE_CLASS, | ||
785 | |||
782 | /* add attributes here, update the policy in nl80211.c */ | 786 | /* add attributes here, update the policy in nl80211.c */ |
783 | 787 | ||
784 | __NL80211_ATTR_AFTER_LAST, | 788 | __NL80211_ATTR_AFTER_LAST, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index add79930f47d..a8d5d04314b9 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -837,6 +837,7 @@ enum wiphy_params_flags { | |||
837 | WIPHY_PARAM_RETRY_LONG = 1 << 1, | 837 | WIPHY_PARAM_RETRY_LONG = 1 << 1, |
838 | WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, | 838 | WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, |
839 | WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, | 839 | WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, |
840 | WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, | ||
840 | }; | 841 | }; |
841 | 842 | ||
842 | /** | 843 | /** |
@@ -1236,6 +1237,7 @@ struct wiphy { | |||
1236 | u8 retry_long; | 1237 | u8 retry_long; |
1237 | u32 frag_threshold; | 1238 | u32 frag_threshold; |
1238 | u32 rts_threshold; | 1239 | u32 rts_threshold; |
1240 | u8 coverage_class; | ||
1239 | 1241 | ||
1240 | char fw_version[ETHTOOL_BUSINFO_LEN]; | 1242 | char fw_version[ETHTOOL_BUSINFO_LEN]; |
1241 | u32 hw_version; | 1243 | u32 hw_version; |
diff --git a/net/wireless/core.c b/net/wireless/core.c index c2a2c563d21a..0a545bb6ed05 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -402,6 +402,7 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv) | |||
402 | rdev->wiphy.retry_long = 4; | 402 | rdev->wiphy.retry_long = 4; |
403 | rdev->wiphy.frag_threshold = (u32) -1; | 403 | rdev->wiphy.frag_threshold = (u32) -1; |
404 | rdev->wiphy.rts_threshold = (u32) -1; | 404 | rdev->wiphy.rts_threshold = (u32) -1; |
405 | rdev->wiphy.coverage_class = 0; | ||
405 | 406 | ||
406 | return &rdev->wiphy; | 407 | return &rdev->wiphy; |
407 | } | 408 | } |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index e3bee3cecdfa..c09fbcd278fb 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -69,6 +69,7 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = { | |||
69 | [NL80211_ATTR_WIPHY_RETRY_LONG] = { .type = NLA_U8 }, | 69 | [NL80211_ATTR_WIPHY_RETRY_LONG] = { .type = NLA_U8 }, |
70 | [NL80211_ATTR_WIPHY_FRAG_THRESHOLD] = { .type = NLA_U32 }, | 70 | [NL80211_ATTR_WIPHY_FRAG_THRESHOLD] = { .type = NLA_U32 }, |
71 | [NL80211_ATTR_WIPHY_RTS_THRESHOLD] = { .type = NLA_U32 }, | 71 | [NL80211_ATTR_WIPHY_RTS_THRESHOLD] = { .type = NLA_U32 }, |
72 | [NL80211_ATTR_WIPHY_COVERAGE_CLASS] = { .type = NLA_U8 }, | ||
72 | 73 | ||
73 | [NL80211_ATTR_IFTYPE] = { .type = NLA_U32 }, | 74 | [NL80211_ATTR_IFTYPE] = { .type = NLA_U32 }, |
74 | [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, | 75 | [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, |
@@ -444,6 +445,8 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
444 | dev->wiphy.frag_threshold); | 445 | dev->wiphy.frag_threshold); |
445 | NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD, | 446 | NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD, |
446 | dev->wiphy.rts_threshold); | 447 | dev->wiphy.rts_threshold); |
448 | NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, | ||
449 | dev->wiphy.coverage_class); | ||
447 | 450 | ||
448 | NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, | 451 | NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, |
449 | dev->wiphy.max_scan_ssids); | 452 | dev->wiphy.max_scan_ssids); |
@@ -684,6 +687,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
684 | u32 changed; | 687 | u32 changed; |
685 | u8 retry_short = 0, retry_long = 0; | 688 | u8 retry_short = 0, retry_long = 0; |
686 | u32 frag_threshold = 0, rts_threshold = 0; | 689 | u32 frag_threshold = 0, rts_threshold = 0; |
690 | u8 coverage_class = 0; | ||
687 | 691 | ||
688 | rtnl_lock(); | 692 | rtnl_lock(); |
689 | 693 | ||
@@ -806,9 +810,16 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
806 | changed |= WIPHY_PARAM_RTS_THRESHOLD; | 810 | changed |= WIPHY_PARAM_RTS_THRESHOLD; |
807 | } | 811 | } |
808 | 812 | ||
813 | if (info->attrs[NL80211_ATTR_WIPHY_COVERAGE_CLASS]) { | ||
814 | coverage_class = nla_get_u8( | ||
815 | info->attrs[NL80211_ATTR_WIPHY_COVERAGE_CLASS]); | ||
816 | changed |= WIPHY_PARAM_COVERAGE_CLASS; | ||
817 | } | ||
818 | |||
809 | if (changed) { | 819 | if (changed) { |
810 | u8 old_retry_short, old_retry_long; | 820 | u8 old_retry_short, old_retry_long; |
811 | u32 old_frag_threshold, old_rts_threshold; | 821 | u32 old_frag_threshold, old_rts_threshold; |
822 | u8 old_coverage_class; | ||
812 | 823 | ||
813 | if (!rdev->ops->set_wiphy_params) { | 824 | if (!rdev->ops->set_wiphy_params) { |
814 | result = -EOPNOTSUPP; | 825 | result = -EOPNOTSUPP; |
@@ -819,6 +830,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
819 | old_retry_long = rdev->wiphy.retry_long; | 830 | old_retry_long = rdev->wiphy.retry_long; |
820 | old_frag_threshold = rdev->wiphy.frag_threshold; | 831 | old_frag_threshold = rdev->wiphy.frag_threshold; |
821 | old_rts_threshold = rdev->wiphy.rts_threshold; | 832 | old_rts_threshold = rdev->wiphy.rts_threshold; |
833 | old_coverage_class = rdev->wiphy.coverage_class; | ||
822 | 834 | ||
823 | if (changed & WIPHY_PARAM_RETRY_SHORT) | 835 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
824 | rdev->wiphy.retry_short = retry_short; | 836 | rdev->wiphy.retry_short = retry_short; |
@@ -828,6 +840,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
828 | rdev->wiphy.frag_threshold = frag_threshold; | 840 | rdev->wiphy.frag_threshold = frag_threshold; |
829 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) | 841 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
830 | rdev->wiphy.rts_threshold = rts_threshold; | 842 | rdev->wiphy.rts_threshold = rts_threshold; |
843 | if (changed & WIPHY_PARAM_COVERAGE_CLASS) | ||
844 | rdev->wiphy.coverage_class = coverage_class; | ||
831 | 845 | ||
832 | result = rdev->ops->set_wiphy_params(&rdev->wiphy, changed); | 846 | result = rdev->ops->set_wiphy_params(&rdev->wiphy, changed); |
833 | if (result) { | 847 | if (result) { |
@@ -835,6 +849,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
835 | rdev->wiphy.retry_long = old_retry_long; | 849 | rdev->wiphy.retry_long = old_retry_long; |
836 | rdev->wiphy.frag_threshold = old_frag_threshold; | 850 | rdev->wiphy.frag_threshold = old_frag_threshold; |
837 | rdev->wiphy.rts_threshold = old_rts_threshold; | 851 | rdev->wiphy.rts_threshold = old_rts_threshold; |
852 | rdev->wiphy.coverage_class = old_coverage_class; | ||
838 | } | 853 | } |
839 | } | 854 | } |
840 | 855 | ||