Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352703
b: refs/heads/master
c: 39886b6
h: refs/heads/master
i:
  352701: 67e2fd8
  352699: 4b170ed
  352695: 1fd1db5
  352687: 55f6ba0
  352671: c8e266a
  352639: 958d861
v: v3
  • Loading branch information
Thomas Pedersen authored and Johannes Berg committed Feb 15, 2013
1 parent 1ed9af1 commit c8bc765
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 38 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: de74a1d9032f4d37ea453ad2a647e1aff4cd2591
refs/heads/master: 39886b618aba3c39e650c191d601e26ec581ce0f
20 changes: 11 additions & 9 deletions trunk/net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1262,9 +1262,8 @@ static int sta_apply_parameters(struct ieee80211_local *local,

if (ieee80211_vif_is_mesh(&sdata->vif)) {
#ifdef CONFIG_MAC80211_MESH
u32 changed = 0;
if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED) {
u32 changed = 0;

switch (params->plink_state) {
case NL80211_PLINK_ESTAB:
if (sta->plink_state != NL80211_PLINK_ESTAB)
Expand All @@ -1273,8 +1272,8 @@ static int sta_apply_parameters(struct ieee80211_local *local,
sta->plink_state = params->plink_state;

ieee80211_mps_sta_status_update(sta);
ieee80211_mps_set_sta_local_pm(sta,
sdata->u.mesh.mshcfg.power_mode);
changed |= ieee80211_mps_set_sta_local_pm(sta,
sdata->u.mesh.mshcfg.power_mode);
break;
case NL80211_PLINK_LISTEN:
case NL80211_PLINK_BLOCKED:
Expand All @@ -1288,26 +1287,29 @@ static int sta_apply_parameters(struct ieee80211_local *local,
sta->plink_state = params->plink_state;

ieee80211_mps_sta_status_update(sta);
ieee80211_mps_local_status_update(sdata);
changed |=
ieee80211_mps_local_status_update(sdata);
break;
default:
/* nothing */
break;
}
ieee80211_bss_info_change_notify(sdata, changed);
} else {
switch (params->plink_action) {
case PLINK_ACTION_OPEN:
mesh_plink_open(sta);
changed |= mesh_plink_open(sta);
break;
case PLINK_ACTION_BLOCK:
mesh_plink_block(sta);
changed |= mesh_plink_block(sta);
break;
}
}

if (params->local_pm)
ieee80211_mps_set_sta_local_pm(sta, params->local_pm);
changed |=
ieee80211_mps_set_sta_local_pm(sta,
params->local_pm);
ieee80211_bss_info_change_notify(sdata, changed);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/net/mac80211/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
sdata->vif.bss_conf.basic_rates =
ieee80211_mandatory_rates(local, band);

ieee80211_mps_local_status_update(sdata);
changed |= ieee80211_mps_local_status_update(sdata);

ieee80211_bss_info_change_notify(sdata, changed);

Expand Down
10 changes: 5 additions & 5 deletions trunk/net/mac80211/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ void ieee80211_mesh_root_setup(struct ieee80211_if_mesh *ifmsh);
const struct ieee80211_mesh_sync_ops *ieee80211_mesh_sync_ops_get(u8 method);

/* mesh power save */
void ieee80211_mps_local_status_update(struct ieee80211_sub_if_data *sdata);
void ieee80211_mps_set_sta_local_pm(struct sta_info *sta,
enum nl80211_mesh_power_mode pm);
u32 ieee80211_mps_local_status_update(struct ieee80211_sub_if_data *sdata);
u32 ieee80211_mps_set_sta_local_pm(struct sta_info *sta,
enum nl80211_mesh_power_mode pm);
void ieee80211_mps_set_frame_flags(struct ieee80211_sub_if_data *sdata,
struct sta_info *sta,
struct ieee80211_hdr *hdr);
Expand Down Expand Up @@ -289,8 +289,8 @@ bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie);
u32 mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata);
void mesh_plink_broken(struct sta_info *sta);
u32 mesh_plink_deactivate(struct sta_info *sta);
int mesh_plink_open(struct sta_info *sta);
void mesh_plink_block(struct sta_info *sta);
u32 mesh_plink_open(struct sta_info *sta);
u32 mesh_plink_block(struct sta_info *sta);
void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgmt *mgmt, size_t len,
struct ieee80211_rx_status *rx_status);
Expand Down
33 changes: 18 additions & 15 deletions trunk/net/mac80211/mesh_plink.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static u32 __mesh_plink_deactivate(struct sta_info *sta)
mesh_path_flush_by_nexthop(sta);

