Bug 197981

Summary: iwlwifi: 8265: Too many chunks: 20
Product: Drivers Reporter: Liam Powell (liampwll)
Component: network-wirelessAssignee: DO NOT USE - assign "network-wireless-intel" component instead (linuxwifi)
Status: CLOSED CODE_FIX    
Severity: normal CC: iam, liampwll, linuxwifi, luca
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 4.14.1 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg output
Fix canditate

Description Liam Powell 2017-11-24 15:48:34 UTC
Created attachment 260823 [details]
dmesg output

iwlwifi prints "Too many chunks: 20" multiple times per second when there is network activity.

firmware-version: 31.532993.0
Comment 1 Liam Powell 2017-11-25 07:06:56 UTC
Turning on swcrypto appears to fix the issue.
Comment 2 Luca Coelho 2017-11-25 11:00:53 UTC
Thanks for reporting! We'll take a look into it.

Any more information you can give us? Type of encryption and such?
Comment 3 Liam Powell 2017-11-25 12:28:40 UTC
AES, and I have these AES related kernel config options:

# CONFIG_SND_MAESTRO3 is not set
CONFIG_CRYPTO_AES=y
# CONFIG_CRYPTO_AES_TI is not set
CONFIG_CRYPTO_AES_X86_64=y
CONFIG_CRYPTO_AES_NI_INTEL=y
CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64=y
# CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64 is not set
Comment 4 Emmanuel Grumbach 2017-12-25 21:04:21 UTC
This can happen when the network stack sends packets that are extremely fragmented.

What application do you use to create such type of traffic?

The explanation on why swcrypto helps is that in order to encrypt the packet in the driver (mac80211 really), we first linearize it (meaning: we copy it to another buffer which is physically contiguous) and then there is no fragmentation.

So what we could do is just to linearize the skb in the if that prints this error message.
Comment 5 Liam Powell 2017-12-26 15:04:40 UTC
I first noticed it when using KTorrent but it continued when other programs were using the network after KTorrent was closed. After testing it again it seems I can only reproduce it using KTorrent.
Comment 6 Emmanuel Grumbach 2017-12-26 15:43:12 UTC
Ok - I guess we can try to do something about it.

I'll come up with a patch later.
Chances are that this patch will crash your system, so... beware.
Comment 7 Emmanuel Grumbach 2017-12-26 18:41:59 UTC
wait - no. I am missing something here.

Please reproduce with:

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
index b47d5483bcad..4c446f1e15e5 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
@@ -470,8 +470,8 @@ static int iwl_pcie_txq_build_tfd(struct iwl_trans *trans, struct iwl_txq *txq,
 
        /* Each TFD can point to a maximum max_tbs Tx buffers */
        if (num_tbs >= trans_pcie->max_tbs) {
-               IWL_ERR(trans, "Error can not send more than %d chunks\n",
-                       trans_pcie->max_tbs);
+               IWL_ERR(trans, "Error can not send more than %d chunks - had %d\n",
+                       trans_pcie->max_tbs, num_tbs);
                return -EINVAL;
        }
Comment 8 Liam Powell 2017-12-27 00:11:51 UTC
The error happens in a different area (line 382: IWL_ERR(trans, "Too many chunks: %i\n", num_tbs);)

max_tbs and num_tbs are both 20 every time the error occurs.
Comment 9 Emmanuel Grumbach 2017-12-27 07:32:54 UTC
Created attachment 273329 [details]
Fix canditate

Please try the patch attached.
Comment 10 Liam Powell 2017-12-29 07:57:27 UTC
Working and seems stable on my machine.
Comment 11 ValdikSS 2018-08-02 12:51:51 UTC
(In reply to Emmanuel Grumbach from comment #9)
> Created attachment 273329 [details]
> Fix canditate
> 
> Please try the patch attached.

It is possible to push this patch into current long-term kernels?
Comment 12 Emmanuel Grumbach 2018-08-02 13:17:53 UTC
(In reply to ValdikSS from comment #11)
> (In reply to Emmanuel Grumbach from comment #9)
> > Created attachment 273329 [details]
> > Fix canditate
> > 
> > Please try the patch attached.
> 
> It is possible to push this patch into current long-term kernels?

Go ahead :)

You can send the patch just like I can :)

If you don't know how, I'll do it.
Comment 13 ValdikSS 2018-08-02 13:35:48 UTC
(In reply to Emmanuel Grumbach from comment #12)
> (In reply to ValdikSS from comment #11)
> > (In reply to Emmanuel Grumbach from comment #9)
> > > Created attachment 273329 [details]
> > > Fix canditate
> > > 
> > > Please try the patch attached.
> > 
> > It is possible to push this patch into current long-term kernels?
> 
> Go ahead :)
> 
> You can send the patch just like I can :)
> 
> If you don't know how, I'll do it.

Please post it yourself.
Comment 14 Emmanuel Grumbach 2018-08-02 13:55:03 UTC
Done