mac80211: clean up mesh HT operation
PATCH 1/3 mac80211: clean up mesh HT operation
ieee80211_ht_cap_ie_to_sta_ht_cap() will clean up the ht_supported flag and station bandwidth field for us if the peer beacon doesn't have an HT capability element (is operating as non-HT).
Also, we don't really need a special station ch_width member to track the station operating mode any more so use sta.bandwidth instead.
--- net/mac80211/mesh_plink.c | 62 ++++++++++++++++++--------------------------- net/mac80211/sta_info.h | 2 -- 2 files changed, 24 insertions(+), 40 deletions(-)
net/mac80211/mesh_plink.c +24 -38
@@ -129,7 +129,6 @@ static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata) {struct ieee80211_local *local = sdata->local;struct sta_info *sta; -u32 changed =0 ;u16 ht_opmode;bool non_ht_sta = false, ht20_sta = false;
@@ -142,23 +141,19 @@ static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata) sta->plink_state != NL80211_PLINK_ESTAB)continue ; -switch (sta->ch_width) { -case NL80211_CHAN_WIDTH_20_NOHT : -mpl_dbg (sdata, -"mesh_plink %pM: nonHT sta (%pM) is present\n" , - sdata->vif.addr, sta->sta.addr); +if (sta->sta.bandwidth >IEEE80211_STA_RX_BW_20 ) +continue ; + +if (!sta->sta.ht_cap.ht_supported) { +mpl_dbg (sdata,"nonHT sta (%pM) is present\n" , + sta->sta.addr); non_ht_sta = true; - goto out; -case NL80211_CHAN_WIDTH_20 : -mpl_dbg (sdata, -"mesh_plink %pM: HT20 sta (%pM) is present\n" , - sdata->vif.addr, sta->sta.addr); - ht20_sta = true; -default :break ; } + +mpl_dbg (sdata,"HT20 sta (%pM) is present\n" , sta->sta.addr); + ht20_sta = true; } -out:rcu_read_unlock ();if (non_ht_sta)
@@ -169,16 +164,13 @@ out:else ht_opmode =IEEE80211_HT_OP_MODE_PROTECTION_NONE ; -if (sdata->vif.bss_conf.ht_operation_mode != ht_opmode) { - sdata->vif.bss_conf.ht_operation_mode = ht_opmode; - sdata->u.mesh.mshcfg.ht_opmode = ht_opmode; - changed =BSS_CHANGED_HT ; -mpl_dbg (sdata, -"mesh_plink %pM: protection mode changed to %d\n" , - sdata->vif.addr, ht_opmode); - } +if (sdata->vif.bss_conf.ht_operation_mode == ht_opmode) +return 0 ; -return changed; + sdata->vif.bss_conf.ht_operation_mode = ht_opmode; + sdata->u.mesh.mshcfg.ht_opmode = ht_opmode; +mpl_dbg (sdata,"selected new HT protection mode %d\n" , ht_opmode); +return BSS_CHANGED_HT ; }/**
@@ -371,24 +363,18 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata,if (sta->sta.supp_rates[band] != rates) changed |=IEEE80211_RC_SUPP_RATES_CHANGED ; sta->sta.supp_rates[band] = rates; -if (elems->ht_cap_elem && - sdata->vif.bss_conf.chandef.width !=NL80211_CHAN_WIDTH_20_NOHT ) -ieee80211_ht_cap_ie_to_sta_ht_cap (sdata, sband, - elems->ht_cap_elem, sta); -else -memset (&sta->sta.ht_cap,0 ,sizeof (sta->sta.ht_cap)); -if (elems->ht_operation) { -struct cfg80211_chan_def chandef; +if (ieee80211_ht_cap_ie_to_sta_ht_cap (sdata, sband, + elems->ht_cap_elem, sta)) + changed |=IEEE80211_RC_BW_CHANGED ; -if (!(elems->ht_operation->ht_param & -IEEE80211_HT_PARAM_CHAN_WIDTH_ANY )) - sta->sta.bandwidth =IEEE80211_STA_RX_BW_20 ; -ieee80211_ht_oper_to_chandef (sdata->vif.bss_conf.chandef.chan, - elems->ht_operation, &chandef); -if (sta->ch_width != chandef.width) +/* HT peer is operating 20MHz-only */ +if (elems->ht_operation && + !(elems->ht_operation->ht_param & +IEEE80211_HT_PARAM_CHAN_WIDTH_ANY )) { +if (sta->sta.bandwidth !=IEEE80211_STA_RX_BW_20 ) changed |=IEEE80211_RC_BW_CHANGED ; - sta->ch_width = chandef.width; + sta->sta.bandwidth =IEEE80211_STA_RX_BW_20 ; }if (insert)
net/mac80211/sta_info.h +0 -2
@@ -285,7 +285,6 @@ struct sta_ampdu_mlme {* @t_offset: timing offset relative to this host * @t_offset_setpoint: reference timing offset of this sta to be used when * calculating clockdrift -* @ch_width: peer's channel width * @local_pm: local link-specific power save mode * @peer_pm: peer-specific power save mode towards local STA * @nonpeer_pm: STA power save mode towards non-peer neighbors
@@ -386,7 +385,6 @@ struct sta_info {struct timer_list plink_timer;s64 t_offset;s64 t_offset_setpoint; -enum nl80211_chan_width ch_width;/* mesh power save */ enum nl80211_mesh_power_mode local_pm;enum nl80211_mesh_power_mode peer_pm;
Signature · 1 line
1.7.10.4
PATCH 2/3 mac80211: stringify mesh peering events
Convert mesh peering events into strings and make the debug output a little easier to read. Also stop printing the llid and plid since these don't change across peering states and are random numbers anyway so they just amount to noise.
--- net/mac80211/mesh_plink.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-)
net/mac80211/mesh_plink.c +24 -14
@@ -37,6 +37,28 @@ enum plink_event {CLS_IGNR }; +static const char *const mplstates[] = { + [NL80211_PLINK_LISTEN ] ="LISTEN" , + [NL80211_PLINK_OPN_SNT ] ="OPN-SNT" , + [NL80211_PLINK_OPN_RCVD ] ="OPN-RCVD" , + [NL80211_PLINK_CNF_RCVD ] ="CNF_RCVD" , + [NL80211_PLINK_ESTAB ] ="ESTAB" , + [NL80211_PLINK_HOLDING ] ="HOLDING" , + [NL80211_PLINK_BLOCKED ] ="BLOCKED" +}; + +static const char *const mplevents[] = { + [PLINK_UNDEFINED ] ="NONE" , + [OPN_ACPT ] ="OPN_ACPT" , + [OPN_RJCT ] ="OPN_RJCT" , + [OPN_IGNR ] ="OPN_IGNR" , + [CNF_ACPT ] ="CNF_ACPT" , + [CNF_RJCT ] ="CNF_RJCT" , + [CNF_IGNR ] ="CNF_IGNR" , + [CLS_ACPT ] ="CLS_ACPT" , + [CLS_IGNR ] ="CLS_IGNR" +}; +static int mesh_plink_frame_tx (struct ieee80211_sub_if_data *sdata,enum ieee80211_self_protected_actioncode action,u8 *da,__le16 llid,__le16 plid,__le16 reason);
@@ -668,15 +690,6 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,u8 *baseaddr;u32 changed =0 ;__le16 plid, llid, reason; -static const char *const mplstates[] = { - [NL80211_PLINK_LISTEN ] ="LISTEN" , - [NL80211_PLINK_OPN_SNT ] ="OPN-SNT" , - [NL80211_PLINK_OPN_RCVD ] ="OPN-RCVD" , - [NL80211_PLINK_CNF_RCVD ] ="CNF_RCVD" , - [NL80211_PLINK_ESTAB ] ="ESTAB" , - [NL80211_PLINK_HOLDING ] ="HOLDING" , - [NL80211_PLINK_BLOCKED ] ="BLOCKED" - };/* need action_code, aux */ if (len <IEEE80211_MIN_ACTION_SIZE +3 )
@@ -849,11 +862,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, } } -mpl_dbg (sdata, -"Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n" , - mgmt->sa, mplstates[sta->plink_state], -le16_to_cpu (sta->llid),le16_to_cpu (sta->plid), - event); +mpl_dbg (sdata,"peer %pM in state %s got event %s\n" , mgmt->sa, + mplstates[sta->plink_state], mplevents[event]); reason =0 ;spin_lock_bh (&sta->lock);switch (sta->plink_state) {
Signature · 1 line
1.7.10.4
PATCH 3/3 mac80211: don't spam mesh probe response messages
In reply to Thomas PedersenIf mesh plink debugging is enabled, this gets annoying in a crowded environment, fast.
--- net/mac80211/mesh.c | 1 - 1 file changed, 1 deletion(-)
net/mac80211/mesh.c +0 -1
@@ -925,7 +925,6 @@ ieee80211_mesh_rx_probe_req(struct ieee80211_sub_if_data *sdata, hdr->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_PROBE_RESP );memcpy (hdr->da, mgmt->sa,ETH_ALEN ); -mpl_dbg (sdata,"sending probe resp. to %pM\n" , hdr->da);IEEE80211_SKB_CB (presp)->flags |=IEEE80211_TX_INTFL_DONT_ENCRYPT ;ieee80211_tx_skb (sdata, presp); out:
Signature · 1 line
1.7.10.4
Re: [PATCH 3/3] mac80211: don't spam mesh probe response messages
Quoted 13 lines · Thomas Pedersen
If mesh plink debugging is enabled, this gets annoying in a crowded environment, fast.
Signed-off-by Thomas Pedersen <[email protected]>--- net/mac80211/mesh.c | 1 - 1 file changed, 1 deletion(-)net/mac80211/mesh.c +0
-0
net/mac80211/mesh.c ieee80211_mesh_rx_probe_req(struct ieee80211_sub_if_data *sdata, · line 928
Quoted 4 lines
net/mac80211/mesh.c +0
-1@@ -925,7 +925,6 @@ ieee80211_mesh_rx_probe_req(struct ieee80211_sub_if_data *sdata, hdr->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_PROBE_RESP );memcpy (hdr->da, mgmt->sa,ETH_ALEN ); -mpl_dbg (sdata,"sending probe resp. to %pM\n" , hdr->da);
I think the problem isn't here so much as_sdata_dbg which doesn't allow per-site
control via dynamic_debug.
How about adding that instead or perhaps
using some ratelimit control?
Something like:
net/mac80211/debug.h | 6 +++++- net/mac80211/trace.c | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-)
net/mac80211/debug.h +5 -1
@@ -72,7 +72,11 @@ void __wiphy_dbg(struct wiphy *wiphy, bool print, const char *fmt, ...)#define _sdata_info (sdata, fmt, ...) \ __sdata_info("%s: " fmt, (sdata)->name, ##__VA_ARGS__)#define _sdata_dbg (print, sdata, fmt, ...) \ - __sdata_dbg(print, "%s: " fmt, (sdata)->name, ##__VA_ARGS__) +do { \ + if (print) \ + pr_debug(fmt, ##__VA_ARGS__); \ + __sdata_dbg(print, "%s: " fmt, (sdata)->name, ##__VA_ARGS__); \ +} while (0)#define _sdata_err (sdata, fmt, ...) \ __sdata_err("%s: " fmt, (sdata)->name, ##__VA_ARGS__)#define _wiphy_dbg (print, wiphy, fmt, ...) \
net/mac80211/trace.c +0 -2
@@ -35,8 +35,6 @@ void __sdata_dbg(bool print, const char *fmt, ...)va_start (args, fmt); vaf.va = &args; -if (print) -pr_debug ("%pV" , &vaf);trace_mac80211_dbg (&vaf);va_end (args); }
Johannes Berg
maintainerApplied all. I guess I could say "I told you so" about patch 3 ;-)
johannes