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@xxxxxxxxxx> CC: Ulrich Kunitz <kune@xxxxxxxxxxxxxx> Signed-off-by: Andy Green <andy@xxxxxxxxxxx> --- 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; } -- - To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html