All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/4] ath11k: add HE support
@ 2019-04-25 18:17 John Crispin
  2019-04-25 18:17 ` [PATCH V2 1/4] ath11k: add HE handling to the debug code John Crispin
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: John Crispin @ 2019-04-25 18:17 UTC (permalink / raw)
  To: Kalle Valo, ath11k; +Cc: Srini Kode, Rajkumar Manoharan, John Crispin

This series adds initial support for HE mode to the ath11k driver.

Things that still need to implemented
* ppe_threshold support
* propagate the he_oper field from userland to wmi_peer_add
* 80p80 support - mac80211 cosniders 160/80p80 to be the same
* he_mcs bitrate_mask support once implemented inside mac80211

Changes in V2:
* generate sband_iftype data from FW provided capabilities
* properly handle rx_status for HE frames
* fix regression in basic VHF phymode
* various minor cleanups

John Crispin (4):
  ath11k: add HE handling to the debug code
  ath11k: extend reading of FW capabilities
  ath11k: handle rx status for HE frames
  ath11k: add HE support

 drivers/net/wireless/ath/ath11k/core.h        |   6 +-
 drivers/net/wireless/ath/ath11k/debugfs_sta.c |  24 +-
 drivers/net/wireless/ath/ath11k/dp_rx.c       |  14 +-
 drivers/net/wireless/ath/ath11k/mac.c         | 348 ++++++++++++++++++++++----
 drivers/net/wireless/ath/ath11k/wmi.c         |   7 +-
 drivers/net/wireless/ath/ath11k/wmi.h         |   5 +-
 6 files changed, 341 insertions(+), 63 deletions(-)

-- 
2.11.0


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH V2 1/4] ath11k: add HE handling to the debug code
  2019-04-25 18:17 [PATCH V2 0/4] ath11k: add HE support John Crispin
@ 2019-04-25 18:17 ` John Crispin
  2019-04-25 18:17 ` [PATCH V2 2/4] ath11k: extend reading of FW capabilities John Crispin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: John Crispin @ 2019-04-25 18:17 UTC (permalink / raw)
  To: Kalle Valo, ath11k
  Cc: Shashidhar Lakkavalli, Srini Kode, Rajkumar Manoharan, John Crispin

This patch allows the driver to also show the HE counters and stats.
Also extend the appropriate debug prints with HE info.

Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/net/wireless/ath/ath11k/core.h        |  2 ++
 drivers/net/wireless/ath/ath11k/debugfs_sta.c | 24 ++++++++++++++++++++++--
 drivers/net/wireless/ath/ath11k/dp_rx.c       |  3 ++-
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index b2a3cacc7344..962c1f13c9e8 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -248,6 +248,7 @@ struct ath11k_peer {
 	struct dp_rx_tid rx_tid[IEEE80211_NUM_TIDS + 1];
 };
 
+#define ATH11K_HE_MCS_NUM       12
 #define ATH11K_VHT_MCS_NUM      10
 #define ATH11K_BW_NUM           4
 #define ATH11K_NSS_NUM          4
@@ -301,6 +302,7 @@ struct ath11k_htt_data_stats {
 	u64 legacy[ATH11K_COUNTER_TYPE_MAX][ATH11K_LEGACY_NUM];
 	u64 ht[ATH11K_COUNTER_TYPE_MAX][ATH11K_HT_MCS_NUM];
 	u64 vht[ATH11K_COUNTER_TYPE_MAX][ATH11K_VHT_MCS_NUM];
+	u64 he[ATH11K_COUNTER_TYPE_MAX][ATH11K_HE_MCS_NUM];
 	u64 bw[ATH11K_COUNTER_TYPE_MAX][ATH11K_BW_NUM];
 	u64 nss[ATH11K_COUNTER_TYPE_MAX][ATH11K_NSS_NUM];
 	u64 gi[ATH11K_COUNTER_TYPE_MAX][ATH11K_GI_NUM];
diff --git a/drivers/net/wireless/ath/ath11k/debugfs_sta.c b/drivers/net/wireless/ath/ath11k/debugfs_sta.c
index 41b2221e0479..d05efe6c0498 100644
--- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c
@@ -45,7 +45,14 @@ ath11k_accumulate_per_peer_tx_stats(struct ath11k_sta *arsta,
 
 #define STATS_OP_FMT(name) tx_stats->stats[ATH11K_STATS_TYPE_##name]
 
-	if (txrate->flags & RATE_INFO_FLAGS_VHT_MCS) {
+	if (txrate->flags & RATE_INFO_FLAGS_HE_MCS) {
+		STATS_OP_FMT(SUCC).he[0][mcs] += peer_stats->succ_bytes;
+		STATS_OP_FMT(SUCC).he[1][mcs] += peer_stats->succ_pkts;
+		STATS_OP_FMT(FAIL).he[0][mcs] += peer_stats->failed_bytes;
+		STATS_OP_FMT(FAIL).he[1][mcs] += peer_stats->failed_pkts;
+		STATS_OP_FMT(RETRY).he[0][mcs] += peer_stats->retry_bytes;
+		STATS_OP_FMT(RETRY).he[1][mcs] += peer_stats->retry_pkts;
+	} else if (txrate->flags & RATE_INFO_FLAGS_VHT_MCS) {
 		STATS_OP_FMT(SUCC).vht[0][mcs] += peer_stats->succ_bytes;
 		STATS_OP_FMT(SUCC).vht[1][mcs] += peer_stats->succ_pkts;
 		STATS_OP_FMT(FAIL).vht[0][mcs] += peer_stats->failed_bytes;
@@ -73,7 +80,12 @@ ath11k_accumulate_per_peer_tx_stats(struct ath11k_sta *arsta,
 	if (peer_stats->is_ampdu) {
 		tx_stats->ba_fails += peer_stats->ba_fails;
 
-		if (txrate->flags & RATE_INFO_FLAGS_MCS) {
+		if (txrate->flags & RATE_INFO_FLAGS_HE_MCS) {
+			STATS_OP_FMT(AMPDU).he[0][mcs] +=
+			peer_stats->succ_bytes + peer_stats->retry_bytes;
+			STATS_OP_FMT(AMPDU).he[1][mcs] +=
+			peer_stats->succ_pkts + peer_stats->retry_pkts;
+		} else if (txrate->flags & RATE_INFO_FLAGS_MCS) {
 			STATS_OP_FMT(AMPDU).ht[0][mcs] +=
 			peer_stats->succ_bytes + peer_stats->retry_bytes;
 			STATS_OP_FMT(AMPDU).ht[1][mcs] +=
@@ -230,6 +242,14 @@ static ssize_t ath11k_dbg_sta_dump_tx_stats(struct file *file,
 					 str_name[k],
 					 str[j]);
 			len += scnprintf(buf + len, size - len,
+					 " HE MCS %s\n",
+					 str[j]);
+			for (i = 0; i < ATH11K_HE_MCS_NUM; i++)
+				len += scnprintf(buf + len, size - len,
+						 "  %llu ",
+						 stats->he[j][i]);
+			len += scnprintf(buf + len, size - len, "\n");
+			len += scnprintf(buf + len, size - len,
 					 " VHT MCS %s\n",
 					 str[j]);
 			for (i = 0; i < ATH11K_VHT_MCS_NUM; i++)
diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index b57cd30be987..f95c2837bc40 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -1760,7 +1760,7 @@ static void ath11k_dp_rx_deliver_msdu(struct ath11k *ar, struct napi_struct *nap
 	status = IEEE80211_SKB_RXCB(msdu);
 
 	ath11k_dbg(ar->ab, ATH11K_DBG_DATA,
-		   "rx skb %pK len %u peer %pM %s %s sn %u %s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i mic-err %i amsdu-more %i\n",
+		   "rx skb %pK len %u peer %pM %s %s sn %u %s%s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i mic-err %i amsdu-more %i\n",
 		   msdu,
 		   msdu->len,
 		   ieee80211_get_SA(hdr),
@@ -1771,6 +1771,7 @@ static void ath11k_dp_rx_deliver_msdu(struct ath11k *ar, struct napi_struct *nap
 		   (status->encoding == RX_ENC_LEGACY) ? "legacy" : "",
 		   (status->encoding == RX_ENC_HT) ? "ht" : "",
 		   (status->encoding == RX_ENC_VHT) ? "vht" : "",
+		   (status->encoding == RX_ENC_HE) ? "he" : "",
 		   (status->bw == RATE_INFO_BW_40) ? "40" : "",
 		   (status->bw == RATE_INFO_BW_80) ? "80" : "",
 		   (status->bw == RATE_INFO_BW_160) ? "160" : "",
-- 
2.11.0


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V2 2/4] ath11k: extend reading of FW capabilities
  2019-04-25 18:17 [PATCH V2 0/4] ath11k: add HE support John Crispin
  2019-04-25 18:17 ` [PATCH V2 1/4] ath11k: add HE handling to the debug code John Crispin
