From patchwork Mon Jan 6 07:51:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jouni Malinen X-Patchwork-Id: 3436291 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 779769F2E9 for ; Mon, 6 Jan 2014 07:58:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F3132016A for ; Mon, 6 Jan 2014 07:58:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3925D20166 for ; Mon, 6 Jan 2014 07:58:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751993AbaAFH60 (ORCPT ); Mon, 6 Jan 2014 02:58:26 -0500 Received: from li674-96.members.linode.com ([212.71.239.96]:43891 "EHLO li674-96.members.linode.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751849AbaAFH6W (ORCPT ); Mon, 6 Jan 2014 02:58:22 -0500 Received: from jm (a91-155-81-93.elisa-laajakaista.fi [91.155.81.93]) by li674-96.members.linode.com (Postfix) with ESMTPSA id 785EE118CA; Mon, 6 Jan 2014 07:51:26 +0000 (UTC) Received: by jm (sSMTP sendmail emulation); Mon, 06 Jan 2014 09:51:26 +0200 Date: Mon, 6 Jan 2014 09:51:26 +0200 From: Jouni Malinen To: Johannes Berg Cc: linux-wireless@vger.kernel.org Subject: [RFC 2/3] cfg80211: MinChannelTime and MaxChannelTime for scan requests Message-ID: <20140106075126.GA31046@w1.fi> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds new nl80211 attributes to allow MinChannelTime and MaxChannelTime to be specified for scan requests. The parameters can be used to control the amount of time spent on each channel during a scan as specified in the IEEE Std 802.11-2012 MLME-SCAN.request() primitive. Signed-off-by: Jouni Malinen --- include/net/cfg80211.h | 7 +++++++ include/uapi/linux/nl80211.h | 11 +++++++++++ net/wireless/nl80211.c | 14 ++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 8b5777a..3553c3a 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1367,6 +1367,11 @@ struct cfg80211_ssid { * @aborted: (internal) scan request was notified as aborted * @notified: (internal) scan request was notified as done or aborted * @no_cck: used to send probe requests at non CCK rate in 2GHz band + * @min_chan_time: MinChannelTime in TUs; time to spend waiting for + * PHY-CCA.indication (channel busy) in Active scan; 0 to indicate that driver + * default value to be used + * @max_chan_time: MaxChannelTime in TUs; time to spend waiting for Beacon or + * Probe Response frames; 0 to indicate that driver default value to be used */ struct cfg80211_scan_request { struct cfg80211_ssid *ssids; @@ -1376,6 +1381,8 @@ struct cfg80211_scan_request { const u8 *ie; size_t ie_len; u32 flags; + unsigned int min_chan_time; + unsigned int max_chan_time; u32 rates[IEEE80211_NUM_BANDS]; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index e57de33..86b8888 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -1568,6 +1568,14 @@ enum nl80211_commands { * @NL80211_ATTR_MAC_HINT: MAC address recommendation as initial BSS * @NL80211_ATTR_WIPHY_FREQ_HINT: frequency of the recommended initial BSS * + * @NL80211_ATTR_MIN_CHANNEL_TIME: MinChannelTime - Minimum time (in TU) to + * spend on each channel when scanning (used for active scans). If not + * included, the driver will use its default value. u32 attribute. + * @NL80211_ATTR_MAX_CHANNEL_TIME: MaxChannelTime - Maximum time (in TU) to + * spend on each channel when scanning (used for both active and passive + * scans). If not included, the driver will use its default value. u32 + * attribute. + * * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */ @@ -1899,6 +1907,9 @@ enum nl80211_attrs { NL80211_ATTR_MAC_HINT, NL80211_ATTR_WIPHY_FREQ_HINT, + NL80211_ATTR_MIN_CHANNEL_TIME, + NL80211_ATTR_MAX_CHANNEL_TIME, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index a3a6fb7..caf2829 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -386,6 +386,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { .len = IEEE80211_QOS_MAP_LEN_MAX }, [NL80211_ATTR_MAC_HINT] = { .len = ETH_ALEN }, [NL80211_ATTR_WIPHY_FREQ] = { .type = NLA_U32 }, + [NL80211_ATTR_MIN_CHANNEL_TIME] = { .type = NLA_U32 }, + [NL80211_ATTR_MAX_CHANNEL_TIME] = { .type = NLA_U32 }, }; /* policy for the key attributes */ @@ -5443,6 +5445,18 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) request->no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); + if (info->attrs[NL80211_ATTR_MIN_CHANNEL_TIME]) + request->min_chan_time = nla_get_u32( + info->attrs[NL80211_ATTR_MIN_CHANNEL_TIME]); + if (info->attrs[NL80211_ATTR_MAX_CHANNEL_TIME]) + request->max_chan_time = nla_get_u32( + info->attrs[NL80211_ATTR_MAX_CHANNEL_TIME]); + if (request->max_chan_time && + request->max_chan_time < request->min_chan_time) { + err = -EINVAL; + goto out_free; + } + request->wdev = wdev; request->wiphy = &rdev->wiphy; request->scan_start = jiffies;