git: 1a7956f64b5c - stable/14 - LinuxKPI: 802.11: implement ieee80211_get_{he,eht}_iftype_cap{,_vif}

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 10 Feb 2025 14:52:51 UTC
The branch stable/14 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=1a7956f64b5cbe912acd49729e18f1f6c1e05607

commit 1a7956f64b5cbe912acd49729e18f1f6c1e05607
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-01-25 11:46:58 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-02-10 14:52:10 +0000

    LinuxKPI: 802.11: implement ieee80211_get_{he,eht}_iftype_cap{,_vif}
    
    Implement the combination of all four functions, the *_vif versions
    from mac80211.h as a wrapper to the non-*_vif ones in cfg80211.h.
    Put the function pairs next to each other and in the right files
    and harmonize argument naming, etc.
    
    Both of them have shown up too often in the todo-tracing to bother
    enough to implement them now for a time in the future when we will
    support HE/EHT.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit c75a558d0729da87ee3c016b57cc8f5ac4fc65d0)
---
 sys/compat/linuxkpi/common/include/net/cfg80211.h | 34 +++++++++++++++++++++--
 sys/compat/linuxkpi/common/include/net/mac80211.h | 26 ++++++++---------
 2 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h
index 7780b265cf6b..0b6a66033536 100644
--- a/sys/compat/linuxkpi/common/include/net/cfg80211.h
+++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h
@@ -2073,12 +2073,40 @@ ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *band,
 	return (NULL);
 }
 
-static __inline const struct ieee80211_sta_eht_cap *
+static inline const struct ieee80211_sta_he_cap *
+ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band,
+    enum nl80211_iftype iftype)
+{
+	const struct ieee80211_sband_iftype_data *iftype_data;
+	const struct ieee80211_sta_he_cap *he_cap;
+
+	iftype_data = ieee80211_get_sband_iftype_data(band, iftype);
+	if (iftype_data == NULL)
+		return (NULL);
+
+	he_cap = NULL;
+	if (iftype_data->he_cap.has_he)
+		he_cap = &iftype_data->he_cap;
+
+	return (he_cap);
+}
+
+static inline const struct ieee80211_sta_eht_cap *
 ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *band,
     enum nl80211_iftype iftype)
 {
-	TODO();
-	return (NULL);
+	const struct ieee80211_sband_iftype_data *iftype_data;
+	const struct ieee80211_sta_eht_cap *eht_cap;
+
+	iftype_data = ieee80211_get_sband_iftype_data(band, iftype);
+	if (iftype_data == NULL)
+		return (NULL);
+
+	eht_cap = NULL;
+	if (iftype_data->eht_cap.has_eht)
+		eht_cap = &iftype_data->eht_cap;
+
+	return (eht_cap);
 }
 
 static inline bool
diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index 3aa383554e93..891277e42541 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -1605,7 +1605,7 @@ ieee80211_csa_finish(struct ieee80211_vif *vif, uint32_t link_id)
 	TODO();
 }
 
-static __inline enum nl80211_iftype
+static inline enum nl80211_iftype
 ieee80211_vif_type_p2p(struct ieee80211_vif *vif)
 {
 
@@ -2271,14 +2271,6 @@ ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif, bool _x)
 	TODO();
 }
 
-static __inline const struct ieee80211_sta_he_cap *
-ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band,
-    enum nl80211_iftype type)
-{
-	TODO();
-        return (NULL);
-}
-
 static __inline void
 ieee80211_key_mic_failure(struct ieee80211_key_conf *key)
 {
@@ -2427,20 +2419,24 @@ ieee80211_vif_is_mld(const struct ieee80211_vif *vif)
 	return (vif->valid_links != 0);
 }
 
-static __inline const struct ieee80211_sta_he_cap *
+static inline const struct ieee80211_sta_he_cap *
 ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band *band,
     struct ieee80211_vif *vif)
 {
-	TODO();
-	return (NULL);
+	enum nl80211_iftype iftype;
+
+	iftype = ieee80211_vif_type_p2p(vif);
+	return (ieee80211_get_he_iftype_cap(band, iftype));
 }
 
-static __inline const struct ieee80211_sta_eht_cap *
+static inline const struct ieee80211_sta_eht_cap *
 ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band *band,
     struct ieee80211_vif *vif)
 {
-	TODO();
-	return (NULL);
+	enum nl80211_iftype iftype;
+
+	iftype = ieee80211_vif_type_p2p(vif);
+	return (ieee80211_get_eht_iftype_cap(band, iftype));
 }
 
 static inline uint32_t