Skip to contentSkip to conversation

wifi: iwlwifi: mld: add KUnit tests for TLC rate helpers

PATCH New April John 1 participant 2 messages Aug 30 Intel wireless wifi link (iwlwifi)

lore
Share & tools
lore

April John

author
#0 lore raw

PATCH 1/2 wifi: iwlwifi: mld: add KUnit tests for TLC rate helpers

From: April John <[email protected]>

Add tests for iwl_mld_get_highest_fw_mcs() covering the 2-bit VHT MCS field extraction for different NSS values, and for iwl_mld_get_eht_max_nss() covering the min() of the peer RX and own TX NSS capabilities.

---
 .../wireless/intel/iwlwifi/mld/tests/Makefile |   1 +
 .../wireless/intel/iwlwifi/mld/tests/tlc.c    | 138 ++++++++++++++++++
 drivers/net/wireless/intel/iwlwifi/mld/tlc.c  |   6 +-
 drivers/net/wireless/intel/iwlwifi/mld/tlc.h  |   6 +
 4 files changed, 149 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/wireless/intel/iwlwifi/mld/tests/tlc.c
drivers/net/wireless/intel/iwlwifi/mld/tests/Makefile +1 -0
index efa61638b8ee..2af1fb838520 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 iwlmld-tests-y += module.o hcmd.o utils.o link.o rx.o agg.o link-selection.o
 iwlmld-tests-y += chan_load_thresh.o
+iwlmld-tests-y += tlc.o
 
 ccflags-y += -I$(src)/../
 obj-$(CONFIG_IWLWIFI_KUNIT_TESTS) += iwlmld-tests.o
drivers/net/wireless/intel/iwlwifi/mld/tests/tlc.c new file +138 -0

138 lines not on this page · raw message

drivers/net/wireless/intel/iwlwifi/mld/tlc.c +4 -2
index b6c2fa3664cb..72ddb788ad3e 100644
@@ -161,7 +161,7 @@ static u8 iwl_mld_get_fw_sgi(struct iwl_mld_tlc_sta_capa *capa)
 	return sgi_chwidths;
 }
 
-static int
+VISIBLE_IF_IWLWIFI_KUNIT int
 iwl_mld_get_highest_fw_mcs(const struct ieee80211_sta_vht_cap *vht_cap,
 			   int nss)
 {
@@ -183,6 +183,7 @@ iwl_mld_get_highest_fw_mcs(const struct ieee80211_sta_vht_cap *vht_cap,
 
 	return 0;
 }
+EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_mld_get_highest_fw_mcs);
 
 static void
 iwl_mld_fill_vht_rates(struct iwl_mld_tlc_sta_capa *capa,
@@ -316,7 +317,7 @@ iwl_mld_get_eht_mcs_of_bw(enum IWL_TLC_MCS_PER_BW bw,
 	}
 }
 
-static u8 iwl_mld_get_eht_max_nss(u8 rx_nss, u8 tx_nss)
+VISIBLE_IF_IWLWIFI_KUNIT u8 iwl_mld_get_eht_max_nss(u8 rx_nss, u8 tx_nss)
 {
 	u8 tx = u8_get_bits(tx_nss, IEEE80211_EHT_MCS_NSS_TX);
 	u8 rx = u8_get_bits(rx_nss, IEEE80211_EHT_MCS_NSS_RX);
@@ -325,6 +326,7 @@ static u8 iwl_mld_get_eht_max_nss(u8 rx_nss, u8 tx_nss)
 	 */
 	return min(tx, rx);
 }
+EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_mld_get_eht_max_nss);
 
 #define MAX_NSS_MCS(mcs_num, rx, tx) \
 	iwl_mld_get_eht_max_nss((rx)->rx_tx_mcs ##mcs_num## _max_nss, \
drivers/net/wireless/intel/iwlwifi/mld/tlc.h +6 -0
index c7ff209c9ab6..269d0f2a61ef 100644
@@ -23,4 +23,10 @@ int iwl_mld_send_tlc_dhc(struct iwl_mld *mld, u8 sta_id, u32 type, u32 data);
 void iwl_mld_tlc_update_phy(struct iwl_mld *mld, struct ieee80211_vif *vif,
 			    struct ieee80211_bss_conf *link_conf);
 
+#if IS_ENABLED(CONFIG_IWLWIFI_KUNIT_TESTS)
+int iwl_mld_get_highest_fw_mcs(const struct ieee80211_sta_vht_cap *vht_cap,
+			       int nss);
+u8 iwl_mld_get_eht_max_nss(u8 rx_nss, u8 tx_nss);
+#endif
+
 #endif /* __iwl_mld_tlc_h__ */

base-commit: 4a2610a5a9fcf77eaad82bb030ec77ec5e381db8

Signature · 1 line
2.53.0
author
#1 lore raw

PATCH 2/2 wifi: iwlwifi: mld: add KUnit test for HE PPE parsing

From: April John <[email protected]>

Add tests for iwl_mld_he_get_ppe_val() covering both the single-byte extraction path and the cross-byte path where a 3-bit value spans a byte boundary.

---
 drivers/net/wireless/intel/iwlwifi/mld/sta.c  |  3 +-
 drivers/net/wireless/intel/iwlwifi/mld/sta.h  |  4 +
 .../wireless/intel/iwlwifi/mld/tests/Makefile |  2 +-
 .../wireless/intel/iwlwifi/mld/tests/sta.c    | 86 +++++++++++++++++++
 4 files changed, 93 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/wireless/intel/iwlwifi/mld/tests/sta.c
drivers/net/wireless/intel/iwlwifi/mld/sta.c +2 -1
index 7957ac11b0cd..fd0cee9a92b5 100644
@@ -121,7 +121,7 @@ static u8 iwl_mld_get_uapsd_acs(struct ieee80211_sta *sta)
 	return uapsd_acs | uapsd_acs << 4;
 }
 
-static u8 iwl_mld_he_get_ppe_val(u8 *ppe, u8 ppe_pos_bit)
+VISIBLE_IF_IWLWIFI_KUNIT u8 iwl_mld_he_get_ppe_val(u8 *ppe, u8 ppe_pos_bit)
 {
 	u8 byte_num = ppe_pos_bit / 8;
 	u8 bit_num = ppe_pos_bit % 8;
@@ -146,6 +146,7 @@ static u8 iwl_mld_he_get_ppe_val(u8 *ppe, u8 ppe_pos_bit)
 
 	return res;
 }
+EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_mld_he_get_ppe_val);
 
 static void iwl_mld_parse_ppe(struct iwl_mld *mld,
 			      struct iwl_he_pkt_ext_v2 *pkt_ext, u8 nss,
drivers/net/wireless/intel/iwlwifi/mld/sta.h +4 -0
index 98d693235c66..8659bb7bf6cf 100644
@@ -300,4 +300,8 @@ void iwl_mld_remove_nan_mgmt_sta(struct iwl_mld *mld,
 void iwl_mld_remove_nan_mcast_data_sta(struct iwl_mld *mld,
 				       struct iwl_mld_int_sta *sta);
 
+#if IS_ENABLED(CONFIG_IWLWIFI_KUNIT_TESTS)
+u8 iwl_mld_he_get_ppe_val(u8 *ppe, u8 ppe_pos_bit);
+#endif
+
 #endif /* __iwl_mld_sta_h__ */
drivers/net/wireless/intel/iwlwifi/mld/tests/Makefile +1 -1
index 2af1fb838520..3201dce9a5b0 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 iwlmld-tests-y += module.o hcmd.o utils.o link.o rx.o agg.o link-selection.o
 iwlmld-tests-y += chan_load_thresh.o
-iwlmld-tests-y += tlc.o
+iwlmld-tests-y += tlc.o sta.o
 
 ccflags-y += -I$(src)/../
 obj-$(CONFIG_IWLWIFI_KUNIT_TESTS) += iwlmld-tests.o
drivers/net/wireless/intel/iwlwifi/mld/tests/sta.c new file +86 -0

86 lines not on this page · raw message

Signature · 1 line
2.53.0