Message ID | AM4PR0101MB2305288C51F159AE69BD78CCE4F50@AM4PR0101MB2305.eurprd01.prod.exchangelabs.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Johannes Berg |
Headers | show |
On Wed, 2018-02-14 at 13:51 +0000, Jean Pierre TOSONI wrote: > When the low-level driver returns an invalid RSSI indication, > set the signal value to 0 as an indication to the upper layer. > > Also, skip average level computation if signal is invalid. Thanks for the patch! > /* Track average RSSI from the Beacon frames of the current AP */ > + if (rx_status->flag & RX_FLAG_NO_SIGNAL_VAL) > + goto skip_signal_processing; > if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { > ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; > ewma_beacon_signal_init(&ifmgd->ave_beacon_signal); > @@ -3454,6 +3456,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, > sig, GFP_KERNEL); > } > } > +skip_signal_processing: Can't say I like this - how about we pull out the actual processing into a helper function, and then abort that function early if the NO_SIGNAL_VAL flag is set. johannes
> -----Message d'origine----- > De : Johannes Berg [mailto:johannes@sipsolutions.net] > Envoyé : lundi 19 février 2018 13:35 > À : Jean Pierre TOSONI; linux-wireless@vger.kernel.org > Objet : Re: [PATCH] mac80211: inform wireless layer when frame RSSI > is invalid > (...) > > > /* Track average RSSI from the Beacon frames of the current AP > */ > > + if (rx_status->flag & RX_FLAG_NO_SIGNAL_VAL) > > + goto skip_signal_processing; > > if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { > > ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; > > ewma_beacon_signal_init(&ifmgd->ave_beacon_signal); > > @@ -3454,6 +3456,7 @@ static void ieee80211_rx_mgmt_beacon(struct > ieee80211_sub_if_data *sdata, > > sig, GFP_KERNEL); > > } > > } > > +skip_signal_processing: > > Can't say I like this - how about we pull out the actual processing > into a helper function, and then abort that function early if the > NO_SIGNAL_VAL flag is set. > Since I am working on an older version of mac80211, I was aiming to keep changes minimal to avoid breaking something I could not test... I'll have a look to your suggestion. > johannes
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 39b660b..99ff679 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -3368,6 +3368,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, bssid = ifmgd->associated->bssid; /* Track average RSSI from the Beacon frames of the current AP */ + if (rx_status->flag & RX_FLAG_NO_SIGNAL_VAL) + goto skip_signal_processing; if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; ewma_beacon_signal_init(&ifmgd->ave_beacon_signal); @@ -3454,6 +3456,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, sig, GFP_KERNEL); } } +skip_signal_processing: if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) { mlme_dbg_ratelimited(sdata, diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index e755f93..8d63a1b 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -2791,7 +2791,8 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, !(rx->flags & IEEE80211_RX_BEACON_REPORTED)) { int sig = 0; - if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM)) + if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM) && + !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) sig = status->signal; cfg80211_report_obss_beacon(rx->local->hw.wiphy, @@ -3132,7 +3133,8 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, * it transmitted were processed or returned. */ - if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM)) + if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM) && + !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) sig = status->signal; if (cfg80211_rx_mgmt(&rx->sdata->wdev, status->freq, sig, diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index ef2beca..a3b1bcc 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -73,7 +73,9 @@ struct ieee80211_bss * bool signal_valid; struct ieee80211_sub_if_data *scan_sdata; - if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) + if (rx_status->flag & RX_FLAG_NO_SIGNAL_VAL) + bss_meta.signal = 0; /* invalid signal indication */ + else if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) bss_meta.signal = rx_status->signal * 100; else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC)) bss_meta.signal = (rx_status->signal * 100) / local->hw.max_signal;
When the low-level driver returns an invalid RSSI indication, set the signal value to 0 as an indication to the upper layer. Also, skip average level computation if signal is invalid. Signed-off-by: Jean Pierre TOSONI <jp.tosoni@acksys.fr> --- WARNING: This patch applies to wireless-testing retrieved on Feb 14, 2018 but it was tested on a much older version (OpenWrt kernel 3.18 with compat-wireless-2015-07-21). net/mac80211/mlme.c | 3 +++ net/mac80211/rx.c | 6 ++++-- net/mac80211/scan.c | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) -- 1.7.2.5