wlan-ap-Telecominfraproject/feeds/wifi-ax/mac80211/patches/qca/215-mac80211-restrict-peer-s-HE-capability-to-own.patch
John Crispin 54939fdb0f mac80211-ax: update to ath11k-ed2 release
Signed-off-by: John Crispin <john@phrozen.org>
2020-12-02 09:48:18 +01:00

75 lines
2.7 KiB
Diff

From eea1b77db809f88bf90b7c6296339fa5ecd291e0 Mon Sep 17 00:00:00 2001
From: P Praneesh <ppranees@codeaurora.org>
Date: Mon, 12 Oct 2020 01:18:02 +0530
Subject: [PATCH] mac80211: restrict peer's HE capability to own
Implement restricting peer HE capablities to
device's own capablities. This is useful when
the device have different capablities, in particular
when they differ in number of spatial streams.
Signed-off-by: P Praneesh <ppranees@codeaurora.org>
---
net/mac80211/he.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
--- a/net/mac80211/he.c
+++ b/net/mac80211/he.c
@@ -52,6 +52,48 @@ ieee80211_update_from_he_6ghz_capa(const
sta->sta.he_6ghz_capa = *he_6ghz_capa;
}
+static void ieee80211_compute_he_mcs_nss(struct ieee80211_supported_band *sband,
+ struct ieee80211_sta_he_cap *he_cap)
+{
+ struct ieee80211_sta_he_cap own_cap = sband->he_cap;
+ int i;
+
+ for (i = 0; i < NL80211_HE_NSS_MAX; i++) {
+ u16 own_rx, own_tx, peer_rx, peer_tx;
+
+ own_rx = le16_to_cpu(own_cap.he_mcs_nss_supp.rx_mcs_80);
+ own_rx = (own_rx >> i * 2) & IEEE80211_HE_MCS_NOT_SUPPORTED;
+ own_tx = le16_to_cpu(own_cap.he_mcs_nss_supp.tx_mcs_80);
+ own_tx = (own_tx >> i * 2) & IEEE80211_HE_MCS_NOT_SUPPORTED;
+
+ peer_rx = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80);
+ peer_rx = (peer_rx >> i * 2) & IEEE80211_HE_MCS_NOT_SUPPORTED;
+ peer_tx = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80);
+ peer_tx = (peer_tx >> i * 2) & IEEE80211_HE_MCS_NOT_SUPPORTED;
+
+ if (peer_tx != IEEE80211_HE_MCS_NOT_SUPPORTED) {
+ if (own_rx == IEEE80211_HE_MCS_NOT_SUPPORTED)
+ peer_tx = IEEE80211_HE_MCS_NOT_SUPPORTED;
+ else if (own_rx < peer_tx)
+ peer_tx = own_rx;
+ }
+
+ if (peer_rx != IEEE80211_HE_MCS_NOT_SUPPORTED) {
+ if (own_tx == IEEE80211_HE_MCS_NOT_SUPPORTED)
+ peer_rx = IEEE80211_HE_MCS_NOT_SUPPORTED;
+ else if (own_tx < peer_rx)
+ peer_rx = own_tx;
+ }
+
+ he_cap->he_mcs_nss_supp.rx_mcs_80 &=
+ ~cpu_to_le16(IEEE80211_HE_MCS_NOT_SUPPORTED << i * 2);
+ he_cap->he_mcs_nss_supp.rx_mcs_80 |= cpu_to_le16(peer_rx << i * 2);
+ he_cap->he_mcs_nss_supp.tx_mcs_80 &=
+ ~cpu_to_le16(IEEE80211_HE_MCS_NOT_SUPPORTED << i * 2);
+ he_cap->he_mcs_nss_supp.tx_mcs_80 |= cpu_to_le16(peer_tx << i * 2);
+ }
+}
+
void
ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
struct ieee80211_supported_band *sband,
@@ -87,6 +129,7 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct
memcpy(&he_cap->he_mcs_nss_supp,
&he_cap_ie[sizeof(he_cap->he_cap_elem)], mcs_nss_size);
+ ieee80211_compute_he_mcs_nss(sband, he_cap);
/* Check if there are (optional) PPE Thresholds */
if (he_cap->he_cap_elem.phy_cap_info[6] &
IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT)