Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 704084 - =sys-kernel/linux-firmware-20191215 with =sys-kernel/gentoo-sources-4.19.86 - iwlwifi: iwl_trans_send_cmd bad state = 0 // expected hw-decrypted unicast frame for station
Summary: =sys-kernel/linux-firmware-20191215 with =sys-kernel/gentoo-sources-4.19.86 -...
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Chí-Thanh Christopher Nguyễn
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-28 13:33 UTC by Gabriele Svelto
Modified: 2020-01-10 10:30 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriele Svelto 2019-12-28 13:33:43 UTC
After upgrading the linux-firmware package I noticed that the wifi performance was severely degraded, dropping from 100+ Mbps to less than 10, additionally the connection would often drop entirely.

Reproducible: Always

Steps to Reproduce:
1. Install the affected modules
2. Have an Intel wifi card
3. Try and do significant network transfers
Actual Results:  
These messages started appearing in my kernel log:

Nov 24 10:34:35 ruby kernel: [38639.868596] iwlwifi 0000:04:00.0: iwl_trans_send_cmd bad state = 0
Nov 24 13:00:10 ruby kernel: [47384.339603] iwlwifi 0000:04:00.0: expected hw-decrypted unicast frame for station

Or these ones:

Dec  2 11:45:59 ruby kernel: [14360.297921] iwlwifi 0000:04:00.0: Unhandled alg: 0x707

At some point I even hit a warning:

Dec 21 21:13:18 ruby kernel: [ 7465.712551] WARNING: CPU: 3 PID: 28769 at drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c:221 iwl_mvm_phy_ctxt_add.cold+0x1e/0x37 [iwlmvm]


Expected Results:  
The iwlwifi driver in the stable sources works properly with the linux-firmware blobs

Reverting the linux firmware package to =sys-kernel/linux-firmware-20191108 fixed the problem for me. Network performance was restored and no new warning appeared in my kernel log.

Apparently the problem is already known and a fix for the 5.4.x kernel series has already been posted:

https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/backport-iwlwifi.git/commit/?id=2fc5847ec08431b1b6e04aa799db686f53eeb31c

Unfortunately the fix hasn't been back-ported to stable kernels yet (it's not v4.19.91 as far as I can tell).
Comment 1 Gabriele Svelto 2019-12-28 14:09:08 UTC
For anybody else affected a quick workaround is to add:

=sys-kernel/linux-firmware-20191215

To /etc/portage/package.mask
Comment 2 Gabriele Svelto 2019-12-29 14:52:28 UTC
FYI after using the workaround in comment 1 for some time I realized that it doesn't fully solve the issue. It just makes it a lot less likely: I recorded a single error in 8 hours of uptime versus a few dozens with the more recent linux-firmware package.

In order to find a stable solution I tried a kernel which contains the upstream fix. I'm now using =sys-kernel/gentoo-sources-5.4.6 and =linux-firmware-20191215 with this kernel configuration:

https://setphaserstostun.org/config-5.4

This seems to work; I haven't found any iwlwifi-related error messages in the kernel log for the past few hours and the connection has been stable, delivering 100Mbps of bandwidth for sustained periods.
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2019-12-29 16:21:56 UTC
(In reply to Gabriele Svelto from comment #0)
> Expected Results:  
> The iwlwifi driver in the stable sources works properly with the
> linux-firmware blobs

I'm sorry to tell you, but we will never be able to meet your expectations:

The problem is, that firmware and kernel must be in sync (=compatible). However, Gentoo is a rolling release and we don't know which kernel version you are using. We don't know if we need to deliver latest firmware bits sometimes requiring latest kernel or  penultimate version because you are running still supported kernel from 2016 (4.4 or 4.9) for example.

This is something only user can solve. We know that this is a challenging problem but we don't have a solution: At the moment, linux-firmware is a giant  package containing firmwares for hundreds of different devices. User can easily run into situation where you want old firmware for wifi but latest AMD microcode for example.

Best solution for know is using savedconfig feature. Keep in mind: The firmware you want is probably still present in latest linux-firmware package but overshadowed by newer firmwares. However, even masking newer versions with savedconfig feature will cause own problems: You are on your own. You need to follow upstream to learn when upstream fixed a vulnerability for example or when you switch kernel version you have to remember to check installed firmwares in case you are masking a firmware version required by your new kernel.


Regarding your findings: You are looking for https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=50f5604476b2bd728910b2e1803a6eafd0eeaf3d upstream. It's present in 5.3+.

You didn't share any details of your wifi chip. So please ask for backport on your own (you even need to test commit from above before doing so which will require access to affected device).
Comment 4 Gabriele Svelto 2019-12-29 19:43:18 UTC
(In reply to Thomas Deutschmann from comment #3)
> I'm sorry to tell you, but we will never be able to meet your expectations:
> 
> The problem is, that firmware and kernel must be in sync (=compatible).
> However, Gentoo is a rolling release and we don't know which kernel version
> you are using. We don't know if we need to deliver latest firmware bits
> sometimes requiring latest kernel or  penultimate version because you are
> running still supported kernel from 2016 (4.4 or 4.9) for example.

I apologize but I filed the bug only because this is happening on the latest versions of gentoo-sources and linux-firmware that have been marked stable. I understand that's impossible to guarantee compatibility across all versions.

Since this configuration should be common among Gentoo users (just stable packages) I thought it was worth to at least document the issue.

> This is something only user can solve. We know that this is a challenging
> problem but we don't have a solution: At the moment, linux-firmware is a
> giant  package containing firmwares for hundreds of different devices. User
> can easily run into situation where you want old firmware for wifi but
> latest AMD microcode for example.
> 
> Best solution for know is using savedconfig feature. Keep in mind: The
> firmware you want is probably still present in latest linux-firmware package
> but overshadowed by newer firmwares. However, even masking newer versions
> with savedconfig feature will cause own problems: You are on your own. You
> need to follow upstream to learn when upstream fixed a vulnerability for
> example or when you switch kernel version you have to remember to check
> installed firmwares in case you are masking a firmware version required by
> your new kernel.

Thanks for the tip.

> Regarding your findings: You are looking for
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/
> ?id=50f5604476b2bd728910b2e1803a6eafd0eeaf3d upstream. It's present in 5.3+.
> 
> You didn't share any details of your wifi chip. So please ask for backport
> on your own (you even need to test commit from above before doing so which
> will require access to affected device).

Yes, I forgot, it's an Intel Wireless-AC 9260. I will try backporting the fix to 4.19.x to check if it works and then follow up with upstream.
Comment 5 Gabriele Svelto 2020-01-10 10:30:10 UTC
Since I found a working configuration I'm closing this. For anybody with the same problem (and the same card) one other working configuration w/o using a 5.4.x kernel is =sys-kernel/gentoo-sources-4.19.86 using the firmware version 34 (iwlwifi-9260-th-b0-jf-b0-34.ucode file in linux-firmware).