ieee80211_mps_sta_status_update(sta);
ieee80211_mps_local_status_update(sdata);
changed |= ieee80211_mps_local_status_update(sdata);

return changed;
}
Expand Down Expand Up @@ -494,6 +494,7 @@ void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata,
struct ieee802_11_elems *elems)
{
struct sta_info *sta;
u32 changed = 0;

sta = mesh_sta_info_get(sdata, hw_addr, elems);
if (!sta)
Expand All @@ -504,11 +505,12 @@ void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata,
sdata->u.mesh.accepting_plinks &&
sdata->u.mesh.mshcfg.auto_open_plinks &&
rssi_threshold_check(sta, sdata))
mesh_plink_open(sta);
changed = mesh_plink_open(sta);

ieee80211_mps_frame_release(sta, elems);
out:
rcu_read_unlock();
ieee80211_bss_info_change_notify(sdata, changed);
}

static void mesh_plink_timer(unsigned long data)
Expand Down Expand Up @@ -621,21 +623,22 @@ static inline void mesh_plink_timer_set(struct sta_info *sta, int timeout)
add_timer(&sta->plink_timer);
}

int mesh_plink_open(struct sta_info *sta)
u32 mesh_plink_open(struct sta_info *sta)
{
__le16 llid;
struct ieee80211_sub_if_data *sdata = sta->sdata;
u32 changed;

if (!test_sta_flag(sta, WLAN_STA_AUTH))
return -EPERM;
return 0;

spin_lock_bh(&sta->lock);
get_random_bytes(&llid, 2);
sta->llid = llid;
if (sta->plink_state != NL80211_PLINK_LISTEN &&
sta->plink_state != NL80211_PLINK_BLOCKED) {
spin_unlock_bh(&sta->lock);
return -EBUSY;
return 0;
}
sta->plink_state = NL80211_PLINK_OPN_SNT;
mesh_plink_timer_set(sta, sdata->u.mesh.mshcfg.dot11MeshRetryTimeout);
Expand All @@ -645,23 +648,23 @@ int mesh_plink_open(struct sta_info *sta)
sta->sta.addr);

/* set the non-peer mode to active during peering */
ieee80211_mps_local_status_update(sdata);
changed = ieee80211_mps_local_status_update(sdata);

return mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN,
sta->sta.addr, llid, 0, 0);
mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN,
sta->sta.addr, llid, 0, 0);
return changed;
}

void mesh_plink_block(struct sta_info *sta)
u32 mesh_plink_block(struct sta_info *sta)
{
struct ieee80211_sub_if_data *sdata = sta->sdata;
u32 changed;

spin_lock_bh(&sta->lock);
changed = __mesh_plink_deactivate(sta);
sta->plink_state = NL80211_PLINK_BLOCKED;
spin_unlock_bh(&sta->lock);

ieee80211_bss_info_change_notify(sdata, changed);
return changed;
}


Expand Down Expand Up @@ -882,7 +885,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
mshcfg->dot11MeshRetryTimeout);

/* set the non-peer mode to active during peering */
ieee80211_mps_local_status_update(sdata);
changed |= ieee80211_mps_local_status_update(sdata);