@ 2019-04-25 18:17 ` John Crispin
  2019-04-25 18:17 ` [PATCH V2 3/4] ath11k: handle rx status for HE frames John Crispin
  2019-04-25 18:17 ` [PATCH V2 4/4] ath11k: add HE support John Crispin
  3 siblings, 0 replies; 7+ messages in thread
From: John Crispin @ 2019-04-25 18:17 UTC (permalink / raw)
  To: Kalle Valo, ath11k
  Cc: Shashidhar Lakkavalli, Srini Kode, Rajkumar Manoharan, John Crispin

Read the additional mcs and extended mac capabilities field from the
service ready callback and store them inside the ath11k_pdev_cap
structure. This allows us to generate the sband_iftype_data dynamically.

Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/net/wireless/ath/ath11k/core.h | 3 ++-
 drivers/net/wireless/ath/ath11k/wmi.c  | 7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index 962c1f13c9e8..1d3d52d86d9b 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -512,7 +512,7 @@ struct ath11k {
 struct ath11k_band_cap {
 	u32 max_bw_supported;
 	u32 ht_cap_info;
-	u32 he_cap_info;
+	u32 he_cap_info[2];
 	u32 he_mcs;
 	u32 he_cap_phy_info[PSOC_HOST_MAX_PHY_SIZE];
 	struct ath11k_ppe_threshold he_ppet;
@@ -523,6 +523,7 @@ struct ath11k_pdev_cap {
 	u32 ampdu_density;
 	u32 vht_cap;
 	u32 vht_mcs;
+	u32 he_mcs;
 	u32 tx_chain_mask;
 	u32 rx_chain_mask;
 	u32 tx_chain_mask_shift;
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 5712ac030419..1856dbcc1859 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -325,6 +325,7 @@ static int ath11k_pull_mac_phy_cap_service_ready_ext(
 	} else if (mac_phy_caps->supported_bands & WMI_HOST_WLAN_5G_CAP) {
 		pdev_cap->vht_cap = mac_phy_caps->vht_cap_info_5g;
 		pdev_cap->vht_mcs = mac_phy_caps->vht_supp_mcs_5g;
+		pdev_cap->he_mcs = mac_phy_caps->he_supp_mcs_5g;
 		pdev_cap->tx_chain_mask = mac_phy_caps->tx_chain_mask_5g;
 		pdev_cap->rx_chain_mask = mac_phy_caps->rx_chain_mask_5g;
 	} else {
@@ -347,7 +348,8 @@ static int ath11k_pull_mac_phy_cap_service_ready_ext(
 	cap_band = &pdev_cap->band[NL80211_BAND_2GHZ];
 	cap_band->max_bw_supported = mac_phy_caps->max_bw_supported_2g;
 	cap_band->ht_cap_info = mac_phy_caps->ht_cap_info_2g;
-	cap_band->he_cap_info = mac_phy_caps->he_cap_info_2g;
+	cap_band->he_cap_info[0] = mac_phy_caps->he_cap_info_2g;
+	cap_band->he_cap_info[1] = mac_phy_caps->he_cap_info_2g_ext;
 	cap_band->he_mcs = mac_phy_caps->he_supp_mcs_2g;
 	memcpy(cap_band->he_cap_phy_info, &mac_phy_caps->he_cap_phy_info_2g,
 	       sizeof(u32) * PSOC_HOST_MAX_PHY_SIZE);
@@ -357,7 +359,8 @@ static int ath11k_pull_mac_phy_cap_service_ready_ext(
 	cap_band = &pdev_cap->band[NL80211_BAND_5GHZ];
 	cap_band->max_bw_supported = mac_phy_caps->max_bw_supported_5g;
 	cap_band->ht_cap_info = mac_phy_caps->ht_cap_info_5g;
-	cap_band->he_cap_info = mac_phy_caps->he_cap_info_5g;
+	cap_band->he_cap_info[0] = mac_phy_caps->he_cap_info_5g;
+	cap_band->he_cap_info[1] = mac_phy_caps->he_cap_info_5g_ext;
 	cap_band->he_mcs = mac_phy_caps->he_supp_mcs_5g;
 	memcpy(cap_band->he_cap_phy_info, &mac_phy_caps->he_cap_phy_info_5g,
 	       sizeof(u32) * PSOC_HOST_MAX_PHY_SIZE);
-- 
2.11.0


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V2 3/4] ath11k: handle rx status for HE frames
  2019-04-25 18:17 [PATCH V2 0/4] ath11k: add HE support John Crispin
  2019-04-25 18:17 ` [PATCH V2 1/4] ath11k: add HE handling to the debug code John Crispin
  2019-04-25 18:17 ` [PATCH V2 2/4] ath11k: extend reading of FW capabilities John Crispin
@ 2019-04-25 18:17 ` John Crispin
  2019-04-25 18:17 ` [PATCH V2 4/4] ath11k: add HE support John Crispin
  3 siblings, 0 replies; 7+ messages in thread
From: John Crispin @ 2019-04-25 18:17 UTC (permalink / raw)
  To: Kalle Valo, ath11k
  Cc: Shashidhar Lakkavalli, Srini Kode, Rajkumar Manoharan, John Crispin

The case clause handling HE frames was not handled yet in the code reading
the RX status. The new case is identical to VHT with the difference of the
higher maximum MCS rate.

Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/net/wireless/ath/ath11k/dp_rx.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index f95c2837bc40..adc34aa56c09 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -1666,7 +1666,16 @@ static void ath11k_dp_rx_h_rate(struct ath11k *ar, void *rx_desc,
 		rx_status->bw = ath11k_bw_to_mac80211_bw(bw);
 		break;
 	case RX_MSDU_START_PKT_TYPE_11AX:
-		ath11k_warn(ar->ab, "pkt_type %d not yet supported\n", pkt_type);
+		rx_status->rate_idx = rate_mcs;
+		if (rate_mcs > 11) {
+			ath11k_warn(ar->ab, "Received with invalid mcs in HE mode %d\n", rate_mcs);
+			break;
+		}
+		rx_status->encoding = RX_ENC_HE;
+		rx_status->nss = nss;
+		if (sgi)
+			rx_status->enc_flags |= RX_ENC_FLAG_SHORT_GI;
+		rx_status->bw = ath11k_bw_to_mac80211_bw(bw);
 		break;
 	}
 }
-- 
2.11.0


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V2 4/4] ath11k: add HE support
  2019-04-25 18:17 [PATCH V2 0/4] ath11k: add HE support John Crispin
                   ` (2 preceding siblings ...)
  2019-04-25 18:17 ` [PATCH V2 3/4] ath11k: handle rx status for HE frames John Crispin
@ 2019-04-25 18:17 ` John Crispin
  2019-04-30  5:41   ` Rajkumar Manoharan
  3 siblings, 1 reply; 7+ messages in thread
From: John Crispin @ 2019-04-25 18:17 UTC (permalink / raw)
  To: Kalle Valo, ath11k
  Cc: Shashidhar Lakkavalli, Srini Kode, Rajkumar Manoharan, John Crispin

Add basic HE support to the driver. The sband_iftype data is generated from
the capabilities read from the FW.

Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/net/wireless/ath/ath11k/core.h |   1 +
 drivers/net/wireless/ath/ath11k/mac.c  | 348 +++++++++++++++++++++++++++------
 drivers/net/wireless/ath/ath11k/wmi.h  |   5 +-
 3 files changed, 298 insertions(+), 56 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index 1d3d52d86d9b..844647c08fbd 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -429,6 +429,7 @@ struct ath11k {
 
 	struct {
 		struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
+		struct ieee80211_sband_iftype_data iftype[NUM_NL80211_BANDS][2];
 	} mac;
 	unsigned long dev_flags;
 	unsigned int filter_flags;
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index ddb8beba3ab7..457e9d68ceaa 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -152,59 +152,151 @@ static int get_num_chains(u32 mask)
 }
 
 static inline enum wmi_phy_mode
-chan_to_phymode(const struct cfg80211_chan_def *chandef)
+chan_to_phymode_2ghz(const struct cfg80211_chan_def *chandef)
+{
+	enum wmi_phy_mode phymode = MODE_UNKNOWN;
+
+	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_20_NOHT:
+		if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM)
+			phymode = MODE_11B;
+		else
+			phymode = MODE_11G;
+		break;
+	case NL80211_CHAN_WIDTH_20:
+		phymode = MODE_11NG_HT20;
+		break;
+	case NL80211_CHAN_WIDTH_40:
+		phymode = MODE_11NG_HT40;
+		break;
+	case NL80211_CHAN_WIDTH_5:
+	case NL80211_CHAN_WIDTH_10:
+	case NL80211_CHAN_WIDTH_80:
+	case NL80211_CHAN_WIDTH_80P80:
+	case NL80211_CHAN_WIDTH_160:
+		phymode = MODE_UNKNOWN;
+		break;
+	}
+
+	return phymode;
+}
+
+static inline enum wmi_phy_mode
+chan_to_phymode_5ghz(const struct cfg80211_chan_def *chandef)
+{
+	enum wmi_phy_mode phymode = MODE_UNKNOWN;
+
+	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_20_NOHT:
+		phymode = MODE_11A;
+		break;
+	case NL80211_CHAN_WIDTH_20:
+		phymode = MODE_11AC_VHT20;
+		break;
+	case NL80211_CHAN_WIDTH_40:
+		phymode = MODE_11AC_VHT40;
+		break;
+	case NL80211_CHAN_WIDTH_80:
+		phymode = MODE_11AC_VHT80;
+		break;
+	case NL80211_CHAN_WIDTH_160:
+		phymode = MODE_11AC_VHT160;
+		break;
+	case NL80211_CHAN_WIDTH_80P80:
+		phymode = MODE_11AC_VHT80_80;
+		break;
+	case NL80211_CHAN_WIDTH_5:
+	case NL80211_CHAN_WIDTH_10:
+		phymode = MODE_UNKNOWN;
+		break;
+	}
+
+	return phymode;
+}
+
+static inline enum wmi_phy_mode
+chan_to_phymode_2ghz_he(const struct cfg80211_chan_def *chandef)
+{
+	enum wmi_phy_mode phymode = MODE_UNKNOWN;
+
+	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_20_NOHT:
+		if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM)
+			phymode = MODE_11B;
+		else
+			phymode = MODE_11G;
+		break;
+	case NL80211_CHAN_WIDTH_20:
+		phymode = MODE_11AX_HE20_2G;
+		break;
+	case NL80211_CHAN_WIDTH_40:
+		phymode = MODE_11AX_HE40_2G;
+		break;
+	case NL80211_CHAN_WIDTH_80:
+		phymode = MODE_11AX_HE80_2G;
+		break;
+	case NL80211_CHAN_WIDTH_5:
+	case NL80211_CHAN_WIDTH_10:
+	case NL80211_CHAN_WIDTH_80P80:
+	case NL80211_CHAN_WIDTH_160:
+		phymode = MODE_UNKNOWN;
+		break;
+	}
+
+	return phymode;
+}
+
+static inline enum wmi_phy_mode
+chan_to_phymode_5ghz_he(const struct cfg80211_chan_def *chandef)
+{
+	enum wmi_phy_mode phymode = MODE_UNKNOWN;
+
+	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_20_NOHT:
+		phymode = MODE_11A;
+		break;
+	case NL80211_CHAN_WIDTH_20:
+		phymode = MODE_11AX_HE20;
+		break;
+	case NL80211_CHAN_WIDTH_40:
+		phymode = MODE_11AX_HE40;
+		break;
+	case NL80211_CHAN_WIDTH_80:
+		phymode = MODE_11AX_HE80;
+		break;
+	case NL80211_CHAN_WIDTH_160:
+		phymode = MODE_11AX_HE160;
+		break;
+	case NL80211_CHAN_WIDTH_80P80:
+		phymode = MODE_11AX_HE80_80;
+		break;
+	case NL80211_CHAN_WIDTH_5:
+	case NL80211_CHAN_WIDTH_10:
+		phymode = MODE_UNKNOWN;
+		break;
+	}
+
+	return phymode;
+}
+
+static inline enum wmi_phy_mode
+chan_to_phymode(const struct cfg80211_chan_def *chandef, int he_support)
 {
 	enum wmi_phy_mode phymode = MODE_UNKNOWN;
 
 	switch (chandef->chan->band) {
 	case NL80211_BAND_2GHZ:
-		switch (chandef->width) {
-		case NL80211_CHAN_WIDTH_20_NOHT:
-			if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM)
-				phymode = MODE_11B;
-			else
-				phymode = MODE_11G;
-			break;
-		case NL80211_CHAN_WIDTH_20:
-			phymode = MODE_11NG_HT20;
-			break;
-		case NL80211_CHAN_WIDTH_40:
-			phymode = MODE_11NG_HT40;
-			break;
-		case NL80211_CHAN_WIDTH_5:
-		case NL80211_CHAN_WIDTH_10:
-		case NL80211_CHAN_WIDTH_80:
-		case NL80211_CHAN_WIDTH_80P80:
-		case NL80211_CHAN_WIDTH_160:
-			phymode = MODE_UNKNOWN;
-			break;
-		}
+		if (he_support)
+			phymode = chan_to_phymode_2ghz_he(chandef);
+		else
+			phymode = chan_to_phymode_2ghz(chandef);
 		break;
 	case NL80211_BAND_5GHZ:
-		switch (chandef->width) {
-		case NL80211_CHAN_WIDTH_20_NOHT:
-			phymode = MODE_11A;
-			break;
-		case NL80211_CHAN_WIDTH_20:
-			phymode = MODE_11AC_VHT20;
-			break;
-		case NL80211_CHAN_WIDTH_40:
-			phymode = MODE_11AC_VHT40;
-			break;
-		case NL80211_CHAN_WIDTH_80:
-			phymode = MODE_11AC_VHT80;
-			break;
-		case NL80211_CHAN_WIDTH_160:
-			phymode = MODE_11AC_VHT160;
-			break;
-		case NL80211_CHAN_WIDTH_80P80:
-			phymode = MODE_11AC_VHT80_80;
-			break;
-		case NL80211_CHAN_WIDTH_5:
-		case NL80211_CHAN_WIDTH_10:
-			phymode = MODE_UNKNOWN;
-			break;
-		}
+		if (he_support)
+			phymode = chan_to_phymode_5ghz_he(chandef);
+		else
+			phymode = chan_to_phymode_5ghz(chandef);
+
 		break;
 	default:
 		break;
@@ -1284,7 +1376,44 @@ static void ath11k_peer_assoc_h_he(struct ath11k *ar,
 				   struct ieee80211_sta *sta,
 				   struct peer_assoc_params *arg)
 {
-	/* TODO: Implementation */
+	const struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
+
+	if (!he_cap->has_he)
+		return;
+
+	arg->he_flag = true;
+
+	memcpy(&arg->peer_he_cap_macinfo, he_cap->he_cap_elem.mac_cap_info,
+	       sizeof(arg->peer_he_cap_macinfo));
+	memcpy(&arg->peer_he_cap_phyinfo, he_cap->he_cap_elem.phy_cap_info,
+	       sizeof(arg->peer_he_cap_phyinfo));
+
+	if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_RES)
+		arg->twt_responder = true;
+	if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_REQ)
+		arg->twt_requester = true;
+
+	/* TODO - peer_ppet and peer_he_ops need to be set */
+
+	switch (sta->bandwidth) {
+	/* TODO - add 80p80 support */
+
+	case IEEE80211_STA_RX_BW_160:
+		arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] =
+			he_cap->he_mcs_nss_supp.rx_mcs_160;
+		arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] =
+			he_cap->he_mcs_nss_supp.tx_mcs_160;
+		arg->peer_he_mcs_count++;
+		/* drop through */
+
+	default:
+		arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] =
+			he_cap->he_mcs_nss_supp.rx_mcs_80;
+		arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] =
+			he_cap->he_mcs_nss_supp.tx_mcs_80;
+		arg->peer_he_mcs_count++;
+		break;
+	}
 }
 
 static void ath11k_peer_assoc_h_smps(struct ieee80211_sta *sta,
@@ -1449,6 +1578,32 @@ static enum wmi_phy_mode ath11k_mac_get_phymode_vht(struct ath11k *ar,
 	return MODE_UNKNOWN;
 }
 
+static enum wmi_phy_mode ath11k_mac_get_phymode_he(struct ath11k *ar,
+						   struct ieee80211_sta *sta)
+{
+	if (sta->bandwidth == IEEE80211_STA_RX_BW_160) {
+		if (sta->he_cap.he_cap_elem.phy_cap_info[0] &
+		     IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G)
+			return MODE_11AX_HE160;
+		else if (sta->he_cap.he_cap_elem.phy_cap_info[0] &
+		     IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
+			return MODE_11AX_HE80_80;
+		/* not sure if this is a valid case? */
+		return MODE_11AX_HE160;
+	}
+
+	if (sta->bandwidth == IEEE80211_STA_RX_BW_80)
+		return MODE_11AX_HE80;
+
+	if (sta->bandwidth == IEEE80211_STA_RX_BW_40)
+		return MODE_11AX_HE40;
+
+	if (sta->bandwidth == IEEE80211_STA_RX_BW_20)
+		return MODE_11AX_HE20;
+
+	return MODE_UNKNOWN;
+}
+
 static void ath11k_peer_assoc_h_phymode(struct ath11k *ar,
 					struct ieee80211_vif *vif,
 					struct ieee80211_sta *sta,
@@ -1459,6 +1614,7 @@ static void ath11k_peer_assoc_h_phymode(struct ath11k *ar,
 	enum nl80211_band band;
 	const u8 *ht_mcs_mask;
 	const u16 *vht_mcs_mask;
+	const u16 *he_mcs_mask;
 	enum wmi_phy_mode phymode = MODE_UNKNOWN;
 
 	if (WARN_ON(ath11k_mac_vif_chan(vif, &def)))
@@ -1467,10 +1623,18 @@ static void ath11k_peer_assoc_h_phymode(struct ath11k *ar,
 	band = def.chan->band;
 	ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs;
 	vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs;
+	he_mcs_mask = arvif->bitrate_mask.control[band].he_mcs;
 
 	switch (band) {
 	case NL80211_BAND_2GHZ:
-		if (sta->vht_cap.vht_supported &&
+		if (sta->he_cap.has_he) {
+			if (sta->bandwidth == IEEE80211_STA_RX_BW_80)
+				phymode = MODE_11AX_HE80_2G;
+			else if (sta->bandwidth == IEEE80211_STA_RX_BW_40)
+				phymode = MODE_11AX_HE40_2G;
+			else
+				phymode = MODE_11AX_HE20_2G;
+		} else if (sta->vht_cap.vht_supported &&
 		    !ath11k_peer_assoc_h_vht_masked(vht_mcs_mask)) {
 			if (sta->bandwidth == IEEE80211_STA_RX_BW_40)
 				phymode = MODE_11AC_VHT40;
@@ -1487,12 +1651,12 @@ static void ath11k_peer_assoc_h_phymode(struct ath11k *ar,
 		} else {
 			phymode = MODE_11B;
 		}
-		/* TODO: HE */
-
 		break;
 	case NL80211_BAND_5GHZ:
-		/* Check VHT first */
-		if (sta->vht_cap.vht_supported &&
+		/* Check HE first */
+		if (sta->he_cap.has_he) {
+			phymode = ath11k_mac_get_phymode_he(ar, sta);
+		} else if (sta->vht_cap.vht_supported &&
 		    !ath11k_peer_assoc_h_vht_masked(vht_mcs_mask)) {
 			phymode = ath11k_mac_get_phymode_vht(ar, sta);
 		} else if (sta->ht_cap.ht_supported &&
@@ -1504,7 +1668,6 @@ static void ath11k_peer_assoc_h_phymode(struct ath11k *ar,
 		} else {
 			phymode = MODE_11A;
 		}
-		/* TODO: HE Phymode */
 		break;
 	default:
 		break;
@@ -3078,6 +3241,78 @@ static int ath11k_check_chain_mask(struct ath11k *ar, u32 ant, bool is_tx_ant)
 	return 0;
 }
 
+static void ath11k_mac_copy_he_cap(struct ath11k_pdev_cap *cap,
+				   struct ieee80211_sband_iftype_data *data,
+				   int band)
+{
+	int i;
+
+	for (i = 0; i < 2; i++) {
+		struct ieee80211_sta_he_cap *he_cap = &data[i].he_cap;
+		struct ath11k_band_cap *band_cap = &cap->band[band];
+		struct ieee80211_he_cap_elem *he_cap_elem =
+				&he_cap->he_cap_elem;
+
+		he_cap->has_he = true;
+		memcpy(he_cap_elem->mac_cap_info, band_cap->he_cap_info,
+		       sizeof(he_cap_elem->mac_cap_info));
+		memcpy(he_cap_elem->phy_cap_info, band_cap->he_cap_phy_info,
+		       sizeof(he_cap_elem->phy_cap_info));
+
+		if (i) {
+			data[i].types_mask = BIT(NL80211_IFTYPE_STATION);
+			he_cap_elem->mac_cap_info[0] &=
+				~IEEE80211_HE_MAC_CAP0_TWT_RES;
+			he_cap_elem->mac_cap_info[0] |=
+				IEEE80211_HE_MAC_CAP0_TWT_REQ;
+			/* TODO - add further differences between AP and STA */
+		} else {
+			data[i].types_mask = BIT(NL80211_IFTYPE_AP);
+		}
+
+		he_cap->he_mcs_nss_supp.rx_mcs_80 =
+			cpu_to_le16(band_cap->he_mcs & 0xffff);
+		he_cap->he_mcs_nss_supp.tx_mcs_80 =
+			cpu_to_le16(band_cap->he_mcs & 0xffff);
+		he_cap->he_mcs_nss_supp.rx_mcs_160 =
+			cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+		he_cap->he_mcs_nss_supp.tx_mcs_160 =
+			cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+		he_cap->he_mcs_nss_supp.rx_mcs_80p80 =
+			cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+		he_cap->he_mcs_nss_supp.tx_mcs_80p80 =
+			cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+
+		/* TODO - disable ppe threshold until we can generate the
+		 * field from the fw capabilities
+		 */
+		he_cap_elem->phy_cap_info[6] &=
+			~IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT;
+	}
+}
+
+static void ath11k_mac_setup_he_cap(struct ath11k *ar,
+				    struct ath11k_pdev_cap *cap)
+{
+	struct ieee80211_supported_band *band;
+
+	if (cap->supported_bands & WMI_HOST_WLAN_2G_CAP) {
+		ath11k_mac_copy_he_cap(cap, ar->mac.iftype[NL80211_BAND_2GHZ],
+				       NL80211_BAND_2GHZ);
+		band = &ar->mac.sbands[NL80211_BAND_2GHZ];
+		band->iftype_data = ar->mac.iftype[NL80211_BAND_2GHZ];
+		band->n_iftype_data = 2;
+	}
+
+	if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP) {
+		ath11k_mac_copy_he_cap(cap, ar->mac.iftype[NL80211_BAND_5GHZ],
+				       NL80211_BAND_5GHZ);
+		band = &ar->mac.sbands[NL80211_BAND_5GHZ];
+		band->iftype_data = ar->mac.iftype[NL80211_BAND_5GHZ];
+		band->n_iftype_data = 2;
+	}
+}
+
 static int __ath11k_set_antenna(struct ath11k *ar, u32 tx_ant, u32 rx_ant)
 {
 	int ret;
@@ -3113,8 +3348,9 @@ static int __ath11k_set_antenna(struct ath11k *ar, u32 tx_ant, u32 rx_ant)
 		return ret;
 	}
 
-	/* Reload HT/VHT capability */
+	/* Reload HT/VHT/HE capability */
 	ath11k_mac_setup_ht_vht_cap(ar, &ar->pdev->cap, NULL);
+	ath11k_mac_setup_he_cap(ar, &ar->pdev->cap);
 
 	return 0;
 }
@@ -3856,7 +4092,8 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif,
 	arg.channel.freq = chandef->chan->center_freq;
 	arg.channel.band_center_freq1 = chandef->center_freq1;
 	arg.channel.band_center_freq2 = chandef->center_freq2;
-	arg.channel.mode = chan_to_phymode(chandef);
+	arg.channel.mode = chan_to_phymode(chandef,
+					   arvif->vif->bss_conf.he_support);
 
 	arg.channel.min_power = 0;
 	arg.channel.max_power = chandef->chan->max_power * 2;
@@ -4852,6 +5089,7 @@ static int ath11k_mac_register(struct ath11k *ar)
 		goto err_free;
 
 	ath11k_mac_setup_ht_vht_cap(ar, cap, &ht_cap);
+	ath11k_mac_setup_he_cap(ar, cap);
 
 	ar->hw->wiphy->available_antennas_rx = cap->rx_chain_mask;
 	ar->hw->wiphy->available_antennas_tx = cap->tx_chain_mask;
diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h
index 5d20f57fbacc..7674fa85301a 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.h
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
@@ -3842,7 +3842,10 @@ struct wmi_vdev_install_key_arg {
 
 #define WMI_MAX_SUPPORTED_RATES			128
 #define WMI_HOST_MAX_HECAP_PHY_SIZE		3
-#define WMI_HOST_MAX_HE_RATE_SET		1
+#define WMI_HOST_MAX_HE_RATE_SET		3
+#define WMI_HECAP_TXRX_MCS_NSS_IDX_80		0
+#define WMI_HECAP_TXRX_MCS_NSS_IDX_160		1
+#define WMI_HECAP_TXRX_MCS_NSS_IDX_80_80	2
 
 struct wmi_rate_set_arg {
 	u32 num_rates;
-- 
2.11.0


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH V2 4/4] ath11k: add HE support
  2019-04-25 18:17 ` [PATCH V2 4/4] ath11k: add HE support John Crispin
