mac80211: move mesh STA parameters code to own function
The code was always a bit awkward due to the 80-col restriction and got worse in the previous patch. Refactor it a bit into its own function to make it read nicer. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
433f5bc1c0
commit
1365770248
1 changed files with 61 additions and 56 deletions
|
@ -1019,6 +1019,65 @@ static int sta_apply_auth_flags(struct ieee80211_local *local,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sta_apply_mesh_params(struct ieee80211_local *local,
|
||||||
|
struct sta_info *sta,
|
||||||
|
struct station_parameters *params)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_MAC80211_MESH
|
||||||
|
struct ieee80211_sub_if_data *sdata = sta->sdata;
|
||||||
|
u32 changed = 0;
|
||||||
|
|
||||||
|
if (params->sta_modify_mask & STATION_PARAM_APPLY_PLINK_STATE) {
|
||||||
|
switch (params->plink_state) {
|
||||||
|
case NL80211_PLINK_ESTAB:
|
||||||
|
if (sta->mesh->plink_state != NL80211_PLINK_ESTAB)
|
||||||
|
changed = mesh_plink_inc_estab_count(sdata);
|
||||||
|
sta->mesh->plink_state = params->plink_state;
|
||||||
|
|
||||||
|
ieee80211_mps_sta_status_update(sta);
|
||||||
|
changed |= ieee80211_mps_set_sta_local_pm(sta,
|
||||||
|
sdata->u.mesh.mshcfg.power_mode);
|
||||||
|
break;
|
||||||
|
case NL80211_PLINK_LISTEN:
|
||||||
|
case NL80211_PLINK_BLOCKED:
|
||||||
|
case NL80211_PLINK_OPN_SNT:
|
||||||
|
case NL80211_PLINK_OPN_RCVD:
|
||||||
|
case NL80211_PLINK_CNF_RCVD:
|
||||||
|
case NL80211_PLINK_HOLDING:
|
||||||
|
if (sta->mesh->plink_state == NL80211_PLINK_ESTAB)
|
||||||
|
changed = mesh_plink_dec_estab_count(sdata);
|
||||||
|
sta->mesh->plink_state = params->plink_state;
|
||||||
|
|
||||||
|
ieee80211_mps_sta_status_update(sta);
|
||||||
|
changed |= ieee80211_mps_set_sta_local_pm(sta,
|
||||||
|
NL80211_MESH_POWER_UNKNOWN);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* nothing */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (params->plink_action) {
|
||||||
|
case NL80211_PLINK_ACTION_NO_ACTION:
|
||||||
|
/* nothing */
|
||||||
|
break;
|
||||||
|
case NL80211_PLINK_ACTION_OPEN:
|
||||||
|
changed |= mesh_plink_open(sta);
|
||||||
|
break;
|
||||||
|
case NL80211_PLINK_ACTION_BLOCK:
|
||||||
|
changed |= mesh_plink_block(sta);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params->local_pm)
|
||||||
|
changed |= ieee80211_mps_set_sta_local_pm(sta,
|
||||||
|
params->local_pm);
|
||||||
|
|
||||||
|
ieee80211_mbss_info_change_notify(sdata, changed);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static int sta_apply_parameters(struct ieee80211_local *local,
|
static int sta_apply_parameters(struct ieee80211_local *local,
|
||||||
struct sta_info *sta,
|
struct sta_info *sta,
|
||||||
struct station_parameters *params)
|
struct station_parameters *params)
|
||||||
|
@ -1143,62 +1202,8 @@ static int sta_apply_parameters(struct ieee80211_local *local,
|
||||||
band, false);
|
band, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ieee80211_vif_is_mesh(&sdata->vif)) {
|
if (ieee80211_vif_is_mesh(&sdata->vif))
|
||||||
#ifdef CONFIG_MAC80211_MESH
|
sta_apply_mesh_params(local, sta, params);
|
||||||
u32 changed = 0;
|
|
||||||
|
|
||||||
if (params->sta_modify_mask & STATION_PARAM_APPLY_PLINK_STATE) {
|
|
||||||
switch (params->plink_state) {
|
|
||||||
case NL80211_PLINK_ESTAB:
|
|
||||||
if (sta->mesh->plink_state != NL80211_PLINK_ESTAB)
|
|
||||||
changed = mesh_plink_inc_estab_count(
|
|
||||||
sdata);
|
|
||||||
sta->mesh->plink_state = params->plink_state;
|
|
||||||
|
|
||||||
ieee80211_mps_sta_status_update(sta);
|
|
||||||
changed |= ieee80211_mps_set_sta_local_pm(sta,
|
|
||||||
sdata->u.mesh.mshcfg.power_mode);
|
|
||||||
break;
|
|
||||||
case NL80211_PLINK_LISTEN:
|
|
||||||
case NL80211_PLINK_BLOCKED:
|
|
||||||
case NL80211_PLINK_OPN_SNT:
|
|
||||||
case NL80211_PLINK_OPN_RCVD:
|
|
||||||
case NL80211_PLINK_CNF_RCVD:
|
|
||||||
case NL80211_PLINK_HOLDING:
|
|
||||||
if (sta->mesh->plink_state == NL80211_PLINK_ESTAB)
|
|
||||||
changed = mesh_plink_dec_estab_count(
|
|
||||||
sdata);
|
|
||||||
sta->mesh->plink_state = params->plink_state;
|
|
||||||
|
|
||||||
ieee80211_mps_sta_status_update(sta);
|
|
||||||
changed |= ieee80211_mps_set_sta_local_pm(sta,
|
|
||||||
NL80211_MESH_POWER_UNKNOWN);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* nothing */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (params->plink_action) {
|
|
||||||
case NL80211_PLINK_ACTION_NO_ACTION:
|
|
||||||
/* nothing */
|
|
||||||
break;
|
|
||||||
case NL80211_PLINK_ACTION_OPEN:
|
|
||||||
changed |= mesh_plink_open(sta);
|
|
||||||
break;
|
|
||||||
case NL80211_PLINK_ACTION_BLOCK:
|
|
||||||
changed |= mesh_plink_block(sta);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params->local_pm)
|
|
||||||
changed |=
|
|
||||||
ieee80211_mps_set_sta_local_pm(sta,
|
|
||||||
params->local_pm);
|
|
||||||
ieee80211_mbss_info_change_notify(sdata, changed);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set the STA state after all sta info from usermode has been set */
|
/* set the STA state after all sta info from usermode has been set */
|
||||||
if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) {
|
if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue