Commit faf046e7 authored by Michal Kazior's avatar Michal Kazior Committed by Johannes Berg

mac80211: batch CSA bss info notification

Instead of having
ieee80211_bss_info_change_notify() scattered all
over the place just call it once when finalizing
CSA.

As a side effect this patch adds missing error
checking for IBSS CSA beacon update.
Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
Reviewed-by: default avatarLuciano Coelho <luciano.coelho@intel.com>
[fix err vs. changed variable usage in ieee80211_csa_finalize()]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 348baf0e
...@@ -3014,29 +3014,28 @@ static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) ...@@ -3014,29 +3014,28 @@ static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
ieee80211_hw_config(local, 0); ieee80211_hw_config(local, 0);
} }
ieee80211_bss_info_change_notify(sdata, changed);
sdata->vif.csa_active = false; sdata->vif.csa_active = false;
switch (sdata->vif.type) { switch (sdata->vif.type) {
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon); err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon);
if (err < 0) if (err < 0)
return; return;
changed |= err; changed |= err;
kfree(sdata->u.ap.next_beacon); kfree(sdata->u.ap.next_beacon);
sdata->u.ap.next_beacon = NULL; sdata->u.ap.next_beacon = NULL;
ieee80211_bss_info_change_notify(sdata, err);
break; break;
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
ieee80211_ibss_finish_csa(sdata); err = ieee80211_ibss_finish_csa(sdata);
if (err < 0)
return;
changed |= err;
break; break;
#ifdef CONFIG_MAC80211_MESH #ifdef CONFIG_MAC80211_MESH
case NL80211_IFTYPE_MESH_POINT: case NL80211_IFTYPE_MESH_POINT:
err = ieee80211_mesh_finish_csa(sdata); err = ieee80211_mesh_finish_csa(sdata);
if (err < 0) if (err < 0)
return; return;
changed |= err;
break; break;
#endif #endif
default: default:
...@@ -3044,6 +3043,8 @@ static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) ...@@ -3044,6 +3043,8 @@ static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
return; return;
} }
ieee80211_bss_info_change_notify(sdata, changed);
ieee80211_wake_queues_by_reason(&sdata->local->hw, ieee80211_wake_queues_by_reason(&sdata->local->hw,
IEEE80211_MAX_QUEUE_MAP, IEEE80211_MAX_QUEUE_MAP,
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
......
...@@ -530,7 +530,7 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata) ...@@ -530,7 +530,7 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata)
{ {
struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
struct cfg80211_bss *cbss; struct cfg80211_bss *cbss;
int err; int err, changed = 0;
u16 capability; u16 capability;
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
...@@ -562,10 +562,9 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata) ...@@ -562,10 +562,9 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata)
if (err < 0) if (err < 0)
return err; return err;
if (err) changed |= err;
ieee80211_bss_info_change_notify(sdata, err);
return 0; return changed;
} }
void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata) void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata)
......
...@@ -1058,6 +1058,7 @@ int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata) ...@@ -1058,6 +1058,7 @@ int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata)
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
struct mesh_csa_settings *tmp_csa_settings; struct mesh_csa_settings *tmp_csa_settings;
int ret = 0; int ret = 0;
int changed = 0;
/* Reset the TTL value and Initiator flag */ /* Reset the TTL value and Initiator flag */
ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE; ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE;
...@@ -1072,11 +1073,11 @@ int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata) ...@@ -1072,11 +1073,11 @@ int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata)
if (ret) if (ret)
return -EINVAL; return -EINVAL;
ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON); changed |= BSS_CHANGED_BEACON;
mcsa_dbg(sdata, "complete switching to center freq %d MHz", mcsa_dbg(sdata, "complete switching to center freq %d MHz",
sdata->vif.bss_conf.chandef.chan->center_freq); sdata->vif.bss_conf.chandef.chan->center_freq);
return 0; return changed;
} }
int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata, int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment