Skip to contentSkip to conversation

mac80211: enable TKIP when using encapsulation offloading

PATCH New Sathishkumar Muruganandam 1 participant 3 messages Apr 24, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover mac80211: enable TKIP when using encapsulation offloading

TKIP was disabled on encap offload mode since if TKIP MIC error reporting is not capable by the driver using encap offload mode, then TKIP countermeasures wont work.

Enabling back TKIP bring-up in encap offload mode to leave the control with the driver to disable hw encap when it is not capable of TKIP MIC error reporting.

Sathishkumar Muruganandam (2):
mac80211: enable TKIP when using encapsulation offloading
ath11k: add 802.3 undecap support to fix TKIP MIC error reporting

 drivers/net/wireless/ath/ath11k/dp_rx.c | 39 ++++++++++++++++++++++++++++++++-
 net/mac80211/iface.c                    |  7 ------
 net/mac80211/key.c                      |  7 ------
 3 files changed, 38 insertions(+), 15 deletions(-)
Signature · 6 lines
2.7.4

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#1 lore raw

PATCH 1/2 mac80211: enable TKIP when using encapsulation offloading

TKIP was disabled on encap offload mode since if TKIP MIC error reporting is not capable by the driver using encap offload mode, then TKIP countermeasures wont work.

Enabling back TKIP bring-up in encap offload mode to leave the control with the driver to disable hw encap when it is not capable of TKIP MIC error reporting.

Fixes 50ff477a8639 ("mac80211: add 802.11 encapsulation offloading support")
---
 net/mac80211/iface.c | 7 -------
 net/mac80211/key.c   | 7 -------
 2 files changed, 14 deletions(-)
net/mac80211/iface.c +0 -7
index d069825705d6..68af8acde0f0 100644
@@ -1257,13 +1257,6 @@ bool ieee80211_set_hw_80211_encap(struct ieee80211_vif *vif, bool enable)
 	    (local->hw.wiphy->frag_threshold != (u32)-1))
 		enable = false;
 
-	mutex_lock(&sdata->local->key_mtx);
-	list_for_each_entry(key, &sdata->key_list, list) {
-		if (key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)
-			enable = false;
-	}
-	mutex_unlock(&sdata->local->key_mtx);
-
 	__ieee80211_set_hw_80211_encap(sdata, enable);
 
 	return enable;
net/mac80211/key.c +0 -7
index 8f403c1bb908..25cab6fc127c 100644
@@ -177,13 +177,6 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
 		}
 	}
 
-	/* TKIP countermeasures don't work in encap offload mode */
-	if (key->conf.cipher == WLAN_CIPHER_SUITE_TKIP &&
-	    sdata->hw_80211_encap) {
-		sdata_dbg(sdata, "TKIP is not allowed in hw 80211 encap mode\n");
-		return -EINVAL;
-	}
-
 	ret = drv_set_key(key->local, SET_KEY, sdata,
 			  sta ? &sta->sta : NULL, &key->conf);
 
Signature · 6 lines
2.7.4

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#2 lore raw

PATCH 2/2 ath11k: add 802.3 undecap support to fix TKIP MIC error reporting

In reply to Sathishkumar Muruganandam

Currently DECAP_TYPE_8023 frames with TKIP MIC error is not undecaped and hence fails to do TKIP MIC error reporting in ieee80211_rx_napi() path.

Fix this by adding undecap support for ieee80211_rx_napi() to process these frames and perform TKIP counter-measures when there is MIC error reported.

Tested with STA triggering TKIP MIC error frames (using debugfs "tkip_mic_test" in SW encryption mode) twice within a minute and verify TKIP counter-measures are performed as expected.

---
 drivers/net/wireless/ath/ath11k/dp_rx.c | 39 ++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +38 -1
index bbd7da48518f..8db42a3d4a1f 100644
@@ -1986,6 +1986,42 @@ static void ath11k_dp_rx_h_undecap_eth(struct ath11k *ar,
 	ether_addr_copy(ieee80211_get_SA(hdr), sa);
 }
 
+static void ath11k_dp_rx_h_undecap_snap(struct ath11k *ar,
+					struct sk_buff *msdu,
+					u8 *first_hdr,
+					enum hal_encrypt_type enctype,
+					struct ieee80211_rx_status *status)
+{
+	struct ieee80211_hdr *hdr;
+	size_t hdr_len;
+	u8 l3_pad_bytes;
+	struct hal_rx_desc *rx_desc;
+
+	/* Delivered decapped frame:
+	 * [amsdu header] <-- replaced with 802.11 hdr
+	 * [rfc1042/llc]
+	 * [payload]
+	 */
+
+	rx_desc = (void *)msdu->data - sizeof(*rx_desc);
+	l3_pad_bytes = ath11k_dp_rx_h_msdu_end_l3pad(rx_desc);
+
+	skb_put(msdu, l3_pad_bytes);
+	skb_pull(msdu, sizeof(struct ath11k_dp_amsdu_subframe_hdr) + l3_pad_bytes);
+
+	hdr = (struct ieee80211_hdr *)first_hdr;
+	hdr_len = ieee80211_hdrlen(hdr->frame_control);
+
+	if (!(status->flag & RX_FLAG_IV_STRIPPED)) {
+		memcpy(skb_push(msdu,
+				ath11k_dp_rx_crypto_param_len(ar, enctype)),
+		       (void *)hdr + hdr_len,
+			ath11k_dp_rx_crypto_param_len(ar, enctype));
+	}
+
+	memcpy(skb_push(msdu, hdr_len), hdr, hdr_len);
+}
+
 static void ath11k_dp_rx_h_undecap(struct ath11k *ar, struct sk_buff *msdu,
 				   struct hal_rx_desc *rx_desc,
 				   enum hal_encrypt_type enctype,
@@ -2013,7 +2049,8 @@ static void ath11k_dp_rx_h_undecap(struct ath11k *ar, struct sk_buff *msdu,
 					   enctype, status);
 		break;
 	case DP_RX_DECAP_TYPE_8023:
-		/* TODO: Handle undecap for these formats */
+		ath11k_dp_rx_h_undecap_snap(ar, msdu, first_hdr,
+					    enctype, status);
 		break;
 	}
 }
Signature · 6 lines
2.7.4

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k