Wifi network connectivity issues and a possible fix

Search This thread

wb86

Member
Feb 11, 2009
5
0
I have the same problem. My Nexus disconnect from the Google server. I change the value from 3 to 0, but the problem is still there.
I contact the Google support: they will send me a new one. We will see...

Gesendet von meinem Nexus 4 mit Tapatalk 2
 

mobilehavoc

Senior Member
Mar 12, 2006
2,172
356
I have the same problem. My Nexus disconnect from the Google server. I change the value from 3 to 0, but the problem is still there.
I contact the Google support: they will send me a new one. We will see...

Gesendet von meinem Nexus 4 mit Tapatalk 2

Interesting, for me it fixed the issue of delays and disconnects but there's still a little lag. My Nexus 4 still takes anywhere from 5 seconds to 60 seconds to notify me of something compared to Nexus 7. It never takes longer than that though and I haven't seen gray signal bars since I changed the config.

Wanted to add that without changing anything my Nexus 4 worked perfectly on a dd-wrt router so there's something that dd-wrt does which doesn't require this change. However on my Cisco e4200 running stock fw I needed to make this change.

Sent from my Nexus 4 using Tapatalk 2
 

floepie

Senior Member
Feb 28, 2006
1,990
455
Amsterdam
Try changing to 0 so it is not filtering anything

Sent from my Nexus 4 using Tapatalk 2

Yes, I have done that. But, still no luck. It's ping-able, so wifi connection is active while screen is off.

Incidentally, while not directly related, does anyone know what the settings "wifi optimization" does in the advanced wifi settings? Could this be related somehow?
 

defnz

Senior Member
Jun 22, 2011
60
12
I've submitted a bug request specifically for this issue: https://code.google.com/p/android/issues/detail?id=42272

I noticed that this thread is linked to https://code.google.com/p/android/issues/detail?id=40065 however its full of idiots spamming

Hopefully with better information Google can at least consider my bug report

Yes, I have done that. But, still no luck. It's ping-able, so wifi connection is active while screen is off.

Incidentally, while not directly related, does anyone know what the settings "wifi optimization" does in the advanced wifi settings? Could this be related somehow?

What ROM are you running, are you running anything like juice defender or any other battery saving programs? I'd suggest resetting to stock, rooting, modifying the ini and trying again. With an active network connection there should be no reason why your Nexus 4 is delayed. Do you see the same delay when you disable wifi and running on mobile data?

Apparently wifi optimisation changes the DTIM client interval amongst other things, there's not much information on what it does really http://www.anandtech.com/show/6440/google-nexus-4-review/4
 
Last edited:
  • Like
Reactions: bganley

floepie

Senior Member
Feb 28, 2006
1,990
455
Amsterdam
What ROM are you running, are you running anything like juice defender or any other battery saving programs? I'd suggest resetting to stock, rooting, modifying the ini and trying again. With an active network connection there should be no reason why your Nexus 4 is delayed. Do you see the same delay when you disable wifi and running on mobile data?

Apparently wifi optimisation changes the DTIM client interval amongst other things, there's not much information on what it does really http://www.anandtech.com/show/6440/google-nexus-4-review/4

Running stock rooted. No battery saving programs. Long delays over wifi, much shorter delays over data network (usually within the minute). OK, thanks for the help so far. Hopefully we get this resolved, but this fix has NOT worked for my device. Has anyone been able to confirm if this is a router-specific problem in that the device is just way too sensitive to router protocols and/or various wireless variables?
 

defnz

Senior Member
Jun 22, 2011
60
12
Someone earlier in the thread running DD-WRT doesn't have issues

The other option is to flash back stock on your router or try a different one
 

floepie