spin_unlock_bh(&sta->lock);
mesh_plink_frame_tx(sdata,
Expand Down Expand Up @@ -978,7 +981,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n",
sta->sta.addr);
ieee80211_mps_sta_status_update(sta);
ieee80211_mps_set_sta_local_pm(sta,
changed |= ieee80211_mps_set_sta_local_pm(sta,
mshcfg->power_mode);
break;
default:
Expand Down Expand Up @@ -1020,8 +1023,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
WLAN_SP_MESH_PEERING_CONFIRM,
sta->sta.addr, llid, plid, 0);
ieee80211_mps_sta_status_update(sta);
ieee80211_mps_set_sta_local_pm(sta,
mshcfg->power_mode);
changed |= ieee80211_mps_set_sta_local_pm(sta,
mshcfg->power_mode);
break;
default:
spin_unlock_bh(&sta->lock);
Expand Down
27 changes: 20 additions & 7 deletions trunk/net/mac80211/mesh_ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,17 @@ static void mps_qos_null_tx(struct sta_info *sta)
* @sdata: local mesh subif
*
* sets the non-peer power mode and triggers the driver PS (re-)configuration
* Return BSS_CHANGED_BEACON if a beacon update is necessary.
*/
void ieee80211_mps_local_status_update(struct ieee80211_sub_if_data *sdata)
u32 ieee80211_mps_local_status_update(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
struct sta_info *sta;
bool peering = false;
int light_sleep_cnt = 0;
int deep_sleep_cnt = 0;
u32 changed = 0;
enum nl80211_mesh_power_mode nonpeer_pm;

rcu_read_lock();
list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) {
Expand Down Expand Up @@ -115,27 +118,37 @@ void ieee80211_mps_local_status_update(struct ieee80211_sub_if_data *sdata)
*/
if (peering) {
mps_dbg(sdata, "setting non-peer PM to active for peering\n");
ifmsh->nonpeer_pm = NL80211_MESH_POWER_ACTIVE;
nonpeer_pm = NL80211_MESH_POWER_ACTIVE;
} else if (light_sleep_cnt || deep_sleep_cnt) {
mps_dbg(sdata, "setting non-peer PM to deep sleep\n");
ifmsh->nonpeer_pm = NL80211_MESH_POWER_DEEP_SLEEP;
nonpeer_pm = NL80211_MESH_POWER_DEEP_SLEEP;
} else {
mps_dbg(sdata, "setting non-peer PM to user value\n");
ifmsh->nonpeer_pm = ifmsh->mshcfg.power_mode;
nonpeer_pm = ifmsh->mshcfg.power_mode;
}

/* need update if sleep counts move between 0 and non-zero */
if (ifmsh->nonpeer_pm != nonpeer_pm ||
!ifmsh->ps_peers_light_sleep != !light_sleep_cnt ||
!ifmsh->ps_peers_deep_sleep != !deep_sleep_cnt)
changed = BSS_CHANGED_BEACON;

ifmsh->nonpeer_pm = nonpeer_pm;
ifmsh->ps_peers_light_sleep = light_sleep_cnt;
ifmsh->ps_peers_deep_sleep = deep_sleep_cnt;

return changed;
}

/**
* ieee80211_mps_set_sta_local_pm - set local PM towards a mesh STA
*
* @sta: mesh STA
* @pm: the power mode to set
* Return BSS_CHANGED_BEACON if a beacon update is in order.
*/
void ieee80211_mps_set_sta_local_pm(struct sta_info *sta,
enum nl80211_mesh_power_mode pm)
u32 ieee80211_mps_set_sta_local_pm(struct sta_info *sta,
enum nl80211_mesh_power_mode pm)
{
struct ieee80211_sub_if_data *sdata = sta->sdata;

Expand All @@ -151,7 +164,7 @@ void ieee80211_mps_set_sta_local_pm(struct sta_info *sta,
if (sta->plink_state == NL80211_PLINK_ESTAB)
mps_qos_null_tx(sta);

ieee80211_mps_local_status_update(sdata);
return ieee80211_mps_local_status_update(sdata);
}

/**
Expand Down

0 comments on commit c8bc765

Please sign in to comment.