Bug 227044 - Add support for Intel 9260 and 5165 (iwm) wireless devices
Summary: Add support for Intel 9260 and 5165 (iwm) wireless devices
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Mark Johnston
URL:
Keywords: feature, patch
Depends on:
Blocks:
 
Reported: 2018-03-28 18:14 UTC by Hanno Meyer-Thurow (geki)
Modified: 2020-12-21 09:03 UTC (History)
23 users (show)

See Also:


Attachments
tar includes sources, firmware, etc. (428.50 KB, application/x-tar)
2019-03-08 21:55 UTC, Nils Johannsen
no flags Details
https://people.freebsd.org/~markj/patches/iwm_9000/v1.diff (86.44 KB, patch)
2019-11-06 23:33 UTC, Ben Woods
no flags Details | Diff
Panic with r354423 memstick image (505.12 KB, image/jpeg)
2019-11-08 20:54 UTC, Raphael Kubo da Costa
no flags Details
dmesg with uCode load failure (630.08 KB, image/jpeg)
2019-11-08 22:50 UTC, Raphael Kubo da Costa
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hanno Meyer-Thurow (geki) 2018-03-28 18:14:28 UTC
Well, the notebook[0] I am going to buy, as soon as my current one breaks down, is with an Intel 9260 chipset. And I would really like to run TrueOS, which is based on FreeBSD.

Looking at the Linux support, it seems to be mostly about configuration parameter sets for these chipsets. Added links[1-9] below to see the changes of Linux. And two more links[10-11] to the current configuration parameter set files.

If anyone is interested to look at this on how to integrate, or if there is more to it than just configuration.


[0] https://www.mysn.de/slim-laptops/schenker-slim14-l17

[1] https://github.com/torvalds/linux/commit/89374fe60bfb481a81b941adaa5e834ace2cc9df
[2] https://github.com/torvalds/linux/commit/aea2a5f0d84745f34eb37bc5eada9ecced40fa88
[3] https://github.com/torvalds/linux/commit/de766142e3a5fcb67096e24ca4233a7f60999468
[4] https://github.com/torvalds/linux/commit/6c7bb7ebb58c0e17b11aebf928ffc5c295959a01
[5] https://github.com/torvalds/linux/commit/558f479f687aca6a336e13309424a7c3afd32721
[6] https://github.com/torvalds/linux/commit/d7a5b3e9e42ee95190742fef0d617bbde4f74d80
[7] https://github.com/torvalds/linux/commit/c2c48ddfc8b03b9ecb51d2832b586497b37531bc
[8] https://github.com/torvalds/linux/commit/dbc89253a7e15f8f031fb1eeb956de91204655e3
[9] https://github.com/torvalds/linux/commit/567deca8e72df3ceb6c07c63f8541a4928f64d3b

[10] https://github.com/torvalds/linux/blob/master/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
[11] https://github.com/torvalds/linux/blob/master/drivers/net/wireless/intel/iwlwifi/cfg/5000.c
Comment 1 Nils Johannsen 2019-03-08 21:55:25 UTC
Created attachment 202728 [details]
tar includes sources, firmware, etc.

