# IWM 7260 Wireless issue with Freebsd 12



## cheme (Sep 24, 2020)

Hello,

My laptop's wireless nic (iwm7260) works fine with FreeBSD 11.  However, it does not work with FreeBSD 12 or FreeBSD 13.  

If I run the `ifconfig` command it reports the following:  


```
wlan0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether fc:f8:ae:01:31:fa
    hwaddr fc:f8:ae:01:31:fa
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
    status: no carrier
    ssid "" channel 1 (2412 MHz 11b)
    authmode OPEN privacy OFF txpower 0 bmiss 10 scanvalid 60 wme
    bintval 0
    groups: wlan
```

I removed any wireless configuration from /boot/loader.conf and /etc/rc.conf so I could test manually.  

`ifconfig wlan0 create wlandev iwm0` will create wlan0  but it also reports "ifconfig: No Channels Found".  

`wpa_supplicant -d -i wlan0 -c /etc/wpa_supplicant.conf` reports the following:


```
wpa_supplicant v2.9
Successfully initialized wpa_supplicant
Initializing interface 'wlan0' conf '/etc/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant.conf'
Priority group 5
   id=0 ssid='XXX'
ioctl[SIOCG80211, op=98, arg_len=32]: Invalid argument
failed to IEEE80211_IOC_DEVCAPS: Invalid argument
wlan0: Failed to initialize driver interface
Failed to add interface wlan0
wlan0: Cancelling scan request
wlan0: Cancelling authentication timeout
```

As a side note the wireless nic works well in FreeBSD 11, DragonFlyBSD 5.8.1,  and Fedora.  It does have issues in FreeBSD 12, FreeBSD 13, and OpenBSD.

Any help or guidance would be greatly appreciated.


----------



## tingo (Sep 25, 2020)

Check to see if the firmware module is loaded correctly (compare FreeBSD 11 with FreeBSD 12).


----------



## cheme (Sep 27, 2020)

When I load the kernel module manually in FreeBSD 11 via the command `kldload if_iwm` I get the following:


```
iwm0: <Intel(R) Dual Band Wireless AC 7260> mem 0xf7d00000-0xf7d01fff irq 18 at device 0.0 on pci1
iwm0: hw rev 0x140, fw ver 17.352738.0, address XXXXXXXXXX
```


When I load the kernel module manually in FreeBSD 12 via the command `kldload if_iwm` I get the following:


```
iwm0: <Intel(R) Dual Band Wireless AC 7260> mem 0xf7d00000-0xf7d01fff irq 18 at device 0.0 on pci2
iwm0: hw rev 0x140, fw ver 17.352738.0, address XXXXXXXXXX
```

They appear to be the same with one exception.  In FreeBSD 11 it is on PCI1 and on FreeBSD 12 it is on PCI2.

Thanks


----------



## mercadal (Jan 19, 2021)

Hi folks,

I hope I'm not dredging up too old a thread — but I recently experienced a similar problem on a laptop, upgrading from 11.4 to 12.2-RELEASE.

My laptop uses the iwm7265D driver.  Works fine under 11, fails to work under 12.

It appears to load the firmware OK in each version, but networking won't come up at boot in 12.2, and when I attempt to run `service netif restart` to capture the errors, I received the same `ioctl[SIOCG80211, op=98, arg_len=32]: Invalid argument` error mentioned above (searching for that is how I found this thread).

11:

```
iwm0: <Intel(R) Dual Band Wireless AC 7265> mem 0x91000000-0x91001fff irq 19 at device 0.0 on pci2
iwm0: hw rev 0x210, fw ver 22.361476.0, address xx:xx:xx:xx:xx:xx
```

12:

```
iwm0: <Intel(R) Dual Band Wireless AC 7265> mem 0x91000000-0x91001fff irq 19 at device 0.0 on pci2
iwm0: hw rev 0x210, fw ver 22.361476.0, address xx:xx:xx:xx:xx:xx
```

Relevant entries in /etc/rc.conf:

```
wlans_iwm0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"
ifconfig_wlan0_ipv6="inet6 accept_rtadv"
```

Relevant entries in /boot/loader.conf:

```
if_iwm_load="YES"
iwm7265Dfw_load="YES"
```

I pared down my wpa_supplicant.conf file to only a couple (simple) entries in hopes that there was a subtle change in configuration from the upgrade, but no luck there.

I'm hoping maybe OP found a solution? Or, alternatively, someone can recommend a good step-by-step guide for debugging this? I usually stumble my way through upgrade issues, but this one has me stumped.  Thank you in advance.


----------



## mercadal (Jan 20, 2021)

I've done a little digging in the source code:  It appears an ioctl call errors out while attempting to query some device capabilities.  Per `man 4 net80211`:


> IEEE80211_IOC_DEVCAPS
> Return device capabilities    in the data buffer pointed at by
> _i___data_.  The buffer must be large enough to return    the number of
> available channels    but otherwise may be made small    to limit how
> much information is returned.


Then, the error message presented appears to be the string for errno EINVAL. Per `man ioctl` EINVAL indicates "the _request_ or _argp_ argument is not valid."

My theory is that something has changed between 11 and 12, such that the allocated buffer is no longer adequate for the returned data — resulting in an EINVAL errno — but I'm not 100% sure that the argp pointer passed to ioctl isn't wrong in some other way.

I'm not too familiar with kernel-level code, but — as a next step — I'm going to dig into what I can to see if I can figure out if this is likely a buffer size issue. If someone familiar with the ioctl interface for 802.11 devices sees this and has any ideas, though, I'd be happy to hear them.


----------



## john_i_ (Jun 15, 2021)

Hi mercadal, were you able to get your wifi working?  I am having the same issue with my iwm7260.  The driver worked in DragonFly BSD, but not FreeBSD 13.

Thanks,
John


----------



## scottro (Jun 15, 2021)

I have had no trouble with the 7260 for awhile. I don't remember if I did in 11, but in 12, 13, and CURRENT, it's worked well for me.


----------

