From patchwork Mon Jul 10 12:40:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitkumar Karwar X-Patchwork-Id: 9832925 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CFB3460318 for ; Mon, 10 Jul 2017 12:46:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C03DC267EC for ; Mon, 10 Jul 2017 12:46:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B389D26E56; Mon, 10 Jul 2017 12:46:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1BA4267EC for ; Mon, 10 Jul 2017 12:46:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753954AbdGJMqH (ORCPT ); Mon, 10 Jul 2017 08:46:07 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34609 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753848AbdGJMqG (ORCPT ); Mon, 10 Jul 2017 08:46:06 -0400 Received: by mail-pf0-f196.google.com with SMTP id c24so14381086pfe.1 for ; Mon, 10 Jul 2017 05:46:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VO165dyambfRZTI2h+bWFVwAY280KPftW5egFMUlM9w=; b=rg/nFXvEEi3Zl5uIzu3s5qvjIdqIbtWqgsuAptRA+rWa3grv2ja/jciZ65a9oa99vz WhVbQSOzz0bbsXhD2a+asVHh1wE3dvxjU02OojiWZNVcsMZ4enKKEK5KFMXEEme9xaS4 ee2cCSDp1sFnRRvZRAV64Hvjo96dar3JOXRzpA/hz4mONgLqlelwUkRUFF7YwasbdcLt r5t9ZVwOE9GmAs74w+FpdaQgvPnmfStjaafRn/CpQ/dYy23RZxw0P4YDwbhsfAfQpsyT uSj/GF9Jm2m3Z8+ympY7EbQjEZyO2eQ2ZHts8L3jm1TCa57A5Xdc/reZ2UjsR3CWkscO uKzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VO165dyambfRZTI2h+bWFVwAY280KPftW5egFMUlM9w=; b=sMEko4ZyORHW7iQQi6Rmwzv8+DR1P/MRvzZOJojYkAw353+V6m/GquE62DvrYZazpb nUOQ/r5rpPzxrwczJgAMQOHab7SzWXWnzaf9ttpNf/hAeNJUj6DpZZn1tK1/SlZI8lWt 46bCWGGsnjiLIBwiG8HOStKeZtocBF861gfjyGGQOPhd1WL7PQgM77Rfc83wdWaWM3Dy STg95gJyVztZM3IQWFQ1PwMPjNPnjgPU35dWfxtQlP4dusxtxIgKJ/NuHijQaN+3bEQN AyKH4GjB5lXp+CPhH/XacvJZajqdN6bSuabO0HUwECX2zWPvo4Xgxb64G/wQnxYnECvc XqUg== X-Gm-Message-State: AIVw111V+0xtmFCnWKnE2BOVbAahiRmfUXEdBFEzbIQe3iFXKrlte25k kW3+iriJYLpnTw== X-Received: by 10.99.117.89 with SMTP id f25mr14352861pgn.5.1499690746129; Mon, 10 Jul 2017 05:45:46 -0700 (PDT) Received: from cpu185.redpinesignals.com ([203.196.161.90]) by smtp.gmail.com with ESMTPSA id s9sm27503963pfe.67.2017.07.10.05.45.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Jul 2017 05:45:45 -0700 (PDT) From: Amitkumar Karwar To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Amitkumar Karwar , Prameela Rani Garnepudi Subject: [v2 17/17] rsi: regulatory enhancements Date: Mon, 10 Jul 2017 18:10:48 +0530 Message-Id: <1499690448-9956-18-git-send-email-amitkarwar@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499690448-9956-1-git-send-email-amitkarwar@gmail.com> References: <1499690448-9956-1-git-send-email-amitkarwar@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Prameela Rani Garnepudi Below regulatory changes are included this patch * Country code is saved as it will be used in bgscan. * Region codes are mapped according to RSI region codes. * Radar flag settings are moved under the check if 5GHZ band is enabled. Signed-off-by: Prameela Rani Garnepudi Signed-off-by: Amitkumar Karwar --- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 49 ++++++++++++++++++++++------- drivers/net/wireless/rsi/rsi_main.h | 8 +++++ 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c index d094b0a..c91d6ef 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c +++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c @@ -1163,6 +1163,21 @@ static int rsi_mac80211_get_antenna(struct ieee80211_hw *hw, return 0; } +static int rsi_map_region_code(enum nl80211_dfs_regions region_code) +{ + switch (region_code) { + case NL80211_DFS_FCC: + return RSI_REGION_FCC; + case NL80211_DFS_ETSI: + return RSI_REGION_ETSI; + case NL80211_DFS_JP: + return RSI_REGION_TELEC; + case NL80211_DFS_UNSET: + return RSI_REGION_WORLD; + } + return RSI_REGION_WORLD; +} + static void rsi_reg_notify(struct wiphy *wiphy, struct regulatory_request *request) { @@ -1170,23 +1185,33 @@ static void rsi_reg_notify(struct wiphy *wiphy, struct ieee80211_channel *ch; struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct rsi_hw * adapter = hw->priv; + struct rsi_common *common = adapter->priv; int i; - - sband = wiphy->bands[NL80211_BAND_5GHZ]; - for (i = 0; i < sband->n_channels; i++) { - ch = &sband->channels[i]; - if (ch->flags & IEEE80211_CHAN_DISABLED) - continue; + mutex_lock(&common->mutex); + + rsi_dbg(INFO_ZONE, "country = %s dfs_region = %d\n", + request->alpha2, request->dfs_region); + + if (common->num_supp_bands > 1) { + sband = wiphy->bands[NL80211_BAND_5GHZ]; - if (ch->flags & IEEE80211_CHAN_RADAR) - ch->flags |= IEEE80211_CHAN_NO_IR; + for (i = 0; i < sband->n_channels; i++) { + ch = &sband->channels[i]; + if (ch->flags & IEEE80211_CHAN_DISABLED) + continue; + + if (ch->flags & IEEE80211_CHAN_RADAR) + ch->flags |= IEEE80211_CHAN_NO_IR; + } } + adapter->dfs_region = rsi_map_region_code(request->dfs_region); + rsi_dbg(INFO_ZONE, "RSI region code = %d\n", adapter->dfs_region); - rsi_dbg(INFO_ZONE, - "country = %s dfs_region = %d\n", - request->alpha2, request->dfs_region); - adapter->dfs_region = request->dfs_region; + adapter->country[0] = request->alpha2[0]; + adapter->country[1] = request->alpha2[1]; + + mutex_unlock(&common->mutex); } static struct ieee80211_ops mac80211_ops = { diff --git a/drivers/net/wireless/rsi/rsi_main.h b/drivers/net/wireless/rsi/rsi_main.h index 485b97a..6a8e8e7 100644 --- a/drivers/net/wireless/rsi/rsi_main.h +++ b/drivers/net/wireless/rsi/rsi_main.h @@ -170,6 +170,13 @@ struct xtended_desc { u16 reserved; }; +enum rsi_dfs_regions { + RSI_REGION_FCC = 0, + RSI_REGION_ETSI, + RSI_REGION_TELEC, + RSI_REGION_WORLD +}; + struct rsi_hw; struct rsi_common { @@ -287,6 +294,7 @@ struct rsi_hw { struct eepromrw_info eeprom; u32 interrupt_status; u8 dfs_region; + char country[2]; void *rsi_dev; struct rsi_host_intf_ops *host_intf_ops; int (*check_hw_queue_status)(struct rsi_hw *adapter, u8 q_num);