Bug 214264 - iwn regression on 11.0 (Centrino Wireless-N 2230)
Summary: iwn regression on 11.0 (Centrino Wireless-N 2230)
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: 11.0-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-wireless (Nobody)
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2016-11-06 12:26 UTC by Neptunium
Modified: 2017-06-15 15:40 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Neptunium 2016-11-06 12:26:48 UTC
I have Centrino Wireless-N 2230 adapter (Lenovo IdeaPad S400) which worked well on 10.X. On 11.0-p2 I experienced a lot of problems with it.

Sometimes (albeit not always), on boot, I see something like this:

---------------------------------------------------------------------------
iwn0: scan timeout
iwn0: iwn_read_firmware: ucode rev=0x12a80601
wlan0: link state changed to UP
iwn0: iwn_intr: fatal firmware error
firmware error log:
  error type      = "UNKNOWN" (0x00002529)
  program counter = 0x00029DDC
  source line     = 0x000000AC
  error data      = 0x0000000100000036
  branch link     = 0x00029DBE00029DBE
  interrupt link  = 0x0000EC7A00000000
  time            = 7160
driver status:
  tx ring  0: qid=0  cur=0   queued=0  
  tx ring  1: qid=1  cur=0   queued=0  
  tx ring  2: qid=2  cur=0   queued=0  
  tx ring  3: qid=3  cur=2   queued=0  
  tx ring  4: qid=4  cur=0   queued=0  
  tx ring  5: qid=5  cur=0   queued=0  
  tx ring  6: qid=6  cur=0   queued=0  
  tx ring  7: qid=7  cur=0   queued=0  
  tx ring  8: qid=8  cur=0   queued=0  
  tx ring  9: qid=9  cur=60  queued=0  
  tx ring 10: qid=10 cur=0   queued=0  
  tx ring 11: qid=11 cur=0   queued=0  
  tx ring 12: qid=12 cur=0   queued=0  
  tx ring 13: qid=13 cur=0   queued=0  
  tx ring 14: qid=14 cur=0   queued=0  
  tx ring 15: qid=15 cur=0   queued=0  
  tx ring 16: qid=16 cur=0   queued=0  
  tx ring 17: qid=17 cur=0   queued=0  
  tx ring 18: qid=18 cur=0   queued=0  
  tx ring 19: qid=19 cur=0   queued=0  
  rx ring: cur=42
iwn0: iwn_panicked: controller panicked, iv_state = 5; restarting
wlan0: link state changed to DOWN
iwn0: iwn_read_firmware: ucode rev=0x12a80601
wlan0: link state changed to UP
wlan0: link state changed to DOWN
iwn0: scan timeout
iwn0: iwn_read_firmware: ucode rev=0x12a80601
wlan0: link state changed to UP
---------------------------------------------------------------------------

Despite this, wifi works after it. However, often (albeit not always) after suspend/resume, iwn0 cannot reconnect, with messages like this:

---------------------------------------------------------------------------
Nov  1 22:07:07 neptunium kernel: iwn0: iwn_read_firmware: ucode rev=0x12a80601
Nov  1 22:07:07 neptunium wpa_supplicant[39597]: wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
Nov  1 22:07:08 neptunium wpa_supplicant[39597]: ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
Nov  1 22:07:08 neptunium wpa_supplicant[39597]: wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
Nov  1 22:07:09 neptunium wpa_supplicant[39597]: ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
Nov  1 22:07:09 neptunium wpa_supplicant[39597]: wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
Nov  1 22:07:10 neptunium wpa_supplicant[39597]: ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
Nov  1 22:07:10 neptunium wpa_supplicant[39597]: wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
---------------------------------------------------------------------------

or like this:

---------------------------------------------------------------------------
ifa_maintain_loopback_route: deletion failed for interface lo0: 48
wlan0: Ethernet address: 68:17:29:a1:b7:47
iwn0: iwn_read_firmware: ucode rev=0x12a80601
iwn0: iwn_read_firmware: ucode rev=0x12a80601
ifa_maintain_loopback_route: deletion failed for interface lo0: 48
ifa_maintain_loopback_route: deletion failed for interface wlan0: 3
wlan0: Ethernet address: 68:17:29:a1:b7:47
iwn0: iwn_read_firmware: ucode rev=0x12a80601
iwn0: iwn_read_firmware: ucode rev=0x12a80601
---------------------------------------------------------------------------

I'm aware of bug #208758 and bug #213444, which describe problems similar to mine. 

As for recommendations from bug #208758, I cannot kldload/kldunload if_iwn (it's in the kernel), and device enable iwn0 (after disabling) causes immediate reboot.

As for recommendations from #213444, I'm currently testing 
create_args_wlan0="-ht"
However, AFAIU, it will not resolve "fatal firmware error".

As I said, I have no problems with iwn on 10.X.
Comment 1 Sean Farley freebsd_committer freebsd_triage 2016-11-24 02:38:16 UTC
I was getting the same although WiFi was not working for more than a few seconds.  I ran across Bug 214266 which held the solution (for me :)).

With lagg, I had the MAC of the wireless NIC set to the same as the wired NIC.  This was causing something to trip.  I just needed to change where I set it.

From:
ifconfig_iwn0="ether aa:bb:cc:dd:ee:ff"
ifconfig_wlan0="WPA"

To:
ifconfig_wlan0="ether aa:bb:cc:dd:ee:ff WPA"

Since the actual wireless NIC's are no longer visible except via the wlan interface, ifconfig_iwn0 is no longer valid.  I had missed that configuration change myself.

