All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv4 0/3] cfg80211/mac80211: cqm rssi config for AP mode
@ 2018-02-25  7:49 Tamizh chelvam
  2018-02-25  7:49 ` [PATCHv4 1/3] cfg80211: enable setting " Tamizh chelvam
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tamizh chelvam @ 2018-02-25  7:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Tamizh chelvam

From: Tamizh chelvam <tamizhr@codeaurora.org>

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(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCHv4 1/3] cfg80211: enable setting cqm rssi config for AP mode
  2018-02-25  7:49 [PATCHv4 0/3] cfg80211/mac80211: cqm rssi config for AP mode Tamizh chelvam
@ 2018-02-25  7:49 ` Tamizh chelvam
  2018-03-23 13:27   ` Johannes Berg
  2018-02-25  7:49 ` [PATCHv4 2/3] mac80211: " Tamizh chelvam
  2018-02-25  7:49 ` [PATCHv4 3/3] mac80211: implement cqm rssi check using rx data signal Tamizh chelvam
  2 siblings, 1 reply; 7+ messages in thread
From: Tamizh chelvam @ 2018-02-25  7:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Tamizh chelvam

From: Tamizh chelvam <tamizhr@codeaurora.org>

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.

Signed-off-by: Tamizh chelvam <tamizhr@codeaurora.org>
---
 include/net/cfg80211.h       |   15 +++++++++
 include/uapi/linux/nl80211.h |    6 ++++
 net/wireless/nl80211.c       |   71 ++++++++++++++++++++++++++++++++++++------
 3 files changed, 82 insertions(+), 10 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 56e905c..d19fd5c 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -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
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index c13c843..81a60dc 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -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,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a910150..0ece819 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -44,6 +44,7 @@ enum nl80211_multicast_groups {
 	NL80211_MCGRP_MLME,
 	NL80211_MCGRP_VENDOR,
 	NL80211_MCGRP_NAN,
+	NL80211_MCGRP_AP_STA_CQM,
 	NL80211_MCGRP_TESTMODE /* keep last - ifdef! */
 };
 
@@ -54,6 +55,8 @@ enum nl80211_multicast_groups {
 	[NL80211_MCGRP_MLME] = { .name = NL80211_MULTICAST_GROUP_MLME },
 	[NL80211_MCGRP_VENDOR] = { .name = NL80211_MULTICAST_GROUP_VENDOR },
 	[NL80211_MCGRP_NAN] = { .name = NL80211_MULTICAST_GROUP_NAN },
+	[NL80211_MCGRP_AP_STA_CQM] = {
+				.name = NL80211_MULTICAST_GROUP_AP_STA_CQM },
 #ifdef CONFIG_NL80211_TESTMODE
 	[NL80211_MCGRP_TESTMODE] = { .name = NL80211_MULTICAST_GROUP_TESTMODE }
 #endif
@@ -9905,8 +9908,13 @@ static int nl80211_set_cqm_rssi(struct genl_info *info,
 		prev = thresholds[i];
 	}
 
-	if (wdev->iftype != NL80211_IFTYPE_STATION &&
-	    wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
+	if ((wdev->iftype != NL80211_IFTYPE_STATION &&
+	     wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) &&
+	    ((wdev->iftype == NL80211_IFTYPE_AP ||
+	      wdev->iftype == NL80211_IFTYPE_AP_VLAN ||
+	      wdev->iftype == NL80211_IFTYPE_P2P_GO) &&
+	     !wiphy_ext_feature_isset(&rdev->wiphy,
+				NL80211_EXT_FEATURE_AP_STA_CQM_RSSI_CONFIG)))
 		return -EOPNOTSUPP;
 
 	wdev_lock(wdev);
@@ -14587,9 +14595,24 @@ static void cfg80211_send_cqm(struct sk_buff *msg, gfp_t gfp)
 				NL80211_MCGRP_MLME, gfp);
 }
 
-void cfg80211_cqm_rssi_notify(struct net_device *dev,
-			      enum nl80211_cqm_rssi_threshold_event rssi_event,
-			      s32 rssi_level, gfp_t gfp)
+static void cfg80211_send_ap_sta_cqm(struct sk_buff *msg, gfp_t gfp)
+{
+	void **cb = (void **)msg->cb;
+	struct cfg80211_registered_device *rdev = cb[2];
+
+	nla_nest_end(msg, cb[1]);
+	genlmsg_end(msg, cb[0]);
+
+	memset(msg->cb, 0, sizeof(msg->cb));
+
+	genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
+				NL80211_MCGRP_AP_STA_CQM, gfp);
+}
+
+static struct sk_buff *cfg80211_cqm_rssi_prepare(struct net_device *dev,
+			const u8 *mac,
+			enum nl80211_cqm_rssi_threshold_event rssi_event,
+			s32 rssi_level, gfp_t gfp)
 {
 	struct sk_buff *msg;
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -14599,7 +14622,7 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
 
 	if (WARN_ON(rssi_event != NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW &&
 		    rssi_event != NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH))
-		return;
+		return NULL;
 
 	if (wdev->cqm_config) {
 		wdev->cqm_config->last_rssi_event_value = rssi_level;
@@ -14612,7 +14635,7 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
 
 	msg = cfg80211_prepare_cqm(dev, NULL, gfp);
 	if (!msg)
-		return;
+		return NULL;
 
 	if (nla_put_u32(msg, NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT,
 			rssi_event))
@@ -14622,15 +14645,43 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
 				      rssi_level))
 		goto nla_put_failure;
 
-	cfg80211_send_cqm(msg, gfp);
-
-	return;
+	return msg;
 
  nla_put_failure:
 	nlmsg_free(msg);
+	return NULL;
+}
+
+void cfg80211_cqm_rssi_notify(struct net_device *dev,
+			      enum nl80211_cqm_rssi_threshold_event rssi_event,
+			      s32 rssi_level, gfp_t gfp)
+{
+	struct sk_buff *msg;
+
+	msg = cfg80211_cqm_rssi_prepare(dev, NULL, rssi_event, rssi_level,
+					gfp);
+	if (!msg)
+		return;
+	cfg80211_send_cqm(msg, gfp);
+
+	return;
 }
 EXPORT_SYMBOL(cfg80211_cqm_rssi_notify);
 
+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)
+{
+	struct sk_buff *msg;
+
+	msg = cfg80211_cqm_rssi_prepare(dev, mac, rssi_event, rssi_level,
+					gfp);
+	if (!msg)
+		return;
+	cfg80211_send_ap_sta_cqm(msg, gfp);
+}
+EXPORT_SYMBOL(cfg80211_ap_sta_cqm_rssi_notify);
+
 void cfg80211_cqm_txe_notify(struct net_device *dev,
 			     const u8 *peer, u32 num_packets,
 			     u32 rate, u32 intvl, gfp_t gfp)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv4 2/3] mac80211: enable setting cqm rssi config for AP mode
  2018-02-25  7:49 [PATCHv4 0/3] cfg80211/mac80211: cqm rssi config for AP mode Tamizh chelvam
  2018-02-25  7:49 ` [PATCHv4 1/3] cfg80211: enable setting " Tamizh chelvam
