All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
To: linux-wireless@vger.kernel.org
Cc: Johannes Berg <johannes@sipsolutions.net>,
	Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>,
	Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Subject: [PATCHv3 17/18] ath5k: set 5/10 MHz supported channels and fix duration
Date: Thu, 16 May 2013 13:00:44 +0200	[thread overview]
Message-ID: <1368702045-27598-18-git-send-email-siwu@hrz.tu-chemnitz.de> (raw)
In-Reply-To: <1368702045-27598-1-git-send-email-siwu@hrz.tu-chemnitz.de>

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 drivers/net/wireless/ath/ath5k/base.c |   24 ++++++++++++++++--------
 drivers/net/wireless/ath/ath5k/pcu.c  |    2 ++
 drivers/net/wireless/ath/ath5k/qcu.c  |   25 ++++++++++++++++++++++++-
 3 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 13b0d37..9be5f11 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -164,28 +164,36 @@ static const struct ieee80211_rate ath5k_rates[] = {
 	  .flags = IEEE80211_RATE_SHORT_PREAMBLE },
 	{ .bitrate = 60,
 	  .hw_value = ATH5K_RATE_CODE_6M,
-	  .flags = 0 },
+	  .flags = IEEE80211_RATE_SUPPORTS_5MHZ |
+		   IEEE80211_RATE_SUPPORTS_10MHZ },
 	{ .bitrate = 90,
 	  .hw_value = ATH5K_RATE_CODE_9M,
-	  .flags = 0 },
+	  .flags = IEEE80211_RATE_SUPPORTS_5MHZ |
+		   IEEE80211_RATE_SUPPORTS_10MHZ },
 	{ .bitrate = 120,
 	  .hw_value = ATH5K_RATE_CODE_12M,
-	  .flags = 0 },
+	  .flags = IEEE80211_RATE_SUPPORTS_5MHZ |
+		   IEEE80211_RATE_SUPPORTS_10MHZ },
 	{ .bitrate = 180,
 	  .hw_value = ATH5K_RATE_CODE_18M,
-	  .flags = 0 },
+	  .flags = IEEE80211_RATE_SUPPORTS_5MHZ |
+		   IEEE80211_RATE_SUPPORTS_10MHZ },
 	{ .bitrate = 240,
 	  .hw_value = ATH5K_RATE_CODE_24M,
-	  .flags = 0 },
+	  .flags = IEEE80211_RATE_SUPPORTS_5MHZ |
+		   IEEE80211_RATE_SUPPORTS_10MHZ },
 	{ .bitrate = 360,
 	  .hw_value = ATH5K_RATE_CODE_36M,
-	  .flags = 0 },
+	  .flags = IEEE80211_RATE_SUPPORTS_5MHZ |
+		   IEEE80211_RATE_SUPPORTS_10MHZ },
 	{ .bitrate = 480,
 	  .hw_value = ATH5K_RATE_CODE_48M,
-	  .flags = 0 },
+	  .flags = IEEE80211_RATE_SUPPORTS_5MHZ |
+		   IEEE80211_RATE_SUPPORTS_10MHZ },
 	{ .bitrate = 540,
 	  .hw_value = ATH5K_RATE_CODE_54M,
-	  .flags = 0 },
+	  .flags = IEEE80211_RATE_SUPPORTS_5MHZ |
+		   IEEE80211_RATE_SUPPORTS_10MHZ },
 };
 
 static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp)
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c
index 1f16b42..c60d36a 100644
--- a/drivers/net/wireless/ath/ath5k/pcu.c
+++ b/drivers/net/wireless/ath/ath5k/pcu.c
@@ -144,11 +144,13 @@ ath5k_hw_get_frame_duration(struct ath5k_hw *ah, enum ieee80211_band band,
 		sifs = AR5K_INIT_SIFS_HALF_RATE;
 		preamble *= 2;
 		sym_time *= 2;
+		bitrate = DIV_ROUND_UP(bitrate, 2);
 		break;
 	case AR5K_BWMODE_5MHZ:
 		sifs = AR5K_INIT_SIFS_QUARTER_RATE;
 		preamble *= 4;
 		sym_time *= 4;
+		bitrate = DIV_ROUND_UP(bitrate, 4);
 		break;
 	default:
 		sifs = AR5K_INIT_SIFS_DEFAULT_BG;
diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c
index 65fe929..0583c69 100644
--- a/drivers/net/wireless/ath/ath5k/qcu.c
+++ b/drivers/net/wireless/ath/ath5k/qcu.c
@@ -566,9 +566,11 @@ int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time)
 {
 	struct ieee80211_channel *channel = ah->ah_current_channel;
 	enum ieee80211_band band;
+	struct ieee80211_supported_band *sband;
 	struct ieee80211_rate *rate;
 	u32 ack_tx_time, eifs, eifs_clock, sifs, sifs_clock;
 	u32 slot_time_clock = ath5k_hw_htoclock(ah, slot_time);
+	u32 rate_flags, i;
 
 	if (slot_time < 6 || slot_time_clock > AR5K_SLOT_TIME_MAX)
 		return -EINVAL;
@@ -605,7 +607,28 @@ int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time)
 	else
 		band = IEEE80211_BAND_2GHZ;
 