Senior Member
Feb 28, 2006
1,990
455
Amsterdam
For those who have it working, could you try something for me? Make sure your wifi icon is blue and turn the screen off. Wait for about 5 minutes. Then, turn on the screen, and stare at the wifi icon. Does it turn gray after about 5 seconds and return to blue a few seconds thereafter? This is what mine does. While the screen is off, wifi is active and connected to the router, as shown by the router. But, when you turn on the screen, the device realizes that there is no working internet connection (icons turn gray) and works to restore it shortly after being unlocked. This clearly must be a bug of some sort.
 

mobilehavoc

Senior Member
Mar 12, 2006
2,172
356
For those who have it working, could you try something for me? Make sure your wifi icon is blue and turn the screen off. Wait for about 5 minutes. Then, turn on the screen, and stare at the wifi icon. Does it turn gray after about 5 seconds and return to blue a few seconds thereafter? This is what mine does. While the screen is off, wifi is active and connected to the router, as shown by the router. But, when you turn on the screen, the device realizes that there is no working internet connection (icons turn gray) and works to restore it shortly after being unlocked. This clearly must be a bug of some sort.

This is what happens to me BEFORE applying the fix in this thread. You're having the arp issue we're talking about.

Sent from my Nexus 4 using Tapatalk 2
 

sky44

Member
Aug 5, 2010
6
0
I might say something stupid, but in the file WCNSS_qcom_cfg.ini, there is the parameter gStaKeepAlivePeriod that have spaces around the "=" sign.
This is the only one in this case, and this parameter is use to keep the connection.
That parameter may be to "0" because of these extra spaces?
 

gnan10

Senior Member
Apr 16, 2011
594
114
33
andhra-kdp
www.google.co.in
How can i connect to adhoc networks on my nexus 4..??
Please suggest me any app or mod....
Will someone please kindly respond me

Sent from my Nexus 4 using Tapatalk 2
 
Last edited:

bstosnbata

Senior Member
Nov 15, 2012
143
20
Is there a way for not rooted ones?

The issues i have is different, here are some that i noticed:

1. When im connected to wifi it cuts to grey then to blue then grey then blue that kinda loop. Like at work im using my nexus 7 and its connected to the same wifi and it doesnt have any problems. I dont think i have the same issue when the phone is sleeping, it doesn't cut it off.

2. Wifi on and bluetooth on at the same time!
It even gets worse when both are on, at work we have an audio bluetooth device so we dont have to plug up to play music, most of the times i play music from YouTube. Same thing as number 1 it goes grey then blue for both Wi-Fi and Bluetooth. To fix it i go to settings turn both Wi-Fi and Bluetooth off then turn it back on, after a while the problems happen again.

3. When I'm doing the fix for number 2, sometimes the settings app crashes, yeah the stock settings app!

It's getting really frustrating now, i absolutely love the phone but i think the biggest downside is the connectivity issues. A part of me is hoping that it's just a 4.2 bug.