Hopefully, that is your issue too.
Comment 2 Neptunium 2017-01-14 17:24:55 UTC
Sean, that's great, that was, obviously, my problem too! Thank you for your idea, I'd never in my life guess such a thing. However, with my configuration I have one little problem.

My original configuration was like this:

defaultrouter="192.168.1.1"
wlans_iwn0="wlan0"
ifconfig_wlan0="inet 192.168.1.2 netmask 255.255.255.0 WPA ssid ABCDEFG"

If I remove the second line, I can normally switch from one wifi network to another, and my wifi connection gets normally resumed after suspend/resume.

The problem is that if laptop is freshly turned on, no wlan0 interface is created, and therefore there is no wifi connection. I have to return the second line in order to connect, and then to remove it again.

Is there a canonical way to do this (i.e. to create wlan0 interface just once)?
Comment 3 Sean Farley freebsd_committer freebsd_triage 2017-01-21 02:51:20 UTC
(In reply to Neptunium from comment #2)

According to rc.conf(5):
	If a wlans_<interface> variable is set, an wlan(4) interface
	will be created for each item in the list with the wlandev
	argument set to interface.  Further wlan cloning arguments


This is my network configuration on my laptop running FreeBSD 11.  I have lagg setup with it too.

ifconfig_bge0="up"
wlans_iwn0="wlan0"
ifconfig_wlan0="ether aa:bb:cc:dd:ee:ff WPA"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport bge0 laggport wlan0 DHCP"
ifconfig_lagg0_ipv6="inet6 accept_rtadv"

> ifconfig_wlan0="inet 192.168.1.2 netmask 255.255.255.0 WPA ssid ABCDEFG"
Do you have /etc/wpa_supplicant.conf setup?  You should not have to set SSID in /etc/rc.conf if you do; it will just switch networks for you.  I think that is what you are asking, yes?
Comment 4 Neptunium 2017-01-22 12:07:36 UTC
Sean Farley wrote:

> According to rc.conf(5):
> 	If a wlans_<interface> variable is set, an wlan(4) interface
> 	will be created for each item in the list with the wlandev
> 	argument set to interface.  Further wlan cloning arguments
> 
> 
> This is my network configuration on my laptop running FreeBSD 11.  I have lagg > setup with it too.
> 
> ifconfig_bge0="up"
> wlans_iwn0="wlan0"
> ifconfig_wlan0="ether aa:bb:cc:dd:ee:ff WPA"
> cloned_interfaces="lagg0"
> ifconfig_lagg0="laggproto failover laggport bge0 laggport wlan0 DHCP"
> ifconfig_lagg0_ipv6="inet6 accept_rtadv"

Hm, I'm a bit confused... Let me explain this way: my previous setup, which used to work for me more than 3 years, was like this:

defaultrouter="192.168.1.1"
wlans_iwn0="wlan0"
ifconfig_wlan0="inet 192.168.1.2 netmask 255.255.255.0 WPA ssid ABCDEFG"

After upgrading to 11.0, I experienced a regression described in my original post. Per your suggestion that "ifconfig_iwn0=..." is "causing something to trip", I tried to remove that line, which resolved all my problems described in PR, but, of course, caused that no wlan is being created at boot. To overcome that problem, I now have this in my rc.conf:

defaultrouter="192.168.1.1"
if ifconfig | grep wlan0 ; then
  # do nothing
else
  wlans_iwn0="wlan0"
fi
ifconfig_wlan0="inet 192.168.1.2 netmask 255.255.255.0 WPA ssid ABCDEFG"

And now it works just as it used to on 10.X. I asked if there was a more elegant way to achieve this.

> Do you have /etc/wpa_supplicant.conf setup?  You should not have to set SSID 
> in /etc/rc.conf if you do; it will just switch networks for you.  I think 
> that is what you are asking, yes?

I have /etc/wpa_supplicant.conf, but it is not convenient for me to use automatic switching of wifi networks: sometimes I need static IP, sometimes I have to use DHCP, so, AFAIU, I have to manually change such settings in rc.conf every time I switch. 

I mean, one can't have separate ifconfig_wlan0 settings for each entry in wpa_supplicant.conf. If I'm wrong, please correct me (but this was not my problem, just an inconvenience I used to live with).
Comment 5 Sean Farley freebsd_committer freebsd_triage 2017-01-22 22:00:09 UTC
(In reply to Neptunium from comment #4)

Off hand, I do not know an elegant way.  Let me give it a try.

The way I outlined will automatically switch the wlan0 interface to any 802.11 found in /etc/wpa_supplicant.conf.  If they are not found, it will not switch it.

I am puzzled by the "ssid ABCDEFG" you have there.  That seems redundant as wpa_supplicant will change it for any network found and authenticated.  Have you tried your pre-11 configuration without it?  Perhaps, wpa_supplicant, in FreeBSD 11, is not looking for networks if it is already set?  Also, you are missing the DHCP tag unless that is by design.

Do you use lagg(4)?  You seem to be attempting to do something similar to what it can do.  Do you want to tie the wired NIC into the equation?

This is unrelated to being more elegant, but you could change the:
> ifconfig | grep wlan0
to:
> ifconfig -l | grep wlan0
You want a static IP.  Is that always the same IP?  If yes, you can use an alias.  Try this:

defaultrouter="192.168.1.1"
wlans_iwn0="wlan0"
ifconfig_wlan0="DHCP WPA"
ifconfig_wlan0_alias0="inet 192.168.1.2 netmask 255.255.255.255"

If you decide to use lagg(4), then you can add the alias to the lagg device instead of wlan.