# Broadcom BCM4313 wireless disconnects frequently

## welter

Hello,

I've encountered a problem with my wlan0 recently. When I'm trying to connect to my home network it often disconnects after a short while. However, there are spans of stable connection so I don't know what this problem depends on. Using the network (for example launching ping) does not maintain the connection.

Some outputs:

fragment of dmesg:

http://bpaste.net/show/50007/

lspci -k:

http://bpaste.net/show/50009/

Thanks in advance.

----------

## khayyam

welter ...

The issue is similar to those posted here, here and here.

I'd suggest you provide/pastebin more information: kernel config, wpa_supplicant.conf (sans psk), the relevant sections of /etc/conf.d/net, and the output of 'awk '{RS="Cell"}/YOUR_AP/' <(iwlist wlan0 scan)'.

best ... khay

----------

## welter

Thanks for your reply.

I've read the first thread before posting this post, and now I've also read the other two. I don't know if they are that similar because in my case running ping does not seem to help.

Also I'm using wicd, but with pure wpa_supplicant it behaved the same. I was using something like that:

```
network={

        ssid="ZagadkowaSiec"

        proto=RSN

        key_mgmt=WPA-PSK

        pairwise=CCMP TKIP

        psk=<wpa_passphrase hash>

}

```

Kernel config:

http://bpaste.net/show/50020/

In /etc/conf.d/net I have only one line uncommented:

```
config_eth0="noop"
```

awk...:

```
01 - Address: 48:5B:39:CC:EC:30

                    Channel:9

                    Frequency:2.452 GHz (Channel 9)

                    Quality=43/70  Signal level=-67 dBm  

                    Encryption key:on

                    ESSID:"ZagadkowaSiec"

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s

                              24 Mb/s; 36 Mb/s; 54 Mb/s

                    Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s

                    Mode:Master

                    Extra:tsf=00000104fec0ccb5

                    Extra: Last beacon: 28ms ago

                    IE: Unknown: 000D5A616761646B6F776153696563

                    IE: Unknown: 010882848B962430486C

                    IE: Unknown: 030109

                    IE: Unknown: 2A0104

                    IE: Unknown: 2F0104

                    IE: IEEE 802.11i/WPA2 Version 1

                        Group Cipher : CCMP

                        Pairwise Ciphers (1) : CCMP

                        Authentication Suites (1) : PSK

                    IE: Unknown: 32040C121860

                    IE: Unknown: 2D1A6C181BFF00000000000000000000000000000000000000000000

                    IE: Unknown: 3D1609080400000000000000000000000000000000000000

                    IE: Unknown: DD090010180204F0050000

                    IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00

                    IE: Unknown: DD1E00904C336C181BFF00000000000000000000000000000000000000000000

                    IE: Unknown: DD1A00904C3409080400000000000000000000000000000000000000

```

----------

## BillWho

welter,

Try config_eth0="dhcp" and proto=WPA2 

----------

## khayyam

 *welter wrote:*   

> I've read the first thread before posting this post, and now I've also read the other two. I don't know if they are that similar because in my case running ping does not seem to help.

 

welter ... yes, but there are other issues outlined in those posts, such as N and mixed N/G networks, and powersave in general.

Looking at the output of 'iwlist scan' I would configure the connection like so:

```
network={

        ssid="ZagadkowaSiec"

        proto=RSN

        key_mgmt=WPA-PSK

        pairwise=CCMP

        group=CCMP

        psk=<wpa_passphrase hash>

}
```

In the kernel config you have CONFIG_PM_RUNTIME=n (allowing I/O devices to be put into energy-saving states) and CONFIG_CFG80211_DEFAULT_PS=y (enables powersave mode by default), and though I'm not altogether sure what the cause of your problem is it does exhibit the general symptoms of powersaving (the connection is established, and shortly thereafter drops). So, I would suggest either enabling or disabling both and see if the problem persists with either of these combinations. You can also disable powersaving on the card with 'iwconfig wlan0 power off' (assuming the PS/PM is enabled in the kernel).

 *welter wrote:*   

> In /etc/conf.d/net I have only one line uncommented:

 

OK, well, you should probably proivde some option for wpa_supplicant to have it use nl80211 ...

/etc/conf.d/net

```
modules_wlan0="!plug wpa_supplicant dhcpcd"

wpa_supplicant_wlan0="-Dnl80211"

config_wlan0="dhcp"

dhcpcd_wlan0="-t 10"
```

 *BillWho wrote:*   

> Try config_eth0="dhcp" and proto=WPA2 

 

Bill ... "RSN" is WPA2 ... and eth0 has nothing to do with it as the dmesg above shows the interface as 'wlan0'.

best ... khay

----------

