Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134121
b: refs/heads/master
c: a8302de
h: refs/heads/master
i:
  134119: d40e0c6
v: v3
  • Loading branch information
Vasanthakumar Thiagarajan authored and John W. Linville committed Jan 29, 2009
1 parent 43589f9 commit 13b4ff8
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 01f8162a854df7f9c259c839ad3c1168ac13b7b8
refs/heads/master: a8302de934b5d1897ff146cd0c7ab87d1417c092
4 changes: 4 additions & 0 deletions trunk/net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ struct ieee80211_local {
struct timer_list dynamic_ps_timer;

int user_power_level; /* in dBm */
int power_constr_level; /* in dBm */

#ifdef CONFIG_MAC80211_DEBUGFS
struct local_debugfsdentries {
Expand Down Expand Up @@ -985,6 +986,9 @@ void ieee80211_chswitch_work(struct work_struct *work);
void ieee80211_process_chanswitch(struct ieee80211_sub_if_data *sdata,
struct ieee80211_channel_sw_ie *sw_elem,
struct ieee80211_bss *bss);
void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata,
u16 capab_info, u8 *pwr_constr_elem,
u8 pwr_constr_elem_len);

/* utility functions/constants */
extern void *mac80211_wiphy_privid; /* for wiphy privid */
Expand Down
10 changes: 8 additions & 2 deletions trunk/net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,16 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
changed |= IEEE80211_CONF_CHANGE_CHANNEL;
}

if (!local->user_power_level)
if (local->sw_scanning)
power = chan->max_power;
else
power = min(chan->max_power, local->user_power_level);
power = local->power_constr_level ?
(chan->max_power - local->power_constr_level) :
chan->max_power;

if (local->user_power_level)
power = min(power, local->user_power_level);

if (local->hw.conf.power_level != power) {
changed |= IEEE80211_CONF_CHANGE_POWER;
local->hw.conf.power_level = power;
Expand Down
9 changes: 9 additions & 0 deletions trunk/net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
/* channel(_type) changes are handled by ieee80211_hw_config */
local->oper_channel_type = NL80211_CHAN_NO_HT;

local->power_constr_level = 0;

del_timer_sync(&local->dynamic_ps_timer);
cancel_work_sync(&local->dynamic_ps_enable_work);

Expand Down Expand Up @@ -1849,6 +1851,13 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
* for the BSSID we are associated to */
regulatory_hint_11d(local->hw.wiphy,
elems.country_elem, elems.country_elem_len);

/* TODO: IBSS also needs this */
if (elems.pwr_constr_elem)
ieee80211_handle_pwr_constr(sdata,
le16_to_cpu(mgmt->u.probe_resp.capab_info),
elems.pwr_constr_elem,
elems.pwr_constr_elem_len);
}

ieee80211_bss_info_change_notify(sdata, changed);
Expand Down
21 changes: 21 additions & 0 deletions trunk/net/mac80211/spectmgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,24 @@ void ieee80211_process_chanswitch(struct ieee80211_sub_if_data *sdata,
jiffies + msecs_to_jiffies(sw_elem->count * bss->beacon_int));
}
}

void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata,
u16 capab_info, u8 *pwr_constr_elem,
u8 pwr_constr_elem_len)
{
struct ieee80211_conf *conf = &sdata->local->hw.conf;

if (!(capab_info & WLAN_CAPABILITY_SPECTRUM_MGMT))
return;

/* Power constraint IE length should be 1 octet */
if (pwr_constr_elem_len != 1)
return;

if ((*pwr_constr_elem <= conf->channel->max_power) &&
(*pwr_constr_elem != sdata->local->power_constr_level)) {
sdata->local->power_constr_level = *pwr_constr_elem;
ieee80211_hw_config(sdata->local, 0);
}
}

0 comments on commit 13b4ff8

Please sign in to comment.