Received: by 10.213.65.68 with SMTP id h4csp223364imn; Fri, 23 Mar 2018 03:16:03 -0700 (PDT) X-Google-Smtp-Source: AG47ELs/siVD5879evJ70CC2m169SYmfn6SDX08jIlO/9o0rf5DZtl+ra1HoQDERlNRctvyicDO6 X-Received: by 10.101.67.68 with SMTP id k4mr83569pgq.197.1521800163411; Fri, 23 Mar 2018 03:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521800163; cv=none; d=google.com; s=arc-20160816; b=jpHXsjDJQWsIggowilud6jXd2GH4b7WjKEtHUZgQ4G8PB/XOX4BkH8wjzIF6VLE4OX /hg0rBdhjTXL2dK0Se80GKlCHvMVIsCaFRerUNLXw2CbT+2/o6AuJGHFZOF8sTs7qOM9 DK3Pz6Z+S+6zFcWXQ4HBioGtPtarq4ztaIQsTJlCnCU5jRnL5SdcHGqp7n/vBiU37pkp 7C4+9/D9CwjFmpZKUVx0AcquqCE/SfO3WxWvPmC8WodTGdsRYD6nZ7rsowwL1mye8gr5 qzovTvWp5+lp4ViXVId2oACjmCw41dL6SAc3L7Il69+skZr04nE43FoiwEmRZ6Zconpm sunA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=PtnkQN/bu119iUJ7TKVyTy4SV8t1ZrEFiJlVEDCUCCA=; b=YM9p0v0fgVk5BNwlrprAP1iRPxR9U+UuqPaat1F8uWztZ70ZX/w2luRfnNJwK8dpMa Xk/ZURc8YJnuylGj/mo2SqTh1Q32YVBk7Izn2U0njOipsX6H7aHVmJbXVYeUhrSkZgL3 YLmtkMhkEpNKKw5gJAdfxgqXZEpRCeY9lbRgVXHubgjiVUaxjKD8QIfWjfB5i75TiRrE YxvayeKffrXbZLHx9cXZ84iPTPHafivMtfD3jo1UjNNMneuT88cn/QTCIP8SMoaoOTNF YMZDR7D0FHP3xOUXCLUguX/yM/QYzui0IwZEUtk/Xjd1+4NtreaudvhTxtOxPUxJp1df h7QQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64-v6si8169172ply.528.2018.03.23.03.15.49; Fri, 23 Mar 2018 03:16:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756019AbeCWKOT (ORCPT + 99 others); Fri, 23 Mar 2018 06:14:19 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45116 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756007AbeCWKOR (ORCPT ); Fri, 23 Mar 2018 06:14:17 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6F2AF1234; Fri, 23 Mar 2018 10:14:16 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mohammed Shafi Shajakhan , Kalle Valo , Sasha Levin Subject: [PATCH 4.4 20/97] ath: Fix updating radar flags for coutry code India Date: Fri, 23 Mar 2018 10:54:07 +0100 Message-Id: <20180323094158.606148531@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mohammed Shafi Shajakhan [ Upstream commit c0c345d4cacc6a1f39d4856f37dcf6e34f51a5e4 ] As per latest regulatory update for India, channel 52, 56, 60, 64 is no longer restricted to DFS. Enabling DFS/no infra flags in driver results in applying all DFS related restrictions (like doing CAC etc before this channel moves to 'available state') for these channels even though the country code is programmed as 'India' in he hardware, fix this by relaxing the frequency range while applying RADAR flags only if the country code is programmed to India. If the frequency range needs to modified based on different country code, ath_is_radar_freq can be extended/modified dynamically. Signed-off-by: Mohammed Shafi Shajakhan Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ath/regd.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) --- a/drivers/net/wireless/ath/regd.c +++ b/drivers/net/wireless/ath/regd.c @@ -254,8 +254,12 @@ bool ath_is_49ghz_allowed(u16 regdomain) EXPORT_SYMBOL(ath_is_49ghz_allowed); /* Frequency is one where radar detection is required */ -static bool ath_is_radar_freq(u16 center_freq) +static bool ath_is_radar_freq(u16 center_freq, + struct ath_regulatory *reg) + { + if (reg->country_code == CTRY_INDIA) + return (center_freq >= 5500 && center_freq <= 5700); return (center_freq >= 5260 && center_freq <= 5700); } @@ -306,7 +310,7 @@ __ath_reg_apply_beaconing_flags(struct w enum nl80211_reg_initiator initiator, struct ieee80211_channel *ch) { - if (ath_is_radar_freq(ch->center_freq) || + if (ath_is_radar_freq(ch->center_freq, reg) || (ch->flags & IEEE80211_CHAN_RADAR)) return; @@ -395,8 +399,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip } } -/* Always apply Radar/DFS rules on freq range 5260 MHz - 5700 MHz */ -static void ath_reg_apply_radar_flags(struct wiphy *wiphy) +/* Always apply Radar/DFS rules on freq range 5500 MHz - 5700 MHz */ +static void ath_reg_apply_radar_flags(struct wiphy *wiphy, + struct ath_regulatory *reg) { struct ieee80211_supported_band *sband; struct ieee80211_channel *ch; @@ -409,7 +414,7 @@ static void ath_reg_apply_radar_flags(st for (i = 0; i < sband->n_channels; i++) { ch = &sband->channels[i]; - if (!ath_is_radar_freq(ch->center_freq)) + if (!ath_is_radar_freq(ch->center_freq, reg)) continue; /* We always enable radar detection/DFS on this * frequency range. Additionally we also apply on @@ -505,7 +510,7 @@ void ath_reg_notifier_apply(struct wiphy struct ath_common *common = container_of(reg, struct ath_common, regulatory); /* We always apply this */ - ath_reg_apply_radar_flags(wiphy); + ath_reg_apply_radar_flags(wiphy, reg); /* * This would happen when we have sent a custom regulatory request @@ -653,7 +658,7 @@ ath_regd_init_wiphy(struct ath_regulator } wiphy_apply_custom_regulatory(wiphy, regd); - ath_reg_apply_radar_flags(wiphy); + ath_reg_apply_radar_flags(wiphy, reg); ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); return 0; }