Bug 213444

Summary: iwn Wi-Fi not working after suspend/resume, after upgrading to 11.0
Product: Base System Reporter: Maxim Usatov <maxim.usatov>
Component: wirelessAssignee: freebsd-wireless (Nobody) <wireless>
Status: New ---    
Severity: Affects Only Me CC: adrian, avos, bz, david, meyer.sydney
Priority: --- Keywords: regression
Version: 11.0-STABLE   
Hardware: amd64   
OS: Any   
Bug Depends on:    
Bug Blocks: 277512, 278175    
Attachments:
Description Flags
dmesg before netif restart, after successful boot, no Wi-fi
none
dmesg after netif restart
none
Try to fix device timeouts after AUTH -> AUTH state transition
none
Fix possible driver hang (see r305745)
none
my if_iwn.c before patching
none
dmesg after patching, Wi-Fi not working after resume
none
dmesg (patched kernel) before suspend
none
dmesg (patched kernel) after resume none

Description Maxim Usatov 2016-10-13 11:04:15 UTC
After upgrading to 11.0-RELEASE wlan0 is not working (NO CARRIER) after laptop is suspended. Can be fixed by adding this to /etc/rc.resume:

sleep 5
service netif restart
dhclient wlan0 

It was working fine on 10.2-RELEASE. 

My laptop is Thinkpad T400, using iwn driver for wireless.
Comment 1 Maxim Usatov 2016-10-13 11:30:29 UTC
It appears I was too quick with a fix, I apologize. The issue seems to be chaotic.
Comment 2 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-10-13 16:32:58 UTC
Hi,

Can you attach `dmesg` output before suspend/after resume with 'wlandebug -i wlan0 state+auth+assoc' set (before suspend)?
Comment 3 david 2016-10-13 16:33:59 UTC
My hardware and experience are both different; whether one has a significant effect on the other, I don't know.

Summary: I don't see the problem.

More details:
  Information on my laptop may be found at <https://wiki.freebsd.org/Laptops/Dell_Precision_M4800?highlight=(\bCategoryLaptop\b)>.  As noted there, I field-replaced the Broadcom wireless/Bluetooth card (which was apparently not supported) with the Intel WiFi Link 5100 that I pulled out of my previous laptop (Dell M4400).

Further, I have (also) been tracking head on the same laptop (on a different slice of the boot drive).  Once stable/11 was branched, I copied the head slice's / and /usr file systems to a 3rd slice, then used "svn switch" to update that slice's /usr/src from head to stable/11; I have been tracking head, stable/11, and stable/10 daily on the m4800 since.

While I have had issues with suspend/resume (e.g., a recent update to x11/nvidia/driver appears to have broken resume for me until I switched from x11/nvidia-driver to x11/nvidia-driver-340), I do not recall ever having an issue with iwn/wlan0 failing to work on resume.  (And yes, I do exercise suspend/resume: I suspend the laptop before getting on my bike to get to the shuttle stop, resume once on shuttle (and use wireless to access the Internet), then suspend again once we reach work (before I stuff the laptop back in my backpack), then resume again once I'm at my desk.)

And for the past 3 weeks or so, I've been running stable/11 on the laptop Monday - Friday.
Comment 4 Maxim Usatov 2016-10-13 18:29:10 UTC
Dobry den, Andriy, 

My FreeBSD installation is totally broken after the upgrade to 11. My chromium segfaults when I try to attach files here, and firefox won't start because it complains on an undefined symbol in libgiofam (thunderbird and any other gtk based stuff won't start as well, and yes, I did full pkg upgrade -f).  

It appears I will need to spend some time fixing that until I can attach files here. 

By the way, this time suspend/resume worked fine for probably 8 times in a row, however, each time it took progressively longer to associate. However, my laptop was unable to associate after reboot. I've had to do "service netif restart" manually after the boot to get it online.  

Max
Comment 5 Maxim Usatov 2016-10-20 07:07:59 UTC
Created attachment 175963 [details]
dmesg before netif restart, after successful boot, no Wi-fi
Comment 6 Maxim Usatov 2016-10-20 07:08:32 UTC
Created attachment 175964 [details]
dmesg after netif restart
Comment 7 Maxim Usatov 2016-10-20 07:09:19 UTC
For some reason resume worked fine and I couldn't capture dmesg, however, I didn't have Wi-Fi straight after the next reboot. dmesg output attached.
Comment 8 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-10-20 08:30:29 UTC
Created attachment 175965 [details]
Try to fix device timeouts after AUTH -> AUTH state transition
Comment 9 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-10-20 08:38:04 UTC
Created attachment 175966 [details]
Fix possible driver hang (see r305745)
Comment 10 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-10-20 08:42:04 UTC
Try to apply both (first may fix device timeout's, second should fix automatic interface restart).
Comment 11 Maxim Usatov 2016-10-20 08:50:19 UTC
Created attachment 175967 [details]
my if_iwn.c before patching

It appears my if_iwn.c is different from yours.
Comment 12 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-10-20 09:03:53 UTC
Yes, it is from CURRENT (but this code path was not modified and patches should apply anyway).
Comment 13 Maxim Usatov 2016-10-20 09:41:21 UTC
Patched, but can't rebuild kernel: it can't find find dev/drm2/i915/intel_bios.h (fatal error when including from i915_drv.h) The file simply isn't there, although I have the .c file. :-(
Comment 14 Maxim Usatov 2016-10-20 10:42:28 UTC
OK, patched (had to grab that header file from GitHub), installed new kernel, still Wi-Fi not working after resume. Had to do service netif restart about 8 times to get it working. Attaching another dmesg.
Comment 15 Maxim Usatov 2016-10-20 10:42:57 UTC
Created attachment 175969 [details]
dmesg after patching, Wi-Fi not working after resume
Comment 16 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-10-20 13:15:35 UTC
wlandebug -i wlan0 state+auth+assoc+scan ?
Comment 17 Maxim Usatov 2016-10-20 14:54:15 UTC
Created attachment 175978 [details]
dmesg (patched kernel) before suspend
Comment 18 Maxim Usatov 2016-10-20 14:54:40 UTC
Created attachment 175979 [details]
dmesg (patched kernel) after resume
Comment 19 Maxim Usatov 2016-10-20 14:54:59 UTC
Here you go.
Comment 20 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-10-20 18:00:26 UTC
Is it reproducible when HT is disabled? (create_args_wlan0="-ht")
Comment 21 Maxim Usatov 2016-10-20 19:05:19 UTC
It appears to work absolutely fine with that line.
Comment 22 Adrian Chadd freebsd_committer freebsd_triage 2017-04-27 15:26:19 UTC
Hiya,

So disabling 11n fixes it? Hm, it shouldn't break association.

oooh, can you uhm, 'ifconfig -v wlan0' before you do stuff, and when it's working, and when it's not ? I'd like to see if this is another one of those "interface media type is out of whack and net80211 scan/association logic starts thinking things aren't useful" bugs. :(