Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

nl80211/cfg80211: add intermediate scan result filter (INTERNAL)

User might want to be notified with intermediate scan results only
above some minimal RSSI. Adding new NL80211_ATTR_IM_SCAN_RESULT_MIN_RSSI
u32 attribute for the intermediate scan results  RSSI filtering mechanism,
which will significantly reduce unnecessary Kernel-User traffic.
It might be optionally enabled during NL80211_CMD_TRIGGER_SCAN.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information...
commit da05813f6cf385e199d29415d9073bb32282a183 1 parent 6f154d4
@victorgld victorgld authored ariknem committed
View
6 include/linux/nl80211.h
@@ -1264,6 +1264,11 @@ enum nl80211_commands {
* for the %NL80211_CMD_TRIGGER_SCAN command.
* When set: will notify on each new scan result in the cache.
*
+ * @%NL80211_ATTR_IM_SCAN_RESULT_MIN_RSSI: Intermediate event filtering.
+ * When set: will notify only those new scan result whose signal
+ * strength of probe response/beacon (in dBm) is stronger than this
+ * negative value (usually: -20 dBm > X > -95 dBm).
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -1516,6 +1521,7 @@ enum nl80211_attrs {
NL80211_ATTR_BG_SCAN_PERIOD,
NL80211_ATTR_IM_SCAN_RESULT,
+ NL80211_ATTR_IM_SCAN_RESULT_MIN_RSSI,
/* add attributes here, update the policy in nl80211.c */
View
1  net/wireless/core.h
@@ -88,6 +88,7 @@ struct cfg80211_registered_device {
/* intermediate scan result pid of sender */
u32 im_scan_result_snd_pid;
+ s32 im_scan_result_min_rssi_mbm;
/* must be last because of the way we do wiphy_priv(),
* and it should at least be aligned to NETDEV_ALIGN */
View
13 net/wireless/nl80211.c
@@ -295,6 +295,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
[NL80211_ATTR_INACTIVITY_TIMEOUT] = { .type = NLA_U16 },
[NL80211_ATTR_BG_SCAN_PERIOD] = { .type = NLA_U16 },
[NL80211_ATTR_IM_SCAN_RESULT] = { .type = NLA_FLAG },
+ [NL80211_ATTR_IM_SCAN_RESULT_MIN_RSSI] = { .type = NLA_U32 },
};
/* policy for the key attributes */
@@ -4173,10 +4174,18 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
request->ie_len);
}
- if (info->attrs[NL80211_ATTR_IM_SCAN_RESULT])
+ if (info->attrs[NL80211_ATTR_IM_SCAN_RESULT]) {
rdev->im_scan_result_snd_pid = info->snd_pid;
- else
+ if (info->attrs[NL80211_ATTR_IM_SCAN_RESULT_MIN_RSSI]) {
+ attr = info->attrs[NL80211_ATTR_IM_SCAN_RESULT_MIN_RSSI];
+ rdev->im_scan_result_min_rssi_mbm =
+ DBM_TO_MBM(nla_get_u32(attr));
+ } else {
+ rdev->im_scan_result_min_rssi_mbm = 0;
+ }
+ } else {
rdev->im_scan_result_snd_pid = 0;
+ }
for (i = 0; i < IEEE80211_NUM_BANDS; i++)
if (wiphy->bands[i])
View
4 net/wireless/scan.c
@@ -182,6 +182,10 @@ void cfg80211_send_intermediate_result(struct net_device *dev,
if (!rdev->im_scan_result_snd_pid || !rdev->scan_req || !cbss)
return;
+ if ((rdev->im_scan_result_min_rssi_mbm) &&
+ (rdev->im_scan_result_min_rssi_mbm > cbss->signal))
+ return;
+
ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
if (!ev)
return;
Please sign in to comment.
Something went wrong with that request. Please try again.