Blame SOURCES/0051-Revert-iwlwifi-mvm-clean-up-HE-radiotap-RU-allocatio.patch

deb259
From a93e24f4eaf087b32f3e81022d4e907224632a73 Mon Sep 17 00:00:00 2001
deb259
From: Eugene Syromiatnikov <esyr@redhat.com>
deb259
Date: Thu, 5 Sep 2019 18:46:38 +0200
deb259
Subject: [PATCH 22/43] Revert "iwlwifi: mvm: clean up HE radiotap RU
deb259
 allocation parsing"
deb259
deb259
This reverts commit ffe9d734b8b556737c87acaa08666d0a6c1686ab.
deb259
---
deb259
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 166 ++++++++++++--------------
deb259
 1 file changed, 77 insertions(+), 89 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:44.039310646 +0200
deb259
+++ src/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c	2019-09-06 01:25:44.206308516 +0200
deb259
@@ -963,83 +963,10 @@
deb259
 	}
deb259
 }
deb259
 
deb259
-static void
deb259
-iwl_mvm_decode_he_phy_ru_alloc(u64 he_phy_data, u32 rate_n_flags,
deb259
-			       struct ieee80211_radiotap_he *he,
deb259
-			       struct ieee80211_radiotap_he_mu *he_mu,
deb259
-			       struct ieee80211_rx_status *rx_status)
deb259
-{
deb259
-	/*
deb259
-	 * Unfortunately, we have to leave the mac80211 data
deb259
-	 * incorrect for the case that we receive an HE-MU
deb259
-	 * transmission and *don't* have the HE phy data (due
deb259
-	 * to the bits being used for TSF). This shouldn't
deb259
-	 * happen though as management frames where we need
deb259
-	 * the TSF/timers are not be transmitted in HE-MU.
deb259
-	 */
deb259
-	u8 ru = FIELD_GET(IWL_RX_HE_PHY_RU_ALLOC_MASK, he_phy_data);
deb259
-	u8 offs = 0;
deb259
-
deb259
-	rx_status->bw = RATE_INFO_BW_HE_RU;
deb259
-
deb259
-	he->data1 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN);
deb259
-
deb259
-	switch (ru) {
deb259
-	case 0 ... 36:
deb259
-		rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_26;
deb259
-		offs = ru;
deb259
-		break;
deb259
-	case 37 ... 52:
deb259
-		rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_52;
deb259
-		offs = ru - 37;
deb259
-		break;
deb259
-	case 53 ... 60:
deb259
-		rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_106;
deb259
-		offs = ru - 53;
deb259
-		break;
deb259
-	case 61 ... 64:
deb259
-		rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_242;
deb259
-		offs = ru - 61;
deb259
-		break;
deb259
-	case 65 ... 66:
deb259
-		rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_484;
deb259
-		offs = ru - 65;
deb259
-		break;
deb259
-	case 67:
deb259
-		rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_996;
deb259
-		break;
deb259
-	case 68:
deb259
-		rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_2x996;
deb259
-		break;
deb259
-	}
deb259
-	he->data2 |= le16_encode_bits(offs,
deb259
-				      IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET);
deb259
-	he->data2 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_KNOWN |
deb259
-				 IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET_KNOWN);
deb259
-	if (he_phy_data & IWL_RX_HE_PHY_RU_ALLOC_SEC80)
deb259
-		he->data2 |=
deb259
-			cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_SEC);
deb259
-
deb259
-	if (he_mu) {
deb259
-#define CHECK_BW(bw) \
deb259
-	BUILD_BUG_ON(IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_ ## bw ## MHZ != \
deb259
-		     RATE_MCS_CHAN_WIDTH_##bw >> RATE_MCS_CHAN_WIDTH_POS)
deb259
-		CHECK_BW(20);
deb259
-		CHECK_BW(40);
deb259
-		CHECK_BW(80);
deb259
-		CHECK_BW(160);
deb259
-		he_mu->flags2 |=
deb259
-			le16_encode_bits(FIELD_GET(RATE_MCS_CHAN_WIDTH_MSK,
deb259
-						   rate_n_flags),
deb259
-					 IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW);
deb259
-	}
deb259
-}
deb259
-
deb259
 static void iwl_mvm_decode_he_phy_data(struct iwl_mvm *mvm,
deb259
 				       struct iwl_rx_mpdu_desc *desc,
deb259
 				       struct ieee80211_radiotap_he *he,
deb259
 				       struct ieee80211_radiotap_he_mu *he_mu,
deb259
-				       struct ieee80211_rx_status *rx_status,
deb259
 				       u64 he_phy_data, u32 rate_n_flags,
deb259
 				       int queue)
deb259
 {
deb259
@@ -1088,17 +1015,6 @@
deb259
 			he->data3 |=
deb259
 				cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA3_UL_DL);
deb259
 	}
deb259
-
deb259
-	switch (FIELD_GET(IWL_RX_HE_PHY_INFO_TYPE_MASK, he_phy_data)) {
deb259
-	case IWL_RX_HE_PHY_INFO_TYPE_MU_EXT_INFO:
deb259
-	case IWL_RX_HE_PHY_INFO_TYPE_TB_EXT_INFO:
deb259
-		iwl_mvm_decode_he_phy_ru_alloc(he_phy_data, rate_n_flags,
deb259
-					       he, he_mu, rx_status);
deb259
-		break;
deb259
-	default:
deb259
-		/* nothing */
deb259
-		break;
deb259
-	}
deb259
 }
deb259
 
deb259
 static void iwl_mvm_rx_he(struct iwl_mvm *mvm, struct sk_buff *skb,
deb259
@@ -1163,8 +1079,8 @@
deb259
 	}
deb259
 
deb259
 	if (he_phy_data != HE_PHY_DATA_INVAL)
deb259
-		iwl_mvm_decode_he_phy_data(mvm, desc, he, he_mu, rx_status,
deb259
-					   he_phy_data, rate_n_flags, queue);
deb259
+		iwl_mvm_decode_he_phy_data(mvm, desc, he, he_mu, he_phy_data,
deb259
+					   rate_n_flags, queue);
deb259
 
deb259
 	/* update aggregation data for monitor sake on default queue */
deb259
 	if (!queue && (phy_info & IWL_RX_MPDU_PHY_AMPDU)) {
deb259
@@ -1188,12 +1104,84 @@
deb259
 		rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_106;
deb259
 	}
deb259
 
deb259
-	/* actually data is filled in mac80211 */
deb259
-	if (he_type == RATE_MCS_HE_TYPE_SU ||
deb259
-	    he_type == RATE_MCS_HE_TYPE_EXT_SU)
deb259
+	if (he_phy_data != HE_PHY_DATA_INVAL &&
deb259
+	    (FIELD_GET(IWL_RX_HE_PHY_INFO_TYPE_MASK, he_phy_data) ==
deb259
+			IWL_RX_HE_PHY_INFO_TYPE_MU_EXT_INFO ||
deb259
+	     FIELD_GET(IWL_RX_HE_PHY_INFO_TYPE_MASK, he_phy_data) ==
deb259
+			IWL_RX_HE_PHY_INFO_TYPE_TB_EXT_INFO)) {
deb259
+		/*
deb259
+		 * Unfortunately, we have to leave the mac80211 data
deb259
+		 * incorrect for the case that we receive an HE-MU
deb259
+		 * transmission and *don't* have the HE phy data (due
deb259
+		 * to the bits being used for TSF). This shouldn't
deb259
+		 * happen though as management frames where we need
deb259
+		 * the TSF/timers are not be transmitted in HE-MU.
deb259
+		 */
deb259
+		u8 ru = FIELD_GET(IWL_RX_HE_PHY_RU_ALLOC_MASK, he_phy_data);
deb259
+		u8 offs = 0;
deb259
+
deb259
+		rx_status->bw = RATE_INFO_BW_HE_RU;
deb259
+
deb259
 		he->data1 |=
deb259
 			cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN);
deb259
 
deb259
+		switch (ru) {
deb259
+		case 0 ... 36:
deb259
+			rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_26;
deb259
+			offs = ru;
deb259
+			break;
deb259
+		case 37 ... 52:
deb259
+			rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_52;
deb259
+			offs = ru - 37;
deb259
+			break;
deb259
+		case 53 ... 60:
deb259
+			rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_106;
deb259
+			offs = ru - 53;
deb259
+			break;
deb259
+		case 61 ... 64:
deb259
+			rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_242;
deb259
+			offs = ru - 61;
deb259
+			break;
deb259
+		case 65 ... 66:
deb259
+			rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_484;
deb259
+			offs = ru - 65;
deb259
+			break;
deb259
+		case 67:
deb259
+			rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_996;
deb259
+			break;
deb259
+		case 68:
deb259
+			rx_status->he_ru = NL80211_RATE_INFO_HE_RU_ALLOC_2x996;
deb259
+			break;
deb259
+		}
deb259
+		he->data2 |=
deb259
+			le16_encode_bits(offs,
deb259
+					 IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET);
deb259
+		he->data2 |=
deb259
+			cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_KNOWN |
deb259
+				    IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET_KNOWN);
deb259
+		if (he_phy_data & IWL_RX_HE_PHY_RU_ALLOC_SEC80)
deb259
+			he->data2 |=
deb259
+				cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_SEC);
deb259
+
deb259
+		if (he_mu) {
deb259
+#define CHECK_BW(bw) \
deb259
+	BUILD_BUG_ON(IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_ ## bw ## MHZ != \
deb259
+		     RATE_MCS_CHAN_WIDTH_##bw >> RATE_MCS_CHAN_WIDTH_POS)
deb259
+			CHECK_BW(20);
deb259
+			CHECK_BW(40);
deb259
+			CHECK_BW(80);
deb259
+			CHECK_BW(160);
deb259
+			he->data2 |=
deb259
+				le16_encode_bits(FIELD_GET(RATE_MCS_CHAN_WIDTH_MSK,
deb259
+							   rate_n_flags),
deb259
+						 IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW);
deb259
+		}
deb259
+	} else if (he_type == RATE_MCS_HE_TYPE_SU ||
deb259
+		   he_type == RATE_MCS_HE_TYPE_EXT_SU) {
deb259
+		he->data1 |=
deb259
+			cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN);
deb259
+	}
deb259
+
deb259
 	stbc = (rate_n_flags & RATE_MCS_STBC_MSK) >> RATE_MCS_STBC_POS;
deb259
 	rx_status->nss =
deb259
 		((rate_n_flags & RATE_VHT_MCS_NSS_MSK) >>