All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@qca.qualcomm.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH 2/6] ath10k: change chan_to_phymode() use chandef
Date: Mon, 20 May 2013 16:36:44 +0300	[thread overview]
Message-ID: <20130520133644.6961.44395.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20130520133551.6961.55701.stgit@localhost6.localdomain6>

That's more logical instead of passing chandef fields one at a time.

Also change ath10k_update_channel_list to hardcode the band directly.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   49 +++++++++++++++++++++------------
 1 file changed, 31 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 974f992..72f4475 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -220,38 +220,46 @@ static int ath10k_clear_vdev_key(struct ath10k_vif *arvif,
 /* General utilities */
 /*********************/
 
-static inline enum wmi_phy_mode chan_to_phymode(struct ieee80211_channel *chan,
-					enum nl80211_channel_type channel_type)
+static inline enum wmi_phy_mode
+chan_to_phymode(const struct cfg80211_chan_def *chandef)
 {
 	enum wmi_phy_mode phymode = MODE_UNKNOWN;
 
-	switch (chan->band) {
+	switch (chandef->chan->band) {
 	case IEEE80211_BAND_2GHZ:
-		switch (channel_type) {
-		case NL80211_CHAN_NO_HT:
+		switch (chandef->width) {
+		case NL80211_CHAN_WIDTH_20_NOHT:
 			phymode = MODE_11G;
 			break;
-		case NL80211_CHAN_HT20:
+		case NL80211_CHAN_WIDTH_20:
 			phymode = MODE_11NG_HT20;
 			break;
-		case NL80211_CHAN_HT40PLUS:
-		case NL80211_CHAN_HT40MINUS:
+		case NL80211_CHAN_WIDTH_40:
 			phymode = MODE_11NG_HT40;
 			break;
+		case NL80211_CHAN_WIDTH_80:
+		case NL80211_CHAN_WIDTH_80P80:
+		case NL80211_CHAN_WIDTH_160:
+			phymode = MODE_UNKNOWN;
+			break;
 		}
 		break;
 	case IEEE80211_BAND_5GHZ:
-		switch (channel_type) {
-		case NL80211_CHAN_NO_HT:
+		switch (chandef->width) {
+		case NL80211_CHAN_WIDTH_20_NOHT:
 			phymode = MODE_11A;
 			break;
-		case NL80211_CHAN_HT20:
+		case NL80211_CHAN_WIDTH_20:
 			phymode = MODE_11NA_HT20;
 			break;
-		case NL80211_CHAN_HT40PLUS:
-		case NL80211_CHAN_HT40MINUS:
+		case NL80211_CHAN_WIDTH_40:
 			phymode = MODE_11NA_HT40;
 			break;
+		case NL80211_CHAN_WIDTH_80:
+		case NL80211_CHAN_WIDTH_80P80:
+		case NL80211_CHAN_WIDTH_160:
+			phymode = MODE_UNKNOWN;
+			break;
 		}
 		break;
 	default:
@@ -408,9 +416,7 @@ static int ath10k_vdev_start(struct ath10k_vif *arvif)
 		band_center_freq(channel,
 				 cfg80211_get_chandef_type(&conf->chandef));
 
-	arg.channel.mode =
-		chan_to_phymode(channel,
-				cfg80211_get_chandef_type(&conf->chandef));
+	arg.channel.mode = chan_to_phymode(&conf->chandef);
 
 	arg.channel.min_power = channel->max_power * 3;
 	arg.channel.max_power = channel->max_power * 4;
@@ -482,7 +488,7 @@ static int ath10k_monitor_start(struct ath10k *ar, int vdev_id)
 
 	/* TODO setup this dynamically, what in case we
 	   don't have any vifs? */
-	arg.channel.mode = chan_to_phymode(channel, type);
+	arg.channel.mode = chan_to_phymode(&ar->hw->conf.chandef);
 
 	arg.channel.min_power = channel->max_power * 3;
 	arg.channel.max_power = channel->max_power * 4;
@@ -1224,7 +1230,14 @@ static int ath10k_update_channel_list(struct ath10k *ar)
 			ch->max_reg_power = channel->max_reg_power * 4;
 			ch->max_antenna_gain = channel->max_antenna_gain;
 			ch->reg_class_id = 0; /* FIXME */
-			ch->mode = chan_to_phymode(channel, NL80211_CHAN_NO_HT);
+
+			/* FIXME: why use only legacy modes, why not any
+			 * HT/VHT modes? Would that even make any
+			 * difference? */
+			if (channel->band == IEEE80211_BAND_2GHZ)
+				ch->mode = MODE_11G;
+			else
+				ch->mode = MODE_11A;
 
 			if (WARN_ON_ONCE(ch->mode == MODE_UNKNOWN))
 				continue;

  parent reply	other threads:[~2013-05-20 13:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20 13:36 [ath9k-devel] [PATCH 0/6] ath10k: vht support Kalle Valo
2013-05-20 13:36 ` [ath9k-devel] [PATCH 1/6] ath10k: set vht_nss correctly Kalle Valo
2013-05-20 13:36 ` Kalle Valo [this message]
2013-05-20 13:36 ` [ath9k-devel] [PATCH 3/6] ath10k: remove band_center_freq() Kalle Valo
2013-05-20 13:36 ` [ath9k-devel] [PATCH 4/6] ath10k: include all management frames to ATH10K_DBG_BEACON Kalle Valo
2013-05-20 13:37 ` [ath9k-devel] [PATCH 5/6] ath10k: add ATH10K_DBG_DATA Kalle Valo
2013-05-20 13:37 ` [ath9k-devel] [PATCH 6/6] ath10k: preliminary VHT support Kalle Valo
2013-05-21 11:45   ` Michal Kazior
2013-05-21 19:19     ` Kalle Valo
2013-05-21 19:30 ` [ath9k-devel] [PATCH 0/6] ath10k: vht support Kalle Valo

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=20130520133644.6961.44395.stgit@localhost6.localdomain6 \
    --to=kvalo@qca.qualcomm.com \
    --cc=ath9k-devel@lists.ath9k.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.