Skip to content

Commit

Permalink
cfg80211: Add background scan period attribute.
Browse files Browse the repository at this point in the history
Receive background scan period as part of connect
command and pass the same to the driver.

Signed-off-by: Bala Shanmugam <bkamatch@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Bala Shanmugam authored and John W. Linville committed Mar 12, 2012
1 parent bff2ec2 commit 4486ea9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@
* %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
* %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and
* %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT.
* Background scan period can optionally be
* specified in %NL80211_ATTR_BG_SCAN_PERIOD,
* if not specified default background scan configuration
* in driver is used and if period value is 0, bg scan will be disabled.
* This attribute is ignored if driver does not support roam scan.
* It is also sent as an event, with the BSSID and response IEs when the
* connection is established or failed to be established. This can be
* determined by the STATUS_CODE attribute.
Expand Down Expand Up @@ -1207,6 +1212,9 @@ enum nl80211_commands {
* this attribute is (depending on the driver capabilities) added to
* received frames indicated with %NL80211_CMD_FRAME.
*
* @NL80211_ATTR_BG_SCAN_PERIOD: Background scan period in seconds
* or 0 to disable background scan.
*
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
Expand Down Expand Up @@ -1456,6 +1464,8 @@ enum nl80211_attrs {

NL80211_ATTR_RX_SIGNAL_DBM,

NL80211_ATTR_BG_SCAN_PERIOD,

/* add attributes here, update the policy in nl80211.c */

__NL80211_ATTR_AFTER_LAST,
Expand Down
3 changes: 3 additions & 0 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,8 @@ struct cfg80211_ibss_params {
* @key_idx: index of WEP key for shared key authentication
* @key: WEP key for shared key authentication
* @flags: See &enum cfg80211_assoc_req_flags
* @bg_scan_period: Background scan period in seconds
* or -1 to indicate that default value is to be used.
* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
* will be used in ht_capa. Un-supported values will be ignored.
* @ht_capa_mask: The bits of ht_capa which are to be used.
Expand All @@ -1220,6 +1222,7 @@ struct cfg80211_connect_params {
const u8 *key;
u8 key_len, key_idx;
u32 flags;
int bg_scan_period;
struct ieee80211_ht_cap ht_capa;
struct ieee80211_ht_cap ht_capa_mask;
};
Expand Down
8 changes: 8 additions & 0 deletions net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
},
[NL80211_ATTR_NOACK_MAP] = { .type = NLA_U16 },
[NL80211_ATTR_INACTIVITY_TIMEOUT] = { .type = NLA_U16 },
[NL80211_ATTR_BG_SCAN_PERIOD] = { .type = NLA_U16 },
};

/* policy for the key attributes */
Expand Down Expand Up @@ -5116,6 +5117,13 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)

wiphy = &rdev->wiphy;

connect.bg_scan_period = -1;
if (info->attrs[NL80211_ATTR_BG_SCAN_PERIOD] &&
(wiphy->flags & WIPHY_FLAG_SUPPORTS_FW_ROAM)) {
connect.bg_scan_period =
nla_get_u16(info->attrs[NL80211_ATTR_BG_SCAN_PERIOD]);
}

if (info->attrs[NL80211_ATTR_MAC])
connect.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]);
connect.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]);
Expand Down
3 changes: 3 additions & 0 deletions net/wireless/wext-sme.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
wdev->wext.connect.ie = wdev->wext.ie;
wdev->wext.connect.ie_len = wdev->wext.ie_len;

/* Use default background scan period */
wdev->wext.connect.bg_scan_period = -1;

if (wdev->wext.keys) {
wdev->wext.keys->def = wdev->wext.default_key;
wdev->wext.keys->defmgmt = wdev->wext.default_mgmt_key;
Expand Down

0 comments on commit 4486ea9

Please sign in to comment.