@ 2018-02-25  7:49 ` Tamizh chelvam
  2018-03-23 13:22   ` Johannes Berg
  2018-02-25  7:49 ` [PATCHv4 3/3] mac80211: implement cqm rssi check using rx data signal Tamizh chelvam
  2 siblings, 1 reply; 7+ messages in thread
From: Tamizh chelvam @ 2018-02-25  7:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Pradeep Kumar Chitrapu, Tamizh chelvam

From: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>

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

Co-Developed-by: Tamizh Chelvam <tamizhr@codeaurora.org>
Signed-off-by: Tamizh chelvam <tamizhr@codeaurora.org>
Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
---
 net/mac80211/cfg.c |   31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6f9d5be..74092cb 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -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;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv4 3/3] mac80211: implement cqm rssi check using rx data signal
  2018-02-25  7:49 [PATCHv4 0/3] cfg80211/mac80211: cqm rssi config for AP mode Tamizh chelvam
  2018-02-25  7:49 ` [PATCHv4 1/3] cfg80211: enable setting " Tamizh chelvam
  2018-02-25  7:49 ` [PATCHv4 2/3] mac80211: " Tamizh chelvam
@ 2018-02-25  7:49 ` Tamizh chelvam
  2018-03-23 13:24   ` Johannes Berg
  2 siblings, 1 reply; 7+ messages in thread
From: Tamizh chelvam @ 2018-02-25  7:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Tamizh chelvam

From: Tamizh chelvam <tamizhr@codeaurora.org>

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.

Signed-off-by: Tamizh chelvam <tamizhr@codeaurora.org>
---
 include/net/mac80211.h  |    7 +++++++
 net/mac80211/rx.c       |   46 +++++++++++++++++++++++++++++++++++++++++++++-
 net/mac80211/sta_info.h |    9 +++++++++
 3 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index dc3e9d9..e973bcd 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -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
 
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 2783c5c..611dea5 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1536,6 +1536,47 @@ void ieee80211_sta_uapsd_trigger(struct ieee80211_sta *pubsta, u8 tid)
 	return RX_CONTINUE;
 }
 
+static void ieee80211_sta_rx_signal_thold_check(struct ieee80211_rx_data *rx)
+{
+	struct sta_info *sta = rx->sta;
+	struct ieee80211_bss_conf *bss_conf =
+		&rx->sdata->vif.bss_conf;
+	int sig, last_event, thold;
+
+	if (!wiphy_ext_feature_isset(rx->local->hw.wiphy,
+				NL80211_EXT_FEATURE_AP_STA_CQM_RSSI_CONFIG))
+		return;
+
+	sta->count_rx_signal++;
+	if (sta->count_rx_signal < IEEE80211_STA_SIGNAL_AVE_MIN_COUNT)
+		return;
+
+	if (!bss_conf->cqm_rssi_thold || !bss_conf->enable_beacon) {
+		sta->count_rx_signal = 0;
+		return;
+	}
+
+	sig = -ewma_signal_read(&sta->rx_stats_avg.signal);
+	last_event = sta->last_cqm_event_signal;
+	thold = bss_conf->cqm_rssi_thold;
+
+	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,
+				sig, GFP_ATOMIC);
+		sta->count_rx_signal = 0;
+	} else if (last_event && sig > thold) {
+		sta->last_cqm_event_signal = 0;
+		cfg80211_ap_sta_cqm_rssi_notify(
+				rx->sdata->dev, sta->addr,
+				NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
+				sig, GFP_ATOMIC);
+		sta->count_rx_signal = 0;
+	}
+}
+
 static ieee80211_rx_result debug_noinline
 ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
 {
@@ -1591,6 +1632,7 @@ void ieee80211_sta_uapsd_trigger(struct ieee80211_sta *pubsta, u8 tid)
 	if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
 		sta->rx_stats.last_signal = status->signal;
 		ewma_signal_add(&sta->rx_stats_avg.signal, -status->signal);
+		ieee80211_sta_rx_signal_thold_check(rx);
 	}
 
 	if (status->chains) {
@@ -4000,9 +4042,11 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx,
 
 	if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
 		stats->last_signal = status->signal;
-		if (!fast_rx->uses_rss)
+		if (!fast_rx->uses_rss) {
 			ewma_signal_add(&sta->rx_stats_avg.signal,
 					-status->signal);
+			ieee80211_sta_rx_signal_thold_check(rx);
+		}
 	}
 
 	if (status->chains) {
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index f64eb86..2127803 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -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;
 };
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCHv4 2/3] mac80211: enable setting cqm rssi config for AP mode
  2018-02-25  7:49 ` [PATCHv4 2/3] mac80211: " Tamizh chelvam
