Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp20268ybk; Fri, 8 May 2020 17:15:30 -0700 (PDT) X-Google-Smtp-Source: APiQypKQzDyDWKm0v1Gcisu5OPiC5GwclP2bNnNbafR5loQAXAYsq+VzDg+hTz3LFryBT/+tc2/D X-Received: by 2002:aa7:db44:: with SMTP id n4mr1089119edt.387.1588983330392; Fri, 08 May 2020 17:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588983330; cv=none; d=google.com; s=arc-20160816; b=LZ9dhivdxNJH/+xY5fQCENWGOTCcgFElp0G0eXr+CsQpfB+G9rkHG6T/wgsg3y8dVA 8odabtKy9NWHpt3ZQXHvqVLaJ1puBOzs49jJL3DElR3m+x9dWxLFw2VjYYobG7Kpqi5P sBCMc0JEk4om6J6tORvkXRxVIVXoWcN2ooOFBkxYR4X7ZXCk+Ia21hPTuNykbllAZRu1 LIktL2jvzuqlDOVFsMoGY6QnkdQpx86AFmSO9V43DBXotIzeVeLbBhlGVQIMXOyVGXvO +D2wH6QuQTOxL8EACiKAUzyrU4WEuxEhN98L21VeL8/oaTvo5JbIn9vJDbdqU6O8XGRJ /uBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature; bh=JD3H+2UIrtT/l1bJEqxT6tXQ3eAeBzabY+eu8PkbSb4=; b=avtM9vKKXww7iCs7efiBBxbHbmx2qMdPyPlpxLQ0DRI35REVXGSF4MZadpIXociLrN 8iwyQBduRCi3QxfqIjIHPwW4QRE/JFdiSxOy9FAengi4x7JyAMIbcOD+6MdtBONKl+qn HA/ct7CnvWUH4qJEinArQ3zhmARn+4nUdZA10sEdWsK+bOW0D8c8EGs2v2ZCnOYkkaa5 5WBIrnlNqZVtYu+zWHLIqZYiWy+934QpXPEm0MM/EhK7cug6x9HoqNnc6cq+RsCzZulu KyltnEicdcwQjSS5Fgac51h0ndcTDnasiBYhbwDC0D5ph4iZ7usytSkJKx6eHfRKe74p Tc7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=anOnIAXu; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ck14si1832846edb.67.2020.05.08.17.15.07; Fri, 08 May 2020 17:15:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=anOnIAXu; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728468AbgEIAN1 (ORCPT + 99 others); Fri, 8 May 2020 20:13:27 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:59280 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727878AbgEIAN0 (ORCPT ); Fri, 8 May 2020 20:13:26 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1588983205; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=JD3H+2UIrtT/l1bJEqxT6tXQ3eAeBzabY+eu8PkbSb4=; b=anOnIAXu4xUYMtZUMt2MS/3bvEeyTxVEhwsJMUDOViBSh+TdN2S7KI/OfNJ52LjSrY0aApjQ INfy1mcHPfkLJlB5JJAmqga/uU8pTBB9QSDoAdmXdwrWaL1mwbVpAcoyRUaeFSstlRqe2I1s BqlUB/i1LibxxW6R98EG+Q9nHEI= 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 5eb5f59e.7fd1ce57f378-smtp-out-n05; Sat, 09 May 2020 00:13:18 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 14F0EC432C2; Sat, 9 May 2020 00:13:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 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 B5218C433D2; Sat, 9 May 2020 00:13:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B5218C433D2 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, kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, Rajkumar Manoharan , Vamsi Krishna Subject: [PATCH v3 01/11] cfg80211: use only HE capability to set prohibited flags in 6 GHz Date: Fri, 8 May 2020 17:12:55 -0700 Message-Id: <1588983185-5741-1-git-send-email-rmanohar@codeaurora.org> X-Mailer: git-send-email 2.7.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The prohibited flags to determine whether configured bandwidth is supported by driver are validated only against HT and VHT capability. In 6 GHz band, Only HE capability should be validated to find out given chandef is usable. Co-developed-by: Vamsi Krishna Signed-off-by: Vamsi Krishna Signed-off-by: Rajkumar Manoharan --- net/wireless/chan.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/net/wireless/chan.c b/net/wireless/chan.c index fcac5c6366e1..582b487576e1 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -19,6 +19,11 @@ 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); +} + void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, struct ieee80211_channel *chan, enum nl80211_channel_type chan_type) @@ -882,6 +887,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, struct ieee80211_sta_ht_cap *ht_cap; struct ieee80211_sta_vht_cap *vht_cap; struct ieee80211_edmg *edmg_cap; + const struct ieee80211_sta_he_cap *he_cap; u32 width, control_freq, cap; if (WARN_ON(!cfg80211_chandef_valid(chandef))) @@ -890,6 +896,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, ht_cap = &wiphy->bands[chandef->chan->band]->ht_cap; vht_cap = &wiphy->bands[chandef->chan->band]->vht_cap; edmg_cap = &wiphy->bands[chandef->chan->band]->edmg_cap; + he_cap = ieee80211_get_he_sta_cap(wiphy->bands[chandef->chan->band]); if (edmg_cap->channels && !cfg80211_edmg_usable(wiphy, @@ -919,6 +926,16 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, break; case NL80211_CHAN_WIDTH_40: width = 40; + if (cfg80211_is_6ghz_freq(chandef->center_freq1)) { + if (!he_cap) + return false; + if (!he_cap->has_he_6ghz) + return false; + if (!(he_cap->he_cap_elem.phy_cap_info[0] & + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G)) + return false; + break; + } if (!ht_cap->ht_supported) return false; if (!(ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) || @@ -933,24 +950,53 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, break; case NL80211_CHAN_WIDTH_80P80: cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; - if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) + if (!cfg80211_is_6ghz_freq(chandef->center_freq1) && + cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) return false; + if (cfg80211_is_6ghz_freq(chandef->center_freq1)) { + if (!he_cap) + return false; + if (!he_cap->has_he_6ghz) + return false; + if (!(he_cap->he_cap_elem.phy_cap_info[0] & + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)) + return false; + } /* fall through */ case NL80211_CHAN_WIDTH_80: - if (!vht_cap->vht_supported) + if (cfg80211_is_6ghz_freq(chandef->center_freq1)) { + if (!he_cap) + return false; + if (!he_cap->has_he_6ghz) + return false; + if (!(he_cap->he_cap_elem.phy_cap_info[0] & + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G)) + return false; + } else if (!vht_cap->vht_supported) { return false; + } prohibited_flags |= IEEE80211_CHAN_NO_80MHZ; width = 80; break; case NL80211_CHAN_WIDTH_160: + prohibited_flags |= IEEE80211_CHAN_NO_160MHZ; + width = 160; + if (cfg80211_is_6ghz_freq(chandef->center_freq1)) { + if (!he_cap) + return false; + if (!he_cap->has_he_6ghz) + return false; + if (!(he_cap->he_cap_elem.phy_cap_info[0] & + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G)) + return false; + break; + } if (!vht_cap->vht_supported) return false; cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ && cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) return false; - prohibited_flags |= IEEE80211_CHAN_NO_160MHZ; - width = 160; break; default: WARN_ON_ONCE(1); -- 2.7.4