From: andy@warmcat.com
To: linux-wireless@vger.kernel.org
Cc: Daniel Drake <dsd@gentoo.org>,
Ulrich Kunitz <kune@deine-taler.de>,
Andy Green <andy@warmcat.com>
Subject: [PATCH 1/2] zd1211rw-mac80211: return hardware specific tx rate code for rx status
Date: Mon, 11 Jun 2007 11:38:29 +0100 [thread overview]
Message-ID: <20070611103914.481787013@warmcat.com> (raw)
In-Reply-To: 20070611103828.961999956@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.
Without this patch the radiotap-based monitor stuff reports a "0.0Mbps" rate for
all packets from this driver.
CC: Daniel Drake <dsd@gentoo.org>
CC: Ulrich Kunitz <kune@deine-taler.de>
Signed-off-by: Andy Green <andy@warmcat.com>
---
drivers/net/wireless/mac80211/zd1211rw/zd_chip.c | 22 ++++++++++++++++++++++
drivers/net/wireless/mac80211/zd1211rw/zd_chip.h | 2 ++
drivers/net/wireless/mac80211/zd1211rw/zd_mac.c | 2 +-
3 files changed, 25 insertions(+), 1 deletion(-)
Index: wireless-dev/drivers/net/wireless/mac80211/zd1211rw/zd_chip.c
===================================================================
--- wireless-dev.orig/drivers/net/wireless/mac80211/zd1211rw/zd_chip.c
+++ wireless-dev/drivers/net/wireless/mac80211/zd1211rw/zd_chip.c
@@ -1569,6 +1569,28 @@ u16 zd_rx_rate(const void *rx_frame, con
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;
Index: wireless-dev/drivers/net/wireless/mac80211/zd1211rw/zd_chip.h
===================================================================
--- wireless-dev.orig/drivers/net/wireless/mac80211/zd1211rw/zd_chip.h
+++ wireless-dev/drivers/net/wireless/mac80211/zd1211rw/zd_chip.h
@@ -877,6 +877,8 @@ u8 zd_rx_qual_percent(const void *rx_fra
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;
Index: wireless-dev/drivers/net/wireless/mac80211/zd1211rw/zd_mac.c
===================================================================
--- wireless-dev.orig/drivers/net/wireless/mac80211/zd1211rw/zd_mac.c
+++ wireless-dev/drivers/net/wireless/mac80211/zd1211rw/zd_mac.c
@@ -642,7 +642,7 @@ static int fill_rx_stats(struct ieee8021
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;
}
--
next prev parent reply other threads:[~2007-06-11 10:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-11 10:38 [PATCH 0/2] Small driver fixes andy
2007-06-11 10:38 ` andy [this message]
2007-07-19 19:10 ` [PATCH 1/2] zd1211rw-mac80211: return hardware specific tx rate code for rx status John W. Linville
2007-07-19 21:19 ` Ulrich Kunitz
2007-06-11 10:38 ` [PATCH 2/2] bcm43xx-mac80211: Fix reported rx frequency and channel andy
2007-06-11 11:26 ` Johannes Berg
2007-06-11 11:45 ` Johannes Berg
2007-07-19 19:10 ` John W. Linville
2007-07-19 19:39 ` Michael Buesch
2007-07-20 6:05 ` Andy Green
2007-07-20 7:37 ` Johannes Berg
2007-07-20 13:31 ` John W. Linville
2007-07-20 14:36 ` Larry Finger
2007-07-20 14:47 ` Andy Green
2007-07-20 16:58 ` Larry Finger
2007-07-20 17:36 ` Michael Buesch
2007-07-20 17:48 ` Andy Green
2007-07-20 17:50 ` Michael Buesch
2007-07-20 20:40 ` Johannes Berg
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=20070611103914.481787013@warmcat.com \
--to=andy@warmcat.com \
--cc=dsd@gentoo.org \
--cc=kune@deine-taler.de \
--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).