@ 2018-03-23 13:22   ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2018-03-23 13:22 UTC (permalink / raw)
  To: Tamizh chelvam; +Cc: linux-wireless, Pradeep Kumar Chitrapu

>  
> +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;

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCHv4 3/3] mac80211: implement cqm rssi check using rx data signal
  2018-02-25  7:49 ` [PATCHv4 3/3] mac80211: implement cqm rssi check using rx data signal Tamizh chelvam
@ 2018-03-23 13:24   ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2018-03-23 13:24 UTC (permalink / raw)
  To: Tamizh chelvam; +Cc: linux-wireless


> +/*
> + * 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.

> +	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
> ,
> +				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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCHv4 1/3] cfg80211: enable setting cqm rssi config for AP mode
  2018-02-25  7:49 ` [PATCHv4 1/3] cfg80211: enable setting " Tamizh chelvam
@ 2018-03-23 13:27   ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2018-03-23 13:27 UTC (permalink / raw)
  To: Tamizh chelvam; +Cc: linux-wireless

On Sun, 2018-02-25 at 13:19 +0530, Tamizh chelvam wrote:
> From: Tamizh chelvam <tamizhr@codeaurora.org>
> 
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-03-23 13:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-25  7:49 [PATCHv4 0/3] cfg80211/mac80211: cqm rssi config for AP mode Tamizh chelvam
2018-02-25  7:49 ` [PATCHv4 1/3] cfg80211: enable setting " Tamizh chelvam
2018-03-23 13:27   ` Johannes Berg
2018-02-25  7:49 ` [PATCHv4 2/3] mac80211: " Tamizh chelvam
2018-03-23 13:22   ` Johannes Berg
2018-02-25  7:49 ` [PATCHv4 3/3] mac80211: implement cqm rssi check using rx data signal Tamizh chelvam
2018-03-23 13:24   ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.