I'm still new to FreeBSD, especially developing drivers is new for me... nevertheless I like to get the "Intel Wireless AC 9260" on my "ThinkPad E490" running in FreeBSD and tried to follow these changesets in the iwm whose already solved a similar task for another chipsets:
[Add support for Intel 8265 WiFi](https://github.com/freebsd/freebsd/commit/a06e5178adcde2036444b756a2e996513ec570bd)
[Add support for iwm 3168 cards](https://github.com/freebsd/freebsd/commit/5237c88c1abcac87b47cc12cee1dff7de106d4d0)

But I still stock at the firmware whose I've downloaded and uuencoded but seems to be not compatible... could anybody follow up this issue? 
My changes, sources, firmware you will find attached, as well as some results.

# dmesg > dmesg-2.txt
iwm0: <Intel(R) Dual Band Wireless AC 9260> mem 0xa1200000-0xa1203fff at device 0.0 on pci3
iwm0: api index=0, flags=0xdd9afffb
iwm0: api index=1, flags=0x00000087
iwm0: api flags index 1 larger than supported by driver
iwm0: iwm_mvm_load_ucode_wait_alive: Loaded ucode is not valid
iwm0: Failed to start INIT ucode: 5

# pciconf -lbcev > pciconf-1.txt
iwm0@pci0:5:0:0:	class=0x028000 card=0x00148086 chip=0x25268086 rev=0x29 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Wireless-AC 9260'
    class      = network
    bar   [10] = type Memory, range 64, base rxa1200000, size 16384, enabled
    cap 01[c8] = powerspec 3  supports D0 D3  current D0
    cap 05[d0] = MSI supports 1 message, 64 bit 
    cap 10[40] = PCI-Express 2 endpoint max data 128(128) FLR RO NS
                 link x1(x1) speed 5.0(5.0) ASPM L1(L1)
    cap 11[80] = MSI-X supports 16 messages
                 Table in map 0x10[0x2000], PBA in map 0x10[0x3000]
    ecap 0001[100] = AER 1 0 fatal 0 non-fatal 0 corrected
    ecap 0018[14c] = LTR 1
    ecap 001e[154] = unknown 1

# vi /usr/src/sys/conf/files
# vi /usr/src/sys/dev/iwm/if_iwm.c
# vi /usr/src/sys/dev/iwm/if_iwm_8000.c
# vi /usr/src/sys/dev/iwm/if_iwm_config.h
# vi /usr/src/sys/modules/iwmfw/Makefile
# vi /usr/src/sys/modules/iwmfw/iwm9260fw/Makefile
# grep '9260' /usr/src/sys/dev/iwm > grep-iwm-1.txt

https://www.intel.com/content/www/us/en/support/articles/000005511/network-and-i-o/wireless-networking.html
Download: [Intel® Wireless-AC 9260](iwlwifi-9260-th-b0-jf-b0-34.618819.0.tgz]

# tar -xf iwlwifi-9260-*.tgz
# cd ./iwlwifi-9260*/
# b64encode -o iwm-9260-34.fw.uu iwlwifi-9260-*.ucode iwm-9260-34.fw.uu
# mv iwm-9260-34.fw.uu /usr/src/sys/contrib/dev/iwm/
==> /usr/src/sys/contrib/dev/iwm/iwm-9260-34.fw.uu

# cd /usr/src/sys/modules/iwmfw/iwm9260fw
# make clean all install
==> /boot/modules/iwm9260fw.ko

# cd /usr/src/sys/modules/iwm
# make install
==> /boot/modules/if_iwm.ko

# kldload /boot/modules/iwm9260fw.ko
# kldload /boot/modules/if_iwm.ko
# service netif restart
# dmesg > dmesg-2.txt

Thanks and regards, Nils
Comment 2 wjguo 2019-03-18 13:46:42 UTC
Hi, I and lwhsu did a similar thing a month ago. We added the code for Intel 9560. But, we encountered an issue that it is failed to start the firmware. We referred to iwl driver in a running linux, but did not find the difference that can bring up the firmware. For your reference, the work is on https://github.com/wjguo/freebsd/pull/1
Comment 3 Johannes Lundberg freebsd_committer freebsd_triage 2019-05-01 20:43:14 UTC
Any success yet with 9560?
Comment 4 Conrad Meyer freebsd_committer freebsd_triage 2019-06-11 04:45:03 UTC
I'm interested in AC 9260
Comment 5 Smog 2019-06-24 06:33:41 UTC
I need driver to.
Comment 6 B 2019-07-24 20:28:15 UTC
Hi, I have a HP laptop with the 9260 chip as well. I have some free time I could contribute, but I am completely new to both FreeBSD and device driver development.
Comment 7 Mark Johnston freebsd_committer freebsd_triage 2019-10-25 16:55:10 UTC
I have access to a laptop with a 9560 chipset.  The big difference in the 9000-series chips is that they support MSIX multiple receive queues and use a different interface ("RFH", not sure what that stands for) to configure them.

I converted iwm to use this interface, based on iwlwifi and lwhsu and wjguo's work, and am trying to configure a single RX queue with MSI.  I'm able to load the firmware image, and get an "firmware alive" interrupt after, but I don't get any RX interrupts, so we time out waiting for a reply to the "alive" message.
Comment 8 Mark Johnston freebsd_committer freebsd_triage 2019-10-30 17:00:18 UTC
I managed to get iwm to work with the 9560 chip in a 7th gen X1 carbon, building on the work from lwhsu and wjguo.  Some fairly substantial changes are needed to the rx path among other things.  I will work on getting the combined patch set into HEAD.
Comment 9 Ben Woods freebsd_committer freebsd_triage 2019-10-30 22:44:44 UTC
Well done and thank you very much Mark - we love you!
Comment 10 Neel Chauhan freebsd_committer freebsd_triage 2019-10-31 22:42:35 UTC
Thank god! I can test on my HP Spectre x360 13-p0043dx (2018) which has a AC 9560 once the patch is posted (even if not committed). The Realtek dongle I'm using is too unreliable for me.
Comment 11 Mark Johnston freebsd_committer freebsd_triage 2019-11-03 03:25:51 UTC
Here is a first patch for testing: https://people.freebsd.org/~markj/patches/iwm_9000/v1.diff

To test, first update to r354276 or later to pick up the new firmware images for these chips.  Then, apply the patch and build a new kernel.  If you know what you are doing you can build sys/modules/iwm and iwmfw directly, but to be safe it's easier to just make buildkernel.

The patch enables a lot of debug output.  To disable that, modify if_iwm.c to stop setting sc->sc_debug.  I tested the patch with an 8000-series device to see if anything regressed, but further testing of that would be appreciated.

Please report success or failure together with "pciconf -lv" output for the device, and a dmesg.  I'm mostly interested in whether you get basic functionality for the moment; I have not tested suspend/resume yet.  iwm(4) also doesn't support 802.11n yet so the chip will not get good performance, but it should obviously be usable.
Comment 12 Neel Chauhan freebsd_committer freebsd_triage 2019-11-03 12:46:54 UTC
Your patch works! Thank you.

BTW I'm on a HP Spectre x360 13-p0043dx (2018 model).

The speeds are only abut ~18Mbps bidirectional (I have 300 Mbps symmetrical FTTH), but at least it's more reliable than my crappy Realtek dongle, and I have a free USB port now.
Comment 13 Mark Johnston freebsd_committer freebsd_triage 2019-11-03 15:08:52 UTC
(In reply to Neel Chauhan from comment #12)
Thanks.  Could you share the pciconf -lv entry for imw0?
Comment 14 Neel Chauhan freebsd_committer freebsd_triage 2019-11-03 18:31:03 UTC
Mine is:

iwm0@pci0:0:20:3:	class=0x028000 rev=0x30 hdr=0x00 vendor=0x8086 device=0x9df0 subvendor=0x8086 subdevice=0x0034
    vendor     = 'Intel Corporation'
    device     = 'Cannon Point-LP CNVi [Wireless-AC]'
    class      = network
Comment 15 Mark Johnston freebsd_committer freebsd_triage 2019-11-03 21:03:05 UTC
(In reply to Mark Johnston from comment #11)
FWIW, suspend/resume works for me with the 7th gen X1 carbon.
Comment 16 Conrad Meyer freebsd_committer freebsd_triage 2019-11-03 22:24:25 UTC
Mine has the same PCIID as Nils' in comment #1 (8086:2526), if that helps.  I wasn't able to try the patch.
Comment 17 Baptiste Daroussin freebsd_committer freebsd_triage 2019-11-04 08:28:12 UTC
works perfectly on X1 7th gen! thanks!
Comment 18 Salvador Martínez Mármol 2019-11-04 14:54:10 UTC
works ok on MSI PS42, Thank You!

pciconf -lv 
------------
iwm0@pci0:0:20:3:	class=0x028000 rev=0x30 hdr=0x00 vendor=0x8086 device=0x9df0 subvendor=0x8086 subdevice=0x0034
    vendor     = 'Intel Corporation'
    device     = 'Cannon Point-LP CNVi [Wireless-AC]'
    class      = network
Comment 19 Mark Johnston freebsd_committer freebsd_triage 2019-11-04 15:32:36 UTC
If anyone can report success or failure with a 9260 chip, I'd appreciate it.  So far all reports are for 9560.
Comment 20 Conrad Meyer freebsd_committer freebsd_triage 2019-11-04 17:46:33 UTC
(In reply to Mark Johnston from comment #19)
Ok, ok, I tested on my 9260.  Tl;dr it works fine (in "11g" mode).


$ pciconf -lv
iwm0@pci0:59:0:0:       class=0x028000 rev=0x29 hdr=0x00 vendor=0x8086 device=0x2526 subvendor=0x8086 subdevice=0x4010
    vendor     = 'Intel Corporation'
    device     = 'Wireless-AC 9260'
    class      = network


$ ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether XXXXXXXXXXXXXXXXX
        inet YYYYYYYYYYY netmask YYYYYYYYYY broadcast YYYYYYYYYYYYY
        groups: wlan
        ssid "ZZZZZZZZZZZZZZZZZZZZZZZZZ" channel Z (ZZZZ MHz 11g) bssid ZZZZZZZZZZZZZZZZZ
        regdomain FCC country US authmode WPA2/802.11i privacy ON
        deftxkey UNDEF AES-CCM 2:128-bit txpower 30 bmiss 10 scanvalid 60
        protmode CTS wme roaming MANUAL
        media: IEEE 802.11 Wireless Ethernet OFDM/18Mbps mode 11g
        status: associated
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>


$ ping -c4 <another host on the same subnet>
PING XXXXXXXXXXXXX (XXXXXXXXXXXXX): 56 data bytes
64 bytes from XXXXXXXXXXXXX: icmp_seq=0 ttl=64 time=5.147 ms
64 bytes from XXXXXXXXXXXXX: icmp_seq=1 ttl=64 time=4.024 ms
64 bytes from XXXXXXXXXXXXX: icmp_seq=2 ttl=64 time=1.603 ms
64 bytes from XXXXXXXXXXXXX: icmp_seq=3 ttl=64 time=1.591 ms

--- XXXXXXXXXXXXX ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 1.591/3.091/5.147/1.546 ms


"fetch" of a big file off the FreeBSD download mirror went at about 1.5-2 MB/s with the debug spam running on another console (I didn't disable it); also this was a GENERIC kernel.  (I failed to save logs from this.)
Comment 21 Mark Johnston freebsd_committer freebsd_triage 2019-11-04 17:51:34 UTC
(In reply to Conrad Meyer from comment #20)
Awesome, thanks Conrad.

I get roughly the same throughput.  Having already spent a bunch of time digging through iwm, I'm going to see how hard it would be to add 802.11n support.
Comment 22 Neel Chauhan freebsd_committer freebsd_triage 2019-11-06 15:24:15 UTC
This works if I don't connect to a Wi-Fi network with WPA-EAP (as used in NYU Tandon, using Cisco APs). If the network has EAP, I don't get an IP address via DHCP.

Wi-Fi works fine with just WPA-PSK on a Linksys WRT1900AC/OpenWrt and Pixel 3 hotspot.

I'm using iwm AC-9560 on a HP Spectre x360 13-ap0043dx (I mistyped it as 13-p0043dx all along).

I didn't have this problem on iwm 7000 or 8000 on WPA-EAP networks on older laptops.
Comment 23 Mark Johnston freebsd_committer freebsd_triage 2019-11-06 15:44:04 UTC
(In reply to Neel Chauhan from comment #22)
Are you using wpa_supplicant?  Can you provide debug output from running, e.g.,

# wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0 -dd

Feel free to mail me privately with debug output if you prefer.  A copy of /var/log/messages with some timestamps corresponding to an attempt to associate would be useful as well.
Comment 24 Ben Woods freebsd_committer freebsd_triage 2019-11-06 23:30:09 UTC
I am trying to get this new driver working on my Lenovo Thinkpad P1, but it is not working currently.

I am using FreeBSD 13-CURRENT r354376, with this patch:
https://people.freebsd.org/~markj/patches/iwm_9000/v1.diff

I suspect this has something to do with the firmware downgrade from 3 days ago:
https://svnweb.freebsd.org/base?view=revision&revision=354276

# pciconf -lv
none4@pci0:0:20:3:	class=0x028000 rev=0x10 hdr=0x00 vendor=0x8086 device=0xa370 subvendor=0x8086 subdevice=0x0030
    vendor     = 'Intel Corporation'
    device     = 'Wireless-AC 9560 [Jefferson Peak]'
    class      = network

Actions performed to try to load the driver with iwm-9260-34.fw.uu from r354376:
# kldload if_iwm
# kldload iwm9260fw
# sysctl net.wlan.devices
net.wlan.devices:
# dmesg
(nothing new)

Any ideas how I could try to get this working?

How would I try to later firmware version 43? I noticed the raw file is called iwm-9260-43.fw.uu, so I tried the following commands, but they did not work:
$ fetch -o iwm-9260-43.fw.uu "https://svnweb.freebsd.org/base/head/sys/contrib/dev/iwm/iwm-9260-43.fw.uu?revision=354201&view=co&pathrev=354275"
$ uudecode -p iwm-9260-43.fw.uu > ./iwm9260fw.ko
# kldload ./iwm9260fw.ko
kldload: an error occurred while loading module ./iwm9260fw.ko. Please check dmesg(8) for more details.
# dmesg
(nothing new)
Comment 25 Ben Woods freebsd_committer freebsd_triage 2019-11-06 23:33:15 UTC
Created attachment 208925 [details]
https://people.freebsd.org/~markj/patches/iwm_9000/v1.diff

Attach the v1 patch from markj to this PR.
Comment 26 Li-Wen Hsu freebsd_committer freebsd_triage 2019-11-06 23:35:26 UTC
(In reply to Ben Woods from comment #24)
Ben, I think you may need this additional patch for your device ID:

https://github.com/michael-yuji/freebsd/commit/1e4d0add6f519cc96b42dbd59e2e7dee72068033
Comment 27 Ben Woods freebsd_committer freebsd_triage 2019-11-07 00:16:18 UTC
(In reply to Li-Wen Hsu from comment #26)
Indeed - it is now working perfectly with this additional patch, and the older firmware iwm-9260-34.fw.uu.
Comment 28 Bjoern A. Zeeb freebsd_committer freebsd_triage 2019-11-07 10:03:24 UTC
I got an awful lot of debug messages when booting this patch with an 8265 installed.  Is there a tuneable or sysctl to turn this off?

The

iwm0@pci0:3:0:0:        class=0x028000 rev=0x29 hdr=0x00 vendor=0x8086 device=0x2526 subvendor=0x8086 subdevice=0x0014
    vendor     = 'Intel Corporation'
    device     = 'Wireless-AC 9260'
    class      = network

seems to basically work (at least after I stopped misspelling the firmware name ;) ).

I've not done any serious performance test given I get "11g" and the amount of logging.  I cannot wait to work on ac soon.   Interactive ssh sessions seem fine, so I am ok.
Comment 29 Li-Wen Hsu freebsd_committer freebsd_triage 2019-11-07 11:09:33 UTC
(In reply to Bjoern A. Zeeb from comment #28)
> I got an awful lot of debug messages when booting this patch with an 8265 installed.  Is there a tuneable or sysctl to turn this off?

There is sysctl dev.iwm.0.debug, but I think this line enables debugging unconditionally:

+        sc->sc_debug = (sc->sc_debug | IWM_DEBUG_ANY);
Comment 30 Mark Johnston freebsd_committer freebsd_triage 2019-11-07 16:10:53 UTC
(In reply to Li-Wen Hsu from comment #26)
Thanks, I rolled this into my patch set: https://people.freebsd.org/~markj/patches/iwm_9000/v2.diff

So far only Neel has reported problems.  I will try and reproduce them, so far my testing has been with only a small set of APs.  In the meantime I will go ahead and commit the patch set.
Comment 31 Neel Chauhan freebsd_committer freebsd_triage 2019-11-07 16:38:07 UTC
However, I have only used the v1 patch, and it has problems if I connect to a network using WPA-EAP. I have not tried the v2 patch.
Comment 32 Mark Johnston freebsd_committer freebsd_triage 2019-11-07 16:55:10 UTC
(In reply to Neel Chauhan from comment #31)
v2 won't help.
Comment 33 Raphael Kubo da Costa freebsd_committer freebsd_triage 2019-11-08 20:54:11 UTC
Created attachment 208985 [details]
Panic with r354423 memstick image

I've got a laptop with a 9560 card (0xa370) that's currently running another OS, so I downloaded the FreeBSD-13.0-CURRENT-amd64-20191107-r354423-memstick.img snapshot, entered Live CD mode and kldload'ed the modules I built on another machine with v2.diff applied.

Loading iwm9260fw.ko worked fine, but loading if_iwm.ko triggered a panic I'm attaching here.

Let me know if that makes sense or whether it could be caused by mixing the memstick image with a module built elsewhere.
Comment 34 Mark Johnston freebsd_committer freebsd_triage 2019-11-08 21:07:00 UTC
(In reply to Raphael Kubo da Costa from comment #33)
This panic is quite bizarre, so I strongly suspect that there is some incompatibility.
Comment 35 Mark Johnston freebsd_committer freebsd_triage 2019-11-08 22:36:15 UTC
All of these patches are now committed to head, BTW.  There is one pending issue reported by Neel in comment 22.
Comment 36 Raphael Kubo da Costa freebsd_committer freebsd_triage 2019-11-08 22:50:21 UTC
Created attachment 208986 [details]
dmesg with uCode load failure

That was indeed a mismatch. I've built my own memstick image with v2.diff and booted it. The driver loaded, but it failed to load the microcode. This is a Dell Latitude 5491.

The device's listed by pciconf as:

iwm0@pci0:0:20:3:        class=0x028000 rev=0x10 hdr=0x00 vendor=0x8086 device=0xa370 subvendor=0x8086 subdevice=0x4030
    vendor     = 'Intel Corporation'
    device     = 'Wireless-AC 9560 [Jefferson Peak]'
    class      = network

dmesg attached (sorry, this was a memstick image so it was easier to just take a picture)
Comment 37 Raphael Kubo da Costa freebsd_committer freebsd_triage 2019-11-08 22:52:30 UTC
> All of these patches are now committed to head, BTW

Is there any difference compared to v2.diff? I can svn up and build a newer memstick image.
Comment 38 Mark Johnston freebsd_committer freebsd_triage 2019-11-08 23:20:33 UTC
(In reply to Raphael Kubo da Costa from comment #36)
Hrm.  So, unfortunately my changes aren't sufficient for your driver.  There's a small handful of chips that are branded as 9[45]60 but have a newer MAC interface that implements 802.11ax.  Supporting them will be a fair bit more work.  In the meantime I'll at least modify iwm to not attach to such devices.
Comment 39 Mark Johnston freebsd_committer freebsd_triage 2019-11-08 23:26:24 UTC
(In reply to Mark Johnston from comment #38)
Oops, my bad.  I was looking at a different device with subdevice ID 0x4030.  You device should be supported.

Please mail me with the full dmesg and we can try to figure out what's going on.

In the meantime I'm just going to close this bug; please mail me and CC -wireless if any new issues come up.
Comment 40 madamin 2020-12-21 09:03:57 UTC
could you please add support for 9461 too? I can see 9260, 9000, 8265, ... drivers but I can't find 9461. I have loaded 9260 driver, it doesn't work for me.