Skip to contentSkip to conversation

cfg80211/mac80211: cqm rssi config for AP mode

PATCH In review Tamizh chelvam 2 participants 7 messages Feb 25, 2018 – Mar 23, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v4 cover cfg80211/mac80211: cqm rssi config for AP mode

From: Tamizh chelvam <[email protected]>

Currently station mode has the support of rssi based cqm. This patchsets extended the support for AP mode as well. Already netlink accepts mac address in cqm notification event. We can use that to pass mac address of the station to specify its rssi change event. This patchsets introduce new api cfg80211_ap_sta_cqm_notify and multicast group to notify the event.

Pradeep Kumar Chitrapu (1):
mac80211: enable setting cqm rssi config for AP mode

Tamizh chelvam (2):
cfg80211: enable setting cqm rssi config for AP mode
mac80211: implement cqm rssi check using rx data signal

v4:
* Fixed compilation warning of missing description for count_rx_signal and last_cqm_event_signal.

v3:
* Added vif type check to avoid enable this feature for all mode.

V2:
* Removed changing existing ieee80211_cqm_rssi_notify api changes.
* Introduced new ext feature bit and multicast group id to support this feature.

 include/net/cfg80211.h       |   15 +++++++++
 include/net/mac80211.h       |    7 +++++
 include/uapi/linux/nl80211.h |    6 ++++
 net/mac80211/cfg.c           |   31 ++++++++++++------
 net/mac80211/rx.c            |   46 ++++++++++++++++++++++++++-
 net/mac80211/sta_info.h      |    9 ++++++
 net/wireless/nl80211.c       |   71 ++++++++++++++++++++++++++++++++++++------
 7 files changed, 164 insertions(+), 21 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v4 1/3 cfg80211: enable setting cqm rssi config for AP mode

From: Tamizh chelvam <[email protected]>

This patch extend cqm rssi config and notifier feature to AP mode by introducing NL80211_EXT_FEATURE_AP_STA_CQM_RSSI_CONFIG ext feature bit. And this patch introduces NL80211_MCGRP_AP_STA_CQM for notifying station's low/high rssi event to userspace application.

---
 include/net/cfg80211.h       |   15 +++++++++
 include/uapi/linux/nl80211.h |    6 ++++
 net/wireless/nl80211.c       |   71 ++++++++++++++++++++++++++++++++++++------
 3 files changed, 82 insertions(+), 10 deletions(-)
