Re: [PATCH 6/7] cfg80211: Accept multiple RSSI threholds for STA_MON command

2018-07-06 Thread Johannes Berg
On Thu, 2018-07-05 at 13:07 +0530, Tamizh chelvam wrote:

> First I've done patch to have single threshold value for AP mode and as 
> per the previous discussion extended to multiple thresholds also. Here 
> the intention is to accept one or more than one RSSI thresholds to 
> monitor. Any thought ?

Is there any point in even offering the API for a single one though? I
mean - we only implement it in mac80211 now, and there we clearly
implement multiple, so single would never be used.

Like I said:

> > Or do you expect somebody to actually really need the single threshold
> > in the near future?

johannes


Re: [PATCH 6/7] cfg80211: Accept multiple RSSI threholds for STA_MON command

2018-07-05 Thread Tamizh chelvam

On 2018-06-29 15:09, Johannes Berg wrote:

On Wed, 2018-06-13 at 16:15 +0530, Tamizh chelvam wrote:

Change the NL80211_CMD_STA_MON RSSI threshold attribut to


This seems weird - you just introduced it a few patches back, and now
you change it and even worry about compatibility and have both cfg80211
callbacks etc. Just remove set_sta_mon_rssi_config() and ask that
drivers/mac80211 implement set_sta_mon_rssi_range_config?

First I've done patch to have single threshold value for AP mode and as 
per the previous discussion extended to multiple thresholds also. Here 
the intention is to accept one or more than one RSSI thresholds to 
monitor. Any thought ?



  * @NL80211_EXT_FEATURE_STA_MON_RSSI_CONFIG: With this driver can set
  * rssi threshold using %NL80211_ATTR_STA_MON_RSSI_THOLD attribute
  * for a connected station.
+ * @NL80211_EXT_FEATURE_STA_MON_RSSI_LIST: With this driver the
+ *	%NL80211_ATTR_STA_MON_RSSI_THOLD attribute accepts a list of zero 
or
+ *	more RSSI threshold values to monitor rather than exactly one 
threshold.


And maybe not have two bits here either?

Or do you expect somebody to actually really need the single threshold
in the near future? It seems you're implementing it for mac80211 only,
which doesn't care.



Thanks,
Tamizh.


Re: [PATCH 6/7] cfg80211: Accept multiple RSSI threholds for STA_MON command

2018-06-29 Thread Johannes Berg
On Wed, 2018-06-13 at 16:15 +0530, Tamizh chelvam wrote:
> Change the NL80211_CMD_STA_MON RSSI threshold attribut to

This seems weird - you just introduced it a few patches back, and now
you change it and even worry about compatibility and have both cfg80211
callbacks etc. Just remove set_sta_mon_rssi_config() and ask that
drivers/mac80211 implement set_sta_mon_rssi_range_config?

>   * @NL80211_EXT_FEATURE_STA_MON_RSSI_CONFIG: With this driver can set
>   *   rssi threshold using %NL80211_ATTR_STA_MON_RSSI_THOLD attribute
>   *   for a connected station.
> + * @NL80211_EXT_FEATURE_STA_MON_RSSI_LIST: With this driver the
> + *   %NL80211_ATTR_STA_MON_RSSI_THOLD attribute accepts a list of zero or
> + *   more RSSI threshold values to monitor rather than exactly one threshold.

And maybe not have two bits here either?

Or do you expect somebody to actually really need the single threshold
in the near future? It seems you're implementing it for mac80211 only,
which doesn't care.

johannes


[PATCH 6/7] cfg80211: Accept multiple RSSI threholds for STA_MON command

