From patchwork Fri Apr 24 22:41:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 215840 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2C51C55191 for ; Fri, 24 Apr 2020 22:42:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D472820728 for ; Fri, 24 Apr 2020 22:42:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="KuoBvfvP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726101AbgDXWma (ORCPT ); Fri, 24 Apr 2020 18:42:30 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:57358 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726070AbgDXWm3 (ORCPT ); Fri, 24 Apr 2020 18:42:29 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1587768149; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=cheA3LCyJJRur1FCaizcxQDlGa3ekuGU1bw9Vi/c/XE=; b=KuoBvfvPP1Ags7a8qTFwn2TD5VU9Sji0ion9Df6ECIUq6ThYagAgYJi0LX9nMyq5JZzsO1Fb C6LeA8cjwPIMuHQRetbdOfzuyKash/CFzZGJONu1hx6d1+ekUZXDbjIiPZc6fZWCRsN+Q1Gh iwSmf8jn+xfTk2edGfisk4a6YkM= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ea36b46.7fbb8aea0ab0-smtp-out-n04; Fri, 24 Apr 2020 22:42:14 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id B7F6BC433D2; Fri, 24 Apr 2020 22:42:14 +0000 (UTC) Received: from rmanohar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rmanohar) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1B279C433CB; Fri, 24 Apr 2020 22:42:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1B279C433CB Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=rmanohar@codeaurora.org From: Rajkumar Manoharan To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Rajkumar Manoharan Subject: [PATCH 02/10] cfg80211: validate 6 GHz chandef Date: Fri, 24 Apr 2020 15:41:40 -0700 Message-Id: <1587768108-25248-3-git-send-email-rmanohar@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587768108-25248-1-git-send-email-rmanohar@codeaurora.org> References: <1587768108-25248-1-git-send-email-rmanohar@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Validate the params of set_channel against 6 GHz frequency range and bandwidth allowed. Signed-off-by: Rajkumar Manoharan --- include/net/cfg80211.h | 14 ++++++++++++++ net/wireless/chan.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 70e48f66dac8..13d3d8f92c99 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -730,6 +730,20 @@ cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef) } /** + * cfg80211_chandef_is_6ghz - check if chandef represents an 6 GHz channel + * + * @chandef: the channel definition + * + * Return: %true if frequency is in 6 GHz range, %false otherwise. + */ +static inline bool +cfg80211_chandef_is_6ghz(const struct cfg80211_chan_def *chandef) +{ + return (chandef->center_freq1 > 5940 && chandef->center_freq1 < 7105); +} + + +/** * cfg80211_chandef_compatible - check if two channel definitions are compatible * @chandef1: first channel definition * @chandef2: second channel definition diff --git a/net/wireless/chan.c b/net/wireless/chan.c index fcac5c6366e1..42d27cada237 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -19,6 +19,29 @@ static bool cfg80211_valid_60g_freq(u32 freq) return freq >= 58320 && freq <= 70200; } +static bool cfg80211_is_6ghz_freq(u32 freq) +{ + return (freq > 5940 && freq < 7105); +} + +static enum nl80211_chan_width cfg80211_chan_to_bw_6ghz(u8 idx) +{ + /* channels: 1, 5, 9, 13... */ + if ((idx & 0x3) == 0x1) + return NL80211_CHAN_WIDTH_20; + /* channels 3, 11, 19... */ + if ((idx & 0x7) == 0x3) + return NL80211_CHAN_WIDTH_40; + /* channels 7, 23, 39.. */ + if ((idx & 0xf) == 0x7) + return NL80211_CHAN_WIDTH_80; + /* channels 15, 47, 79...*/ + if ((idx & 0x1f) == 0xf) + return NL80211_CHAN_WIDTH_160; + + return NL80211_CHAN_WIDTH_20; +} + void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, struct ieee80211_channel *chan, enum nl80211_channel_type chan_type) @@ -139,6 +162,25 @@ static bool cfg80211_edmg_chandef_valid(const struct cfg80211_chan_def *chandef) return true; } +static bool cfg80211_6ghz_chandef_valid(const struct cfg80211_chan_def *chandef) +{ + enum nl80211_chan_width bw; + int chan_idx; + + if (!cfg80211_is_6ghz_freq(chandef->center_freq1)) + return false; + + chan_idx = ieee80211_frequency_to_channel(chandef->center_freq1); + if (chan_idx <= 0) + return false; + + bw = cfg80211_chan_to_bw_6ghz(chan_idx); + if (bw != chandef->width) + return false; + + return true; +} + bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef) { u32 control_freq; @@ -213,6 +255,10 @@ bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef) !cfg80211_edmg_chandef_valid(chandef)) return false; + if (cfg80211_chandef_is_6ghz(chandef) && + !cfg80211_6ghz_chandef_valid(chandef)) + return false; + return true; } EXPORT_SYMBOL(cfg80211_chandef_valid); From patchwork Fri Apr 24 22:41:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 215841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10D96C55191 for ; Fri, 24 Apr 2020 22:42:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E68A12074F for ; Fri, 24 Apr 2020 22:42:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="ecKvhBcg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726076AbgDXWm1 (ORCPT ); Fri, 24 Apr 2020 18:42:27 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:50737 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725874AbgDXWm0 (ORCPT ); Fri, 24 Apr 2020 18:42:26 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1587768146; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=qO3ezB9knaagKo7t+GFGnKM3WTgs9SRv5mTFGhqOjYQ=; b=ecKvhBcgAIjC+0g7+stPpfoJ/frts3G+WUjZxXBBmCPKK2usgHuGZoYGO7LKW2SIjf4n9kfu CFKNLh901pbcvhPRNBH5AZEWuyKjLWYjYjOhMpwUjDxwHZMwrNFr/AIwcRTO+T0QPJL6D3nE 8w1eUhmBeZIj+9+7cwhhmeod2Eo= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ea36b51.7fa95bdcf7a0-smtp-out-n05; Fri, 24 Apr 2020 22:42:25 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E65D1C433D2; Fri, 24 Apr 2020 22:42:25 +0000 (UTC) Received: from rmanohar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rmanohar) by smtp.codeaurora.org (Postfix) with ESMTPSA id ECEBEC433CB; Fri, 24 Apr 2020 22:42:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org ECEBEC433CB Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=rmanohar@codeaurora.org From: Rajkumar Manoharan To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Rajkumar Manoharan Subject: [PATCH 07/10] mac80211: build HE operation with 6 GHz oper information Date: Fri, 24 Apr 2020 15:41:45 -0700 Message-Id: <1587768108-25248-8-git-send-email-rmanohar@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587768108-25248-1-git-send-email-rmanohar@codeaurora.org> References: <1587768108-25248-1-git-send-email-rmanohar@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add 6 GHz operation information (IEEE 802.11ax/D6.0, Figure 9-787k) while building HE operation element for non-HE AP. This field is used to determine channel information in the absence of HT/VHT IEs. Signed-off-by: Rajkumar Manoharan --- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/mesh.c | 11 +++++--- net/mac80211/util.c | 63 +++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 68 insertions(+), 8 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index d8b03b657431..d5f4fb3a7a73 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -2174,7 +2174,7 @@ u8 *ieee80211_ie_build_he_cap(u8 *pos, const struct ieee80211_sta_he_cap *he_cap, u8 *end); u8 *ieee80211_ie_build_he_6ghz_band_cap(u8 *pos, u16 he_6ghz_cap); -u8 *ieee80211_ie_build_he_oper(u8 *pos); +u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef); int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef, const struct ieee80211_supported_band *sband, const u8 *srates, int srates_len, u32 *rates); diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 72a7a38a470c..ced032d21cdb 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -565,6 +565,7 @@ int mesh_add_he_oper_ie(struct ieee80211_sub_if_data *sdata, { const struct ieee80211_sta_he_cap *he_cap; struct ieee80211_supported_band *sband; + u32 len; u8 *pos; sband = ieee80211_get_sband(sdata); @@ -578,11 +579,15 @@ int mesh_add_he_oper_ie(struct ieee80211_sub_if_data *sdata, sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10) return 0; - if (skb_tailroom(skb) < 2 + 1 + sizeof(struct ieee80211_he_operation)) + len = 2 + 1 + sizeof(struct ieee80211_he_operation); + if (sdata->vif.bss_conf.chandef.chan->band == NL80211_BAND_6GHZ) + len += sizeof(struct ieee80211_he_oper_6ghz_op_info); + + if (skb_tailroom(skb) < len) return -ENOMEM; - pos = skb_put(skb, 2 + 1 + sizeof(struct ieee80211_he_operation)); - ieee80211_ie_build_he_oper(pos); + pos = skb_put(skb, len); + ieee80211_ie_build_he_oper(pos, &sdata->vif.bss_conf.chandef); return 0; } diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 2bcebe672c0d..90b8c42b1aa8 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2977,13 +2977,18 @@ u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, return pos + sizeof(struct ieee80211_vht_operation); } -u8 *ieee80211_ie_build_he_oper(u8 *pos) +u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef) { struct ieee80211_he_operation *he_oper; + struct ieee80211_he_oper_6ghz_op_info *he_6ghz_op; u32 he_oper_params; + u8 ie_len = 1 + sizeof(struct ieee80211_he_operation); + + if (chandef->chan->band == NL80211_BAND_6GHZ) + ie_len += sizeof(struct ieee80211_he_oper_6ghz_op_info); *pos++ = WLAN_EID_EXTENSION; - *pos++ = 1 + sizeof(struct ieee80211_he_operation); + *pos++ = ie_len; *pos++ = WLAN_EID_EXT_HE_OPERATION; he_oper_params = 0; @@ -2993,16 +2998,66 @@ u8 *ieee80211_ie_build_he_oper(u8 *pos) IEEE80211_HE_OPERATION_ER_SU_DISABLE); he_oper_params |= u32_encode_bits(1, IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED); + if (chandef->chan->band == NL80211_BAND_6GHZ) + he_oper_params |= u32_encode_bits(1, + IEEE80211_HE_OPERATION_6GHZ_OP_INFO); he_oper = (struct ieee80211_he_operation *)pos; he_oper->he_oper_params = cpu_to_le32(he_oper_params); /* don't require special HE peer rates */ he_oper->he_mcs_nss_set = cpu_to_le16(0xffff); + pos += sizeof(struct ieee80211_he_operation); - /* TODO add VHT operational and 6GHz operational subelement? */ + if (chandef->chan->band != NL80211_BAND_6GHZ) + goto out; - return pos + sizeof(struct ieee80211_vht_operation); + /* TODO add VHT operational */ + he_6ghz_op = (struct ieee80211_he_oper_6ghz_op_info *)pos; + he_6ghz_op->min_rate = 6; /* 6 Mbps */ + he_6ghz_op->primary_chan = + ieee80211_frequency_to_channel(chandef->chan->center_freq); + he_6ghz_op->center_freq_seg0_idx = + ieee80211_frequency_to_channel(chandef->center_freq1); + if (chandef->center_freq2) + he_6ghz_op->center_freq_seg1_idx = + ieee80211_frequency_to_channel(chandef->center_freq2); + else + he_6ghz_op->center_freq_seg1_idx = 0; + + switch (chandef->width) { + case NL80211_CHAN_WIDTH_160: + /* Convert 160 MHz channel width to new style as interop + * workaround. + */ + he_6ghz_op->control = + IEEE80211_HE_6GHZ_CHANWIDTH_160MHZ_80P80MHZ; + he_6ghz_op->center_freq_seg1_idx = + he_6ghz_op->center_freq_seg0_idx; + if (chandef->chan->center_freq < chandef->center_freq1) + he_6ghz_op->center_freq_seg0_idx -= 8; + else + he_6ghz_op->center_freq_seg0_idx += 8; + fallthrough; + case NL80211_CHAN_WIDTH_80P80: + he_6ghz_op->control = + IEEE80211_HE_6GHZ_CHANWIDTH_160MHZ_80P80MHZ; + break; + case NL80211_CHAN_WIDTH_80: + he_6ghz_op->control = IEEE80211_HE_6GHZ_CHANWIDTH_80MHZ; + break; + case NL80211_CHAN_WIDTH_40: + he_6ghz_op->control = IEEE80211_HE_6GHZ_CHANWIDTH_40MHZ; + break; + default: + he_6ghz_op->control = IEEE80211_HE_6GHZ_CHANWIDTH_20MHZ; + break; + } + + pos += sizeof(struct ieee80211_he_oper_6ghz_op_info); + +out: + return pos; } bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper, From patchwork Fri Apr 24 22:41:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 215839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6986C54FCB for ; Fri, 24 Apr 2020 22:42:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 842382074F for ; Fri, 24 Apr 2020 22:42:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="CfTy5kzP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726117AbgDXWmf (ORCPT ); Fri, 24 Apr 2020 18:42:35 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:12512 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726070AbgDXWmf (ORCPT ); Fri, 24 Apr 2020 18:42:35 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1587768154; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=UaiNPaloe80h1aK44TAWYTCRWVsUDyJhsiBXpVwOEk0=; b=CfTy5kzPuAe/7DUzJPc1U9npcTrdllxCqHrJp3cj5IjFPK67efa3GrKS8ZDKY5yb5cIxR1Lh pCPfpa0dRRs0HC0wR4SRomCfBKeUsXTQCaMcXk/OahlD4lStW9UGL2pqYfWl26Tiz5R0j8Jl RigXi5wyb9/I7IX34rBcvro3+sw= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ea36b52.7f2dc5636e30-smtp-out-n03; Fri, 24 Apr 2020 22:42:26 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 805ABC433D2; Fri, 24 Apr 2020 22:42:26 +0000 (UTC) Received: from rmanohar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rmanohar) by smtp.codeaurora.org (Postfix) with ESMTPSA id C9622C433F2; Fri, 24 Apr 2020 22:42:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C9622C433F2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=rmanohar@codeaurora.org From: Rajkumar Manoharan To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Rajkumar Manoharan Subject: [PATCH 08/10] mac80211: do not allow HT/VHT IEs in 6 GHz mesh mode Date: Fri, 24 Apr 2020 15:41:46 -0700 Message-Id: <1587768108-25248-9-git-send-email-rmanohar@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587768108-25248-1-git-send-email-rmanohar@codeaurora.org> References: <1587768108-25248-1-git-send-email-rmanohar@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org As HT/VHT elements are not allowed in 6 GHz band, do not include them in mesh beacon template formation. Signed-off-by: Rajkumar Manoharan --- net/mac80211/mesh.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index ced032d21cdb..f6e46b18c304 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -415,6 +415,10 @@ int mesh_add_ht_cap_ie(struct ieee80211_sub_if_data *sdata, if (!sband) return -EINVAL; + /* HT not allowed in 6 GHz */ + if (sband->band == NL80211_BAND_6GHZ) + return 0; + if (!sband->ht_cap.ht_supported || sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT || sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 || @@ -452,6 +456,10 @@ int mesh_add_ht_oper_ie(struct ieee80211_sub_if_data *sdata, sband = local->hw.wiphy->bands[channel->band]; ht_cap = &sband->ht_cap; + /* HT not allowed in 6 GHz */ + if (sband->band == NL80211_BAND_6GHZ) + return 0; + if (!ht_cap->ht_supported || sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT || sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 || @@ -479,6 +487,10 @@ int mesh_add_vht_cap_ie(struct ieee80211_sub_if_data *sdata, if (!sband) return -EINVAL; + /* VHT not allowed in 6 GHz */ + if (sband->band == NL80211_BAND_6GHZ) + return 0; + if (!sband->vht_cap.vht_supported || sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT || sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 || @@ -516,6 +528,10 @@ int mesh_add_vht_oper_ie(struct ieee80211_sub_if_data *sdata, sband = local->hw.wiphy->bands[channel->band]; vht_cap = &sband->vht_cap; + /* VHT not allowed in 6 GHz */ + if (sband->band == NL80211_BAND_6GHZ) + return 0; + if (!vht_cap->vht_supported || sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT || sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 || From patchwork Fri Apr 24 22:41:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 215838 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47EB3C55194 for ; Fri, 24 Apr 2020 22:42:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23A5C20728 for ; Fri, 24 Apr 2020 22:42:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="ADWch/Zg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726061AbgDXWmh (ORCPT ); Fri, 24 Apr 2020 18:42:37 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:41446 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726105AbgDXWmg (ORCPT ); Fri, 24 Apr 2020 18:42:36 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1587768154; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=VxY8suiVyo1RraUmOlNWnapxuSMeUPKipYrG08rD4n8=; b=ADWch/ZgshUpNYBVt5hzeLXFLXeuKQMM4M/GqgftEYiQxX9E1IMAj+x8ZVrqNryF2dMc+rSn tFRqi2DeTsN7B6O96S6/lQIU5uIX2M9gNuTIMlOvZBBV5LVDaBk1UlJerLrJbqJe5wRznVjI KHodLRcNKGiNAZ2thwLITe5pM0I= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ea36b54.7f317777cab0-smtp-out-n05; Fri, 24 Apr 2020 22:42:28 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 10E3BC432C2; Fri, 24 Apr 2020 22:42:28 +0000 (UTC) Received: from rmanohar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rmanohar) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6D9C5C433D2; Fri, 24 Apr 2020 22:42:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6D9C5C433D2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=rmanohar@codeaurora.org From: Rajkumar Manoharan To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Rajkumar Manoharan Subject: [PATCH 09/10] mac80211: determine chantype from HE operation in 6 GHz Date: Fri, 24 Apr 2020 15:41:47 -0700 Message-Id: <1587768108-25248-10-git-send-email-rmanohar@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587768108-25248-1-git-send-email-rmanohar@codeaurora.org> References: <1587768108-25248-1-git-send-email-rmanohar@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In 6 GHz band, determine chandef from 6 GHz operation information of HE operation element. Signed-off-by: Rajkumar Manoharan --- net/mac80211/ieee80211_i.h | 3 ++ net/mac80211/mesh.c | 1 + net/mac80211/mlme.c | 12 ++++++ net/mac80211/util.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 108 insertions(+) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index d5f4fb3a7a73..70393084a1cb 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -2193,6 +2193,9 @@ bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw, const struct ieee80211_vht_operation *oper, const struct ieee80211_ht_operation *htop, struct cfg80211_chan_def *chandef); +bool ieee80211_chandef_he_oper(struct ieee80211_sub_if_data *sdata, + const struct ieee80211_he_operation *heop, + struct cfg80211_chan_def *chandef); u32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c); int __must_check diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index f6e46b18c304..daa2d6abef3f 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -99,6 +99,7 @@ bool mesh_matches_local(struct ieee80211_sub_if_data *sdata, ieee80211_chandef_vht_oper(&sdata->local->hw, ie->vht_operation, ie->ht_operation, &sta_chan_def); + ieee80211_chandef_he_oper(sdata, ie->he_operation, &sta_chan_def); if (!cfg80211_chandef_compatible(&sdata->vif.bss_conf.chandef, &sta_chan_def)) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 6ff1087e3bba..02d7d28594e5 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -163,6 +163,9 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, chandef->width = NL80211_CHAN_WIDTH_20_NOHT; chandef->center_freq1 = channel->center_freq; + if (channel->band == NL80211_BAND_6GHZ) + goto skip_ht_vht_oper; + if (!ht_oper || !sta_ht_cap.ht_supported) { ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT | @@ -263,6 +266,15 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, *chandef = vht_chandef; +skip_ht_vht_oper: + if (!ieee80211_chandef_he_oper(sdata, he_oper, chandef)) { + if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE)) + sdata_info(sdata, + "AP HE information is invalid, disable HE\n"); + ret = IEEE80211_STA_DISABLE_HE; + goto out; + } + ret = 0; out: diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 90b8c42b1aa8..660cf52913f1 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -3170,6 +3170,98 @@ bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw, return true; } +bool ieee80211_chandef_he_oper(struct ieee80211_sub_if_data *sdata, + const struct ieee80211_he_operation *heop, + struct cfg80211_chan_def *chandef) +{ + struct ieee80211_he_oper_6ghz_op_info info; + const struct ieee80211_sta_he_cap *he_cap; + struct ieee80211_supported_band *sband; + struct cfg80211_chan_def new = *chandef; + int cf0, cf1; + int ccf0, ccf1; + bool support_80_80; + bool support_160; + u8 he_phy_cap; + u8 pos = 0; + + if (!heop) + return false; + + sband = ieee80211_get_sband(sdata); + if (!sband) + return false; + + he_cap = ieee80211_get_he_iftype_cap(sband, sdata->vif.type); + if (!he_cap) + return false; + + if (!(le32_to_cpu(heop->he_oper_params) & + IEEE80211_HE_OPERATION_6GHZ_OP_INFO)) + return false; + + he_phy_cap = he_cap->he_cap_elem.phy_cap_info[0]; + support_160 = + !!(he_phy_cap & + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G); + support_80_80 = + !!(he_phy_cap & + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G); + + if (le32_to_cpu(heop->he_oper_params) & + IEEE80211_HE_OPERATION_VHT_OPER_INFO) + pos += 3; + if (le32_to_cpu(heop->he_oper_params) & + IEEE80211_HE_OPERATION_CO_HOSTED_BSS) + pos += 1; + + memcpy(&info, &heop->optional[pos], sizeof(info)); + ccf0 = info.center_freq_seg0_idx; + ccf1 = info.center_freq_seg1_idx; + + cf0 = ieee80211_channel_to_frequency(ccf0, chandef->chan->band); + cf1 = ieee80211_channel_to_frequency(ccf1, chandef->chan->band); + + switch (info.control & 0x3) { + case IEEE80211_HE_6GHZ_CHANWIDTH_20MHZ: + new.center_freq1 = cf0; + new.width = NL80211_CHAN_WIDTH_20; + break; + case IEEE80211_HE_6GHZ_CHANWIDTH_40MHZ: + new.center_freq1 = cf0; + new.width = NL80211_CHAN_WIDTH_40; + break; + case IEEE80211_HE_6GHZ_CHANWIDTH_80MHZ: + new.center_freq1 = cf0; + new.width = NL80211_CHAN_WIDTH_80; + break; + case IEEE80211_HE_6GHZ_CHANWIDTH_160MHZ_80P80MHZ: + new.center_freq1 = cf0; + new.width = NL80211_CHAN_WIDTH_80; + if (ccf1) { + unsigned int diff; + + diff = abs(ccf1 - ccf0); + if (diff == 8 && support_160) { + new.width = NL80211_CHAN_WIDTH_160; + new.center_freq1 = cf1; + } else if ((diff > 8) && support_80_80) { + new.width = NL80211_CHAN_WIDTH_80P80; + new.center_freq2 = cf1; + } + } + break; + default: + return false; + } + + if (!cfg80211_chandef_valid(&new)) + return false; + + *chandef = new; + return true; +} + int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef, const struct ieee80211_supported_band *sband, const u8 *srates, int srates_len, u32 *rates) From patchwork Fri Apr 24 22:41:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 215837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDBBEC54FCB for ; Fri, 24 Apr 2020 22:42:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE54E20728 for ; Fri, 24 Apr 2020 22:42:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="pGh2eqP3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726130AbgDXWmj (ORCPT ); Fri, 24 Apr 2020 18:42:39 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:50737 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbgDXWmj (ORCPT ); Fri, 24 Apr 2020 18:42:39 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1587768158; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=agUELOV9lipNsFvH/nyiWApqAJhfdAC9LPNeRPNoYZ0=; b=pGh2eqP35DrGzLduFMhZmphrYne9e8Mo7tSPqtDVo2kyCDTtK6rMO+Si3Mq8JpORgmA4F/ys /JICoY6w8jZBzvc0eUM827DoO4/YWVm6kVqJNOD2FXJYyyjcYYAubZJ+GoxZG+b/+BGUB6YA RXy5bY8PCakV8f3YxVGs7CvU2Qo= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ea36b55.7f006ae200a0-smtp-out-n02; Fri, 24 Apr 2020 22:42:29 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id CD26DC433D2; Fri, 24 Apr 2020 22:42:29 +0000 (UTC) Received: from rmanohar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rmanohar) by smtp.codeaurora.org (Postfix) with ESMTPSA id 0F2B9C433CB; Fri, 24 Apr 2020 22:42:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0F2B9C433CB Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=rmanohar@codeaurora.org From: Rajkumar Manoharan To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Rajkumar Manoharan Subject: [PATCH 10/10] ath11k: build HE 6 GHz capability Date: Fri, 24 Apr 2020 15:41:48 -0700 Message-Id: <1587768108-25248-11-git-send-email-rmanohar@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587768108-25248-1-git-send-email-rmanohar@codeaurora.org> References: <1587768108-25248-1-git-send-email-rmanohar@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Build 6 GHz band capability from HT and VHT capabilities reported by firmware. Signed-off-by: Rajkumar Manoharan --- drivers/net/wireless/ath/ath11k/core.h | 1 + drivers/net/wireless/ath/ath11k/mac.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 6e7b8ecd09a6..730829eaee23 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -537,6 +537,7 @@ struct ath11k_band_cap { u32 he_mcs; u32 he_cap_phy_info[PSOC_HOST_MAX_PHY_SIZE]; struct ath11k_ppe_threshold he_ppet; + u32 he_6ghz_cap; }; struct ath11k_pdev_cap { diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 06d063274eea..eb4dc6fc4209 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -3522,6 +3522,32 @@ ath11k_mac_filter_he_cap_mesh(struct ieee80211_he_cap_elem *he_cap_elem) he_cap_elem->phy_cap_info[9] &= ~m; } +static u16 ath11k_mac_setup_he_6ghz_cap(struct ath11k_pdev_cap *pcap, + struct ath11k_band_cap *bcap) +{ + bcap->he_6ghz_cap = IEEE80211_HT_MPDU_DENSITY_NONE; + if (bcap->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) + bcap->he_6ghz_cap |= + FIELD_PREP(IEEE80211_HE_6GHZ_CAP_SMPS_MASK, + WLAN_HT_CAP_SM_PS_DYNAMIC); + bcap->he_6ghz_cap |= + FIELD_PREP(IEEE80211_HE_6GHZ_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK, + FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK, + pcap->vht_cap)); + bcap->he_6ghz_cap |= + FIELD_PREP(IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LENGTH_MASK, + FIELD_GET(IEEE80211_VHT_CAP_MAX_MPDU_MASK, + pcap->vht_cap)); + if (pcap->vht_cap & IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN) + bcap->he_6ghz_cap |= + IEEE80211_HE_6GHZ_CAP_RX_ANTENNA_PATTERN; + if (pcap->vht_cap & IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN) + bcap->he_6ghz_cap |= + IEEE80211_HE_6GHZ_CAP_TX_ANTENNA_PATTERN; + + return bcap->he_6ghz_cap; +} + static int ath11k_mac_copy_he_cap(struct ath11k *ar, struct ath11k_pdev_cap *cap, struct ieee80211_sband_iftype_data *data, @@ -3602,6 +3628,10 @@ static int ath11k_mac_copy_he_cap(struct ath11k *ar, IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT) ath11k_gen_ppe_thresh(&band_cap->he_ppet, he_cap->ppe_thres); + + if (band == NL80211_BAND_6GHZ) + he_cap->he_6ghz_cap = + ath11k_mac_setup_he_6ghz_cap(cap, band_cap); idx++; }