From kpjkpjkpjkpjkpjkpj at gmail.com  Wed Jan 15 18:25:25 2014
From: kpjkpjkpjkpjkpjkpj at gmail.com (kpj)
Date: Thu, 16 Jan 2014 00:25:25 +0100
Subject: Concerning the promiscuous mode
Message-ID: <20140115232524.GA2961@archer.lan>

Hello,
I have noticed quite a strange behaviour when trying to enable the promiscuous mode (PM) with Wireshark (version 1.10.5):
Wireshark itself is saying that PM is enabled ("Capture Options/Capture List/Prom. Mode" says enabled). Accordingly dmesg tells me about it: "[..] device wlan0 entered promiscuous mode".
However, netstat and ip don't seem as convinced:
$ ip l
..
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> ..
..
(yes, wlan0 is the correct interface)

$ netstat -i
wlan0 ? ? 1500 ? 336406 ? ? ?0 ? 3985 0 ? ? ? ? 70978 ? ? ?0 ? ? ?0 ? ? ?0 BMRU
(BMRU are the flags, P is not amongst them)
I am also not convinced, since I am not able to see any other packets than the ones directed at me or broadcasted ones.

Some information about my system:
$ uname -a
Linux . 3.12.7-1-ARCH #1 SMP PREEMPT Fri Jan 10 08:50:35 CET 2014 x86_64 GNU/Linux

