Wi-Fi firmware crashing in Ubuntu 16.04

I have a Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter that works fine after rebooting the computer, but if I disable and re-enable wi-fi via the GUI control at the top right corner of the screen, it never comes back on and I must reboot. I have reason to believe this is a firmware problem. Does anything look wrong in the following:

lspci for my Wi-Fi card:

03:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 20)
    Subsystem: Lenovo QCA6174 802.11ac Wireless Network Adapter
    Flags: bus master, fast devsel, latency 0, IRQ 52
    Memory at c4000000 (64-bit, non-prefetchable) [size=2M]
    Capabilities: [40] Power Management version 3
    Capabilities: [50] MSI: Enable+ Count=8/8 Maskable+ 64bit-
    Capabilities: [70] Express Endpoint, MSI 00
    Capabilities: [100] Advanced Error Reporting
    Capabilities: [148] Virtual Channel
    Capabilities: [168] Device Serial Number 00-00-00-00-00-00-00-00
    Capabilities: [178] Latency Tolerance Reporting
    Capabilities: [180] L1 PM Substates
    Kernel driver in use: ath10k_pci
    Kernel modules: ath10k_pci

My dmesg (right after booting up):

[   12.530934] ath10k_pci 0000:03:00.0: pci irq msi-x interrupts 8 irq_mode 0 reset_mode 0
[   12.880922] ath10k_pci 0000:03:00.0: Direct firmware load for ath10k/cal-pci-0000:03:00.0.bin failed with error -2
[   14.538317] ath10k_pci 0000:03:00.0: qca6174 hw2.1 (0x05010000, 0x003405ff sub 17aa:3044) fw SW_RM.1.1.1-00157-QCARMSWPZ-1 fwapi 5 bdapi 2 htt-ver 3.1 wmi-op 4 htt-op 3 cal otp max-sta 32 raw 0 hwcrypto 1 features ignore-otp,no-4addr-pad
[   14.538321] ath10k_pci 0000:03:00.0: debug 0 debugfs 1 tracing 1 dfs 0 testmode 0

my dmesg (after disabling wi-fi):

[  657.466226] ath10k_pci 0000:03:00.0: firmware crashed! (uuid a1205b5c-0343-4aff-bda6-bb1e8842ada8)
[  657.466234] ath10k_pci 0000:03:00.0: qca6174 hw2.1 (0x05010000, 0x003405ff sub 17aa:3044) fw SW_RM.1.1.1-00157-QCARMSWPZ-1 fwapi 5 bdapi 2 htt-ver 3.1 wmi-op 4 htt-op 3 cal otp max-sta 32 raw 0 hwcrypto 1 features ignore-otp,no-4addr-pad
[  657.466236] ath10k_pci 0000:03:00.0: debug 0 debugfs 1 tracing 1 dfs 0 testmode 0
[  657.468246] ath10k_pci 0000:03:00.0: firmware register dump:
[  657.468248] ath10k_pci 0000:03:00.0: [00]: 0x05010000 0x00000000 0x0092E4DC 0xF6151216
[  657.468249] ath10k_pci 0000:03:00.0: [04]: 0x0092E4DC 0x00060130 0x00000018 0x0041A760
[  657.468251] ath10k_pci 0000:03:00.0: [08]: 0xF6151202 0x00400000 0x00000000 0x000A5C88
[  657.468252] ath10k_pci 0000:03:00.0: [12]: 0x00000009 0x00000000 0x0096C09C 0x0096C0A7
[  657.468253] ath10k_pci 0000:03:00.0: [16]: 0x0096BDBC 0x009286B6 0x00000000 0x009287BD
[  657.468254] ath10k_pci 0000:03:00.0: [20]: 0x4092E4DC 0x0041A710 0x00000000 0x0F000000
[  657.468256] ath10k_pci 0000:03:00.0: [24]: 0x809432A7 0x0041A770 0x0040D400 0xC092E4DC
[  657.468257] ath10k_pci 0000:03:00.0: [28]: 0x80942BC4 0x0041A790 0xF6151202 0x00400000
[  657.468258] ath10k_pci 0000:03:00.0: [32]: 0x80947BA7 0x0041A7B0 0x00404BF8 0x00413980
[  657.468259] ath10k_pci 0000:03:00.0: [36]: 0x809BDECC 0x0041A7D0 0x00404BF8 0x00413980
[  657.468261] ath10k_pci 0000:03:00.0: [40]: 0x8099638C 0x0041A7F0 0x00404BF8 0x00000000
[  657.468262] ath10k_pci 0000:03:00.0: [44]: 0x80992076 0x0041A810 0x004084F0 0x00405244
[  657.468263] ath10k_pci 0000:03:00.0: [48]: 0x80996BD3 0x0041A830 0x004084F0 0x00000000
[  657.468264] ath10k_pci 0000:03:00.0: [52]: 0x800B4405 0x0041A850 0x00422318 0x00005002
[  657.468266] ath10k_pci 0000:03:00.0: [56]: 0x809A6C34 0x0041A8E0 0x0042932C 0x0042CA20
[  657.468313] ath10k_pci 0000:03:00.0: could not suspend target (-108)
[  657.544844] ath10k_pci 0000:03:00.0: cannot restart a device that hasn't been started

Obviously there is a problem here.

What I have tried: I followed instructions in a similar post and re-downloaded the ath10k_pci firmware, and did the whole "rename to firmware-5.bin and firmware-4.bin" thing. This did not work and I'm sure I did it correctly. Other than that, I'm not sure what to do.

EDIT: I think a very important part of this is that my Wi-Fi DOES work, only when I do a fresh bootup. As soon as I disable my Wi-Fi via the GUI icon in the system tray, the driver crashes and I must reboot.


Solution 1:

I downgraded my linux-firmware package from 1.157.13 -> 1.157. I downloaded linux-firmware_1.157_all.deb from https://launchpad.net/ubuntu/xenial/amd64/linux-firmware/1.157 and installed it with the following command:

sudo dpkg -i linux-firmware_1.157_all.deb

So far,so good. :)

Solution 2:

Okay, I fixed it. After hours of tweaking and brute forcing, I finally found a configuration of firmware files and board files from various git repositories. For my system, I needed the kvalo board-2.bin and the atondwal board.bin and firmware-5.bin. For anyone who has the same problem as me, these can be found from:

https://github.com/kvalo/ath10k-firmware

and

https://github.com/atondwal/ath10k-firmware

Just try different combinations of firmwares and board files from these repositories until you find the right one. And when you get it working, don't try to understand it, just accept that it works and move on ;)

Solution 3:

I'm having still (06/2018, Ubuntu 18.04, latest linux-firmware) the issue with the crashing ath10k_pci firmware, mostly after the laptop goes to suspend mode.

My workaround currently is restarting it via:

sudo rmmod ath10k_pci
sudo modprobe ath10k_pci
sudo ifup -a