The link quality output from wireless extensions is too small by the ratio
of 100/BCM43xx_RX_MAX_SSI (60) for bcm43xx-mac80211. This patch puts the
quantity on the proper scale.
Signed-off-by: Larry Finger <[email protected]>
---
Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_xmit.c
===================================================================
--- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_xmit.c
+++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_xmit.c
@@ -537,7 +537,8 @@ void bcm43xx_rx(struct bcm43xx_wldev *de
(phystat0 & BCM43xx_RX_PHYST0_GAINCTL),
(phystat3 & BCM43xx_RX_PHYST3_TRSTATE));
status.noise = dev->stats.link_noise;
- status.signal = jssi; /* this looks wrong, but is what mac80211 wants */
+ /* the next line looks wrong, but is what mac80211 wants */
+ status.signal = jssi * 100 / BCM43xx_RX_MAX_SSI;
if (phystat0 & BCM43xx_RX_PHYST0_OFDM)
status.rate = bcm43xx_plcp_get_bitrate_ofdm(plcp);
else
Somebody in the thread at some point said:
> Andy Green wrote:
>> Somebody in the thread at some point said:
>>> BCM43xx_RX_MAX_SSI (60)
>>
>>> + status.signal = jssi * 100 / BCM43xx_RX_MAX_SSI;
>>
>> That can't be doing what you intended... (int)100/60 == 1, it just
>> multiplies jssi by 1. Maybe some brackets around the multiply?
>
> I think gcc does equal rank operations from left to right, and the
> change does have the desired result, but the parentheses should be there
> for clarity.
Man I don't know when * started to have equal precedence to /, but you
are right:
#include <stdio.h>
main()
{
printf("%d\n", 5 * 100 / 60);
printf("%d\n", (5 * 100) / 60);
printf("%d\n", 5 * (100 / 60));
}
$ gcc test.c -o test
$ ./test
8
8
5
Sorry for the noise.
-Andy
Andy Green wrote:
> Somebody in the thread at some point said:
>> BCM43xx_RX_MAX_SSI (60)
>
>> + status.signal = jssi * 100 / BCM43xx_RX_MAX_SSI;
>
> That can't be doing what you intended... (int)100/60 == 1, it just
> multiplies jssi by 1. Maybe some brackets around the multiply?
I think gcc does equal rank operations from left to right, and the change does have the desired
result, but the parentheses should be there for clarity.
Thanks,
Larry
Somebody in the thread at some point said:
> BCM43xx_RX_MAX_SSI (60)
> + status.signal = jssi * 100 / BCM43xx_RX_MAX_SSI;
That can't be doing what you intended... (int)100/60 == 1, it just
multiplies jssi by 1. Maybe some brackets around the multiply?
-Andy