Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 203289
b: refs/heads/master
c: 98d2ff8
h: refs/heads/master
i:
  203287: 1f3978a
v: v3
  • Loading branch information
Juuso Oikarinen authored and John W. Linville committed Jun 24, 2010
1 parent c1b12cb commit d08c433
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fa61cf70a6ae1089e459e4b59b2e8d8e90d8535e
refs/heads/master: 98d2ff8bec82fc35fe2008a187a5fef9241dab10
9 changes: 9 additions & 0 deletions trunk/include/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,12 @@ enum nl80211_commands {
* @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations
* connected to this BSS.
*
* @NL80211_ATTR_WIPHY_TX_POWER_SETTING: Transmit power setting type. See
* &enum nl80211_tx_power_setting for possible values.
* @NL80211_ATTR_WIPHY_TX_POWER_LEVEL: Transmit power level in signed mBm units.
* This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING
* for non-automatic settings.
*
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
Expand Down Expand Up @@ -882,6 +888,9 @@ enum nl80211_attrs {

NL80211_ATTR_AP_ISOLATE,

NL80211_ATTR_WIPHY_TX_POWER_SETTING,
NL80211_ATTR_WIPHY_TX_POWER_LEVEL,

/* add attributes here, update the policy in nl80211.c */

__NL80211_ATTR_AFTER_LAST,
Expand Down
31 changes: 31 additions & 0 deletions trunk/net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
[NL80211_ATTR_CQM] = { .type = NLA_NESTED, },
[NL80211_ATTR_LOCAL_STATE_CHANGE] = { .type = NLA_FLAG },
[NL80211_ATTR_AP_ISOLATE] = { .type = NLA_U8 },

[NL80211_ATTR_WIPHY_TX_POWER_SETTING] = { .type = NLA_U32 },
[NL80211_ATTR_WIPHY_TX_POWER_LEVEL] = { .type = NLA_U32 },
};

/* policy for the attributes */
Expand Down Expand Up @@ -869,6 +872,34 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
goto bad_res;
}

if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) {
enum nl80211_tx_power_setting type;
int idx, mbm = 0;

if (!rdev->ops->set_tx_power) {
return -EOPNOTSUPP;
goto bad_res;
}

idx = NL80211_ATTR_WIPHY_TX_POWER_SETTING;
type = nla_get_u32(info->attrs[idx]);

if (!info->attrs[NL80211_ATTR_WIPHY_TX_POWER_LEVEL] &&
(type != NL80211_TX_POWER_AUTOMATIC)) {
result = -EINVAL;
goto bad_res;
}

if (type != NL80211_TX_POWER_AUTOMATIC) {
idx = NL80211_ATTR_WIPHY_TX_POWER_LEVEL;
mbm = nla_get_u32(info->attrs[idx]);
}

result = rdev->ops->set_tx_power(&rdev->wiphy, type, mbm);
if (result)
goto bad_res;
}

changed = 0;

if (info->attrs[NL80211_ATTR_WIPHY_RETRY_SHORT]) {
Expand Down

0 comments on commit d08c433

Please sign in to comment.