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 <[email protected]>
CC: Ulrich Kunitz <[email protected]>
Signed-off-by: Andy Green <[email protected]>
---
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;
}
--
On 07-07-19 15:10 John W. Linville wrote:
> On Mon, Jun 11, 2007 at 11:38:29AM +0100, [email protected] wrote:
> > 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 <[email protected]>
> > CC: Ulrich Kunitz <[email protected]>
> > Signed-off-by: Andy Green <[email protected]>
>
> Daniel, Uli -- ack/nak?
John,
NAK. The patch introduces unnecessarily a new function.
I have already the correct patch in the queue:
http://deine-taler.de/git-bin/gitweb.cgi?p=zd1211rw.git;a=commitdiff;h=d635ff55fa76ff36da0b923c680861ccbddf34ad;hp=7e052f8d9f078314f3a3ad4a052e9a6c0e8fcadb
Kind regards,
Uli
--
Uli Kunitz
On Mon, Jun 11, 2007 at 11:38:29AM +0100, [email protected] wrote:
> 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 <[email protected]>
> CC: Ulrich Kunitz <[email protected]>
> Signed-off-by: Andy Green <[email protected]>
Daniel, Uli -- ack/nak?
--
John W. Linville
[email protected]