# About bwn on FreeBSD 8.1R amd64



## alphachi (Feb 16, 2011)

OS: FreeBSD 8.1R amd64
Adapter: BCM4309
Crypto: WPA2-PSK

I have installed bwn-firmware-kmod and enabled if_bwn and bwn_v4_ucode on /boot/loader.conf.
When the system starts every time, the console shows:

```
bwn0: need multicast update callback
```


```
bwn0: RX decryption attempted (old 0 keyidx 0x1)
```
Although I can connect the AP, many packets lost when ping AP.
I have tried bwn_v4_lp_ucode instead of bwn_v4_ucode. It can't be used.

Thanks!


----------



## bschmidt (Feb 16, 2011)

The bwn(4) manpages mentions some loader tunables, did you try those? Especially the *usedma* one?


----------



## alphachi (Feb 16, 2011)

When I set usedma from 1 to 0 and restart, the first error was same and the second error turned to

```
bwn0: RX decryption attempted (old 0 keyidx 0x2)
```
Still lost packets...


----------



## bschmidt (Feb 16, 2011)

alphachi said:
			
		

> When I set usedma from 1 to 0 and restart, the first error was same and the second error turned to
> 
> ```
> bwn0: RX decryption attempted (old 0 keyidx 0x2)
> ...



The message about the multicast update is just a warning, you can safely ignore that. I have no clue what the other message is supposed to mean though, keyidx is just the index into the key table (the group and unicast keys), but what's wrong about trying to decrypt a packet? hmm..

*looking at the code*

Seems like the hardware is trying to tell us that it tried 50 times to decrypt frames but failed. Does that happen with other kinds of encryption too? for example WPA1-TKIP?


----------



## bschmidt (Feb 16, 2011)

Also the output of `# wlandebug +crypto` might be helpful.


----------



## richardpl (Feb 16, 2011)

alphachi said:
			
		

> Although I can connect the AP, many packets lost when ping AP.



Use ucastrate & mcastrate command with ifconfig(8). Set it to something low like 2-10.


----------



## alphachi (Feb 17, 2011)

bschmidt said:
			
		

> The message about the multicast update is just a warning, you can safely ignore that. I have no clue what the other message is supposed to mean though, keyidx is just the index into the key table (the group and unicast keys), but what's wrong about trying to decrypt a packet? hmm..
> 
> *looking at the code*
> 
> Seems like the hardware is trying to tell us that it tried 50 times to decrypt frames but failed. Does that happen with other kinds of encryption too? for example WPA1-TKIP?



When using no-crypto wifi (*ifconfig_wlan0="inet xxx netmask xxx ssid xxx"*), no errors. I think the problem is the WPA2-PSK support for bwn.


----------



## alphachi (Feb 17, 2011)

richardpl said:
			
		

> Use ucastrate & mcastrate command with ifconfig(8). Set it to something low like 2-10.



Still lost packets...


----------



## alphachi (Feb 17, 2011)

bschmidt said:
			
		

> Also the output of `# wlandebug +crypto` might be helpful.



When I use this command and input [cmd=]/etc/rc.d/netif start[/cmd] the output is:


```
wlan0: [00:1d:0f:6a:63:30] AES-CCM replay detected <rsc 0, csc 0, keyix 0 rxkeyix 65535>
wlan0: ieee80211_crypto_newkey: cipher 3 flags 0x6 keyix 1
wlan0: ieee80211_crypto_newkey: [B]no h/w support[/B] for cipher AES-CCM, falling back to s/w
wlan0: ieee80211_crypto_setkey: AES-CCM keyix 1 flags 0x136 mac ff:ff:ff:ff:ff:ff rsc 0 tsc 0 len 16
wlan0: [00:1d:0f:6a:63:30] AES-CCM replay detected <rsc 0, csc 0, keyix 1 rxkeyix 65535>
bwn0: need multicast update callback
bwn0: need multicast update callback
bwn0: need multicast update callback
bwn0: need multicast update callback
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: AES-CCM keyix 1 flags 0x136 rsc 100 tsc 0 len 16
wlan0: _ieee80211_crypto_delkey: AES-CCM keyix 2 flags 0x136 rsc 316 tsc 0 len 16
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
Feb 17 17:29:10 Ferrari wpa_supplicant[436]: [B]Failed to disable WPA[/B] in the driver.
wlan0: _ieee80211_crypto_delkey: AES-CCM keyix 0 flags 0x133 rsc 18 tsc 22 len 16
wlan0: link state changed to DOWN
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
bwn0: need multicast update callback
ifa_add_loopback_route: insertion failed
bwn0: firmware version (rev 410 patch 2160 date 0x751a time 0x7c0a)
bwn0: need multicast update callback
Feb 17 17:29:11 Ferrari wpa_supplicant[1774]: Failed to disable WPA in the driver.
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
bwn0: firmware version (rev 410 patch 2160 date 0x751a time 0x7c0a)
wlan0: ieee80211_new_state_locked: [B]pending INIT -> SCAN transition lost[/B]
```