@ 2019-04-30  5:41   ` Rajkumar Manoharan
  2019-04-30  7:05     ` John Crispin
  0 siblings, 1 reply; 7+ messages in thread
From: Rajkumar Manoharan @ 2019-04-30  5:41 UTC (permalink / raw)
  To: John Crispin
  Cc: Rajkumar Manoharan, Srini Kode, ath11k, Kalle Valo,
	Shashidhar Lakkavalli

On 2019-04-25 11:17, John Crispin wrote:
> Add basic HE support to the driver. The sband_iftype data is generated 
> from
> the capabilities read from the FW.
> 
Nice.. :) Sorry for the late response.
> 
>  static inline enum wmi_phy_mode
> -chan_to_phymode(const struct cfg80211_chan_def *chandef)
> +chan_to_phymode_2ghz(const struct cfg80211_chan_def *chandef)
> +{
> +	enum wmi_phy_mode phymode = MODE_UNKNOWN;
> +
> +	switch (chandef->width) {
> +	case NL80211_CHAN_WIDTH_20_NOHT:
> +		if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM)
> +			phymode = MODE_11B;
> +		else
> +			phymode = MODE_11G;
> +		break;
> +	case NL80211_CHAN_WIDTH_20:
> +		phymode = MODE_11NG_HT20;
> +		break;
> +	case NL80211_CHAN_WIDTH_40:
> +		phymode = MODE_11NG_HT40;
> +		break;
> +	case NL80211_CHAN_WIDTH_5:
> +	case NL80211_CHAN_WIDTH_10:
> +	case NL80211_CHAN_WIDTH_80:
> +	case NL80211_CHAN_WIDTH_80P80:
> +	case NL80211_CHAN_WIDTH_160:
> +		phymode = MODE_UNKNOWN;
> +		break;
> +	}
> +
> +	return phymode;
> +}
> +
> +static inline enum wmi_phy_mode
> +chan_to_phymode_5ghz(const struct cfg80211_chan_def *chandef)
> +{
> +	enum wmi_phy_mode phymode = MODE_UNKNOWN;
> +
> +	switch (chandef->width) {
> +	case NL80211_CHAN_WIDTH_20_NOHT:
> +		phymode = MODE_11A;
> +		break;
> +	case NL80211_CHAN_WIDTH_20:
> +		phymode = MODE_11AC_VHT20;
> +		break;
> +	case NL80211_CHAN_WIDTH_40:
> +		phymode = MODE_11AC_VHT40;
> +		break;
> +	case NL80211_CHAN_WIDTH_80:
> +		phymode = MODE_11AC_VHT80;
> +		break;
> +	case NL80211_CHAN_WIDTH_160:
> +		phymode = MODE_11AC_VHT160;
> +		break;
> +	case NL80211_CHAN_WIDTH_80P80:
> +		phymode = MODE_11AC_VHT80_80;
> +		break;
> +	case NL80211_CHAN_WIDTH_5:
> +	case NL80211_CHAN_WIDTH_10:
> +		phymode = MODE_UNKNOWN;
> +		break;
> +	}
> +
> +	return phymode;
> +}
> +
> +static inline enum wmi_phy_mode
> +chan_to_phymode_2ghz_he(const struct cfg80211_chan_def *chandef)
> +{
> +	enum wmi_phy_mode phymode = MODE_UNKNOWN;
> +
> +	switch (chandef->width) {
> +	case NL80211_CHAN_WIDTH_20_NOHT:
> +		if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM)
> +			phymode = MODE_11B;
> +		else
> +			phymode = MODE_11G;
> +		break;
> +	case NL80211_CHAN_WIDTH_20:
> +		phymode = MODE_11AX_HE20_2G;
> +		break;
> +	case NL80211_CHAN_WIDTH_40:
> +		phymode = MODE_11AX_HE40_2G;
> +		break;
> +	case NL80211_CHAN_WIDTH_80:
> +		phymode = MODE_11AX_HE80_2G;
> +		break;
> +	case NL80211_CHAN_WIDTH_5:
> +	case NL80211_CHAN_WIDTH_10:
> +	case NL80211_CHAN_WIDTH_80P80:
> +	case NL80211_CHAN_WIDTH_160:
> +		phymode = MODE_UNKNOWN;
> +		break;
> +	}
> +
> +	return phymode;
> +}
> +
> +static inline enum wmi_phy_mode
> +chan_to_phymode_5ghz_he(const struct cfg80211_chan_def *chandef)
> +{
> +	enum wmi_phy_mode phymode = MODE_UNKNOWN;
> +
> +	switch (chandef->width) {
> +	case NL80211_CHAN_WIDTH_20_NOHT:
> +		phymode = MODE_11A;
> +		break;
> +	case NL80211_CHAN_WIDTH_20:
> +		phymode = MODE_11AX_HE20;
> +		break;
> +	case NL80211_CHAN_WIDTH_40:
> +		phymode = MODE_11AX_HE40;
> +		break;
> +	case NL80211_CHAN_WIDTH_80:
> +		phymode = MODE_11AX_HE80;
> +		break;
> +	case NL80211_CHAN_WIDTH_160:
> +		phymode = MODE_11AX_HE160;
> +		break;
> +	case NL80211_CHAN_WIDTH_80P80:
> +		phymode = MODE_11AX_HE80_80;
> +		break;
> +	case NL80211_CHAN_WIDTH_5:
> +	case NL80211_CHAN_WIDTH_10:
> +		phymode = MODE_UNKNOWN;
> +		break;
> +	}
> +
> +	return phymode;
> +}
> +
> +static inline enum wmi_phy_mode
> +chan_to_phymode(const struct cfg80211_chan_def *chandef, int 
> he_support)
>  {
>  	enum wmi_phy_mode phymode = MODE_UNKNOWN;
> 
>  	switch (chandef->chan->band) {
>  	case NL80211_BAND_2GHZ:
> -		switch (chandef->width) {
> -		case NL80211_CHAN_WIDTH_20_NOHT:
> -			if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM)
> -				phymode = MODE_11B;
> -			else
> -				phymode = MODE_11G;
> -			break;
> -		case NL80211_CHAN_WIDTH_20:
> -			phymode = MODE_11NG_HT20;
> -			break;
> -		case NL80211_CHAN_WIDTH_40:
> -			phymode = MODE_11NG_HT40;
> -			break;
> -		case NL80211_CHAN_WIDTH_5:
> -		case NL80211_CHAN_WIDTH_10:
> -		case NL80211_CHAN_WIDTH_80:
> -		case NL80211_CHAN_WIDTH_80P80:
> -		case NL80211_CHAN_WIDTH_160:
> -			phymode = MODE_UNKNOWN;
> -			break;
> -		}
> +		if (he_support)
> +			phymode = chan_to_phymode_2ghz_he(chandef);
> +		else
> +			phymode = chan_to_phymode_2ghz(chandef);
>  		break;
>  	case NL80211_BAND_5GHZ:
> -		switch (chandef->width) {
> -		case NL80211_CHAN_WIDTH_20_NOHT:
> -			phymode = MODE_11A;
> -			break;
> -		case NL80211_CHAN_WIDTH_20:
> -			phymode = MODE_11AC_VHT20;
> -			break;
> -		case NL80211_CHAN_WIDTH_40:
> -			phymode = MODE_11AC_VHT40;
> -			break;
> -		case NL80211_CHAN_WIDTH_80:
> -			phymode = MODE_11AC_VHT80;
> -			break;
> -		case NL80211_CHAN_WIDTH_160:
> -			phymode = MODE_11AC_VHT160;
> -			break;
> -		case NL80211_CHAN_WIDTH_80P80:
> -			phymode = MODE_11AC_VHT80_80;
> -			break;
> -		case NL80211_CHAN_WIDTH_5:
> -		case NL80211_CHAN_WIDTH_10:
> -			phymode = MODE_UNKNOWN;
> -			break;
> -		}
> +		if (he_support)
> +			phymode = chan_to_phymode_5ghz_he(chandef);
> +		else
> +			phymode = chan_to_phymode_5ghz(chandef);
> +
>  		break;
> 
The above repeated switch case routines can be simplified by simple 
array of modes. no?

               WIDTH_20_NOHT |   WIDTH_20    | WIDTH_40     | WIDTH_80    
   | WIDTH_160        | WIDTH_80P80

MODE_11G            11G       11NG_HT20       11NG_HT40       NA         
          NA            NA
MODE_11G_HE         11G       11AX_HE20_2G    11AX_HE40_2G   
11AX_HE80_2G         NA            NA
MODE_11A            11A       11NA_HT20       11NA_HT40      NA          
          NA            NA
MODE_11A_VHT        11A       11AC_VHT20      11AC_VHT40     11AC_VHT80  
          11AC_VHT160   11AC_VHT80_80
MODE_11A_HE         11A       11AX_HE20       11AX_HE40      11AX_HE80   
          11AX_HE160    11AX_HE80_80

[...]

> +static enum wmi_phy_mode ath11k_mac_get_phymode_he(struct ath11k *ar,
> +						   struct ieee80211_sta *sta)
> +{
> +	if (sta->bandwidth == IEEE80211_STA_RX_BW_160) {
> +		if (sta->he_cap.he_cap_elem.phy_cap_info[0] &
> +		     IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G)
> +			return MODE_11AX_HE160;
> +		else if (sta->he_cap.he_cap_elem.phy_cap_info[0] &
> +		     IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
> +			return MODE_11AX_HE80_80;
> +		/* not sure if this is a valid case? */
> +		return MODE_11AX_HE160;
> +	}
> +
> +	if (sta->bandwidth == IEEE80211_STA_RX_BW_80)
> +		return MODE_11AX_HE80;
> +
> +	if (sta->bandwidth == IEEE80211_STA_RX_BW_40)
> +		return MODE_11AX_HE40;
> +
> +	if (sta->bandwidth == IEEE80211_STA_RX_BW_20)
> +		return MODE_11AX_HE20;
> +
> +	return MODE_UNKNOWN;
> +}
> +

I think this function also be removed if we have MODE table as mentioned 
above.

[...]

> +static void ath11k_mac_copy_he_cap(struct ath11k_pdev_cap *cap,
> +				   struct ieee80211_sband_iftype_data *data,
> +				   int band)
> +{
> +	int i;
> +
> +	for (i = 0; i < 2; i++) {
> +		struct ieee80211_sta_he_cap *he_cap = &data[i].he_cap;
> +		struct ath11k_band_cap *band_cap = &cap->band[band];
> +		struct ieee80211_he_cap_elem *he_cap_elem =
> +				&he_cap->he_cap_elem;
> +
> +		he_cap->has_he = true;
> +		memcpy(he_cap_elem->mac_cap_info, band_cap->he_cap_info,
> +		       sizeof(he_cap_elem->mac_cap_info));
> +		memcpy(he_cap_elem->phy_cap_info, band_cap->he_cap_phy_info,
> +		       sizeof(he_cap_elem->phy_cap_info));
> +
> +		if (i) {
> +			data[i].types_mask = BIT(NL80211_IFTYPE_STATION);
> +			he_cap_elem->mac_cap_info[0] &=
> +				~IEEE80211_HE_MAC_CAP0_TWT_RES;
> +			he_cap_elem->mac_cap_info[0] |=
> +				IEEE80211_HE_MAC_CAP0_TWT_REQ;
> +			/* TODO - add further differences between AP and STA */
> +		} else {
> +			data[i].types_mask = BIT(NL80211_IFTYPE_AP);
> +		}
> 
Hmmm.. If you are running loop to extract he_cap, he_cap_extn, how will 
you extend HE support
for other interface types (Mesh)?

-Rajkumar

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V2 4/4] ath11k: add HE support
  2019-04-30  5:41   ` Rajkumar Manoharan
@ 2019-04-30  7:05     ` John Crispin
  0 siblings, 0 replies; 7+ messages in thread
From: John Crispin @ 2019-04-30  7:05 UTC (permalink / raw)
  To: Rajkumar Manoharan
  Cc: Rajkumar Manoharan, Srini Kode, ath11k, Kalle Valo,
	Shashidhar Lakkavalli


Hi,

[...]
>
>               WIDTH_20_NOHT |   WIDTH_20    | WIDTH_40     | 
> WIDTH_80      | WIDTH_160        | WIDTH_80P80
>
> MODE_11G            11G       11NG_HT20       11NG_HT40 NA         
>          NA            NA
> MODE_11G_HE         11G       11AX_HE20_2G    11AX_HE40_2G 
> 11AX_HE80_2G         NA            NA
> MODE_11A            11A       11NA_HT20       11NA_HT40 NA          
>          NA            NA
> MODE_11A_VHT        11A       11AC_VHT20      11AC_VHT40 11AC_VHT80  
>          11AC_VHT160   11AC_VHT80_80
> MODE_11A_HE         11A       11AX_HE20       11AX_HE40 11AX_HE80   
>          11AX_HE160    11AX_HE80_80
>
> [...]
>
good idea !


>> +static enum wmi_phy_mode ath11k_mac_get_phymode_he(struct ath11k *ar,
>> +                           struct ieee80211_sta *sta)
>> +{
>> +    if (sta->bandwidth == IEEE80211_STA_RX_BW_160) {
>> +        if (sta->he_cap.he_cap_elem.phy_cap_info[0] &
>> + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G)
>> +            return MODE_11AX_HE160;
>> +        else if (sta->he_cap.he_cap_elem.phy_cap_info[0] &
>> + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
>> +            return MODE_11AX_HE80_80;
>> +        /* not sure if this is a valid case? */
>> +        return MODE_11AX_HE160;
>> +    }
>> +
>> +    if (sta->bandwidth == IEEE80211_STA_RX_BW_80)
>> +        return MODE_11AX_HE80;
>> +
>> +    if (sta->bandwidth == IEEE80211_STA_RX_BW_40)
>> +        return MODE_11AX_HE40;
>> +
>> +    if (sta->bandwidth == IEEE80211_STA_RX_BW_20)
>> +        return MODE_11AX_HE20;
>> +
>> +    return MODE_UNKNOWN;
>> +}
>> +
>
> I think this function also be removed if we have MODE table as 
> mentioned above.
>
> [...]
>
>> +static void ath11k_mac_copy_he_cap(struct ath11k_pdev_cap *cap,
>> +                   struct ieee80211_sband_iftype_data *data,
>> +                   int band)
>> +{
>> +    int i;
>> +
>> +    for (i = 0; i < 2; i++) {
>> +        struct ieee80211_sta_he_cap *he_cap = &data[i].he_cap;
>> +        struct ath11k_band_cap *band_cap = &cap->band[band];
>> +        struct ieee80211_he_cap_elem *he_cap_elem =
>> +                &he_cap->he_cap_elem;
>> +
>> +        he_cap->has_he = true;
>> +        memcpy(he_cap_elem->mac_cap_info, band_cap->he_cap_info,
>> +               sizeof(he_cap_elem->mac_cap_info));
>> +        memcpy(he_cap_elem->phy_cap_info, band_cap->he_cap_phy_info,
>> +               sizeof(he_cap_elem->phy_cap_info));
>> +
>> +        if (i) {
>> +            data[i].types_mask = BIT(NL80211_IFTYPE_STATION);
>> +            he_cap_elem->mac_cap_info[0] &=
>> +                ~IEEE80211_HE_MAC_CAP0_TWT_RES;
>> +            he_cap_elem->mac_cap_info[0] |=
>> +                IEEE80211_HE_MAC_CAP0_TWT_REQ;
>> +            /* TODO - add further differences between AP and STA */
>> +        } else {
>> +            data[i].types_mask = BIT(NL80211_IFTYPE_AP);
>> +        }
>>
> Hmmm.. If you are running loop to extract he_cap, he_cap_extn, how 
> will you extend HE support
> for other interface types (Mesh)?
>
I will make this future-proof

     John



_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-04-30  7:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-25 18:17 [PATCH V2 0/4] ath11k: add HE support John Crispin
2019-04-25 18:17 ` [PATCH V2 1/4] ath11k: add HE handling to the debug code John Crispin
2019-04-25 18:17 ` [PATCH V2 2/4] ath11k: extend reading of FW capabilities John Crispin
2019-04-25 18:17 ` [PATCH V2 3/4] ath11k: handle rx status for HE frames John Crispin
2019-04-25 18:17 ` [PATCH V2 4/4] ath11k: add HE support John Crispin
2019-04-30  5:41   ` Rajkumar Manoharan
2019-04-30  7:05     ` John Crispin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.