linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
To: <ath12k@lists.infradead.org>
Cc: <linux-wireless@vger.kernel.org>,
	Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>,
	Muna Sinada <quic_msinada@quicinc.com>
Subject: [PATCH v2 04/10] wifi: ath12k: move HE MCS mapper to a separate function
Date: Wed, 27 Mar 2024 10:09:04 -0700	[thread overview]
Message-ID: <20240327170910.23975-5-quic_pradeepc@quicinc.com> (raw)
In-Reply-To: <20240327170910.23975-1-quic_pradeepc@quicinc.com>

Refactor the HE MCS mapper functionality in
ath12k_mac_copy_he_cap() into a new function.

This helps improve readability, extensibility and will be used
when adding support for 160 MHz bandwidth in subsequent patches.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Co-developed-by: Muna Sinada <quic_msinada@quicinc.com>
Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/mac.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 6465dc11a92e..72b157e60158 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -4879,12 +4879,24 @@ static __le16 ath12k_mac_setup_he_6ghz_cap(struct ath12k_pdev_cap *pcap,
 	return cpu_to_le16(bcap->he_6ghz_capa);
 }
 
+static void ath12k_mac_set_hemcsmap(struct ath12k_band_cap *band_cap,
+				    struct ieee80211_sta_he_cap *he_cap)
+{
+	struct ieee80211_he_mcs_nss_supp *mcs_nss = &he_cap->he_mcs_nss_supp;
+
+	mcs_nss->rx_mcs_80 = cpu_to_le16(band_cap->he_mcs & 0xffff);
+	mcs_nss->tx_mcs_80 = cpu_to_le16(band_cap->he_mcs & 0xffff);
+	mcs_nss->rx_mcs_160 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+	mcs_nss->tx_mcs_160 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+	mcs_nss->rx_mcs_80p80 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+	mcs_nss->tx_mcs_80p80 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+}
+
 static void ath12k_mac_copy_he_cap(struct ath12k_band_cap *band_cap,
 				   int iftype, u8 num_tx_chains,
 				   struct ieee80211_sta_he_cap *he_cap)
 {
 	struct ieee80211_he_cap_elem *he_cap_elem = &he_cap->he_cap_elem;
-	struct ieee80211_he_mcs_nss_supp *mcs_nss = &he_cap->he_mcs_nss_supp;
 
 	he_cap->has_he = true;
 	memcpy(he_cap_elem->mac_cap_info, band_cap->he_cap_info,
@@ -4922,13 +4934,7 @@ static void ath12k_mac_copy_he_cap(struct ath12k_band_cap *band_cap,
 		break;
 	}
 
-	mcs_nss->rx_mcs_80 = cpu_to_le16(band_cap->he_mcs & 0xffff);
-	mcs_nss->tx_mcs_80 = cpu_to_le16(band_cap->he_mcs & 0xffff);
-	mcs_nss->rx_mcs_160 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-	mcs_nss->tx_mcs_160 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-	mcs_nss->rx_mcs_80p80 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-	mcs_nss->tx_mcs_80p80 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-
+	ath12k_mac_set_hemcsmap(band_cap, he_cap);
 	memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres));
 	if (he_cap_elem->phy_cap_info[6] &
 	    IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT)
-- 
2.17.1


  parent reply	other threads:[~2024-03-27 17:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 17:09 [PATCH v2 00/10] wifi: ath12k: add MU-MIMO and 160 MHz bandwidth support Pradeep Kumar Chitrapu
2024-03-27 17:09 ` [PATCH v2 01/10] wifi: mac80211: Add EHT UL MU-MIMO flag in ieee80211_bss_conf Pradeep Kumar Chitrapu
2024-03-27 17:09 ` [PATCH v2 02/10] wifi: ath12k: push HE MU-MIMO params from hostapd to hardware Pradeep Kumar Chitrapu
2024-03-27 17:09 ` [PATCH v2 03/10] wifi: ath12k: push EHT " Pradeep Kumar Chitrapu
2024-03-27 17:09 ` Pradeep Kumar Chitrapu [this message]
2024-03-27 17:09 ` [PATCH v2 05/10] wifi: ath12k: generate rx and tx mcs maps for supported HE mcs Pradeep Kumar Chitrapu
2024-03-27 17:09 ` [PATCH v2 06/10] wifi: ath12k: fix TX and RX MCS rate configurations in HE mode Pradeep Kumar Chitrapu
2024-03-27 17:09 ` [PATCH v2 07/10] wifi: ath12k: add support for setting fixed HE rate/GI/LTF Pradeep Kumar Chitrapu
2024-03-29 21:34   ` Jeff Johnson
2024-04-01 18:08     ` Pradeep Kumar Chitrapu
2024-04-02 11:41     ` Kalle Valo
2024-03-27 17:09 ` [PATCH v2 08/10] wifi: ath12k: clean up 80P80 support Pradeep Kumar Chitrapu
2024-03-27 17:09 ` [PATCH v2 09/10] wifi: ath12k: add support for 160 MHz bandwidth Pradeep Kumar Chitrapu
2024-03-27 17:09 ` [PATCH v2 10/10] wifi: ath12k: add extended NSS bandwidth support for 160 MHz Pradeep Kumar Chitrapu
2024-03-29 17:45 ` [PATCH v2 00/10] wifi: ath12k: add MU-MIMO and 160 MHz bandwidth support Pradeep Kumar Chitrapu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240327170910.23975-5-quic_pradeepc@quicinc.com \
    --to=quic_pradeepc@quicinc.com \
    --cc=ath12k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_msinada@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).