diff mbox

[19/24] iwlwifi: mvm: fix TCP CSUM offload with WEP and A000 series

Message ID 20170728142337.19183-20-luca@coelho.fi (mailing list archive)
State Superseded
Delegated to: Luca Coelho
Headers show

Commit Message

Luca Coelho July 28, 2017, 2:23 p.m. UTC
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

When we enabled TCP checksum offload, we need to tell the
firmware where the IP header starts. If we have an IV, then
we need to adapt that value since the IV is placed before
the SNAP header. This is true only for cases where the
driver adds the IV, not the WEP case in which the IV is
added by the firmware itself.

On A000 devices series, the IV is always added by the
device.

Fix this.

Fixes: 5e6a98dc4863 ("iwlwifi: mvm: enable TCP/UDP checksum support for 9000 family")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Luca Coelho Aug. 1, 2017, 4:48 a.m. UTC | #1
On Fri, 2017-07-28 at 17:23 +0300, Luca Coelho wrote:
> From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

> 

> When we enabled TCP checksum offload, we need to tell the

> firmware where the IP header starts. If we have an IV, then

> we need to adapt that value since the IV is placed before

> the SNAP header. This is true only for cases where the

> driver adds the IV, not the WEP case in which the IV is

> added by the firmware itself.

> 

> On A000 devices series, the IV is always added by the

> device.

> 

> Fix this.

> 

> Fixes: 5e6a98dc4863 ("iwlwifi: mvm: enable TCP/UDP checksum support for 9000 family")

> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

> ---


Emmanuel asked me to send this for the rc-series, since it fixes our
newly supported 9000 family.

--
Luca.
diff mbox

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index cccff1073e3b..f16228f9b93b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -184,8 +184,14 @@  static u16 iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
 	else
 		udp_hdr(skb)->check = 0;
 
-	/* mac header len should include IV, size is in words */
-	if (info->control.hw_key)
+	/*
+	 * mac header len should include IV, size is in words unless
+	 * the IV is added by the firmware like in WEP.
+	 * In new Tx API, the IV is always added by the firmware.
+	 */
+	if (!iwl_mvm_has_new_tx_api(mvm) && info->control.hw_key &&
+	    info->control.hw_key->cipher != WLAN_CIPHER_SUITE_WEP40 &&
+	    info->control.hw_key->cipher != WLAN_CIPHER_SUITE_WEP104)
 		mh_len += info->control.hw_key->iv_len;
 	mh_len /= 2;
 	offload_assist |= mh_len << TX_CMD_OFFLD_MH_SIZE;