## BillWho

My mistake with eth0 - meant  wlan0    :Embarassed: 

----------

## welter

I don't have much time today, so I'll try changing kernel options tomorrow.

Nevertheless, I did some observation today and found out that in my place (where link quality is ~40/70) even when the network connection is not getting disconnected it loses many packets (about 25% packet loss in ping). I don't think it is too far, because when tested on Windows it behaved well in the same place. When I came to a place about 2 meters from the router the connection was stable (a few packets lost out of 1000). 

I will also try to check if this issue depends on specific protocol  (WPA2).

Also, is nl80211 much better when compared to wext? What is the difference? (wicd said that in most cases I should use wext)

Thanks for help.

----------

## khayyam

 *welter wrote:*   

> Nevertheless, I did some observation today and found out that in my place (where link quality is ~40/70) even when the network connection is not getting disconnected it loses many packets (about 25% packet loss in ping). I don't think it is too far, because when tested on Windows it behaved well in the same place. When I came to a place about 2 meters from the router the connection was stable (a few packets lost out of 1000).

 

welter ... don't read too much into this, of course packet loss is generally a sign of some problem (but this much we know) however its *radio* and so is effected by many environmental factors, infact being too close to the AP can effect signal quality. Also, packet loss can occur between any hop from the client and whatever is being pinged, and as you didn't say if you pinged the router, it could be packet loss between you and google for all we know. Anyhow, none of the above is relevant to debugging the issue.   

 *welter wrote:*   

> I will also try to check if this issue depends on specific protocol (WPA2).

 

... but what leads you to think it's WPA2 thats at issue?

 *welter wrote:*   

> Also, is nl80211 much better when compared to wext? What is the difference? (wicd said that in most cases I should use wext)

 

mac80211 is the linux stack for 802.11 hardware, nl80211/cfg80211 is intended to replace wext (Wireless Extensions).

best ... khay

----------

## oquol

 *welter wrote:*   

> Also, is nl80211 much better when compared to wext? What is the difference? (wicd said that in most cases I should use wext)
> 
> 

 I have the same card BCM4313 - it works for me with brcmsmac kernel module and -Dnl80211. It also worked with broadcom-sta driver and -Dwext wpa_supplicant option. So, in your case (CONFIG_BRCMSMAC=m) I suggest to use -Dnl80211.

I use wpa2 encryption, but my network is configured with 'pairwise=TKIP', so my configs are:

/etc/wpa_supplicant/wpa_supplicant.conf

```
network={

 ssid="my SSID"

 proto=RSN

 key_mgmt=WPA-PSK

 pairwise=TKIP

 psk="really long password"

 priority=1

}

```

/etc/conf.d/net

```
modules="wpa_supplicant"

wpa_supplicant_wlan0="-Dnl80211"

config_wlan0="dhcp"

```

I hope this will help to solve your problem.

----------

## khayyam

 *oquol wrote:*   

> I use wpa2 encryption, but my network is configured with 'pairwise=TKIP'

 

oquol ... this depends on what the AP supports, and in the information returned from 'iwlist scan' above the AP shows "Pairwise Ciphers (1) : CCMP".

best ... khay

----------

## welter

Tried both combinations of PM/PS and neither of them made the situation better.

----------

## welter

The strange thing is that the connection seems to work fine on all networks but not on the one I have in my flat. I haven't tried many networks but my university's eduroam and the network in my hometown worked well. That's why I wanted to try different protocol. But then, why the network is stable on other OS? Maybe it is the specific combination of router and wireless card configurations that causes this behaviour?

----------

## khayyam

 *welter wrote:*   

> The strange thing is that the connection seems to work fine on all networks but not on the one I have in my flat. I haven't tried many networks but my university's eduroam and the network in my hometown worked well. That's why I wanted to try different protocol. But then, why the network is stable on other OS? Maybe it is the specific combination of router and wireless card configurations that causes this behaviour?

 

welter ... if the symptom only shows itself with one specific AP then the issue is not with powersave. As for the AP does it have a hidden ESSID, and what type of network is it N only, A,G,N mixed, or A,G?

best ... khay

----------

## Princess Nell

I have a very similar problem with a BCM4401. At first, I thought either AP or laptop radio are on the blink, but it seems that the disconnects only happen on my x86 Gentoo system, not on am64 or FreeBSD (this laptop is quad-boot). I was wondering whether the kernel is the problem, I did not experience it before 3.3.x. Apart from the dis/reconncts, I've also seen the network go dead completely without anything being logged, or any change in ifconfig or routing status.

----------

## welter

@khayyam

The ESSID is not hidden, the network is N only.

@Princess Nell

Please inform me if you find a solution  :Smile: 

----------

