From: andy@warmcat.com
To: linux-wireless@vger.kernel.org
Cc: Andy Green <andy@warmcat.com>
Subject: [PATCH 7/7] zd1211rw-mac80211: return hardware specific tx rate code for rx status
Date: Mon, 09 Apr 2007 16:48:09 +0100 [thread overview]
Message-ID: <20070409155336.002012553@warmcat.com> (raw)
In-Reply-To: 20070409154802.470925215@warmcat.com
zd1211rw-mac80211 uses different hardware-specific codings to talk about
rates when doing transmit and receive. Because mac80211 looks up the rx
rate against the rates table used for selecting hardware-specific coding for
tx, the rate returned in the rx_status struct needs to be adjusted to use the
coding used to hardware-specific tx rates. This patch performs this adjustment.
From: Andy Green <andy@warmcat.com>
Signed-off-by: Andy Green <andy@warmcat.com>
diff --git a/drivers/net/wireless/mac80211/zd1211rw/zd_chip.c b/drivers/net/wireless/mac80211/zd1211rw/zd_chip.c
index 4d226dc..30684e3 100644
--- a/drivers/net/wireless/mac80211/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/mac80211/zd1211rw/zd_chip.c
@@ -1563,6 +1563,28 @@ u16 zd_rx_rate(const void *rx_frame, const struct rx_status *status)
return rate;
}
+int zd_rx_rate_using_tx_format(const void *rx_frame,
+ const struct rx_status *status)
+{
+ if (status->frame_status & ZD_RX_OFDM) {
+ return ZD_CS_OFDM | (zd_ofdm_plcp_header_rate(rx_frame) & 0xf);
+ }
+
+ switch (zd_cck_plcp_header_rate(rx_frame)) {
+ case ZD_CCK_SIGNAL_1M:
+ return ZD_CS_CCK_RATE_1M;
+ case ZD_CCK_SIGNAL_2M:
+ return ZD_CS_CCK_RATE_2M;
+ case ZD_CCK_SIGNAL_5M5:
+ return ZD_CS_CCK_RATE_5_5M;
+ case ZD_CCK_SIGNAL_11M:
+ return ZD_CS_CCK_RATE_11M;
+ default:
+ return 0;
+ }
+
+}
+
int zd_chip_switch_radio_on(struct zd_chip *chip)
{
int r;
diff --git a/drivers/net/wireless/mac80211/zd1211rw/zd_chip.h b/drivers/net/wireless/mac80211/zd1211rw/zd_chip.h
index a4dc06c..4f4fe8c 100644
--- a/drivers/net/wireless/mac80211/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/mac80211/zd1211rw/zd_chip.h
@@ -873,6 +873,8 @@ u8 zd_rx_qual_percent(const void *rx_frame, unsigned int size,
u8 zd_rx_strength_percent(u8 rssi);
u16 zd_rx_rate(const void *rx_frame, const struct rx_status *status);
+int zd_rx_rate_using_tx_format(const void *rx_frame,
+ const struct rx_status *status);
struct zd_mc_hash {
u32 low;
diff --git a/drivers/net/wireless/mac80211/zd1211rw/zd_mac.c b/drivers/net/wireless/mac80211/zd1211rw/zd_mac.c
index 65eabfa..bfaa923 100644
--- a/drivers/net/wireless/mac80211/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/mac80211/zd1211rw/zd_mac.c
@@ -411,7 +411,7 @@ static int fill_rx_stats(struct ieee80211_rx_status *stats,
stats->signal = zd_rx_qual_percent(buffer,
length - sizeof(struct rx_status),
status);
- stats->rate = zd_rx_rate(buffer, status);
+ stats->rate = zd_rx_rate_using_tx_format(buffer, status);
return 0;
}
--
prev parent reply other threads:[~2007-04-09 15:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-09 15:48 [PATCH 0/7] Try #8: Radiotap on Monitor Mode interfaces for rx and tx andy
2007-04-09 15:48 ` [PATCH 1/7] sync wireless-dev with radiotap header in wireless-2.6 andy
2007-04-09 15:48 ` [PATCH 2/7] mac80211: Add radiotap support andy
2007-04-09 15:48 ` [PATCH 3/7] mac80211: Monitor mode radiotap injection docs andy
2007-04-09 15:48 ` [PATCH 4/7] mac80211: Define present bitmap extend bit mask andy
2007-04-09 15:48 ` [PATCH 5/7] cfg80211: Radiotap parser andy
2007-04-09 15:48 ` [PATCH 6/7] mac80211: Monitor mode radiotap-based packet injection andy
2007-04-09 15:48 ` andy [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=20070409155336.002012553@warmcat.com \
--to=andy@warmcat.com \
--cc=linux-wireless@vger.kernel.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 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).