$ lspci -vvn|grep 43 -A7
04:00.0 0280: 14e4:432b (rev 01)
? ? ? ? Subsystem: 106b:008d
? ? ? ? Physical Slot: 3
? ? ? ? Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
? ? ? ? Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
? ? ? ? Latency: 0, Cache Line Size: 256 bytes
? ? ? ? Interrupt: pin A routed to IRQ 18
? ? ? ? Region 0: Memory at df200000 (64-bit, non-prefetchable) [size=16K]
--
? ? ? ? Kernel driver in use: b43-pci-bridge
? ? ? ? Kernel modules: ssb
?
05:00.0 0c00: 11c1:5901 (rev 07) (prog-if 10 [OHCI])
? ? ? ? Subsystem: 11c1:5900
? ? ? ? Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
? ? ? ? Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
? ? ? ? Latency: 0, Cache Line Size: 256 bytes
(see http://pastebin.com/puVahU19)

The wiki (http://wireless.kernel.org/en/users/Drivers/b43) mentiones that my chip (Broadcom Corporation BCM4322, 14e4:432b) is only ?partially supported (in 2.6.39+). Could this be the reason for this strange behaviour or am I simply missing something.

Thanks in advance for any advice,
kpj


From gamerh2o at gmail.com  Fri Jan 17 00:27:34 2014
From: gamerh2o at gmail.com (ZHAO Gang)
Date: Fri, 17 Jan 2014 13:27:34 +0800
Subject: [PATCH 2/2] b43: use kernel api to replace b43 specific helper
 function
In-Reply-To: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
References: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
Message-ID: <c7ed453b30f30ee193ec0969904da001bef5dc3e.1389935084.git.gamerh2o@gmail.com>

Use ieee80211_channel_to_frequency() to replace b43_channel_to_freq_{2,5}ghz(),
and remove unused b43_freq_to_channel_{2,5}ghz().

Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
---
 drivers/net/wireless/b43/main.h | 35 -----------------------------------
 drivers/net/wireless/b43/xmit.c | 12 ++++++------
 2 files changed, 6 insertions(+), 41 deletions(-)

diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index abac25e..f476fc3 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -58,41 +58,6 @@ enum b43_verbosity {
 #endif
 };
 
-
-/* Lightweight function to convert a frequency (in Mhz) to a channel number. */
-static inline u8 b43_freq_to_channel_5ghz(int freq)
-{
-	return ((freq - 5000) / 5);
-}
-static inline u8 b43_freq_to_channel_2ghz(int freq)
-{
-	u8 channel;
-
-	if (freq == 2484)
-		channel = 14;
-	else
-		channel = (freq - 2407) / 5;
-
-	return channel;
-}
-
-/* Lightweight function to convert a channel number to a frequency (in Mhz). */
-static inline int b43_channel_to_freq_5ghz(u8 channel)
-{
-	return (5000 + (5 * channel));
-}
-static inline int b43_channel_to_freq_2ghz(u8 channel)
-{
-	int freq;
-
-	if (channel == 14)
-		freq = 2484;
-	else
-		freq = 2407 + (5 * channel);
-
-	return freq;
-}
-
 static inline int b43_is_cck_rate(int rate)
 {
 	return (rate == B43_CCK_RATE_1MB ||
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 50e5ddb..218a0f3 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -806,7 +806,8 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 		B43_WARN_ON(1);
 		/* FIXME: We don't really know which value the "chanid" contains.
 		 *        So the following assignment might be wrong. */
-		status.freq = b43_channel_to_freq_5ghz(chanid);
+		status.freq =
+			ieee80211_channel_to_frequency(chanid, status.band);
 		break;
 	case B43_PHYTYPE_G:
 		status.band = IEEE80211_BAND_2GHZ;
@@ -819,13 +820,12 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 	case B43_PHYTYPE_HT:
 		/* chanid is the SHM channel cookie. Which is the plain
 		 * channel number in b43. */
-		if (chanstat & B43_RX_CHAN_5GHZ) {
+		if (chanstat & B43_RX_CHAN_5GHZ)
 			status.band = IEEE80211_BAND_5GHZ;
-			status.freq = b43_channel_to_freq_5ghz(chanid);
-		} else {
+		else
 			status.band = IEEE80211_BAND_2GHZ;
-			status.freq = b43_channel_to_freq_2ghz(chanid);
-		}
+		status.freq =
+			ieee80211_channel_to_frequency(chanid, status.band);
 		break;
 	default:
 		B43_WARN_ON(1);
-- 
1.8.4.2



From gamerh2o at gmail.com  Fri Jan 17 00:27:33 2014
From: gamerh2o at gmail.com (ZHAO Gang)
Date: Fri, 17 Jan 2014 13:27:33 +0800
Subject: [PATCH 1/2] b43: fix the wrong assignment of status.freq in b43_rx()
Message-ID: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>

In following patch, replace b43 specific helper function with kernel
api to reduce code duplication.

Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
---
 drivers/net/wireless/b43/xmit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 4ae63f4..50e5ddb 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 		 * channel number in b43. */
 		if (chanstat & B43_RX_CHAN_5GHZ) {
 			status.band = IEEE80211_BAND_5GHZ;
-			status.freq = b43_freq_to_channel_5ghz(chanid);
+			status.freq = b43_channel_to_freq_5ghz(chanid);
 		} else {
 			status.band = IEEE80211_BAND_2GHZ;
-			status.freq = b43_freq_to_channel_2ghz(chanid);
+			status.freq = b43_channel_to_freq_2ghz(chanid);
 		}
 		break;
 	default:
-- 
1.8.4.2



From luca at coelho.fi  Fri Jan 17 01:24:56 2014
From: luca at coelho.fi (Luca Coelho)
Date: Fri, 17 Jan 2014 08:24:56 +0200
Subject: [PATCH 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
References: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
Message-ID: <1389939896.8062.53.camel@porter.coelho.fi>

On Fri, 2014-01-17 at 13:27 +0800, ZHAO Gang wrote:
> In following patch, replace b43 specific helper function with kernel
> api to reduce code duplication.
> 
> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
> ---
>  drivers/net/wireless/b43/xmit.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
> index 4ae63f4..50e5ddb 100644
> --- a/drivers/net/wireless/b43/xmit.c
> +++ b/drivers/net/wireless/b43/xmit.c
> @@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>  		 * channel number in b43. */
>  		if (chanstat & B43_RX_CHAN_5GHZ) {
>  			status.band = IEEE80211_BAND_5GHZ;
> -			status.freq = b43_freq_to_channel_5ghz(chanid);
> +			status.freq = b43_channel_to_freq_5ghz(chanid);
>  		} else {
>  			status.band = IEEE80211_BAND_2GHZ;
> -			status.freq = b43_freq_to_channel_2ghz(chanid);
> +			status.freq = b43_channel_to_freq_2ghz(chanid);
>  		}
>  		break;
>  	default:

Why do you need this patch if you're going to remove these calls in the
next patch anyway?

--
Luca.




From zajec5 at gmail.com  Fri Jan 17 02:11:34 2014
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Fri, 17 Jan 2014 08:11:34 +0100
Subject: [PATCH 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <1389939896.8062.53.camel@porter.coelho.fi>
References: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
 <1389939896.8062.53.camel@porter.coelho.fi>
Message-ID: <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>

2014/1/17 Luca Coelho <luca at coelho.fi>:
> On Fri, 2014-01-17 at 13:27 +0800, ZHAO Gang wrote:
>> In following patch, replace b43 specific helper function with kernel
>> api to reduce code duplication.
>>
>> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
>> ---
>>  drivers/net/wireless/b43/xmit.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
>> index 4ae63f4..50e5ddb 100644
>> --- a/drivers/net/wireless/b43/xmit.c
>> +++ b/drivers/net/wireless/b43/xmit.c
>> @@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>>                * channel number in b43. */
>>               if (chanstat & B43_RX_CHAN_5GHZ) {
>>                       status.band = IEEE80211_BAND_5GHZ;
>> -                     status.freq = b43_freq_to_channel_5ghz(chanid);
>> +                     status.freq = b43_channel_to_freq_5ghz(chanid);
>>               } else {
>>                       status.band = IEEE80211_BAND_2GHZ;
>> -                     status.freq = b43_freq_to_channel_2ghz(chanid);
>> +                     status.freq = b43_channel_to_freq_2ghz(chanid);
>>               }
>>               break;
>>       default:
>
> Why do you need this patch if you're going to remove these calls in the
> next patch anyway?

I was thinking about this for a moment too. You could just make a one
patch and note in commit message that "translation" was reversed.


From luca at coelho.fi  Fri Jan 17 04:01:44 2014
From: luca at coelho.fi (Luca Coelho)
Date: Fri, 17 Jan 2014 11:01:44 +0200
Subject: [PATCH 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <CAOiHx=nui0nVGiCLoukRovB3zY5jiKAt__Numo4y4bQv0dzOcQ@mail.gmail.com>
References: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
 <1389939896.8062.53.camel@porter.coelho.fi>
 <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>
 <CAOiHx=nui0nVGiCLoukRovB3zY5jiKAt__Numo4y4bQv0dzOcQ@mail.gmail.com>
Message-ID: <1389949304.8062.55.camel@porter.coelho.fi>

On Fri, 2014-01-17 at 09:56 +0100, Jonas Gorski wrote:
> On Fri, Jan 17, 2014 at 8:11 AM, Rafa? Mi?ecki <zajec5 at gmail.com> wrote:
> > 2014/1/17 Luca Coelho <luca at coelho.fi>:
> >> On Fri, 2014-01-17 at 13:27 +0800, ZHAO Gang wrote:
> >>> In following patch, replace b43 specific helper function with kernel
> >>> api to reduce code duplication.
> >>>
> >>> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
> >>> ---
> >>>  drivers/net/wireless/b43/xmit.c | 4 ++--
> >>>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
> >>> index 4ae63f4..50e5ddb 100644
> >>> --- a/drivers/net/wireless/b43/xmit.c
> >>> +++ b/drivers/net/wireless/b43/xmit.c
> >>> @@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
> >>>                * channel number in b43. */
> >>>               if (chanstat & B43_RX_CHAN_5GHZ) {
> >>>                       status.band = IEEE80211_BAND_5GHZ;
> >>> -                     status.freq = b43_freq_to_channel_5ghz(chanid);
> >>> +                     status.freq = b43_channel_to_freq_5ghz(chanid);
> >>>               } else {
> >>>                       status.band = IEEE80211_BAND_2GHZ;
> >>> -                     status.freq = b43_freq_to_channel_2ghz(chanid);
> >>> +                     status.freq = b43_channel_to_freq_2ghz(chanid);
> >>>               }
> >>>               break;
> >>>       default:
> >>
> >> Why do you need this patch if you're going to remove these calls in the
> >> next patch anyway?
> >
> > I was thinking about this for a moment too. You could just make a one
> > patch and note in commit message that "translation" was reversed.
> 
> That would mean mixing fixes and improvements, which is something you
> are not supposed to do, so IMHO having these split into two is
> correct. Think about stable maintainers wanting the fix but not the
> other change because it might introduce unknown side effects.

Makes sense.  In such case, the first patch should be clearly marked as
a bug fix, so at least the commit message should be changed (ie.
mentioning the next patch in the series is useless).

--
Luca.



From jogo at openwrt.org  Fri Jan 17 03:56:45 2014
From: jogo at openwrt.org (Jonas Gorski)
Date: Fri, 17 Jan 2014 09:56:45 +0100
Subject: [PATCH 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>
References: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
 <1389939896.8062.53.camel@porter.coelho.fi>
 <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>
Message-ID: <CAOiHx=nui0nVGiCLoukRovB3zY5jiKAt__Numo4y4bQv0dzOcQ@mail.gmail.com>

On Fri, Jan 17, 2014 at 8:11 AM, Rafa? Mi?ecki <zajec5 at gmail.com> wrote:
> 2014/1/17 Luca Coelho <luca at coelho.fi>:
>> On Fri, 2014-01-17 at 13:27 +0800, ZHAO Gang wrote:
>>> In following patch, replace b43 specific helper function with kernel
>>> api to reduce code duplication.
>>>
>>> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
>>> ---
>>>  drivers/net/wireless/b43/xmit.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
>>> index 4ae63f4..50e5ddb 100644
>>> --- a/drivers/net/wireless/b43/xmit.c
>>> +++ b/drivers/net/wireless/b43/xmit.c
>>> @@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>>>                * channel number in b43. */
>>>               if (chanstat & B43_RX_CHAN_5GHZ) {
>>>                       status.band = IEEE80211_BAND_5GHZ;
>>> -                     status.freq = b43_freq_to_channel_5ghz(chanid);
>>> +                     status.freq = b43_channel_to_freq_5ghz(chanid);
>>>               } else {
>>>                       status.band = IEEE80211_BAND_2GHZ;
>>> -                     status.freq = b43_freq_to_channel_2ghz(chanid);
>>> +                     status.freq = b43_channel_to_freq_2ghz(chanid);
>>>               }
>>>               break;
>>>       default:
>>
>> Why do you need this patch if you're going to remove these calls in the
>> next patch anyway?
>
> I was thinking about this for a moment too. You could just make a one
> patch and note in commit message that "translation" was reversed.

That would mean mixing fixes and improvements, which is something you
are not supposed to do, so IMHO having these split into two is
correct. Think about stable maintainers wanting the fix but not the
other change because it might introduce unknown side effects.


Jonas
>
> _______________________________________________
> b43-dev mailing list
> b43-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/b43-dev


From gamerh2o at gmail.com  Fri Jan 17 04:11:46 2014
From: gamerh2o at gmail.com (ZHAO Gang)
Date: Fri, 17 Jan 2014 17:11:46 +0800
Subject: [PATCH v2] b43: use kernel api to replace b43 specific helper function
In-Reply-To: <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>
References: <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>
Message-ID: <8b96c31da0f8a23b8e99ed790e462bd933925041.1389947627.git.gamerh2o@gmail.com>

The b43_freq_to_channel_{2,5}ghz() should be changed to
b43_channel_to_freq{2,5}ghz() if we want to use b43 helper function,
but a better way is to use kernel api ieee80211_channel_to_frequency()
and remove these unnecessary helper function.

Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
---
v2: combine two patches to one.
    suggested by Luca Coelho and Rafa? Mi?ecki

 drivers/net/wireless/b43/main.h | 35 -----------------------------------
 drivers/net/wireless/b43/xmit.c | 12 ++++++------
 2 files changed, 6 insertions(+), 41 deletions(-)

diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index abac25e..f476fc3 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -58,41 +58,6 @@ enum b43_verbosity {
 #endif
 };
 
-
-/* Lightweight function to convert a frequency (in Mhz) to a channel number. */
-static inline u8 b43_freq_to_channel_5ghz(int freq)
-{
-	return ((freq - 5000) / 5);
-}
-static inline u8 b43_freq_to_channel_2ghz(int freq)
-{
-	u8 channel;
-
-	if (freq == 2484)
-		channel = 14;
-	else
-		channel = (freq - 2407) / 5;
-
-	return channel;
-}
-
-/* Lightweight function to convert a channel number to a frequency (in Mhz). */
-static inline int b43_channel_to_freq_5ghz(u8 channel)
-{
-	return (5000 + (5 * channel));
-}
-static inline int b43_channel_to_freq_2ghz(u8 channel)
-{
-	int freq;
-
-	if (channel == 14)
-		freq = 2484;
-	else
-		freq = 2407 + (5 * channel);
-
-	return freq;
-}
-
 static inline int b43_is_cck_rate(int rate)
 {
 	return (rate == B43_CCK_RATE_1MB ||
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 4ae63f4..218a0f3 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -806,7 +806,8 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 		B43_WARN_ON(1);
 		/* FIXME: We don't really know which value the "chanid" contains.
 		 *        So the following assignment might be wrong. */
-		status.freq = b43_channel_to_freq_5ghz(chanid);
+		status.freq =
+			ieee80211_channel_to_frequency(chanid, status.band);
 		break;
 	case B43_PHYTYPE_G:
 		status.band = IEEE80211_BAND_2GHZ;
@@ -819,13 +820,12 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 	case B43_PHYTYPE_HT:
 		/* chanid is the SHM channel cookie. Which is the plain
 		 * channel number in b43. */
-		if (chanstat & B43_RX_CHAN_5GHZ) {
+		if (chanstat & B43_RX_CHAN_5GHZ)
 			status.band = IEEE80211_BAND_5GHZ;
-			status.freq = b43_freq_to_channel_5ghz(chanid);
-		} else {
+		else
 			status.band = IEEE80211_BAND_2GHZ;
-			status.freq = b43_freq_to_channel_2ghz(chanid);
-		}
+		status.freq =
+			ieee80211_channel_to_frequency(chanid, status.band);
 		break;
 	default:
 		B43_WARN_ON(1);
-- 
1.8.4.2



From jogo at openwrt.org  Fri Jan 17 04:19:55 2014
From: jogo at openwrt.org (Jonas Gorski)
Date: Fri, 17 Jan 2014 10:19:55 +0100
Subject: [PATCH 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <1389949304.8062.55.camel@porter.coelho.fi>
References: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
 <1389939896.8062.53.camel@porter.coelho.fi>
 <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>
 <CAOiHx=nui0nVGiCLoukRovB3zY5jiKAt__Numo4y4bQv0dzOcQ@mail.gmail.com>
 <1389949304.8062.55.camel@porter.coelho.fi>
Message-ID: <CAOiHx==S9-A4z7wNcK10FsCjyRTFWcSj7Ei8O95xo1mOjC-dCg@mail.gmail.com>

On Fri, Jan 17, 2014 at 10:01 AM, Luca Coelho <luca at coelho.fi> wrote:
> On Fri, 2014-01-17 at 09:56 +0100, Jonas Gorski wrote:
>> On Fri, Jan 17, 2014 at 8:11 AM, Rafa? Mi?ecki <zajec5 at gmail.com> wrote:
>> > 2014/1/17 Luca Coelho <luca at coelho.fi>:
>> >> On Fri, 2014-01-17 at 13:27 +0800, ZHAO Gang wrote:
>> >>> In following patch, replace b43 specific helper function with kernel
>> >>> api to reduce code duplication.
>> >>>
>> >>> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
>> >>> ---
>> >>>  drivers/net/wireless/b43/xmit.c | 4 ++--
>> >>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> >>>
>> >>> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
>> >>> index 4ae63f4..50e5ddb 100644
>> >>> --- a/drivers/net/wireless/b43/xmit.c
>> >>> +++ b/drivers/net/wireless/b43/xmit.c
>> >>> @@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>> >>>                * channel number in b43. */
>> >>>               if (chanstat & B43_RX_CHAN_5GHZ) {
>> >>>                       status.band = IEEE80211_BAND_5GHZ;
>> >>> -                     status.freq = b43_freq_to_channel_5ghz(chanid);
>> >>> +                     status.freq = b43_channel_to_freq_5ghz(chanid);
>> >>>               } else {
>> >>>                       status.band = IEEE80211_BAND_2GHZ;
>> >>> -                     status.freq = b43_freq_to_channel_2ghz(chanid);
>> >>> +                     status.freq = b43_channel_to_freq_2ghz(chanid);
>> >>>               }
>> >>>               break;
>> >>>       default:
>> >>
>> >> Why do you need this patch if you're going to remove these calls in the
>> >> next patch anyway?
>> >
>> > I was thinking about this for a moment too. You could just make a one
>> > patch and note in commit message that "translation" was reversed.
>>
>> That would mean mixing fixes and improvements, which is something you
>> are not supposed to do, so IMHO having these split into two is
>> correct. Think about stable maintainers wanting the fix but not the
>> other change because it might introduce unknown side effects.
>
> Makes sense.  In such case, the first patch should be clearly marked as
> a bug fix, so at least the commit message should be changed (ie.
> mentioning the next patch in the series is useless).

Well, it uses "fix" in the subject ;-). But I agree about the commit
message; it should describe the changes of this patch and the impact
of the fixed defect, so it's easier to decide whether to backport the
fix or not.


Jonas


From gamerh2o at gmail.com  Fri Jan 17 04:29:24 2014
From: gamerh2o at gmail.com (ZHAO Gang)
Date: Fri, 17 Jan 2014 17:29:24 +0800
Subject: [PATCH 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <1389949304.8062.55.camel@porter.coelho.fi>
References: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
 <1389939896.8062.53.camel@porter.coelho.fi>
 <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>
 <CAOiHx=nui0nVGiCLoukRovB3zY5jiKAt__Numo4y4bQv0dzOcQ@mail.gmail.com>
 <1389949304.8062.55.camel@porter.coelho.fi>
Message-ID: <CAAb+SYYyQF54Cib3Wae18orzH31RJ-vYoTEOBidMEPwVYYRv=g@mail.gmail.com>

On Fri, Jan 17, 2014 at 5:01 PM, Luca Coelho <luca at coelho.fi> wrote:
> On Fri, 2014-01-17 at 09:56 +0100, Jonas Gorski wrote:
>> On Fri, Jan 17, 2014 at 8:11 AM, Rafa? Mi?ecki <zajec5 at gmail.com> wrote:
>> > 2014/1/17 Luca Coelho <luca at coelho.fi>:
>> >> On Fri, 2014-01-17 at 13:27 +0800, ZHAO Gang wrote:
>> >>> In following patch, replace b43 specific helper function with kernel
>> >>> api to reduce code duplication.
>> >>>
>> >>> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
>> >>> ---
>> >>>  drivers/net/wireless/b43/xmit.c | 4 ++--
>> >>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> >>>
>> >>> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
>> >>> index 4ae63f4..50e5ddb 100644
>> >>> --- a/drivers/net/wireless/b43/xmit.c
>> >>> +++ b/drivers/net/wireless/b43/xmit.c
>> >>> @@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>> >>>                * channel number in b43. */
>> >>>               if (chanstat & B43_RX_CHAN_5GHZ) {
>> >>>                       status.band = IEEE80211_BAND_5GHZ;
>> >>> -                     status.freq = b43_freq_to_channel_5ghz(chanid);
>> >>> +                     status.freq = b43_channel_to_freq_5ghz(chanid);
>> >>>               } else {
>> >>>                       status.band = IEEE80211_BAND_2GHZ;
>> >>> -                     status.freq = b43_freq_to_channel_2ghz(chanid);
>> >>> +                     status.freq = b43_channel_to_freq_2ghz(chanid);
>> >>>               }
>> >>>               break;
>> >>>       default:
>> >>
>> >> Why do you need this patch if you're going to remove these calls in the
>> >> next patch anyway?
>> >
>> > I was thinking about this for a moment too. You could just make a one
>> > patch and note in commit message that "translation" was reversed.
>>
>> That would mean mixing fixes and improvements, which is something you
>> are not supposed to do, so IMHO having these split into two is
>> correct. Think about stable maintainers wanting the fix but not the
>> other change because it might introduce unknown side effects.
>
> Makes sense.  In such case, the first patch should be clearly marked as
> a bug fix, so at least the commit message should be changed (ie.
> mentioning the next patch in the series is useless).
>

I am OK to send this fix either in one patch or two, actually I have
sent a version 2 which is a one patch version :-)

I'm not sure if this patch is needed for stable, yes, as you said, if
it's for stable, the commit message should be changed.

> --
> Luca.
>


From zajec5 at gmail.com  Fri Jan 17 04:37:22 2014
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Fri, 17 Jan 2014 10:37:22 +0100
Subject: [PATCH 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <CAAb+SYYyQF54Cib3Wae18orzH31RJ-vYoTEOBidMEPwVYYRv=g@mail.gmail.com>
References: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
 <1389939896.8062.53.camel@porter.coelho.fi>
 <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>
 <CAOiHx=nui0nVGiCLoukRovB3zY5jiKAt__Numo4y4bQv0dzOcQ@mail.gmail.com>
 <1389949304.8062.55.camel@porter.coelho.fi>
 <CAAb+SYYyQF54Cib3Wae18orzH31RJ-vYoTEOBidMEPwVYYRv=g@mail.gmail.com>
Message-ID: <CACna6rzTF8Wpj+Bn40iwEsZ9Ca+gE1ydYz1cgonb4u1rQPGQgw@mail.gmail.com>

2014/1/17 ZHAO Gang <gamerh2o at gmail.com>:
> On Fri, Jan 17, 2014 at 5:01 PM, Luca Coelho <luca at coelho.fi> wrote:
>> On Fri, 2014-01-17 at 09:56 +0100, Jonas Gorski wrote:
>>> On Fri, Jan 17, 2014 at 8:11 AM, Rafa? Mi?ecki <zajec5 at gmail.com> wrote:
>>> > 2014/1/17 Luca Coelho <luca at coelho.fi>:
>>> >> On Fri, 2014-01-17 at 13:27 +0800, ZHAO Gang wrote:
>>> >>> In following patch, replace b43 specific helper function with kernel
>>> >>> api to reduce code duplication.
>>> >>>
>>> >>> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
>>> >>> ---
>>> >>>  drivers/net/wireless/b43/xmit.c | 4 ++--
>>> >>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>> >>>
>>> >>> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
>>> >>> index 4ae63f4..50e5ddb 100644
>>> >>> --- a/drivers/net/wireless/b43/xmit.c
>>> >>> +++ b/drivers/net/wireless/b43/xmit.c
>>> >>> @@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>>> >>>                * channel number in b43. */
>>> >>>               if (chanstat & B43_RX_CHAN_5GHZ) {
>>> >>>                       status.band = IEEE80211_BAND_5GHZ;
>>> >>> -                     status.freq = b43_freq_to_channel_5ghz(chanid);
>>> >>> +                     status.freq = b43_channel_to_freq_5ghz(chanid);
>>> >>>               } else {
>>> >>>                       status.band = IEEE80211_BAND_2GHZ;
>>> >>> -                     status.freq = b43_freq_to_channel_2ghz(chanid);
>>> >>> +                     status.freq = b43_channel_to_freq_2ghz(chanid);
>>> >>>               }
>>> >>>               break;
>>> >>>       default:
>>> >>
>>> >> Why do you need this patch if you're going to remove these calls in the
>>> >> next patch anyway?
>>> >
>>> > I was thinking about this for a moment too. You could just make a one
>>> > patch and note in commit message that "translation" was reversed.
>>>
>>> That would mean mixing fixes and improvements, which is something you
>>> are not supposed to do, so IMHO having these split into two is
>>> correct. Think about stable maintainers wanting the fix but not the
>>> other change because it might introduce unknown side effects.
>>
>> Makes sense.  In such case, the first patch should be clearly marked as
>> a bug fix, so at least the commit message should be changed (ie.
>> mentioning the next patch in the series is useless).
>>
>
> I am OK to send this fix either in one patch or two, actually I have
> sent a version 2 which is a one patch version :-)
>
> I'm not sure if this patch is needed for stable, yes, as you said, if
> it's for stable, the commit message should be changed.

Thanks for your help guys.

I think it may be the best idea to send
1/2 as fix (probably 3.14) + stable CC
2/2 as improvement (for next)
Does it make sense?

-- 
Rafa?


From luca at coelho.fi  Fri Jan 17 04:53:38 2014
From: luca at coelho.fi (Luca Coelho)
Date: Fri, 17 Jan 2014 11:53:38 +0200
Subject: [PATCH 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <CACna6rzTF8Wpj+Bn40iwEsZ9Ca+gE1ydYz1cgonb4u1rQPGQgw@mail.gmail.com>
References: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
 <1389939896.8062.53.camel@porter.coelho.fi>
 <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>
 <CAOiHx=nui0nVGiCLoukRovB3zY5jiKAt__Numo4y4bQv0dzOcQ@mail.gmail.com>
 <1389949304.8062.55.camel@porter.coelho.fi>
 <CAAb+SYYyQF54Cib3Wae18orzH31RJ-vYoTEOBidMEPwVYYRv=g@mail.gmail.com>
 <CACna6rzTF8Wpj+Bn40iwEsZ9Ca+gE1ydYz1cgonb4u1rQPGQgw@mail.gmail.com>
Message-ID: <1389952418.8062.57.camel@porter.coelho.fi>

On Fri, 2014-01-17 at 10:37 +0100, Rafa? Mi?ecki wrote:
> 2014/1/17 ZHAO Gang <gamerh2o at gmail.com>:
> > On Fri, Jan 17, 2014 at 5:01 PM, Luca Coelho <luca at coelho.fi> wrote:
> >> On Fri, 2014-01-17 at 09:56 +0100, Jonas Gorski wrote:
> >>> On Fri, Jan 17, 2014 at 8:11 AM, Rafa? Mi?ecki <zajec5 at gmail.com> wrote:
> >>> > 2014/1/17 Luca Coelho <luca at coelho.fi>:
> >>> >> On Fri, 2014-01-17 at 13:27 +0800, ZHAO Gang wrote:
> >>> >>> In following patch, replace b43 specific helper function with kernel
> >>> >>> api to reduce code duplication.
> >>> >>>
> >>> >>> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
> >>> >>> ---
> >>> >>>  drivers/net/wireless/b43/xmit.c | 4 ++--
> >>> >>>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>> >>>
> >>> >>> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
> >>> >>> index 4ae63f4..50e5ddb 100644
> >>> >>> --- a/drivers/net/wireless/b43/xmit.c
> >>> >>> +++ b/drivers/net/wireless/b43/xmit.c
> >>> >>> @@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
> >>> >>>                * channel number in b43. */
> >>> >>>               if (chanstat & B43_RX_CHAN_5GHZ) {
> >>> >>>                       status.band = IEEE80211_BAND_5GHZ;
> >>> >>> -                     status.freq = b43_freq_to_channel_5ghz(chanid);
> >>> >>> +                     status.freq = b43_channel_to_freq_5ghz(chanid);
> >>> >>>               } else {
> >>> >>>                       status.band = IEEE80211_BAND_2GHZ;
> >>> >>> -                     status.freq = b43_freq_to_channel_2ghz(chanid);
> >>> >>> +                     status.freq = b43_channel_to_freq_2ghz(chanid);
> >>> >>>               }
> >>> >>>               break;
> >>> >>>       default:
> >>> >>
> >>> >> Why do you need this patch if you're going to remove these calls in the
> >>> >> next patch anyway?
> >>> >
> >>> > I was thinking about this for a moment too. You could just make a one
> >>> > patch and note in commit message that "translation" was reversed.
> >>>
> >>> That would mean mixing fixes and improvements, which is something you
> >>> are not supposed to do, so IMHO having these split into two is
> >>> correct. Think about stable maintainers wanting the fix but not the
> >>> other change because it might introduce unknown side effects.
> >>
> >> Makes sense.  In such case, the first patch should be clearly marked as
> >> a bug fix, so at least the commit message should be changed (ie.
> >> mentioning the next patch in the series is useless).
> >>
> >
> > I am OK to send this fix either in one patch or two, actually I have
> > sent a version 2 which is a one patch version :-)
> >
> > I'm not sure if this patch is needed for stable, yes, as you said, if
> > it's for stable, the commit message should be changed.
> 
> Thanks for your help guys.
> 
> I think it may be the best idea to send
> 1/2 as fix (probably 3.14) + stable CC
> 2/2 as improvement (for next)
> Does it make sense?

Sounds good to me.  The actual fix is so simple and obvious that I don't
see any reason for not sending it as a fix + stable.

--
Luca.



From gamerh2o at gmail.com  Fri Jan 17 07:56:45 2014
From: gamerh2o at gmail.com (ZHAO Gang)
Date: Fri, 17 Jan 2014 20:56:45 +0800
Subject: [PATCH 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <1389952418.8062.57.camel@porter.coelho.fi>
References: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
 <1389939896.8062.53.camel@porter.coelho.fi>
 <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>
 <CAOiHx=nui0nVGiCLoukRovB3zY5jiKAt__Numo4y4bQv0dzOcQ@mail.gmail.com>
 <1389949304.8062.55.camel@porter.coelho.fi>
 <CAAb+SYYyQF54Cib3Wae18orzH31RJ-vYoTEOBidMEPwVYYRv=g@mail.gmail.com>
 <CACna6rzTF8Wpj+Bn40iwEsZ9Ca+gE1ydYz1cgonb4u1rQPGQgw@mail.gmail.com>
 <1389952418.8062.57.camel@porter.coelho.fi>
Message-ID: <CAAb+SYacFzn_ybhtVbH6upNbvL8L3xf299TPeJnExcmiqLk5Sw@mail.gmail.com>

On Fri, Jan 17, 2014 at 5:53 PM, Luca Coelho <luca at coelho.fi> wrote:
> On Fri, 2014-01-17 at 10:37 +0100, Rafa? Mi?ecki wrote:
>> 2014/1/17 ZHAO Gang <gamerh2o at gmail.com>:
>> > On Fri, Jan 17, 2014 at 5:01 PM, Luca Coelho <luca at coelho.fi> wrote:
>> >> On Fri, 2014-01-17 at 09:56 +0100, Jonas Gorski wrote:
>> >>> On Fri, Jan 17, 2014 at 8:11 AM, Rafa? Mi?ecki <zajec5 at gmail.com> wrote:
>> >>> > 2014/1/17 Luca Coelho <luca at coelho.fi>:
>> >>> >> On Fri, 2014-01-17 at 13:27 +0800, ZHAO Gang wrote:
>> >>> >>> In following patch, replace b43 specific helper function with kernel
>> >>> >>> api to reduce code duplication.
>> >>> >>>
>> >>> >>> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
>> >>> >>> ---
>> >>> >>>  drivers/net/wireless/b43/xmit.c | 4 ++--
>> >>> >>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> >>> >>>
>> >>> >>> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
>> >>> >>> index 4ae63f4..50e5ddb 100644
>> >>> >>> --- a/drivers/net/wireless/b43/xmit.c
>> >>> >>> +++ b/drivers/net/wireless/b43/xmit.c
>> >>> >>> @@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>> >>> >>>                * channel number in b43. */
>> >>> >>>               if (chanstat & B43_RX_CHAN_5GHZ) {
>> >>> >>>                       status.band = IEEE80211_BAND_5GHZ;
>> >>> >>> -                     status.freq = b43_freq_to_channel_5ghz(chanid);
>> >>> >>> +                     status.freq = b43_channel_to_freq_5ghz(chanid);
>> >>> >>>               } else {
>> >>> >>>                       status.band = IEEE80211_BAND_2GHZ;
>> >>> >>> -                     status.freq = b43_freq_to_channel_2ghz(chanid);
>> >>> >>> +                     status.freq = b43_channel_to_freq_2ghz(chanid);
>> >>> >>>               }
>> >>> >>>               break;
>> >>> >>>       default:
>> >>> >>
>> >>> >> Why do you need this patch if you're going to remove these calls in the
>> >>> >> next patch anyway?
>> >>> >
>> >>> > I was thinking about this for a moment too. You could just make a one
>> >>> > patch and note in commit message that "translation" was reversed.
>> >>>
>> >>> That would mean mixing fixes and improvements, which is something you
>> >>> are not supposed to do, so IMHO having these split into two is
>> >>> correct. Think about stable maintainers wanting the fix but not the
>> >>> other change because it might introduce unknown side effects.
>> >>
>> >> Makes sense.  In such case, the first patch should be clearly marked as
>> >> a bug fix, so at least the commit message should be changed (ie.
>> >> mentioning the next patch in the series is useless).
>> >>
>> >
>> > I am OK to send this fix either in one patch or two, actually I have
>> > sent a version 2 which is a one patch version :-)
>> >
>> > I'm not sure if this patch is needed for stable, yes, as you said, if
>> > it's for stable, the commit message should be changed.
>>
>> Thanks for your help guys.
>>
>> I think it may be the best idea to send
>> 1/2 as fix (probably 3.14) + stable CC
>> 2/2 as improvement (for next)
>> Does it make sense?
>
> Sounds good to me.  The actual fix is so simple and obvious that I don't
> see any reason for not sending it as a fix + stable.
>

Hi, after reading the code, it seems that status.freq is not actually used
in rx path, so this fix has no user sensible changes. So I think it is
not needed
to send this patch to stable.

Anyway, I should mention that the version 2 patch should be ignored.

> --
> Luca.
>


From gamerh2o at gmail.com  Fri Jan 17 07:59:18 2014
From: gamerh2o at gmail.com (ZHAO Gang)
Date: Fri, 17 Jan 2014 20:59:18 +0800
Subject: [PATCH v2] b43: use kernel api to replace b43 specific helper
 function
In-Reply-To: <8b96c31da0f8a23b8e99ed790e462bd933925041.1389947627.git.gamerh2o@gmail.com>
References: <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>
 <8b96c31da0f8a23b8e99ed790e462bd933925041.1389947627.git.gamerh2o@gmail.com>
Message-ID: <CAAb+SYZ4K1iLLiZG-RjyJeBjUu13QVGH2XgBGyWKE1_U6fQZWw@mail.gmail.com>

On Fri, Jan 17, 2014 at 5:11 PM, ZHAO Gang <gamerh2o at gmail.com> wrote:
> The b43_freq_to_channel_{2,5}ghz() should be changed to
> b43_channel_to_freq{2,5}ghz() if we want to use b43 helper function,
> but a better way is to use kernel api ieee80211_channel_to_frequency()
> and remove these unnecessary helper function.
>
> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
> ---
> v2: combine two patches to one.
>     suggested by Luca Coelho and Rafa? Mi?ecki
>

The version 2 patch should be ignored. After more discussion, it seems it's
good to let the fix be two patches.

>  drivers/net/wireless/b43/main.h | 35 -----------------------------------
>  drivers/net/wireless/b43/xmit.c | 12 ++++++------
>  2 files changed, 6 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
> index abac25e..f476fc3 100644
> --- a/drivers/net/wireless/b43/main.h
> +++ b/drivers/net/wireless/b43/main.h
> @@ -58,41 +58,6 @@ enum b43_verbosity {
>  #endif
>  };
>
> -
> -/* Lightweight function to convert a frequency (in Mhz) to a channel number. */
> -static inline u8 b43_freq_to_channel_5ghz(int freq)
> -{
> -       return ((freq - 5000) / 5);
> -}
> -static inline u8 b43_freq_to_channel_2ghz(int freq)
> -{
> -       u8 channel;
> -
> -       if (freq == 2484)
> -               channel = 14;
> -       else
> -               channel = (freq - 2407) / 5;
> -
> -       return channel;
> -}
> -
> -/* Lightweight function to convert a channel number to a frequency (in Mhz). */
> -static inline int b43_channel_to_freq_5ghz(u8 channel)
> -{
> -       return (5000 + (5 * channel));
> -}
> -static inline int b43_channel_to_freq_2ghz(u8 channel)
> -{
> -       int freq;
> -
> -       if (channel == 14)
> -               freq = 2484;
> -       else
> -               freq = 2407 + (5 * channel);
> -
> -       return freq;
> -}
> -
>  static inline int b43_is_cck_rate(int rate)
>  {
>         return (rate == B43_CCK_RATE_1MB ||
> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
> index 4ae63f4..218a0f3 100644
> --- a/drivers/net/wireless/b43/xmit.c
> +++ b/drivers/net/wireless/b43/xmit.c
> @@ -806,7 +806,8 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>                 B43_WARN_ON(1);
>                 /* FIXME: We don't really know which value the "chanid" contains.
>                  *        So the following assignment might be wrong. */
> -               status.freq = b43_channel_to_freq_5ghz(chanid);
> +               status.freq =
> +                       ieee80211_channel_to_frequency(chanid, status.band);
>                 break;
>         case B43_PHYTYPE_G:
>                 status.band = IEEE80211_BAND_2GHZ;
> @@ -819,13 +820,12 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>         case B43_PHYTYPE_HT:
>                 /* chanid is the SHM channel cookie. Which is the plain
>                  * channel number in b43. */
> -               if (chanstat & B43_RX_CHAN_5GHZ) {
> +               if (chanstat & B43_RX_CHAN_5GHZ)
>                         status.band = IEEE80211_BAND_5GHZ;
> -                       status.freq = b43_freq_to_channel_5ghz(chanid);
> -               } else {
> +               else
>                         status.band = IEEE80211_BAND_2GHZ;
> -                       status.freq = b43_freq_to_channel_2ghz(chanid);
> -               }
> +               status.freq =
> +                       ieee80211_channel_to_frequency(chanid, status.band);
>                 break;
>         default:
>                 B43_WARN_ON(1);
> --
> 1.8.4.2
>


From gamerh2o at gmail.com  Fri Jan 17 09:00:07 2014
From: gamerh2o at gmail.com (ZHAO Gang)
Date: Fri, 17 Jan 2014 22:00:07 +0800
Subject: [PATCH 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <CAAb+SYacFzn_ybhtVbH6upNbvL8L3xf299TPeJnExcmiqLk5Sw@mail.gmail.com>
References: <a8aa052ea196de8256dcdc5b3ae81cfa64d3f9ff.1389935084.git.gamerh2o@gmail.com>
 <1389939896.8062.53.camel@porter.coelho.fi>
 <CACna6rzkKGxBxReQJ0Y=TscY8GJ+r=S+6Cs+g+B0=7k1FFxW2w@mail.gmail.com>
 <CAOiHx=nui0nVGiCLoukRovB3zY5jiKAt__Numo4y4bQv0dzOcQ@mail.gmail.com>
 <1389949304.8062.55.camel@porter.coelho.fi>
 <CAAb+SYYyQF54Cib3Wae18orzH31RJ-vYoTEOBidMEPwVYYRv=g@mail.gmail.com>
 <CACna6rzTF8Wpj+Bn40iwEsZ9Ca+gE1ydYz1cgonb4u1rQPGQgw@mail.gmail.com>
 <1389952418.8062.57.camel@porter.coelho.fi>
 <CAAb+SYacFzn_ybhtVbH6upNbvL8L3xf299TPeJnExcmiqLk5Sw@mail.gmail.com>
Message-ID: <CAAb+SYayF=9TrrVQz34FRfvFCFF4-OUW05LBbVwYCs-sXcB4Vg@mail.gmail.com>

On Fri, Jan 17, 2014 at 8:56 PM, ZHAO Gang <gamerh2o at gmail.com> wrote:
> On Fri, Jan 17, 2014 at 5:53 PM, Luca Coelho <luca at coelho.fi> wrote:
>> On Fri, 2014-01-17 at 10:37 +0100, Rafa? Mi?ecki wrote:
>>> 2014/1/17 ZHAO Gang <gamerh2o at gmail.com>:
>>> > On Fri, Jan 17, 2014 at 5:01 PM, Luca Coelho <luca at coelho.fi> wrote:
>>> >> On Fri, 2014-01-17 at 09:56 +0100, Jonas Gorski wrote:
>>> >>> On Fri, Jan 17, 2014 at 8:11 AM, Rafa? Mi?ecki <zajec5 at gmail.com> wrote:
>>> >>> > 2014/1/17 Luca Coelho <luca at coelho.fi>:
>>> >>> >> On Fri, 2014-01-17 at 13:27 +0800, ZHAO Gang wrote:
>>> >>> >>> In following patch, replace b43 specific helper function with kernel
>>> >>> >>> api to reduce code duplication.
>>> >>> >>>
>>> >>> >>> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
>>> >>> >>> ---
>>> >>> >>>  drivers/net/wireless/b43/xmit.c | 4 ++--
>>> >>> >>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>> >>> >>>
>>> >>> >>> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
>>> >>> >>> index 4ae63f4..50e5ddb 100644
>>> >>> >>> --- a/drivers/net/wireless/b43/xmit.c
>>> >>> >>> +++ b/drivers/net/wireless/b43/xmit.c
>>> >>> >>> @@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>>> >>> >>>                * channel number in b43. */
>>> >>> >>>               if (chanstat & B43_RX_CHAN_5GHZ) {
>>> >>> >>>                       status.band = IEEE80211_BAND_5GHZ;
>>> >>> >>> -                     status.freq = b43_freq_to_channel_5ghz(chanid);
>>> >>> >>> +                     status.freq = b43_channel_to_freq_5ghz(chanid);
>>> >>> >>>               } else {
>>> >>> >>>                       status.band = IEEE80211_BAND_2GHZ;
>>> >>> >>> -                     status.freq = b43_freq_to_channel_2ghz(chanid);
>>> >>> >>> +                     status.freq = b43_channel_to_freq_2ghz(chanid);
>>> >>> >>>               }
>>> >>> >>>               break;
>>> >>> >>>       default:
>>> >>> >>
>>> >>> >> Why do you need this patch if you're going to remove these calls in the
>>> >>> >> next patch anyway?
>>> >>> >
>>> >>> > I was thinking about this for a moment too. You could just make a one
>>> >>> > patch and note in commit message that "translation" was reversed.
>>> >>>
>>> >>> That would mean mixing fixes and improvements, which is something you
>>> >>> are not supposed to do, so IMHO having these split into two is
>>> >>> correct. Think about stable maintainers wanting the fix but not the
>>> >>> other change because it might introduce unknown side effects.
>>> >>
>>> >> Makes sense.  In such case, the first patch should be clearly marked as
>>> >> a bug fix, so at least the commit message should be changed (ie.
>>> >> mentioning the next patch in the series is useless).
>>> >>
>>> >
>>> > I am OK to send this fix either in one patch or two, actually I have
>>> > sent a version 2 which is a one patch version :-)
>>> >
>>> > I'm not sure if this patch is needed for stable, yes, as you said, if
>>> > it's for stable, the commit message should be changed.
>>>
>>> Thanks for your help guys.
>>>
>>> I think it may be the best idea to send
>>> 1/2 as fix (probably 3.14) + stable CC
>>> 2/2 as improvement (for next)
>>> Does it make sense?
>>
>> Sounds good to me.  The actual fix is so simple and obvious that I don't
>> see any reason for not sending it as a fix + stable.
>>
>
> Hi, after reading the code, it seems that status.freq is not actually used
> in rx path, so this fix has no user sensible changes. So I think it is
> not needed
> to send this patch to stable.
>

Oh yes, at least it's used in ieee80211_rx -> __ieee80211_rx_handle_packet ->
ieee80211_scan_rx -> ieee80211_get_channel(local->hw.wiphy, rx_status->freq)

Now I think it should be sent to stable. I think I should resend the two patches
to update the commit message.

> Anyway, I should mention that the version 2 patch should be ignored.
>
>> --
>> Luca.
>>


From gamerh2o at gmail.com  Fri Jan 17 10:19:13 2014
From: gamerh2o at gmail.com (ZHAO Gang)
Date: Fri, 17 Jan 2014 23:19:13 +0800
Subject: [PATCH v3 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
Message-ID: <b28b37da08e43e0f459c5094ed210649ab1f7090.1389970392.git.gamerh2o@gmail.com>

Use the right function to update status.freq. The wrong frequency
value can cause problem that bss info can't be updated when it
should be.

This bug is introduced by commit 8318d78a44d49ac1edf2bdec7299de3617c4232e
"cfg80211 API for channels/bitrates, mac80211 and driver conversion".

Cc: Stable <stable at vger.kernel.org>
Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
---
v3: change commit log
    suggested by Luca Coelho, Rafa? Mi?ecki and Jonas Gorski

I'm not very familiar with wireless subsystem yet. If commit message needs
more changes, feel free to point it out.

 drivers/net/wireless/b43/xmit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 4ae63f4..50e5ddb 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 		 * channel number in b43. */
 		if (chanstat & B43_RX_CHAN_5GHZ) {
 			status.band = IEEE80211_BAND_5GHZ;
-			status.freq = b43_freq_to_channel_5ghz(chanid);
+			status.freq = b43_channel_to_freq_5ghz(chanid);
 		} else {
 			status.band = IEEE80211_BAND_2GHZ;
-			status.freq = b43_freq_to_channel_2ghz(chanid);
+			status.freq = b43_channel_to_freq_2ghz(chanid);
 		}
 		break;
 	default:
-- 
1.8.4.2



From gamerh2o at gmail.com  Fri Jan 17 10:19:14 2014
From: gamerh2o at gmail.com (ZHAO Gang)
Date: Fri, 17 Jan 2014 23:19:14 +0800
Subject: [PATCH v3 2/2] b43: use kernel api to replace b43 specific helper
 function
In-Reply-To: <b28b37da08e43e0f459c5094ed210649ab1f7090.1389970392.git.gamerh2o@gmail.com>
References: <b28b37da08e43e0f459c5094ed210649ab1f7090.1389970392.git.gamerh2o@gmail.com>
Message-ID: <55214eacffbb07577f07b58f3333f151af469720.1389970392.git.gamerh2o@gmail.com>

Use ieee80211_channel_to_frequency() to replace b43_channel_to_freq_{2,5}ghz(),
and remove unused b43_freq_to_channel_{2,5}ghz().

Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
---
v3: let this fix be two patches again.
    first patch is fix, second patch is improvement.

 drivers/net/wireless/b43/main.h | 35 -----------------------------------
 drivers/net/wireless/b43/xmit.c | 12 ++++++------
 2 files changed, 6 insertions(+), 41 deletions(-)

diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index abac25e..f476fc3 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -58,41 +58,6 @@ enum b43_verbosity {
 #endif
 };
 
-
-/* Lightweight function to convert a frequency (in Mhz) to a channel number. */
-static inline u8 b43_freq_to_channel_5ghz(int freq)
-{
-	return ((freq - 5000) / 5);
-}
-static inline u8 b43_freq_to_channel_2ghz(int freq)
-{
-	u8 channel;
-
-	if (freq == 2484)
-		channel = 14;
-	else
-		channel = (freq - 2407) / 5;
-
-	return channel;
-}
-
-/* Lightweight function to convert a channel number to a frequency (in Mhz). */
-static inline int b43_channel_to_freq_5ghz(u8 channel)
-{
-	return (5000 + (5 * channel));
-}
-static inline int b43_channel_to_freq_2ghz(u8 channel)
-{
-	int freq;
-
-	if (channel == 14)
-		freq = 2484;
-	else
-		freq = 2407 + (5 * channel);
-
-	return freq;
-}
-
 static inline int b43_is_cck_rate(int rate)
 {
 	return (rate == B43_CCK_RATE_1MB ||
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 50e5ddb..218a0f3 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -806,7 +806,8 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 		B43_WARN_ON(1);
 		/* FIXME: We don't really know which value the "chanid" contains.
 		 *        So the following assignment might be wrong. */
-		status.freq = b43_channel_to_freq_5ghz(chanid);
+		status.freq =
+			ieee80211_channel_to_frequency(chanid, status.band);
 		break;
 	case B43_PHYTYPE_G:
 		status.band = IEEE80211_BAND_2GHZ;
@@ -819,13 +820,12 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 	case B43_PHYTYPE_HT:
 		/* chanid is the SHM channel cookie. Which is the plain
 		 * channel number in b43. */
-		if (chanstat & B43_RX_CHAN_5GHZ) {
+		if (chanstat & B43_RX_CHAN_5GHZ)
 			status.band = IEEE80211_BAND_5GHZ;
-			status.freq = b43_channel_to_freq_5ghz(chanid);
-		} else {
+		else
 			status.band = IEEE80211_BAND_2GHZ;
-			status.freq = b43_channel_to_freq_2ghz(chanid);
-		}
+		status.freq =
+			ieee80211_channel_to_frequency(chanid, status.band);
 		break;
 	default:
 		B43_WARN_ON(1);
-- 
1.8.4.2



From johannes at sipsolutions.net  Fri Jan 17 10:29:03 2014
From: johannes at sipsolutions.net (Johannes Berg)
Date: Fri, 17 Jan 2014 16:29:03 +0100
Subject: [PATCH v3 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <b28b37da08e43e0f459c5094ed210649ab1f7090.1389970392.git.gamerh2o@gmail.com>
 (sfid-20140117_161955_063280_BEA8D929)
References: <b28b37da08e43e0f459c5094ed210649ab1f7090.1389970392.git.gamerh2o@gmail.com>
 (sfid-20140117_161955_063280_BEA8D929)
Message-ID: <1389972543.10404.5.camel@jlt4.sipsolutions.net>

On Fri, 2014-01-17 at 23:19 +0800, ZHAO Gang wrote:
> Use the right function to update status.freq. The wrong frequency
> value can cause problem that bss info can't be updated when it
> should be.
> 
> This bug is introduced by commit 8318d78a44d49ac1edf2bdec7299de3617c4232e
> "cfg80211 API for channels/bitrates, mac80211 and driver conversion".
> 
> Cc: Stable <stable at vger.kernel.org>
> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
> ---
> v3: change commit log
>     suggested by Luca Coelho, Rafa? Mi?ecki and Jonas Gorski
> 
> I'm not very familiar with wireless subsystem yet. If commit message needs
> more changes, feel free to point it out.

In general, you should also put a Fixes: pseudo-header (with 12-digit
commit ID and commit subject) into such commits, so this would be:

Cc: stable at vger.kernel.org
Fixes: 8318d78a44d4 ("cfg80211 API for channels/bitrates, mac80211 and driver conversion")
Signed-off-by: ...


Thanks for fixing this!

johannes



From gamerh2o at gmail.com  Fri Jan 17 11:17:38 2014
From: gamerh2o at gmail.com (ZHAO Gang)
Date: Sat, 18 Jan 2014 00:17:38 +0800
Subject: [PATCH v4 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
Message-ID: <d4d1340a176aee1e58ffe80e83ddc3394f2829e3.1389975095.git.gamerh2o@gmail.com>

Use the right function to update frequency value.

If rx skb is probe response or beacon, the wrong frequency value can
cause problem that bss info can't be updated when it should be.

Cc: <stable at vger.kernel.org>
Fixes: 8318d78a44d4 ("cfg80211 API for channels/bitrates, mac80211
and driver conversion")
Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
---
v4: change commit message
    suggested by Johannes Berg

 drivers/net/wireless/b43/xmit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 4ae63f4..50e5ddb 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 		 * channel number in b43. */
 		if (chanstat & B43_RX_CHAN_5GHZ) {
 			status.band = IEEE80211_BAND_5GHZ;
-			status.freq = b43_freq_to_channel_5ghz(chanid);
+			status.freq = b43_channel_to_freq_5ghz(chanid);
 		} else {
 			status.band = IEEE80211_BAND_2GHZ;
-			status.freq = b43_freq_to_channel_2ghz(chanid);
+			status.freq = b43_channel_to_freq_2ghz(chanid);
 		}
 		break;
 	default:
-- 
1.8.4.2



From gamerh2o at gmail.com  Fri Jan 17 11:17:39 2014
From: gamerh2o at gmail.com (ZHAO Gang)
Date: Sat, 18 Jan 2014 00:17:39 +0800
Subject: [PATCH v4 2/2] b43: use kernel api to replace b43 specific helper
 function
In-Reply-To: <d4d1340a176aee1e58ffe80e83ddc3394f2829e3.1389975095.git.gamerh2o@gmail.com>
References: <d4d1340a176aee1e58ffe80e83ddc3394f2829e3.1389975095.git.gamerh2o@gmail.com>
Message-ID: <1d5702e0bc7bddf7d1fbd5d068d8eaa2025bf32c.1389975095.git.gamerh2o@gmail.com>

Use ieee80211_channel_to_frequency() to replace b43_channel_to_freq_{2,5}ghz(),
and remove unused b43_freq_to_channel_{2,5}ghz().

Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
---
v4: bump version to consistent with first patch.

 drivers/net/wireless/b43/main.h | 35 -----------------------------------
 drivers/net/wireless/b43/xmit.c | 12 ++++++------
 2 files changed, 6 insertions(+), 41 deletions(-)

diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index abac25e..f476fc3 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -58,41 +58,6 @@ enum b43_verbosity {
 #endif
 };
 
-
-/* Lightweight function to convert a frequency (in Mhz) to a channel number. */
-static inline u8 b43_freq_to_channel_5ghz(int freq)
-{
-	return ((freq - 5000) / 5);
-}
-static inline u8 b43_freq_to_channel_2ghz(int freq)
-{
-	u8 channel;
-
-	if (freq == 2484)
-		channel = 14;
-	else
-		channel = (freq - 2407) / 5;
-
-	return channel;
-}
-
-/* Lightweight function to convert a channel number to a frequency (in Mhz). */
-static inline int b43_channel_to_freq_5ghz(u8 channel)
-{
-	return (5000 + (5 * channel));
-}
-static inline int b43_channel_to_freq_2ghz(u8 channel)
-{
-	int freq;
-
-	if (channel == 14)
-		freq = 2484;
-	else
-		freq = 2407 + (5 * channel);
-
-	return freq;
-}
-
 static inline int b43_is_cck_rate(int rate)
 {
 	return (rate == B43_CCK_RATE_1MB ||
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 50e5ddb..218a0f3 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -806,7 +806,8 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 		B43_WARN_ON(1);
 		/* FIXME: We don't really know which value the "chanid" contains.
 		 *        So the following assignment might be wrong. */
-		status.freq = b43_channel_to_freq_5ghz(chanid);
+		status.freq =
+			ieee80211_channel_to_frequency(chanid, status.band);
 		break;
 	case B43_PHYTYPE_G:
 		status.band = IEEE80211_BAND_2GHZ;
@@ -819,13 +820,12 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 	case B43_PHYTYPE_HT:
 		/* chanid is the SHM channel cookie. Which is the plain
 		 * channel number in b43. */
-		if (chanstat & B43_RX_CHAN_5GHZ) {
+		if (chanstat & B43_RX_CHAN_5GHZ)
 			status.band = IEEE80211_BAND_5GHZ;
-			status.freq = b43_channel_to_freq_5ghz(chanid);
-		} else {
+		else
 			status.band = IEEE80211_BAND_2GHZ;
-			status.freq = b43_channel_to_freq_2ghz(chanid);
-		}
+		status.freq =
+			ieee80211_channel_to_frequency(chanid, status.band);
 		break;
 	default:
 		B43_WARN_ON(1);
-- 
1.8.4.2



From Larry.Finger at lwfinger.net  Fri Jan 17 17:18:07 2014
From: Larry.Finger at lwfinger.net (Larry Finger)
Date: Fri, 17 Jan 2014 16:18:07 -0600
Subject: [PATCH v4 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <d4d1340a176aee1e58ffe80e83ddc3394f2829e3.1389975095.git.gamerh2o@gmail.com>
References: <d4d1340a176aee1e58ffe80e83ddc3394f2829e3.1389975095.git.gamerh2o@gmail.com>
Message-ID: <52D9AC1F.6090002@lwfinger.net>

On 01/17/2014 10:17 AM, ZHAO Gang wrote:
> Use the right function to update frequency value.
>
> If rx skb is probe response or beacon, the wrong frequency value can
> cause problem that bss info can't be updated when it should be.
>
> Cc: <stable at vger.kernel.org>
> Fixes: 8318d78a44d4 ("cfg80211 API for channels/bitrates, mac80211
> and driver conversion")
> Signed-off-by: ZHAO Gang <gamerh2o at gmail.com>
> ---

This patch seems to fix a problem that caused scanning under NetworkManager to 
fail. The symptom was that no available networks were seen in the NM applet 
after a connection was made. Now the available AP list remains populated.

Acked-by: Larry Finger <Larry.Finger at lwfinger.net>

Larry




From wyattfward at gmail.com  Fri Jan 24 20:47:41 2014
From: wyattfward at gmail.com (Wyatt Ward)
Date: Fri, 24 Jan 2014 20:47:41 -0500
Subject: I'm not sure which one of you to send this to, but I do have a
 bug to report.
In-Reply-To: <CADzE2xw0vpeOXxVLdvnfnX57+gRnthrrSnNy=S0HVhH19YS7bQ@mail.gmail.com>
References: <CADzE2xw0vpeOXxVLdvnfnX57+gRnthrrSnNy=S0HVhH19YS7bQ@mail.gmail.com>
Message-ID: <CADzE2xzAaGUQ8XWCA4vjJPO5oxFq8VCiJKHWEd0-1FTvUFxxFw@mail.gmail.com>

Sorry, I forgot something: I think the config line in the kernel
compilation that fixed everything was `CONFIG_BCMA_BLOCKIO=y`. This
stops BCMA from interfacing with devices, correct? Anyway, with SSB
only, my card is working again at a normal speed.

On Fri, Jan 24, 2014 at 8:45 PM, Wyatt Ward <wyattfward at gmail.com> wrote:
> I have a bcm4311 chipset; it is identified in `lspci -vnn` as:
>     01:00.0 Network controller [0280]: Broadcom Corporation BCM4311
> 802.11a/b/g [14e4:4312] (rev 01)
>
> Without compiling the kernel with some of BCMA disabled, I cannot make
> my card work at a decent speed.
>
> This is in Linux Kernel 3.13, but I have had this problem with other
> recent kernel versions.
> My hardware is a late 2006, Intel Core 2 Duo iMac, and the linux
> distro  is Mint 16.
>
> The problem is that both  SSB  and BCMA are loading to support the b43
>  module, where I only want SSB to load. I had this issue in 3.11, and
> my custom build of 3.13 worked, but I don't see any changes to b43 or
> BCMA that would effect this. I think that it was my tweaking of the
> compile options for BCMA fixed this, but in any case
>
> I believe that the SSB and BCMA modules are  interfering with each
> other, killing my network speed seemingly at random.
> I think it's because my card (*'0x4312') is being recognized in bcma
> as a supported bcm4312 or 4313 chipset, when it actually can indicate
> a 4311 chipset, which, as far as i know, is not supported by these, or
> brcmsmac. I have to admit I am not clear on the differences between
> these chipsets, but I do know the 4312 is a PHY device, and as far as
> I know, the 4313 is an upgraded 4311.
>
> Attached are the `lspci` and `lsmod` outputs for when the 3.13 kernel
> is loaded and when the 3.11 kernel is loaded. I believe that without
> tweaking my compile settings, my system would still be behaving badly.
> The 3.13 kernel works, and lsmod shows that bcma is not loaded. 3.11
> doesn't and shows it as loaded. I am having a hard time finding my
> unmodified .config file for the kernel, but i have an intermediate
> step's config file which also exhibited the problems. The `lsmod` and
> `lspci` files also contain the outputs of `uname --all` so you can see
> details of the kernel being used when I performed each test.
>
> I apologize if I am giving too much information, but I have never
> reported a bug in the Linux Kernel before. I hope I did alright :)
> -Wyatt


From zajec5 at gmail.com  Sat Jan 25 16:53:25 2014
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Sat, 25 Jan 2014 22:53:25 +0100
Subject: I'm not sure which one of you to send this to, but I do have a
 bug to report.
In-Reply-To: <CADzE2xw0vpeOXxVLdvnfnX57+gRnthrrSnNy=S0HVhH19YS7bQ@mail.gmail.com>
References: <CADzE2xw0vpeOXxVLdvnfnX57+gRnthrrSnNy=S0HVhH19YS7bQ@mail.gmail.com>
Message-ID: <CACna6ryE1At0K9TPddN6T-ySPPK+RwCsMO60yUd_RAgQDdpY8w@mail.gmail.com>

2014/1/25 Wyatt Ward <wyattfward at gmail.com>:
> The problem is that both  SSB  and BCMA are loading to support the b43
>  module, where I only want SSB to load. I had this issue in 3.11, and
> my custom build of 3.13 worked, but I don't see any changes to b43 or
> BCMA that would effect this. I think that it was my tweaking of the
> compile options for BCMA fixed this, but in any case
>
> I believe that the SSB and BCMA modules are  interfering with each
> other, killing my network speed seemingly at random.

Loading b43 (when compiled with BCMA support) will cause loading both:
ssb and bcma. That's true, this is caused by symbols b43 uses. This is
expected.

Now look at drivers/bcma/host_pci.c and try to find a reference to
0x4312 (since your card it 14e4:4312). Or try to find a sign of "bcma"
in dmesg.

bcma does not try to touch 14e4:4312 in any way. It gets loaded but
does nothing.

There must be something else in your builds affecting performance. If
you want to compare 2 kernels, remember to do cold boots. Some things
in (WiFi) hardware configuration may survive reboot.


From zajec5 at gmail.com  Sun Jan 26 09:35:42 2014
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Sun, 26 Jan 2014 15:35:42 +0100
Subject: [PATCH v4 1/2] b43: fix the wrong assignment of status.freq in
 b43_rx()
In-Reply-To: <d4d1340a176aee1e58ffe80e83ddc3394f2829e3.1389975095.git.gamerh2o@gmail.com>
References: <d4d1340a176aee1e58ffe80e83ddc3394f2829e3.1389975095.git.gamerh2o@gmail.com>
Message-ID: <CACna6rw3GuZ-hmGJvQRQvb33GtSFrA50OpQjyjwYcUHQsHK-fQ@mail.gmail.com>

2014/1/17 ZHAO Gang <gamerh2o at gmail.com>:
> Use the right function to update frequency value.
>
> If rx skb is probe response or beacon, the wrong frequency value can
> cause problem that bss info can't be updated when it should be.

Zhao: this fix is great. My development machine was running some
ancient distro with kernel 2.6.22, so I couldn't test it earlier.

For a long time I got problem with finding AP on channel 13. I reported it in:
cfg80211: use DS or HT operation IEs to determine BSS channel"

I did 10 tests *without* your patch. wpa_supplicant had to scan 43,
33, 7, 2, 46, 12, 7, 32, 6, 6 times to find my AP on channel 13.
With your patch wpa_supplicant finds it in scanning results after the first try!

Thanks a lot for finding and fixing it!

[0] http://lists.infradead.org/pipermail/b43-dev/2013-March/003003.html


From zajec5 at gmail.com  Sun Jan 26 09:37:37 2014
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Sun, 26 Jan 2014 15:37:37 +0100
Subject: Scanning regression since "cfg80211: use DS or HT operation IEs
 to determine BSS channel"
In-Reply-To: <CACna6rwdAAsCX76=nwHpj-grVvQznbNCPVnpXL9kP2TkvhR-yw@mail.gmail.com>
References: <CACna6rwdAAsCX76=nwHpj-grVvQznbNCPVnpXL9kP2TkvhR-yw@mail.gmail.com>
Message-ID: <CACna6ryDakV+oo6pW1BN5rcDPqR9=1khUHtYqmtTf85JR5x2Lg@mail.gmail.com>

2013/3/26 Rafa? Mi?ecki <zajec5 at gmail.com>:
> I've just finished bisecting wireless scanning regression I'm
> experiencing with my 14e4:432b (BCM4322) and b43 driver.
>
> The problem is getting my network visible in scanning results (iw dev
> wlan0 scan). I've to repeat scanning dozens of time to notice my AP.
> It's also well visible when using wpa_supplicant. It takes from 20s to
> 100s before I get the "Trying to authenticate with".
> The performance however is not affected. Once I connect to my network,
> I can transmit (tested with iperf) with stable 21.5Mb/s which is just
> great for 802.11g.
>
> After going back to the kernel before that commit it takes
> wpa_supplicant less than 2 seconds to connect to my WiFi network.
>
> My network is at channel 13, I still have to verify if it matters.
>
> Any thought about that?
>
>
> The first bad commit (I've verified manually after bisecting) appears to be:
>
> 0172bb75073e11a5aa9d8a953bdaefb8709f00c8 is the first bad commit
> commit 0172bb75073e11a5aa9d8a953bdaefb8709f00c8
> Author: Johannes Berg <johannes.berg at intel.com>
> Date:   Fri Nov 23 14:23:30 2012 +0100
>
>     cfg80211: use DS or HT operation IEs to determine BSS channel

This has been finally fixed in 64e5acb09ca6b50c97299cff9ef51299470b29f2 [0].

[0] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=64e5acb09ca6b50c97299cff9ef51299470b29f2


From johannes at sipsolutions.net  Mon Jan 27 03:43:24 2014
From: johannes at sipsolutions.net (Johannes Berg)
Date: Mon, 27 Jan 2014 09:43:24 +0100
Subject: Scanning regression since "cfg80211: use DS or HT operation IEs
 to determine BSS channel"
In-Reply-To: <CACna6ryDakV+oo6pW1BN5rcDPqR9=1khUHtYqmtTf85JR5x2Lg@mail.gmail.com>
 (sfid-20140126_153740_663759_6A0F67EA)
References: <CACna6rwdAAsCX76=nwHpj-grVvQznbNCPVnpXL9kP2TkvhR-yw@mail.gmail.com>
 <CACna6ryDakV+oo6pW1BN5rcDPqR9=1khUHtYqmtTf85JR5x2Lg@mail.gmail.com>
 (sfid-20140126_153740_663759_6A0F67EA)
Message-ID: <1390812204.4251.1.camel@jlt4.sipsolutions.net>

On Sun, 2014-01-26 at 15:37 +0100, Rafa? Mi?ecki wrote:

> >     cfg80211: use DS or HT operation IEs to determine BSS channel
> 
> This has been finally fixed in 64e5acb09ca6b50c97299cff9ef51299470b29f2 [0].

It's no wonder I couldn't find it to be bad in the above commit though -
the breakage is two years older than that ... oh well. I'm surprised by
how little problematic this seems to have been.

johannes



