From patchwork Thu Jun 4 07:09:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 11587029 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 37D89913 for ; Thu, 4 Jun 2020 07:10:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EF91F206DC for ; Thu, 4 Jun 2020 07:10:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CMZPAH62" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF91F206DC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/FBJl04ghV19tGfv5/uMF6wAKS/yGv/cbSXrMy3KY5E=; b=CMZPAH62SkYizq EWrAzmsiZLEk0NIOhqInC1jO8D4qBNey5fkRjvau+mucrg4PI8O4AzxBIx2ApB5czLahKxekXm9RT EYac/TklMvrA3TpQRBvrQjPHEP03UgLxkJkDJ6uG6lUskpy6jU3A9qSGrblUyUSKjXQew4R4VX21d yFD1ocpM1Y2NRpKI/ISbU4QyApAE7DJfbvWy7mQFZ9wTQ0K1PEu5h7Rm0ncd9fJpF5LShebNh4/Es I2u6epzYkVMlS6DOjrH4FSd5bsYRYda3sq0MCHAdaaPCE1nhDHvwvSVd8wgQXImCFd7/tqKVk4Hzs mouzIpS2nfb/OUThaITA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jgk0z-0001bG-4K; Thu, 04 Jun 2020 07:10:13 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jgk0p-0000GN-FI for ath11k@lists.infradead.org; Thu, 04 Jun 2020 07:10:05 +0000 Received: from [46.59.202.224] (helo=localhost.localdomain) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1jgk0k-0001P3-Vc; Thu, 04 Jun 2020 09:09:59 +0200 From: John Crispin To: Johannes Berg Subject: [PATCH 03/12] nl80211: add attributes to set beacon transmit mode Date: Thu, 4 Jun 2020 09:09:43 +0200 Message-Id: <20200604070952.15481-4-john@phrozen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200604070952.15481-1-john@phrozen.org> References: <20200604070952.15481-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200604_001003_671206_506B7F0D X-CRM114-Status: GOOD ( 13.03 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, John Crispin Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org Beacons on a radio can be sent out in burst (back to back) or staggered (equally spread out over time) mode. This patch adds the required nl80211 attributes allowing us to configure this from userland. Signed-off-by: John Crispin --- include/net/cfg80211.h | 3 +++ include/uapi/linux/nl80211.h | 17 +++++++++++++++++ net/wireless/nl80211.c | 7 +++++++ 3 files changed, 27 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 77cd2f780c6a..157d37f74efb 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1094,6 +1094,8 @@ enum cfg80211_ap_settings_flags { * @he_obss_pd: OBSS Packet Detection settings * @he_bss_color: BSS Color settings * @he_oper: HE operation IE (or %NULL if HE isn't enabled) + * @beacon_tx_mode: can be set to tell the driver to sent the beacons in staggered + * or burst mode. */ struct cfg80211_ap_settings { struct cfg80211_chan_def chandef; @@ -1125,6 +1127,7 @@ struct cfg80211_ap_settings { struct ieee80211_he_obss_pd he_obss_pd; struct cfg80211_he_bss_color he_bss_color; struct ieee80211_multi_bssid multi_bssid; + enum nl80211_beacon_tx_mode beacon_tx_mode; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index f18f681796ed..2c4950aeb474 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2481,6 +2481,8 @@ enum nl80211_commands { * * @NL80211_ATTR_MULTI_BSSID_COUNT: The number of BSSs inside the multi bssid IE. * + * @NL80211_ATTR_BEACON_TX_MODE: Set the beacon tx mode to staggered or burst. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -2961,6 +2963,8 @@ enum nl80211_attrs { NL80211_ATTR_MULTI_BSSID_INDEX, NL80211_ATTR_MULTI_BSSID_COUNT, + NL80211_ATTR_BEACON_TX_MODE, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -6732,6 +6736,19 @@ enum nl80211_multi_bssid_mode { NL80211_MULTIPLE_BSSID_NON_TRANSMITTED, }; +/** + * enum nl80211_beacon_tx_mode - Beacon tx mode settings + * + * @BEACON_TX_MODE_DEFAULT: The beacons shall be sent out in its default mode + * @BEACON_TX_MODE_STAGGERED: The beacons shall be sent out in staggered mode + * @BEACON_TX_MODE_BURST: The beacons shall be sent out in burst mode + * beacon + */ +enum nl80211_beacon_tx_mode { + NL80211_BEACON_TX_MODE_STAGGERED = 0, + NL80211_BEACON_TX_MODE_BURST, +}; + /** * enum nl80211_peer_measurement_ftm_resp - FTM response attributes * @__NL80211_PMSR_FTM_RESP_ATTR_INVALID: invalid diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 58ce67bc31da..1f6f8ecbfb57 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -669,6 +669,9 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_MULTI_BSSID_PARENT] = { .type = NLA_U32 }, [NL80211_ATTR_MULTI_BSSID_INDEX] = { .type = NLA_U32 }, [NL80211_ATTR_MULTI_BSSID_COUNT] = { .type = NLA_U32 }, + [NL80211_ATTR_BEACON_TX_MODE] = NLA_POLICY_RANGE(NLA_U8, + NL80211_BEACON_TX_MODE_STAGGERED, + NL80211_BEACON_TX_MODE_BURST), }; /* policy for the key attributes */ @@ -5165,6 +5168,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) params.multi_bssid.count = nla_get_u32( info->attrs[NL80211_ATTR_MULTI_BSSID_COUNT]); + if (info->attrs[NL80211_ATTR_BEACON_TX_MODE]) + params.beacon_tx_mode = + nla_get_u8(info->attrs[NL80211_ATTR_BEACON_TX_MODE]); + nl80211_calculate_ap_params(¶ms); if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])