2018-06-13 Thread Tamizh chelvam
Change the NL80211_CMD_STA_MON RSSI threshold attribut to
accept any number of thresholds as a sorted array. If
user send the configuration with single RSSI threshold then
the old mechanism is enabled. Same netlink event will be
generated in both cases. This patch introduced
set_sta_mon_rssi_range_config to configure high and low
value.
Driver supporting this feature should advertise
NL80211_EXT_FEATURE_STA_MON_RSSI_LIST.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |   10 +++
 include/uapi/linux/nl80211.h |4 +
 net/wireless/nl80211.c   |  176 ++
 net/wireless/rdev-ops.h  |   15 
 net/wireless/trace.h |   26 +++
 5 files changed, 180 insertions(+), 51 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 7dcf9b9..4c49cc5 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3029,6 +3029,12 @@ struct cfg80211_external_auth_params {
  * the current level of a station is above/below the configured threshold;
  * this may need some care when the configuration is changed
  * (without first being disabled.)
+ * @set_sta_mon_rssi_range_config: Configure two RSSI thresholds in the
+ * station's rssi monitor.  An event is to be sent only when the
+ * signal level of a station is found to be outside the two values.
+ * The driver should advertise %NL80211_EXT_FEATURE_STA_MON_RSSI_LIST if
+ * this method is implemented. If it is provided then there's no point
+ * providing @set_sta_mon_rssi_config
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3338,6 +3344,10 @@ struct cfg80211_ops {
   struct net_device *dev,
   const u8 *addr,
   s32 rssi_thold, u32 rssi_hyst);
+   int (*set_sta_mon_rssi_range_config)(struct wiphy *wiphy,
+struct net_device *dev,
+const u8 *addr,
+s32 rssi_low, s32 rssi_high);
 };
 
 /*
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 9d47ee6..8e2a84b 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -5188,6 +5188,9 @@ enum nl80211_feature_flags {
  * @NL80211_EXT_FEATURE_STA_MON_RSSI_CONFIG: With this driver can set
  * rssi threshold using %NL80211_ATTR_STA_MON_RSSI_THOLD attribute
  * for a connected station.
+ * @NL80211_EXT_FEATURE_STA_MON_RSSI_LIST: With this driver the
+ * %NL80211_ATTR_STA_MON_RSSI_THOLD attribute accepts a list of zero or
+ * more RSSI threshold values to monitor rather than exactly one threshold.
  *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -5223,6 +5226,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT,
NL80211_EXT_FEATURE_TXQS,
NL80211_EXT_FEATURE_STA_MON_RSSI_CONFIG,
+   NL80211_EXT_FEATURE_STA_MON_RSSI_LIST,
 
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 021e55a..c0fccb4 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -10134,61 +10134,101 @@ static int nl80211_set_cqm_txe(struct genl_info 
*info,
 
 static const struct nla_policy
 nl80211_attr_sta_mon_policy[NL80211_ATTR_STA_MON_MAX + 1] = {
-   [NL80211_ATTR_STA_MON_RSSI_THOLD] = { .type = NLA_U32 },
+   [NL80211_ATTR_STA_MON_RSSI_THOLD] = { .type = NLA_BINARY },
[NL80211_ATTR_STA_MON_RSSI_HYST] = { .type = NLA_U32 },
[NL80211_ATTR_STA_MON_RSSI_THRESHOLD_EVENT] = { .type = NLA_U32 },
[NL80211_ATTR_STA_MON_RSSI_LEVEL] = { .type = NLA_S32 },
 };
 
-static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev,
-   struct net_device *dev)
+static int cfg80211_set_rssi_range(struct cfg80211_registered_device *rdev,
+  struct net_device *dev, const u8 *mac_addr,
+  bool get_last_rssi)
 {
struct wireless_dev *wdev = dev->ieee80211_ptr;
-   s32 last, low, high;
+   s32 low, high, last;
u32 hyst;
-   int i, n;
-   int err;
-
-   /* RSSI reporting disabled? */
-   if (!wdev->rssi_config)
-   return rdev_set_cqm_rssi_range_config(rdev, dev, 0, 0);
+   int i, n, err;
 
-   /*
-* Obtain current RSSI value if possible, if not and no RSSI threshold
-* event has been received yet, we should receive an event after a
-* connection is established and enough beacons received to calculate
-* the average.
-*/
-   if (!wdev->rssi_config->last_rssi_event_value