----------



## bschmidt (Feb 17, 2011)

Same with other types of encryption? WPA1-TKIP maybe?



> ```
> wlan0: [00:1d:0f:6a:63:30] AES-CCM replay detected <rsc 0, csc 0, keyix 1 rxkeyix 65535>
> ```



That is suspicious.. smells like the hardware itself tries to decrypt the frame and net80211 tries again, hmm..


----------



## kpedersen (Feb 17, 2011)

I have experienced exactly the same with my bwn card.

Though it works, it does seem to lose packets. Proof of this is when I attempt a ping to the router, sometimes only 20% of the packets succeed and I am only 3m from the AP.

Linux's broadcom-wl driver seems to avoid this problem. I have not tried a windows driver and NDIS.


----------



## alphachi (Feb 17, 2011)

bschmidt said:
			
		

> Same with other types of encryption? WPA1-TKIP maybe?
> 
> 
> 
> That is suspicious.. smells like the hardware itself tries to decrypt the frame and net80211 tries again, hmm..



I have tried all crypto options:
WEP
WPA TKIP/AES
WPA2 TKIP/AES
Still wrong...


----------



## alphachi (Feb 17, 2011)

kpedersen said:
			
		

> I have experienced exactly the same with my bwn card.
> 
> Though it works, it does seem to lose packets. Proof of this is when I attempt a ping to the router, sometimes only 20% of the packets succeed and I am only 3m from the AP.
> 
> Linux's broadcom-wl driver seems to avoid this problem. I have not tried a windows driver and NDIS.



I have tried Windows driver and NDIS, "fatal error" to system hang.

I found Broadcom 802.11 Linux STA driver:
http://www.broadcom.com/support/802.11/linux_sta.php
Can I use it on FreeBSD? If possible, how to do?


----------



## richardpl (Feb 25, 2011)

FreeBSD 8.1 amd64 have broken NDIS, try 8.2 instead.


----------



## yurigor (Apr 11, 2011)

richardpl said:
			
		

> FreeBSD 8.1 amd64 have broken NDIS, try 8.2 instead.



I'm trying 8.2 now: FreeBSD 8.2-RELEASE amd64 accessing AP with WPA-PSK encryption enabled. AP is 2m away from notebook [Dell Vostro 3500 with Broadcom BCM4312 (as siba reports)], directly visible. 

Loaded modules: if_bwn.ko siba_bwn.ko wlan.ko wlan_amrr.ko wlan_wep.ko wlan_ccmp.ko wlan_tkip.ko bwn_v4_lp_ucode.ko. Within first 1-2 mins after boot I get 
	
	



```
bwn0: RX decryption attempted (old 0 keyidx 0x2)
```
 errors at tty0. Pinging AP gives 20% to 50% packet loss out of 1000 packages.

Loading Ubuntu LiveCD at the same conditions and installing offered 802.11 Linux STA driver gives 0% packet loss.


----------



## yurigor (Apr 12, 2011)

Filed a PR kern/156327: [bwn] bwn driver causes 20%-50% packet loss


----------



## blaize (Jul 14, 2012)

Hello, 
I had the same issue, about 50% of packet loss with bwn on Broadcom BCM4312.
This is an old chip, you have to load the LP micro code (bwn_v4_lp_ucode).
Then, when you create virtual interface with ifconfig, it put you default mode on 802.11n.
But, this card doesn't not support 802.11n. You just have to switch back on 802.11b and all work good with 0% packet loss.



> ifconfig wlan create wlandev bwn0 mode 11b



Sorry if my english is bad. Hope that help you !


----------

