[PATCH] b43: Fix rxheader channel parsing
This patch fixes the parsing of the RX data header channel field. The current code parses the header incorrectly and passes a wrong channel number and frequency for each frame to mac80211. The FIXMEs added by this patch don't matter for now as the code where they live won't get executed anyway. They will be fixed later. Signed-off-by: Michael Buesch [EMAIL PROTECTED] --- John, as this is a bugfix, it should go into 2.6.24 if still possible. Index: wireless-2.6/drivers/net/wireless/b43/xmit.c === --- wireless-2.6.orig/drivers/net/wireless/b43/xmit.c 2007-12-30 20:30:03.0 +0100 +++ wireless-2.6/drivers/net/wireless/b43/xmit.c2008-01-02 18:13:15.0 +0100 @@ -549,21 +549,32 @@ void b43_rx(struct b43_wldev *dev, struc switch (chanstat B43_RX_CHAN_PHYTYPE) { case B43_PHYTYPE_A: status.phymode = MODE_IEEE80211A; - status.freq = chanid; - status.channel = b43_freq_to_channel_a(chanid); - break; - case B43_PHYTYPE_B: - status.phymode = MODE_IEEE80211B; - status.freq = chanid + 2400; - status.channel = b43_freq_to_channel_bg(chanid + 2400); + B43_WARN_ON(1); + /* FIXME: We don't really know which value the chanid contains. +*So the following assignment might be wrong. */ + status.channel = chanid; + status.freq = b43_channel_to_freq_5ghz(status.channel); break; case B43_PHYTYPE_G: status.phymode = MODE_IEEE80211G; + /* chanid is the radio channel cookie value as used +* to tune the radio. */ status.freq = chanid + 2400; - status.channel = b43_freq_to_channel_bg(chanid + 2400); + status.channel = b43_freq_to_channel_2ghz(status.freq); + break; + case B43_PHYTYPE_N: + status.phymode = 0xDEAD /*FIXME MODE_IEEE80211N*/; + /* chanid is the SHM channel cookie. Which is the plain +* channel number in b43. */ + status.channel = chanid; + if (chanstat B43_RX_CHAN_5GHZ) + status.freq = b43_freq_to_channel_5ghz(status.freq); + else + status.freq = b43_freq_to_channel_2ghz(status.freq); break; default: B43_WARN_ON(1); + goto drop; } dev-stats.last_rx = jiffies; Index: wireless-2.6/drivers/net/wireless/b43/xmit.h === --- wireless-2.6.orig/drivers/net/wireless/b43/xmit.h 2007-12-30 20:30:03.0 +0100 +++ wireless-2.6/drivers/net/wireless/b43/xmit.h2008-01-02 16:42:24.0 +0100 @@ -142,49 +142,56 @@ struct b43_rxhdr_fw4 { } __attribute__ ((__packed__)); /* PHY RX Status 0 */ -#define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */ -#define B43_RX_PHYST0_PLCPHCF 0x0200 -#define B43_RX_PHYST0_PLCPFV 0x0100 -#define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */ +#define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */ +#define B43_RX_PHYST0_PLCPHCF 0x0200 +#define B43_RX_PHYST0_PLCPFV 0x0100 +#define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */ #define B43_RX_PHYST0_LCRS 0x0040 -#define B43_RX_PHYST0_ANT 0x0020 /* Antenna */ -#define B43_RX_PHYST0_UNSRATE 0x0010 +#define B43_RX_PHYST0_ANT 0x0020 /* Antenna */ +#define B43_RX_PHYST0_UNSRATE 0x0010 #define B43_RX_PHYST0_CLIP 0x000C #define B43_RX_PHYST0_CLIP_SHIFT 2 -#define B43_RX_PHYST0_FTYPE0x0003 /* Frame type */ -#define B43_RX_PHYST0_CCK 0x /* Frame type: CCK */ -#define B43_RX_PHYST0_OFDM0x0001 /* Frame type: OFDM */ -#define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */ -#define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */ +#define B43_RX_PHYST0_FTYPE0x0003 /* Frame type */ +#define B43_RX_PHYST0_CCK 0x /* Frame type: CCK */ +#define B43_RX_PHYST0_OFDM0x0001 /* Frame type: OFDM */ +#define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */ +#define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */ /* PHY RX Status 2 */ -#define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */ +#define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */ #define B43_RX_PHYST2_LNAG_SHIFT 14 -#define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */ +#define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */ #define B43_RX_PHYST2_PNAG_SHIFT 10 -#define B43_RX_PHYST2_FOFF 0x03FF /* F offset */ +#define B43_RX_PHYST2_FOFF 0x03FF
Re: [PATCH] b43: Fix rxheader channel parsing
Michael Buesch wrote: This patch fixes the parsing of the RX data header channel field. The current code parses the header incorrectly and passes a wrong channel number and frequency for each frame to mac80211. The FIXMEs added by this patch don't matter for now as the code where they live won't get executed anyway. They will be fixed later. Signed-off-by: Michael Buesch [EMAIL PROTECTED] --- John, as this is a bugfix, it should go into 2.6.24 if still possible. Index: wireless-2.6/drivers/net/wireless/b43/xmit.c === --- wireless-2.6.orig/drivers/net/wireless/b43/xmit.c 2007-12-30 20:30:03.0 +0100 +++ wireless-2.6/drivers/net/wireless/b43/xmit.c 2008-01-02 18:13:15.0 +0100 @@ -549,21 +549,32 @@ void b43_rx(struct b43_wldev *dev, struc switch (chanstat B43_RX_CHAN_PHYTYPE) { case B43_PHYTYPE_A: status.phymode = MODE_IEEE80211A; - status.freq = chanid; - status.channel = b43_freq_to_channel_a(chanid); - break; - case B43_PHYTYPE_B: - status.phymode = MODE_IEEE80211B; - status.freq = chanid + 2400; - status.channel = b43_freq_to_channel_bg(chanid + 2400); + B43_WARN_ON(1); + /* FIXME: We don't really know which value the chanid contains. + *So the following assignment might be wrong. */ + status.channel = chanid; + status.freq = b43_channel_to_freq_5ghz(status.channel); break; Shouldn't you just drop this case? No B PHY devices will ever use b43 and the default branch will issue the WARN_ON anyway. Larry ___ Bcm43xx-dev mailing list Bcm43xx-dev@lists.berlios.de https://lists.berlios.de/mailman/listinfo/bcm43xx-dev
Re: [PATCH] b43: Fix rxheader channel parsing
On Wednesday 02 January 2008 19:52:08 Larry Finger wrote: Michael Buesch wrote: This patch fixes the parsing of the RX data header channel field. The current code parses the header incorrectly and passes a wrong channel number and frequency for each frame to mac80211. The FIXMEs added by this patch don't matter for now as the code where they live won't get executed anyway. They will be fixed later. Signed-off-by: Michael Buesch [EMAIL PROTECTED] --- John, as this is a bugfix, it should go into 2.6.24 if still possible. Index: wireless-2.6/drivers/net/wireless/b43/xmit.c === --- wireless-2.6.orig/drivers/net/wireless/b43/xmit.c 2007-12-30 20:30:03.0 +0100 +++ wireless-2.6/drivers/net/wireless/b43/xmit.c2008-01-02 18:13:15.0 +0100 @@ -549,21 +549,32 @@ void b43_rx(struct b43_wldev *dev, struc switch (chanstat B43_RX_CHAN_PHYTYPE) { case B43_PHYTYPE_A: status.phymode = MODE_IEEE80211A; - status.freq = chanid; - status.channel = b43_freq_to_channel_a(chanid); - break; - case B43_PHYTYPE_B: - status.phymode = MODE_IEEE80211B; - status.freq = chanid + 2400; - status.channel = b43_freq_to_channel_bg(chanid + 2400); + B43_WARN_ON(1); + /* FIXME: We don't really know which value the chanid contains. +*So the following assignment might be wrong. */ + status.channel = chanid; + status.freq = b43_channel_to_freq_5ghz(status.channel); break; Shouldn't you just drop this case? No B PHY devices will ever use b43 and the default branch will issue the WARN_ON anyway. I guess you misread the patch. -- Greetings Michael. ___ Bcm43xx-dev mailing list Bcm43xx-dev@lists.berlios.de https://lists.berlios.de/mailman/listinfo/bcm43xx-dev
Re: [PATCH] b43: Fix rxheader channel parsing
Michael Buesch wrote: Shouldn't you just drop this case? No B PHY devices will ever use b43 and the default branch will issue the WARN_ON anyway. I guess you misread the patch. I did indeed. Sorry. Larry ___ Bcm43xx-dev mailing list Bcm43xx-dev@lists.berlios.de https://lists.berlios.de/mailman/listinfo/bcm43xx-dev
Re: [PATCH] b43: Fix rxheader channel parsing
On Wednesday 02 January 2008 20:37:41 Ehud Gavron wrote: Happy New Year, Michael! :) Yeah, thanks. :) Happy New Year to everyone on the list. Let's work on making The Linux Wireless Year (tm) out of it. -- Greetings Michael. ___ Bcm43xx-dev mailing list Bcm43xx-dev@lists.berlios.de https://lists.berlios.de/mailman/listinfo/bcm43xx-dev