linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amitkumar Karwar <amitkarwar@gmail.com>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org,
	Amitkumar Karwar <amit.karwar@redpinesignals.com>,
	Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Subject: [v2 17/17] rsi: regulatory enhancements
Date: Mon, 10 Jul 2017 18:10:48 +0530	[thread overview]
Message-ID: <1499690448-9956-18-git-send-email-amitkarwar@gmail.com> (raw)
In-Reply-To: <1499690448-9956-1-git-send-email-amitkarwar@gmail.com>

From: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>

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 <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
---
 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);
-- 
2.7.4

      parent reply	other threads:[~2017-07-10 12:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10 12:40 [v2 00/17] rsi: station enhancements Amitkumar Karwar
2017-07-10 12:40 ` [v2 01/17] rsi: add common structures needed for command packets Amitkumar Karwar
2017-07-28 14:27   ` [v2,01/17] " Kalle Valo
2017-07-10 12:40 ` [v2 02/17] rsi: immediate wakeup bit and priority for TX " Amitkumar Karwar
2017-07-10 12:40 ` [v2 03/17] rsi: Update in tx command frame radio capabilities Amitkumar Karwar
2017-07-10 12:40 ` [v2 04/17] rsi: remove unnecessary check for 802.11 management packet Amitkumar Karwar
2017-07-10 12:40 ` [v2 05/17] rsi: Update peer notify command frame Amitkumar Karwar
2017-07-10 12:40 ` [v2 06/17] rsi: Update aggregation parameters " Amitkumar Karwar
2017-07-10 12:40 ` [v2 07/17] rsi: Update baseband RF programming frame Amitkumar Karwar
2017-07-10 12:40 ` [v2 08/17] rsi: update set_channel command frame Amitkumar Karwar
2017-07-10 12:40 ` [v2 09/17] rsi: update vap capabilities " Amitkumar Karwar
2017-07-10 12:40 ` [v2 10/17] rsi: update set_key " Amitkumar Karwar
2017-07-10 12:40 ` [v2 11/17] rsi: set_key enhancements Amitkumar Karwar
2017-07-10 12:40 ` [v2 12/17] rsi: update autorate request command frame Amitkumar Karwar
2017-07-10 12:40 ` [v2 13/17] rsi: block/unblock data queues as per connection status Amitkumar Karwar
2017-07-10 12:40 ` [v2 14/17] rsi: update tx command frame block/unblock data Amitkumar Karwar
2017-07-10 12:40 ` [v2 15/17] rsi: Remove internal header from Tx status skb Amitkumar Karwar
2017-07-10 12:40 ` [v2 16/17] rsi: Send rx filter frame to device when interface is down Amitkumar Karwar
2017-07-10 12:40 ` Amitkumar Karwar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1499690448-9956-18-git-send-email-amitkarwar@gmail.com \
    --to=amitkarwar@gmail.com \
    --cc=amit.karwar@redpinesignals.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=prameela.j04cs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).