Received: by 10.213.65.68 with SMTP id h4csp226018imn; Fri, 23 Mar 2018 03:19:59 -0700 (PDT) X-Google-Smtp-Source: AG47ELum0htBp9F58JABZoIqCGa4Mwdgw96OXM3Zf29PR629nmDyMYYOIdiSOdd4TCmurnmKz0gw X-Received: by 2002:a17:902:850c:: with SMTP id bj12-v6mr29137616plb.110.1521800399766; Fri, 23 Mar 2018 03:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521800399; cv=none; d=google.com; s=arc-20160816; b=PxE9bHWmBKInI5tgIF11PZa19rL6OiQcBC3kBnD2J9KpYJnVxrzUmV2J3PMHXUt6WM W/r9hoBSgmnnI71iMKue8Vm3f4NMqiJoju3BCJtxKlOlhkN5c7drjXJxWFOJDgvoyUcw sPBKKow8GJVCsAnCgZl3MBo+/VaSqJNRElPCS+9CXnem1SZWtRt12deAvVi9AeF/grcL 6RTXWWMBdPDz84aLbrchYJYGnLUtEHvoNmEGjQ88tMZ6GMl2kfQykD6Xf6lROd+vsb8E pTLSnig2vBXAQYRsIYkxUo68mJxNgM5FOU4rMeAlsXS+VLw58gkQVZ0v/RFTY+Z3IHL7 6eGg== 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=q4xYuh0Sz/WmaD7zfkItrgmvLcEmTObKnBpGn49Dmuc=; b=uy2m4vJLNk6kdO0yE4PMn14eFCb5M4ZmT1ro9gURtYl+V2dhY5CQ1bAw8nyvBNx3Uo 5Yu3os940YBmAHCSPf9QYiQWGrrGIgmHCMlj2zjRQ9VaCGdikLmqwq2dQkDq4KbB3Cmc 09wf4bDSp0coXU+qUif/ZitiSGTUVs7iS3+zRmlta4DBAsMRN/YZPZ5errxBtiq2RU26 LmbZrWWXz3uYHF9yu9I+KqBAZ3ovPC6ChYnkOzXwMlWbXYmn4Jl4w4iIYVyt7LKYL8WH 8iqn1pTxXvyTz/f8ditgXk5CIoLoclOEDweuvscGf6T3yugt68JpUmIr38nUtV0f5zxf oHOg== 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 w130si6463932pfd.280.2018.03.23.03.19.44; Fri, 23 Mar 2018 03:19:59 -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 S1756087AbeCWKSj (ORCPT + 99 others); Fri, 23 Mar 2018 06:18:39 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47730 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752874AbeCWKSg (ORCPT ); Fri, 23 Mar 2018 06:18:36 -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 4B8F3F2F; Fri, 23 Mar 2018 10:18:35 +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 3.18 11/47] ath: Fix updating radar flags for coutry code India Date: Fri, 23 Mar 2018 10:55:02 +0100 Message-Id: <20180323094248.604803239@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094248.117679641@linuxfoundation.org> References: <20180323094248.117679641@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 3.18-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; }