## khayyam

 *welter wrote:*   

> The ESSID is not hidden, the network is N only.

 

welter ... I'll refer you again to the discussion in the [...] not ready for N? thread. Because data rates and modulation coding schemes (MCS) higher rates do not always equate to stable connectivity, you might try setting the data rate to a lower value and see if the connectivity stablises.

/etc/conf.d/net

```
rate_wlan0="5.5M auto" # "TX Bitrate"
```

or via the command line ...

```
iwconfig wlan0 rate 5.5M auto
```

Higher bitrates mean data is packed more tightly together and so more prone to error. '5.5' is low, but you can test this and raise it incrementally.

The following will provide you with a list of birates the AP supports (eg: 1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s; 54 Mb/s; etc):

```
awk '{RS="Cell"}/ESSID/' <(iwlist wlan0 scan)
```

best ... khay

----------

## welter

I've changed the mode of the router to mix B/G and after short while of testing the connection seems to be much more stable than before. Nonetheless it's a pity that the drivers don't allow to use the N mode in my case.

----------

## khayyam

 *welter wrote:*   

> I've changed the mode of the router to mix B/G and after short while of testing the connection seems to be much more stable than before. Nonetheless it's a pity that the drivers don't allow to use the N mode in my case.

 

welter ... why do you think its the driver? Right now it could be anything as we have no idea of what your current setup is, you were advised to use NL80211, but who knows, maybe you are ... maybe your not, and as you don't seem concerned with providing that information, but continue speculating as to the cause, then really we can't help.

best ... khay

----------

## alinefr

 *oquol wrote:*   

>  *welter wrote:*   Also, is nl80211 much better when compared to wext? What is the difference? (wicd said that in most cases I should use wext)
> 
>  I have the same card BCM4313 - it works for me with brcmsmac kernel module and -Dnl80211. It also worked with broadcom-sta driver and -Dwext wpa_supplicant option. So, in your case (CONFIG_BRCMSMAC=m) I suggest to use -Dnl80211.
> 
> I use wpa2 encryption, but my network is configured with 'pairwise=TKIP', so my configs are:
> ...

 

Because of this thread I just managed to make my BCM4313 to work with wpa_supplicant without issues. Thank you!

----------

## welter

 *khayyam wrote:*   

>  *welter wrote:*   I've changed the mode of the router to mix B/G and after short while of testing the connection seems to be much more stable than before. Nonetheless it's a pity that the drivers don't allow to use the N mode in my case. 
> 
> welter ... why do you think its the driver? Right now it could be anything as we have no idea of what your current setup is, you were advised to use NL80211, but who knows, maybe you are ... maybe your not, and as you don't seem concerned with providing that information, but continue speculating as to the cause, then really we can't help.
> 
> best ... khay

 

Sorry if I haven't been informative enough. My current setup is:

/etc/conf.d/net:

```

modules_wlan0="!plug wpa_supplicant dhcpcd"

wpa_supplicant_wlan0="-Dnl80211"

config_wlan0="dhcp"

dhcpcd_wlan0="-t 10"

```

/etc/wpa_supplicant.conf:

```

network={

        ssid="SSID"

   proto=RSN

   key_mgmt=WPA-PSK

   pairwise=CCMP

        psk=<hash>

}

```

This was the same before I've changed the wireless mode and the problems still occurred. And after I've done that it works fine. Are there some specific config options that should be set for different wireless modes? If not, then I think I might have some grounds to suspect the driver.

----------

## khayyam

 *welter wrote:*   

> Sorry if I haven't been informative enough.

 

welter ... thats ok, the only reason for me to make a fuss is that quite often its a case where the poster assumes we know what they have done, or are currently doing, and unless we are told we often don't, and so end up making assumptions.

 *welter wrote:*   

> My current setup is:

 

This looks fine ... there are other options you could supply but as it'll default to whatever information is supplied by the AP (with the default 'ap_scan=1') then these don't necessarily need to be supplied.

 *welter wrote:*   

> This was the same before I've changed the wireless mode and the problems still occurred. And after I've done that it works fine. Are there some specific config options that should be set for different wireless modes? If not, then I think I might have some grounds to suspect the driver.

 

Well, there is also the protocol itself, WMM/QoS, the AP, and the supplicant, If you read the links I provided above again you will see that there are a number of factors that can cause instability, not least of which is the basic premise that higher bitrates are more prone to error. In my experience N is the least stable 802.11 standard, and the claims made for it are beyond what can be achieved in practice (which is why the end up on the market as its more about selling the product than about the basic functionality). So, while the driver, and underlying mac80211, may be at issue, its equally as likely that other components, or some specific combination of factors, could be at issue.

best ... khay

----------

