diff options
| -rw-r--r-- | include/linux/nl80211.h | 9 | ||||
| -rw-r--r-- | net/wireless/nl80211.c | 31 |
2 files changed, 40 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 07aa04693f94..2c8701687336 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
| @@ -725,6 +725,12 @@ enum nl80211_commands { | |||
| 725 | * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations | 725 | * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations |
| 726 | * connected to this BSS. | 726 | * connected to this BSS. |
| 727 | * | 727 | * |
| 728 | * @NL80211_ATTR_WIPHY_TX_POWER_SETTING: Transmit power setting type. See | ||
| 729 | * &enum nl80211_tx_power_setting for possible values. | ||
| 730 | * @NL80211_ATTR_WIPHY_TX_POWER_LEVEL: Transmit power level in signed mBm units. | ||
| 731 | * This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING | ||
| 732 | * for non-automatic settings. | ||
| 733 | * | ||
| 728 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 734 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
| 729 | * @__NL80211_ATTR_AFTER_LAST: internal use | 735 | * @__NL80211_ATTR_AFTER_LAST: internal use |
| 730 | */ | 736 | */ |
| @@ -882,6 +888,9 @@ enum nl80211_attrs { | |||
| 882 | 888 | ||
| 883 | NL80211_ATTR_AP_ISOLATE, | 889 | NL80211_ATTR_AP_ISOLATE, |
| 884 | 890 | ||
| 891 | NL80211_ATTR_WIPHY_TX_POWER_SETTING, | ||
| 892 | NL80211_ATTR_WIPHY_TX_POWER_LEVEL, | ||
| 893 | |||
| 885 | /* add attributes here, update the policy in nl80211.c */ | 894 | /* add attributes here, update the policy in nl80211.c */ |
| 886 | 895 | ||
| 887 | __NL80211_ATTR_AFTER_LAST, | 896 | __NL80211_ATTR_AFTER_LAST, |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 41529aca794c..a999fc154623 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -153,6 +153,9 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
| 153 | [NL80211_ATTR_CQM] = { .type = NLA_NESTED, }, | 153 | [NL80211_ATTR_CQM] = { .type = NLA_NESTED, }, |
| 154 | [NL80211_ATTR_LOCAL_STATE_CHANGE] = { .type = NLA_FLAG }, | 154 | [NL80211_ATTR_LOCAL_STATE_CHANGE] = { .type = NLA_FLAG }, |
| 155 | [NL80211_ATTR_AP_ISOLATE] = { .type = NLA_U8 }, | 155 | [NL80211_ATTR_AP_ISOLATE] = { .type = NLA_U8 }, |
| 156 | |||
| 157 | [NL80211_ATTR_WIPHY_TX_POWER_SETTING] = { .type = NLA_U32 }, | ||
| 158 | [NL80211_ATTR_WIPHY_TX_POWER_LEVEL] = { .type = NLA_U32 }, | ||
| 156 | }; | 159 | }; |
| 157 | 160 | ||
| 158 | /* policy for the attributes */ | 161 | /* policy for the attributes */ |
| @@ -869,6 +872,34 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
| 869 | goto bad_res; | 872 | goto bad_res; |
| 870 | } | 873 | } |
| 871 | 874 | ||
| 875 | if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) { | ||
| 876 | enum nl80211_tx_power_setting type; | ||
| 877 | int idx, mbm = 0; | ||
| 878 | |||
| 879 | if (!rdev->ops->set_tx_power) { | ||
| 880 | return -EOPNOTSUPP; | ||
| 881 | goto bad_res; | ||
| 882 | } | ||
| 883 | |||
| 884 | idx = NL80211_ATTR_WIPHY_TX_POWER_SETTING; | ||
| 885 | type = nla_get_u32(info->attrs[idx]); | ||
| 886 | |||
| 887 | if (!info->attrs[NL80211_ATTR_WIPHY_TX_POWER_LEVEL] && | ||
| 888 | (type != NL80211_TX_POWER_AUTOMATIC)) { | ||
| 889 | result = -EINVAL; | ||
| 890 | goto bad_res; | ||
| 891 | } | ||
| 892 | |||
| 893 | if (type != NL80211_TX_POWER_AUTOMATIC) { | ||
| 894 | idx = NL80211_ATTR_WIPHY_TX_POWER_LEVEL; | ||
| 895 | mbm = nla_get_u32(info->attrs[idx]); | ||
| 896 | } | ||
| 897 | |||
| 898 | result = rdev->ops->set_tx_power(&rdev->wiphy, type, mbm); | ||
| 899 | if (result) | ||
| 900 | goto bad_res; | ||
| 901 | } | ||
| 902 | |||
| 872 | changed = 0; | 903 | changed = 0; |
| 873 | 904 | ||
| 874 | if (info->attrs[NL80211_ATTR_WIPHY_RETRY_SHORT]) { | 905 | if (info->attrs[NL80211_ATTR_WIPHY_RETRY_SHORT]) { |