include/net/cfg80211.h +15 -0
index 56e905c..d19fd5c 100644
@@ -5706,6 +5706,21 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
 			      s32 rssi_level, gfp_t gfp);
 
 /**
+ * cfg80211_ap_sta_cqm_rssi_notify - CQM rssi event for connected stations
+ * @dev: network device
+ * @mac: peer's MAC address
+ * @rssi_event: the triggered RSSI event
+ * @rssi_level: new RSSI level value or 0 if not available
+ * @gfp: context flags
+ *
+ * This function is called when a configured connection quality monitoring
+ * rssi threshold reached event occurs for a station.
+ */
+void cfg80211_ap_sta_cqm_rssi_notify(struct net_device *dev, const u8 *mac,
+		enum nl80211_cqm_rssi_threshold_event rssi_event,
+		s32 rssi_level, gfp_t gfp);
+
+/**
  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
  * @dev: network device
  * @peer: peer's MAC address
include/uapi/linux/nl80211.h +6 -0
index c13c843..81a60dc 100644
@@ -49,6 +49,7 @@
 #define NL80211_MULTICAST_GROUP_MLME		"mlme"
 #define NL80211_MULTICAST_GROUP_VENDOR		"vendor"
 #define NL80211_MULTICAST_GROUP_NAN		"nan"
+#define NL80211_MULTICAST_GROUP_AP_STA_CQM	"apstacqm"
 #define NL80211_MULTICAST_GROUP_TESTMODE	"testmode"
 
 /**
@@ -4999,6 +5000,10 @@ enum nl80211_feature_flags {
  * @NL80211_EXT_FEATURE_LOW_SPAN_SCAN: Driver supports low span scan.
  * @NL80211_EXT_FEATURE_LOW_POWER_SCAN: Driver supports low power scan.
  * @NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN: Driver supports high accuracy scan.
+ * @NL80211_EXT_FEATURE_AP_STA_CQM_RSSI_CONFIG: With this driver will accept
+ *	%NL80211_ATTR_CQM_RSSI_THOLD and %NL80211_ATTR_CQM_RSSI_HYST attributes
+ *	for AP/AP_VLAN/P2P_GO interface to monitor rssi values of connected
+ *	client.
  *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -5029,6 +5034,7 @@ enum nl80211_ext_feature_index {
 	NL80211_EXT_FEATURE_LOW_SPAN_SCAN,
 	NL80211_EXT_FEATURE_LOW_POWER_SCAN,
 	NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN,
+	NL80211_EXT_FEATURE_AP_STA_CQM_RSSI_CONFIG,
 
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
net/wireless/nl80211.c +61 -10

119 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#2 lore raw

Re: [PATCHv4 1/3] cfg80211: enable setting cqm rssi config for AP mode

Quoted 6 lines · Tamizh chelvam

From: Tamizh chelvam <[email protected]>

This patch extend cqm rssi config and notifier feature to AP mode by introducing NL80211_EXT_FEATURE_AP_STA_CQM_RSSI_CONFIG ext feature bit. And this patch introduces NL80211_MCGRP_AP_STA_CQM for notifying station's low/high rssi event to userspace application.

So, I guess I can sort of see how this could be useful.

However, is it really best in this current form?

For example, it seems trivial to imagine that one might want to have different thresholds for different stations, and nothing in the current implementation would prevent that, just the CQM API isn't very suited to that.

There was also an extension to CQM to support different levels - not sure where that ended up, but we should take that into account I guess.

Overall, I'm still not really convinced CQM is the right approach here.

One thing I could even imagine would be to just not have this capability at all, but build it into a little BPF program you install. I had - and still want to revive - the code to insert a "programming point" into the wireless stack, and one could then easily build a hash table of TAs vs. signal strength in BPF code.

We may not want to go that far, but I think the current approach is too short-sighted. This might solve a specific problem today, but I don't think it'll serve us well into the future if we don't make it more flexible.

johannes

#3 lore raw

PATCH v4 2/3 mac80211: enable setting cqm rssi config for AP mode

In reply to Tamizh chelvam

From: Pradeep Kumar Chitrapu <[email protected]>

Enable connection monitoring for AP mode which makes it possible to track signal strength of connected stations.

---
 net/mac80211/cfg.c |   31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)
net/mac80211/cfg.c +21 -10
index 6f9d5be..74092cb 100644
@@ -2690,6 +2690,25 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
 	return 0;
 }
 
+static void ieee80211_update_rssi_config(struct ieee80211_sub_if_data *sdata)
+{
+	if (!(sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI))
+		return;
+
+	/* tell the driver upon association, unless already associated */
+	if (sdata->vif.type == NL80211_IFTYPE_STATION &&
+	    !sdata->u.mgd.associated)
+		return;
+
+	/* if AP, always tell the driver by checking beacon status */
+	if (!sdata->vif.bss_conf.enable_beacon ||
+	    !wiphy_ext_feature_isset(sdata->local->hw.wiphy,
+				NL80211_EXT_FEATURE_AP_STA_CQM_RSSI_CONFIG))
+		return;
+
+	ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_CQM);
+}
+
 static int ieee80211_set_cqm_rssi_config(struct wiphy *wiphy,
 					 struct net_device *dev,
 					 s32 rssi_thold, u32 rssi_hyst)
@@ -2712,11 +2731,7 @@ static int ieee80211_set_cqm_rssi_config(struct wiphy *wiphy,
 	bss_conf->cqm_rssi_high = 0;
 	sdata->u.mgd.last_cqm_event_signal = 0;
 
-	/* tell the driver upon association, unless already associated */
-	if (sdata->u.mgd.associated &&
-	    sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)
-		ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_CQM);
-
+	ieee80211_update_rssi_config(sdata);
 	return 0;
 }
 
@@ -2737,11 +2752,7 @@ static int ieee80211_set_cqm_rssi_range_config(struct wiphy *wiphy,
 	bss_conf->cqm_rssi_hyst = 0;
 	sdata->u.mgd.last_cqm_event_signal = 0;
 
-	/* tell the driver upon association, unless already associated */
-	if (sdata->u.mgd.associated &&
-	    sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)
-		ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_CQM);
-
+	ieee80211_update_rssi_config(sdata);
 	return 0;
 }
 
Signature · 1 line
1.7.9.5
maintainer
#4 lore raw

Re: [PATCHv4 2/3] mac80211: enable setting cqm rssi config for AP mode

Quoted 20 lines

+static void ieee80211_update_rssi_config(struct
ieee80211_sub_if_data *sdata)