Help guys :(

Sent from my Nexus 7 using xda app-developers app
 

Rivermind

Senior Member
Dec 24, 2012
105
55
Ann Arbor
Im an android newbie. I couldnt understand a thing from the steps above :(

Sent from my Nexus 7 using xda app-developers app

Since you're only modifying some files and don't need to run a program with root privileges, you don't need to be "rooted" for this change. Recovery is a special partition you can boot into and will let you make this change. You will need an unlocked bootloader if you haven't already put on a custom recovery (the stock recovery does not support this feature). See this thread for instructions on how to unlock your bootloader and put on a custom recovery, as well as optionally rooting (it's really easy, just flashing another zip from recovery). But do note that if your bootloader is not already unlocked, unlocking it will wipe everything.

Hopefully that helps!
 

Lucena04

Member
Dec 14, 2012
32
2
I bought another router (multilaser) and solved my problems with wifi.

Enviado de meu Nexus 4 usando o Tapatalk 2
 

zdenoh1975

Senior Member
Feb 16, 2010
129
17
Hi, one question please - when I flash a new ROM, I lost this sleepfix and must apply and flash again, or it stay allways till i flash restorefix ? Thanks!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 86
    4.3 Update: It looks like Android 4.3 (JWR66V) did not fix the Nexus 4 delayed notifications on wifi issue. New wifi drivers with ARP offload support are included but for some unknown reason, Google disabled ARP offload in this release (even though ARP offload was enabled in the leaked 4.3 version). Interestingly, ARP offload is now re-enabled in AOSP JSS15J.

    If you are on JWR66V and still have delayed notifications on wifi, then check this post for instructions on how to enable ARP offload either manually or with a flashable ZIP: http://xdaforums.com/showpost.php?p=43940926&postcount=601. Only do this if you are running 4.3 JWR66V.

    An alternative option is to try disabling wifi optimization. Some people have found this fixes the delayed notification problem but also causes an increased battery drain.


    ----------------------------
    Below is for Android 4.2 builds only

    Update: Android 4.2.2 is out and despite a comment from a Google rep that this was fixed and the fix was scheduled to be included in 4.2.2, it appears that isn't the case. This same rep from Google just confirmed as much in post 34 - https://code.google.com/p/android/issues/detail?id=42272#c34.

    I've confirmed the workaround described in this thread does still work on 4.2.2. Also, the ini file that this workaround changes was untouched between 4.2.1 and 4.2.2 so the same zip files posted here will work on either version.

    Also, thanks to thesebastian for finding this - it looks like Qualcomm is finally getting ARP Offload fixed (http://xdaforums.com/showpost.php?p=38598963&postcount=267). Hopefully they will get this pushed out sometime soon.
    ------------------

    Since the Nexus 4 was released, there have been many reports of various problems with wifi. Everything from slow speeds to delayed notifications to not being able to connect to certain APs at all. With the release of Android 4.2.2, a lot of these problems have been fixed. Unfortunately, a number of issues still remain.

    One issue that has yet to be fixed as of 4.2.2 is the ability for the phone to respond to ARP requests while the screen is off. This results in the phone being unable to receive network traffic over wifi under certain circumstances while asleep. The most noticeable effect of this issue is notifications being delayed for up to 15 minutes while the screen is off. During this time, turning the screen on will result in these delayed notifications flooding in all at once. You may also notice the wifi signal indicator turning gray immediately after turning the screen on followed a few seconds later by it turning blue. Another symptom that some have had is incoming VoIP calls not ringing the phone while the screen is off but working fine while the screen is on.

    This issue has been confirmed by Google (https://code.google.com/p/android/issues/detail?id=42272) and is related to a buggy implementation of ARP Offload in the Nexus 4 wifi driver. Due to this, ARP Offload is disabled on the N4. In addition, the N4 wifi driver is set to filter all incoming broadcast and multicast traffic during sleep. Since ARP is broadcast (usually), the combination of these settings will prevent the phone from hearing and responding to ARP requests while the screen is off. If a neighboring network device (such as your router) is unable to obtain the MAC address of the phone, it will be unable to send any traffic to the phone.

    Please note that this issue only affects the Nexus 4 (and possibly other devices with the Prima wifi chip). Wifi issues on other devices are not affected by this particular issue. Also note, this is one particular issue with the N4 wifi. There are lots of other issues. The workarounds described here will not help with those issues.

    Also, even though all Nexus 4's are affected by this issue, not everyone will be affected in the same way. One of the main reasons for this is due to varying router configurations (in particular, the ARP cache timers). Some will even be lucky enough to have this problem completely masked due to their router configuration. If you are so lucky, you can still see the effect of this issue - turn the screen off, wait a few minutes, and ping the phone from your PC. While doing this run Wireshark and notice the unanswered ARP queries being sent to your phone.

    ----------------

    Until Google releases a proper fix (ARP Offload), there are a couple of options to work around this issue.

    Option 1 - Static ARP
    The easiest fix is to add a static ARP entry for your N4 to your router. This allows the router to communicate with the phone without having to bother with the ARP process (thereby bypassing the issue completely). On some routers, there is an option to directly add a static ARP entry. On some, you have to do it via the CLI. On some, adding a static DHCP lease also adds a static ARP entry. And of course some just don't allow you to set this.

    There are a couple of negatives. First, you may not have access to all routers that you connect to. Even if you do have access, you may not be able to set a static ARP depending on the firmware on the router. Also, you would have to add a static ARP to every device on the same network segment that you would want to communicate with. Say for example you used wireless ADB. In that case you would have to add a static ARP to both the router and the PC that you ran ADB on.

    The positive to adding a static ARP entry is you don't have to muck with a system file on the phone and this option is the most battery efficient.

    Option 2 - Disable filtering on the N4
    Another solution is to disable the unicast and/or multicast filtering on your N4 by modifying an ini file on the phone. This will allow the phone to see all broadcast traffic (including ARP) during sleep. As a result the phone will be able to properly respond to ARP requests.

    The positive is once you make this change, the phone will properly respond to ARP requests without having to make any other changes. It will work with any wifi network that you connect to.

    The negative is making this change will cause a negative impact on battery life. How much of an impact depends entirely on how much broadcast and multicast traffic exists on your network. The more traffic, the more the phone is woken up, the more the battery hit will be. The only way to know how much of a battery impact you will have is to test it out.

    To make the ini file change manually (see below for installable zip files):
    • Make sure your phone is rooted
    • Remount /system as RW
    • Make a backup of file /system/etc/wifi/WCNSS_qcom_cfg.ini
    • Edit the file /system/etc/wifi/WCNSS_qcom_cfg.ini
    • Change the line "McastBcastFilter=3" to "McastBcastFilter=0"
    • Save the file and double check file permissions (-rw-r--r-- root root)
    • Reboot the phone

    To undo this change, simply change the "0" back to the original value of "3". If you want to prevent the the phone from hearing multicast traffic while the screen is off but still allow broadcast traffic, you could change the value to "1". This may help with battery life and will keep most things working.

    Please remember, this changes a system file so 2 things. First, I'm not responsible if you break something. Second, this will likely prevent the phone from being able to get an OTA. You would need to revert the change before applying an OTA.

    --------------------

    One other router setting that can cause the same type of issue that some have run into is related to the TCP Established timer. If you are still having this problem after making the ini file change (or static ARP), make sure that the TCP Established timer on your router is set to at least 1200 seconds.

    ------------------------------------------

    Edit 12/31: I attached CWM installable zip files to make changing the ini file easier and help prevent file permission problems, etc. I tested all 3 files with my Nexus 4 using CWM 6.0.2.3.

    n4-wifi-sleepfix-restore-original.zip -- This restores the ini file to the original one from stock 4.2.1 JOP40D / 4.2.2 JDQ39.
    n4-wifi-sleepfix-mcast_and_bcast.zip -- This sets McastBcastFilter to 0, allowing the phone to hear multicast and broadcast traffic during sleep. Only for 4.2.1 JOP40D / 4.2.2 JDQ39.
    n4-wifi-sleepfix-bcast_only.zip -- This sets McastBcastFilter to 1, allowing the phone to hear broadcast traffic during sleep, but not multicast. Only for 4.2.1 JOP40D / 4.2.2 JDQ39.

    Don't forget to make a CWM backup first!
    18
    Ok guys something weird is happening.
    I reported a few days ago that I was running the 4.3 leaked rom and that this problem was fixed.

    Well today, I flashed the official factory images for 4.3 and the problem has come back.
    Anytime with screen off now, pinging my phone with my computer will instantly drop packets again (same as 4.2.2 problem).

    Once again, my settings are static ip, wifi optimization ON.

    Now here is the weird part: I compared the WCNSS_QCOM_CFG.ini file from the leaked 4.3 rom and the official factory image and they are identical except for two lines:
    gEnableActiveModeOffload
    hostArpOffload

    Both flags are set to =0 on the factory 4.3 image; while in the leaked rom they are set to =1.

    Since this discovery, I have changed both settings to mimic the leaked 4.3 rom (ie. to =1 for both settings) and NOW my problem is FIXED again.

    Anyone else notice this? Is this a mistake on Google's part for not enabling these two flags on the factory images? Does anyone that got the OTA want to check their wcnss_qcom_cfg.ini file?

    tldr: change gEnableActiveModeOffload AND hostARPOffload in the wcnss_qcom_cfg.ini file to =1 and the problem should be fixed...at least for me so far..


    As jeffwei8 found, the options in the ini file for ARP offload were enabled in the leaked 4.3 image, and disabled in the official 4.3 image. I have no idea why Google has these settings disabled now - there very well may be a good reason for it. Either way it is interesting that some people are reporting that their wifi issue is now fixed with 4.3, and some are still having the same problem with delayed notifications.

    I don't have an N4 anymore, so I can't test this but since re-enabling ARP offload in the ini file seemed to fix jeffwei8's delayed notifications on wifi, I put together a CWM zip update to enable ARP offload in the wifi ini file.

    Flash this patch using CWM at your own risk - this is untested. Also attached to this post is a CWM zip to restore the ini file to what was included in the official 4.3 image.
    6
    Is this related to Nexus 4 "WiFi driver"?

    https://www.codeaurora.org/gitweb/external/wlan/?p=prima.git;a=shortlog

    I'm seeing recently changes, but i don't know if it's for a totally different device. (I saw this folder on nexus 4: /vendor/firmware/wlan/prima/ )

    I also saw that they now use McastBcastFilter=0 like in the OP.

    What about this one? (26-FEB-2013)


    https://www.codeaurora.org/gitweb/e...it;h=b8ddf46808da1267b35086b478884bed27360e5c
    6
    OK, So how does your fix work?

    It is a workaround to let the phone hear and respond to ARP requests. It does this by telling the wifi driver to not filter broadcast/multicast traffic during sleep. The negative of course is the CPU needs to process every broadcast/multicast packet received during sleep which prevents the phone from staying in deep sleep. On busy networks, this can really add up.

    This is why they filter broadcast/multicast traffic during sleep. Problem is if you don't respond to ARP requests (which are normally broadcast) then other devices won't be able to send any traffic to your phone. This is what is causing the late notifications issue that this workaround addresses.

    The real solution is to use ARP offload. This basically offloads the processing of ARP to the wifi driver. With this enabled, the wifi driver can still filter broadcast/multicast traffic to save battery during sleep and at the same time receive and respond to ARP requests so network connectivity isn't broken (all without hitting the CPU).

    The issue on the N4 is ARP offload is broken - pretty badly. So it is disabled which in conjunction with the filtering is what is causing the issue.

    Once Google pushes a patch that fixes and enables ARP offload, then this workaround won't be needed any more. Supposedly it was schedule to be in 4.2.2 but so much for that....
    6
    Nice!!

    It seems that we can also download these new drivers. But i have no idea how to install them...(for instance: WCNSS_cfg.dat ). There are a lot of folders with those files in the N4. (Probably a lot of them are symlinked or whatever; but they have different permissions).

    To check this, i downloaded and extracted: wlan: cs release 3.2.0.70.

    I am rewriting this post for clarity and because what I wrote previously is incorrect.

    The specific file linked before is a firmware that is located in /etc/wifi/ in our device, however simply swapping the files will not work and is not recommended.

    Good news is that this does look like the problem we're having is being worked on. As a matter of fact if the change log is accurate the fix is implemented already we just have to wait for the update.

    Even better news is that someone might be able to make this available sooner if all the source code is available.

    EDIT: This is the code change that allegedly fixes the ARP offload issue we are having, for anyone curious: https://www.codeaurora.org/gitweb/e...ff;h=b8ddf46808da1267b35086b478884bed27360e5c

    Sent from my Nexus 7 using Tapatalk HD