-	rate = &ah->sbands[band].bitrates[0];
+	switch (ah->ah_bwmode) {
+	case AR5K_BWMODE_5MHZ:
+		rate_flags = IEEE80211_RATE_SUPPORTS_5MHZ;
+		break;
+	case AR5K_BWMODE_10MHZ:
+		rate_flags = IEEE80211_RATE_SUPPORTS_10MHZ;
+		break;
+	default:
+		rate_flags = 0;
+		break;
+	}
+	sband = &ah->sbands[band];
+	rate = NULL;
+	for (i = 0; i < sband->n_bitrates; i++) {
+		if ((rate_flags & sband->bitrates[i].flags) != rate_flags)
+			continue;
+		rate = &sband->bitrates[i];
+		break;
+	}
+	if (WARN_ON(!rate))
+		return -EINVAL;
+
 	ack_tx_time = ath5k_hw_get_frame_duration(ah, band, 10, rate, false);
 
 	/* ack_tx_time includes an SIFS already */
-- 
1.7.10.4


  parent reply	other threads:[~2013-05-16 11:02 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16 11:00 [PATCHv3 00/18] Add support for 5 and 10 MHz channels Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 01/18] nl80211/cfg80211: add 5 and 10 MHz defines and wiphy flag Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 02/18] nl80211: add rate flags for 5/10 Mhz channels Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 03/18] mac80211: Fix rate control mask matching call Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 04/18] mac80211: fix various components for the new 5 and 10 MHz widths Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 05/18] mac80211: fix timing for 5 MHz and 10 MHz channels Simon Wunderlich
2013-06-18 14:21   ` Johannes Berg
2013-06-18 16:27     ` Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 06/18] mac80211: select and adjust bitrates according for channel mode Simon Wunderlich
2013-06-18 14:25   ` Johannes Berg
2013-05-16 11:00 ` [PATCHv3 07/18] mac80211: add radiotap flag and handling for 5/10 MHz Simon Wunderlich
2013-06-18 14:27   ` Johannes Berg
2013-06-18 15:50     ` Simon Wunderlich
2013-06-18 15:53       ` Johannes Berg
2013-05-16 11:00 ` [PATCHv3 08/18] cfg80211/mac80211: use reduced txpower for 5 and 10 MHz Simon Wunderlich
2013-05-16 11:49   ` Felix Fietkau
2013-05-16 11:00 ` [PATCHv3 09/18] mac80211: change IBSS channel state to chandef Simon Wunderlich
2013-06-18 14:28   ` Johannes Berg
2013-08-21  9:35   ` Johannes Berg
2013-05-16 11:00 ` [PATCHv3 10/18] nl80211: allow 5 and 10 MHz channels for IBSS Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 11/18] ath9k: always use SIFS times from OFDM for 5/10 MHz Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 12/18] ath9k: use chandef instead of channel_type Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 13/18] ath9k: report 5/10 MHz channels Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 14/18] ath9k: set 5/10 MHz supported channels and fix bitrate Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 15/18] ath9k: announce that ath9k supports 5/10 MHz Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 16/18] ath5k: report 5/10 MHz channels Simon Wunderlich
2013-05-16 11:00 ` Simon Wunderlich [this message]
2013-05-16 11:00 ` [PATCHv3 18/18] ath5k: enable support for 5 MHz and 10 " Simon Wunderlich
2013-05-28 10:41 ` [PATCHv3 00/18] Add support for 5 " Simon Wunderlich

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=1368702045-27598-18-git-send-email-siwu@hrz.tu-chemnitz.de \
    --to=simon.wunderlich@s2003.tu-chemnitz.de \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mathias.kretschmer@fokus.fraunhofer.de \
    --cc=siwu@hrz.tu-chemnitz.de \
    /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.