(quoted diff) +2 -0
+{
+	if (!(sdata->vif.driver_flags &

IEEE80211_VIF_SUPPORTS_CQM_RSSI))

net/mac80211/cfg.c +3 -0
+		return;
+
+	/* tell the driver upon association, unless already

associated */

net/mac80211/cfg.c +5 -0
+	if (sdata->vif.type == NL80211_IFTYPE_STATION &&
+	    !sdata->u.mgd.associated)
+		return;
+
+	/* if AP, always tell the driver by checking beacon status

*/

net/mac80211/cfg.c +3 -0
+	if (!sdata->vif.bss_conf.enable_beacon ||
+	    !wiphy_ext_feature_isset(sdata->local->hw.wiphy,
+				NL80211_EXT_FEATURE_AP_STA_CQM_RSSI_

CONFIG))

Review

Quoted 1 line
(quoted diff) +1 -0
+		return;

This probably should check for AP mode as well - not sure we use enable_beacon for e.g. IBSS but I guess we could.

johannes

#5 lore raw

PATCH v4 3/3 mac80211: implement cqm rssi check using rx data signal

In reply to Tamizh chelvam

From: Tamizh chelvam <[email protected]>

Triggers cfg80211_ap_sta_cqm_rssi_notify with the corresponding event when station signal goes lower than the configured rssi threshold. And notify back to user space once the station signal becomes greater than the configured value. It uses rx data signal and compare with rssi value given by user. This rssi threshold is bss specific and it is common for all the stations.

---
 include/net/mac80211.h  |    7 +++++++
 net/mac80211/rx.c       |   46 +++++++++++++++++++++++++++++++++++++++++++++-
 net/mac80211/sta_info.h |    9 +++++++++
 3 files changed, 61 insertions(+), 1 deletion(-)
include/net/mac80211.h +7 -0
index dc3e9d9..e973bcd 100644
@@ -800,6 +800,13 @@ enum mac80211_rate_control_flags {
 };
 
 
+/*
+ * How many frames need to have been used in average station's
+ * signal strength before checking against the threshold
+ */
+#define IEEE80211_STA_SIGNAL_AVE_MIN_COUNT	4
+
+
 /* there are 40 bytes if you don't need the rateset to be kept */
 #define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40
 
net/mac80211/rx.c +45 -1

66 lines not on this page · raw message

net/mac80211/sta_info.h +9 -0
index f64eb86..2127803 100644
@@ -481,6 +481,12 @@ struct ieee80211_sta_rx_stats {
  * @pcpu_rx_stats: per-CPU RX statistics, assigned only if the driver needs
  *	this (by advertising the USES_RSS hw flag)
  * @status_stats: TX status statistics
+ * @last_cqm_event_signal: Last data frame signal strength average that
+ *	triggered a cqm event for a connected station. 0 indicates that no
+ *	event has been generated for the station.
+ * @count_rx_signal: Number of data frames used in avg signal for a station.
+ *	This can be used to avoid generating less reliable cqm events for
+ *	the station.
  */
 struct sta_info {
 	/* General information, mostly static */
@@ -581,6 +587,9 @@ struct sta_info {
 
 	struct cfg80211_chan_def tdls_chandef;
 
+	int last_cqm_event_signal;
+	unsigned int count_rx_signal;
+
 	/* keep last! */
 	struct ieee80211_sta sta;
 };
Signature · 1 line
1.7.9.5
maintainer
#6 lore raw

Re: [PATCHv4 3/3] mac80211: implement cqm rssi check using rx data signal

include/net/mac80211.h enum mac80211_rate_control_flags { · line 807

Quoted 6 lines
include/net/mac80211.h +5 -0
+/*
+ * How many frames need to have been used in average station's
+ * signal strength before checking against the threshold
+ */
+#define IEEE80211_STA_SIGNAL_AVE_MIN_COUNT	4

This seems OK - you want something to start up from?

However, I don't think we do that in "normal" CQM, and building different behaviour here seems a bit odd.

Review

Quoted 8 lines
net/mac80211/rx.c +5 -0
+	if (sig < thold && last_event == 0) {
+		sta->last_cqm_event_signal = sig;
+		cfg80211_ap_sta_cqm_rssi_notify(
+				rx->sdata->dev, sta->addr,
+				NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW

,

(quoted diff) +2 -0
+				sig, GFP_ATOMIC);
+		sta->count_rx_signal = 0;

In particular, resetting it all the time seems even stranger, since then you can only react at a granularity of these 4 frames. EWMA catches fluctuations already, so I don't think you should do it this way.

johannes