Blame SOURCES/0039-Revert-iwlwifi-mvm-don-t-hide-HE-radiotap-data-in-SK.patch

deb259
From 9ecf5349a3dc266355c9ae1fd74ad711515097e8 Mon Sep 17 00:00:00 2001
deb259
From: Eugene Syromiatnikov <esyr@redhat.com>
deb259
Date: Thu, 5 Sep 2019 18:19:11 +0200
deb259
Subject: [PATCH 10/43] Revert "iwlwifi: mvm: don't hide HE radiotap data in
deb259
 SKB"
deb259
deb259
This reverts commit 3619b088a87905a28d51b10172ff1e923c692cd7.
deb259
---
deb259
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 47 +++++++--------------------
deb259
 1 file changed, 11 insertions(+), 36 deletions(-)
deb259
deb259
Index: src/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
deb259
===================================================================
deb259
--- src.orig/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c	2019-09-06 01:25:42.023336361 +0200
deb259
+++ src/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c	2019-09-06 01:25:42.203334065 +0200
deb259
@@ -66,37 +66,11 @@
deb259
 #include "mvm.h"
deb259
 #include "fw-api.h"
deb259
 
deb259
-static void *iwl_mvm_skb_get_hdr(struct sk_buff *skb)
deb259
-{
deb259
-	struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
deb259
-	u8 *data = skb->data;
deb259
-
deb259
-	/* Alignment concerns */
deb259
-	BUILD_BUG_ON(sizeof(struct ieee80211_radiotap_he) % 4);
deb259
-	BUILD_BUG_ON(sizeof(struct ieee80211_radiotap_he_mu) % 4);
deb259
-	BUILD_BUG_ON(sizeof(struct ieee80211_radiotap_lsig) % 4);
deb259
-	BUILD_BUG_ON(sizeof(struct ieee80211_vendor_radiotap) % 4);
deb259
-
deb259
-	if (rx_status->flag & RX_FLAG_RADIOTAP_HE)
deb259
-		data += sizeof(struct ieee80211_radiotap_he);
deb259
-	if (rx_status->flag & RX_FLAG_RADIOTAP_HE_MU)
deb259
-		data += sizeof(struct ieee80211_radiotap_he_mu);
deb259
-	if (rx_status->flag & RX_FLAG_RADIOTAP_LSIG)
deb259
-		data += sizeof(struct ieee80211_radiotap_lsig);
deb259
-	if (rx_status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA) {
deb259
-		struct ieee80211_vendor_radiotap *radiotap = (void *)data;
deb259
-
deb259
-		data += sizeof(*radiotap) + radiotap->len + radiotap->pad;
deb259
-	}
deb259
-
deb259
-	return data;
deb259
-}
deb259
-
deb259
 static inline int iwl_mvm_check_pn(struct iwl_mvm *mvm, struct sk_buff *skb,
deb259
 				   int queue, struct ieee80211_sta *sta)
deb259
 {
deb259
 	struct iwl_mvm_sta *mvmsta;
deb259
-	struct ieee80211_hdr *hdr = iwl_mvm_skb_get_hdr(skb);
deb259
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
deb259
 	struct ieee80211_rx_status *stats = IEEE80211_SKB_RXCB(skb);
deb259
 	struct iwl_mvm_key_pn *ptk_pn;
deb259
 	int res;
deb259
@@ -239,15 +213,12 @@
deb259
 {
deb259
 	struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
deb259
 	struct ieee80211_vendor_radiotap *radiotap;
deb259
-	const int size = sizeof(*radiotap) + sizeof(__le16);
deb259
+	int size = sizeof(*radiotap) + sizeof(__le16);
deb259
 
deb259
 	if (!mvm->cur_aid)
deb259
 		return;
deb259
 
deb259
-	/* ensure alignment */
deb259
-	BUILD_BUG_ON((size + 2) % 4);
deb259
-
deb259
-	radiotap = skb_put(skb, size + 2);
deb259
+	radiotap = skb_put(skb, size);
deb259
 	radiotap->align = 1;
deb259
 	/* Intel OUI */
deb259
 	radiotap->oui[0] = 0xf6;
deb259
@@ -257,12 +228,10 @@
deb259
 	radiotap->subns = 1;
deb259
 	radiotap->present = 0x1;
deb259
 	radiotap->len = size - sizeof(*radiotap);
deb259
-	radiotap->pad = 2;
deb259
+	radiotap->pad = 0;
deb259
 
deb259
 	/* fill the data now */
deb259
 	memcpy(radiotap->data, &mvm->cur_aid, sizeof(mvm->cur_aid));
deb259
-	/* and clear the padding */
deb259
-	memset(radiotap->data + sizeof(__le16), 0, radiotap->pad);
deb259
 
deb259
 	rx_status->flag |= RX_FLAG_RADIOTAP_VENDOR_DATA;
deb259
 }
deb259
@@ -710,7 +679,7 @@
deb259
 			    struct sk_buff *skb,
deb259
 			    struct iwl_rx_mpdu_desc *desc)
deb259
 {
deb259
-	struct ieee80211_hdr *hdr = iwl_mvm_skb_get_hdr(skb);
deb259
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
deb259
 	struct iwl_mvm_sta *mvm_sta;
deb259
 	struct iwl_mvm_baid_data *baid_data;
deb259
 	struct iwl_mvm_reorder_buffer *buffer;
deb259
@@ -1218,16 +1187,22 @@
deb259
 		.flags2 = cpu_to_le16(IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN |
deb259
 				      IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_KNOWN),
deb259
 	};
deb259
+	unsigned int radiotap_len = 0;
deb259
 
deb259
 	he = skb_put_data(skb, &known, sizeof(known));
deb259
+	radiotap_len += sizeof(known);
deb259
 	rx_status->flag |= RX_FLAG_RADIOTAP_HE;
deb259
 
deb259
 	if (phy_data->info_type == IWL_RX_PHY_INFO_TYPE_HE_MU ||
deb259
 	    phy_data->info_type == IWL_RX_PHY_INFO_TYPE_HE_MU_EXT) {
deb259
 		he_mu = skb_put_data(skb, &mu_known, sizeof(mu_known));
deb259
+		radiotap_len += sizeof(mu_known);
deb259
 		rx_status->flag |= RX_FLAG_RADIOTAP_HE_MU;
deb259
 	}
deb259
 
deb259
+	/* temporarily hide the radiotap data */
deb259
+	__skb_pull(skb, radiotap_len);
deb259
+
deb259
 	/* report the AMPDU-EOF bit on single frames */
deb259
 	if (!queue && !(phy_info & IWL_RX_MPDU_PHY_AMPDU)) {
deb259
 		rx_status->flag |= RX_FLAG_AMPDU_DETAILS;