Permalink
Browse files

nl80211/cfg80211: add new scan configurations attributes (INTERNAL)

To enhance scan abilities by being able to setup some low level
scan parameters dynamically during NL80211_CMD_TRIGGER_SCAN
command.

Exposing 3 new attributes:
  NL80211_ATTR_SCAN_MIN_DWELL: Minimum scan dwell time (in TUs), u32
	attribute to setup minimum time to wait on each channel, if received
	at least one probe response during this period will continue waiting
	%NL80211_ATTR_SCAN_MAX_DWELL, otherwise will move to next channel.
 	This is optional attribute, so if it's not set driver should
	use hardware default values.
  NL80211_ATTR_SCAN_MAX_DWELL: Maximum scan dwell time (in TUs), u32
	attribute to setup maximum time to wait on each channel.
	This is optional attribute, so if it's not set driver should
	use hardware default values.
  NL80211_ATTR_SCAN_NUM_PROBE:  Attribute (u8) to setup number of probe
 	requests to transmit on each active scan channel, used with
	NL80211_CMD_TRIGGER_SCAN command.

These attributes are also required for the beacon reports in the
802.11k standard.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information...
1 parent da05813 commit f849df98543049880445a104e8092c53aa6760e9 @victorgld victorgld committed with ariknem May 16, 2012
Showing with 48 additions and 0 deletions.
  1. +20 −0 include/linux/nl80211.h
  2. +7 −0 include/net/cfg80211.h
  3. +3 −0 net/mac80211/scan.c
  4. +18 −0 net/wireless/nl80211.c
@@ -1269,6 +1269,22 @@ enum nl80211_commands {
* strength of probe response/beacon (in dBm) is stronger than this
* negative value (usually: -20 dBm > X > -95 dBm).
*
+ * @%NL80211_ATTR_SCAN_MIN_DWELL: Minimum scan dwell time (in TUs), u32
+ * attribute to setup minimum time to wait on each channel, if received
+ * at least one probe response during this period will continue waiting
+ * %NL80211_ATTR_SCAN_MAX_DWELL, otherwise will move to next channel.
+ * Relevant only for active scan, used with %NL80211_CMD_TRIGGER_SCAN
+ * command. This is optional attribute, so if it's not set driver should
+ * use hardware default values.
+ * @%NL80211_ATTR_SCAN_MAX_DWELL: Maximum scan dwell time (in TUs), u32
+ * attribute to setup maximum time to wait on each channel.
+ * Relevant only for active scan, used with %NL80211_CMD_TRIGGER_SCAN
+ * command. This is optional attribute, so if it's not set driver should
+ * use hardware default values.
+ * @%NL80211_ATTR_SCAN_NUM_PROBE: Attribute (u8) to setup number of probe
+ * requests to transmit on each active scan channel, used with
+ * %NL80211_CMD_TRIGGER_SCAN command.
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -1523,6 +1539,10 @@ enum nl80211_attrs {
NL80211_ATTR_IM_SCAN_RESULT,
NL80211_ATTR_IM_SCAN_RESULT_MIN_RSSI,
+ NL80211_ATTR_SCAN_MIN_DWELL,
+ NL80211_ATTR_SCAN_MAX_DWELL,
+ NL80211_ATTR_SCAN_NUM_PROBE,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -1001,6 +1001,9 @@ struct cfg80211_ssid {
* @wiphy: the wiphy this was for
* @dev: the interface
* @aborted: (internal) scan request was notified as aborted
+ * @min_dwell: minimum time to wait on each channel for active scans
+ * @max_dwell: maximum time to wait on each channel for active scans
+ * @num_probe: number of probe requests to transmit on each active scan channel
* @no_cck: used to send probe requests at non CCK rate in 2GHz band
*/
struct cfg80211_scan_request {
@@ -1018,6 +1021,10 @@ struct cfg80211_scan_request {
bool aborted;
bool no_cck;
+ u32 min_dwell;
+ u32 max_dwell;
+ u8 num_probe;
+
/* keep last */
struct ieee80211_channel *channels[0];
};
View
@@ -460,6 +460,9 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
local->hw_scan_req->ssids = req->ssids;
local->hw_scan_req->n_ssids = req->n_ssids;
+ local->hw_scan_req->max_dwell = req->max_dwell;
+ local->hw_scan_req->min_dwell = req->min_dwell;
+ local->hw_scan_req->num_probe = req->num_probe;
ies = (u8 *)local->hw_scan_req +
sizeof(*local->hw_scan_req) +
req->n_channels * sizeof(req->channels[0]);
@@ -296,6 +296,9 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
[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 },
+ [NL80211_ATTR_SCAN_MIN_DWELL] = { .type = NLA_U32 },
+ [NL80211_ATTR_SCAN_MAX_DWELL] = { .type = NLA_U32 },
+ [NL80211_ATTR_SCAN_NUM_PROBE] = { .type = NLA_U8 },
};
/* policy for the key attributes */
@@ -4187,6 +4190,21 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
rdev->im_scan_result_snd_pid = 0;
}
+ if (info->attrs[NL80211_ATTR_SCAN_MIN_DWELL]) {
+ request->min_dwell =
+ nla_get_u32(info->attrs[NL80211_ATTR_SCAN_MIN_DWELL]);
+ }
+
+ if (info->attrs[NL80211_ATTR_SCAN_MAX_DWELL]) {
+ request->max_dwell =
+ nla_get_u32(info->attrs[NL80211_ATTR_SCAN_MAX_DWELL]);
+ }
+
+ if (info->attrs[NL80211_ATTR_SCAN_NUM_PROBE]) {
+ request->num_probe =
+ nla_get_u8(info->attrs[NL80211_ATTR_SCAN_NUM_PROBE]);
+ }
+
for (i = 0; i < IEEE80211_NUM_BANDS; i++)
if (wiphy->bands[i])
request->rates[i] =

0 comments on commit f849df9

Please sign in to comment.