git: 9b13e6ce5b09 - main - LinuxKPI: 802.11: add more defines, structures, ...

Bjoern A. Zeeb <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a85cf21.3615c.79e67f62__13670.449114737$1787154250$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=9b13e6ce5b099af0958a824fa37c70538a8b6d2a

commit 9b13e6ce5b099af0958a824fa37c70538a8b6d2a
Author:     Bjoern A. Zeeb <[email protected]>
AuthorDate: 2026-08-12 14:11:36 +0000
Commit:     Bjoern A. Zeeb <[email protected]>
CommitDate: 2026-08-19 15:37:42 +0000

    LinuxKPI: 802.11: add more defines, structures, ...
    
    Add more defines, structures, sort struct field types, add inline
    functions (partially implemented) all needed for the upcoming
    espwl(4) wireless driver.
    
    MFC after:      3 days
---
 .../linuxkpi/common/include/linux/ieee80211.h      | 27 +++++++++--
 sys/compat/linuxkpi/common/include/linux/nl80211.h |  6 +++
 sys/compat/linuxkpi/common/include/net/cfg80211.h  | 54 ++++++++++++++++++----
 sys/compat/linuxkpi/common/include/net/mac80211.h  | 12 ++++-
 4 files changed, 84 insertions(+), 15 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/ieee80211.h b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
index 3edcf96292f7..3d5c938835fe 100644
--- a/sys/compat/linuxkpi/common/include/linux/ieee80211.h
+++ b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2020-2026 The FreeBSD Foundation
+ * Copyright (c) 2026 Bjoern A. Zeeb
  *
  * This software was developed by Björn Zeeb under sponsorship from
  * the FreeBSD Foundation.
@@ -159,6 +160,13 @@ enum ieee80211_vht_max_ampdu_len_exp {
 	IEEE80211_VHT_MAX_AMPDU_1024K		= 7,
 };
 
+/* 802.11-2020, 9.6.22 VHT Action frame details. */
+enum ieee80211_vht_actioncode {
+	/* VHT Compressed Beamforming		= 0, */
+	WLAN_VHT_ACTION_GROUPID_MGMT		= 1,
+	/* Operating Mode Notification		= 2, */
+};
+
 #define	IEEE80211_WEP_IV_LEN			3	/* net80211: IEEE80211_WEP_IVLEN */
 #define	IEEE80211_WEP_ICV_LEN			4
 
@@ -539,6 +547,7 @@ enum ieee80211_sa_query {
 enum ieee80211_category {
 	WLAN_CATEGORY_BACK		= 3,
 	WLAN_CATEGORY_SA_QUERY		= 8,	/* net80211::IEEE80211_ACTION_CAT_SA_QUERY */
+	WLAN_CATEGORY_VHT		= 21,
 };
 
 /* 80211-2020 9.3.3.2 Format of Management frames */
@@ -563,6 +572,14 @@ struct ieee80211_mgmt {
 			uint16_t	listen_interval;
 			uint8_t		variable[0];
 		} __packed assoc_req;
+		/* 9.3.3.6 Association Response frame format */
+		/* 9.3.3.8 Reassociation Response frame format */
+		struct {
+			uint16_t	capab_info;
+			uint16_t	status_code;
+			uint16_t	aid;
+			uint8_t		variable[0];
+		} __packed assoc_resp, reassoc_resp;
 		/* 9.3.3.10 Probe Request frame format */
 		struct {
 			uint8_t		variable[0];
@@ -732,15 +749,15 @@ struct ieee80211_trigger {
 /* Table 9-29c-Trigger Type subfield encoding */
 enum {
 	IEEE80211_TRIGGER_TYPE_BASIC		= 0x0,
+	IEEE80211_TRIGGER_TYPE_BFRP		= 0x1,
 	IEEE80211_TRIGGER_TYPE_MU_BAR		= 0x2,
+	IEEE80211_TRIGGER_TYPE_MU_RTS		= 0x3,
+	IEEE80211_TRIGGER_TYPE_BSRP		= 0x4,
+	IEEE80211_TRIGGER_TYPE_BQRP		= 0x6,
+	IEEE80211_TRIGGER_TYPE_NFRP		= 0x7,
 #if 0
 	/* Not seen yet. */
-	BFRP					= 0x1,
-	MU-RTS					= 0x3,
-	BSRP					= 0x4,
 	GCR MU-BAR				= 0x5,
-	BQRP					= 0x6,
-	NFRP					= 0x7,
 	/* 0x8..0xf reserved */
 #endif
 	IEEE80211_TRIGGER_TYPE_MASK		= 0xf
diff --git a/sys/compat/linuxkpi/common/include/linux/nl80211.h b/sys/compat/linuxkpi/common/include/linux/nl80211.h
index 845ffec4bcba..635ded732d7e 100644
--- a/sys/compat/linuxkpi/common/include/linux/nl80211.h
+++ b/sys/compat/linuxkpi/common/include/linux/nl80211.h
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2020-2024 The FreeBSD Foundation
+ * Copyright (c) 2026 Bjoern A. Zeeb
  *
  * This software was developed by Björn Zeeb under sponsorship from
  * the FreeBSD Foundation.
@@ -444,6 +445,11 @@ enum nl80211_rxmgmt_flags {
 	NL80211_RXMGMT_FLAG_EXTERNAL_AUTH	= BIT(1),
 };
 
+enum nl80211_radar_event {
+	NL80211_RADAR_CAC_FINISHED,
+	NL80211_RADAR_CAC_STARTED,
+};
+
 #define	NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY	16
 #define	NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY	24
 
diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h
index dedf687d6530..1538f70b58d0 100644
--- a/sys/compat/linuxkpi/common/include/net/cfg80211.h
+++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2020-2026 The FreeBSD Foundation
- * Copyright (c) 2021-2022 Bjoern A. Zeeb
+ * Copyright (c) 2021-2026 Bjoern A. Zeeb
  *
  * This software was developed by Björn Zeeb under sponsorship from
  * the FreeBSD Foundation.
@@ -64,6 +64,9 @@ extern int linuxkpi_debug_80211;
     printf("%s:%d: XXX LKPI80211 IMPROVE " fmt "\n", __func__, __LINE__, ##__VA_ARGS__)
 #endif
 
+#define	wiphy_dbg(_wiphy, _fmt, ...)						\
+    dev_dbg(&(_wiphy)->dev, _fmt, ##__VA_ARGS__)
+
 enum rfkill_hard_block_reasons {
 	RFKILL_HARD_BLOCK_NOT_OWNER		= BIT(0),
 };
@@ -1023,12 +1026,14 @@ struct ieee80211_iface_limit {
 };
 
 struct ieee80211_iface_combination {
-	/* TODO FIXME */
 	const struct ieee80211_iface_limit	*limits;
-	int					n_limits;
-	int		max_interfaces, num_different_channels;
-	int		beacon_int_infra_match, beacon_int_min_gcd;
-	int		radar_detect_widths;
+	uint32_t				num_different_channels;
+	uint32_t				beacon_int_min_gcd;
+	uint16_t				max_interfaces;
+	uint8_t					n_limits;
+	uint8_t					radar_detect_widths;
+	uint8_t					radar_detect_regions;
+	bool					beacon_int_infra_match;
 };
 
 struct iface_combination_params {
@@ -1204,6 +1209,8 @@ struct wiphy {
 	uint8_t					nan_supported_bands;
 	struct wiphy_nan_capa			nan_capa;
 
+	struct list_head			wdev_list;
+
 	int	features, hw_version;
 	int	interface_modes, max_match_sets, max_remain_on_channel_duration, max_scan_ssids, max_sched_scan_ie_len, max_sched_scan_plan_interval, max_sched_scan_plan_iterations, max_sched_scan_plans, max_sched_scan_reqs, max_sched_scan_ssids;
 	int	num_iftype_ext_capab;
@@ -1230,11 +1237,13 @@ struct wiphy {
 
 struct wireless_dev {
 		/* XXX TODO, like ic? */
+	struct wiphy				*wiphy;
 	enum nl80211_iftype			iftype;
-	uint32_t				radio_mask;
-	uint8_t					address[ETH_ALEN];
+
 	struct net_device			*netdev;
-	struct wiphy				*wiphy;
+	struct list_head			list;
+	uint8_t					address[ETH_ALEN];
+	uint32_t				radio_mask;
 };
 
 struct cfg80211_ops {
@@ -1554,6 +1563,26 @@ cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)
 	return (false);
 }
 
+static inline enum nl80211_channel_type
+cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
+{
+
+	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_20_NOHT:
+		return (NL80211_CHAN_NO_HT);
+	case NL80211_CHAN_WIDTH_20:
+		return (NL80211_CHAN_HT20);
+	case NL80211_CHAN_WIDTH_40:
+		if (chandef->center_freq1 < chandef->chan->center_freq)
+			return (NL80211_CHAN_HT40MINUS);
+		return (NL80211_CHAN_HT40PLUS);
+	default:
+		WARN_ONCE(1, "%s: invalid chandef width %d\n",
+		    __func__, chandef->width);
+		return (NL80211_CHAN_NO_HT);
+	}
+}
+
 static inline int
 cfg80211_chandef_get_width(const struct cfg80211_chan_def *chandef)
 {
@@ -1574,6 +1603,13 @@ cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, const struct cfg80211_chan_de
 	return (0);
 }
 
+static inline void
+cfg80211_cac_event(struct net_device *netdev, const struct cfg80211_chan_def *chandef,
+    enum nl80211_radar_event re, gfp_t gfp, unsigned int link_id)
+{
+	TODO();
+}
+
 static __inline bool
 cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef_1,
     const struct cfg80211_chan_def *chandef_2)
diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index 5555e14b06f9..83521c2fabaf 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2020-2026 The FreeBSD Foundation
- * Copyright (c) 2020-2025 Bjoern A. Zeeb
+ * Copyright (c) 2020-2026 Bjoern A. Zeeb
  *
  * This software was developed by Björn Zeeb under sponsorship from
  * the FreeBSD Foundation.
@@ -471,6 +471,7 @@ enum ieee80211_hw_flags {
 	IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN,
 	IEEE80211_HW_HANDLES_QUIET_CSA,
 	IEEE80211_HW_NO_VIRTUAL_MONITOR,
+	IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING,
 
 	/* Keep last. */
 	NUM_IEEE80211_HW_FLAGS
@@ -647,6 +648,7 @@ struct ieee80211_rx_status {
 	uint8_t				band;
 	uint8_t				chains;
 	int8_t				chain_signal[IEEE80211_MAX_CHAINS];
+	uint8_t				antenna;
 	int8_t				signal;
 	uint8_t				enc_flags;
 	union {
@@ -1056,6 +1058,7 @@ struct ieee80211_ops {
         uint64_t (*get_tsf)(struct ieee80211_hw *, struct ieee80211_vif *);
         void (*set_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, uint64_t);
 	void (*offset_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, s64);
+	void (*reset_tsf)(struct ieee80211_hw *, struct ieee80211_vif *);
 
 	int  (*set_bitrate_mask)(struct ieee80211_hw *, struct ieee80211_vif *, const struct cfg80211_bitrate_mask *);
 	void (*set_coverage_class)(struct ieee80211_hw *, int, s16);
@@ -2106,6 +2109,13 @@ ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t)
 	TODO();
 }
 
+static inline struct sk_buff *
+ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+{
+	TODO("IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING (espwl)");
+	return (NULL);
+}
+
 static __inline void
 ieee80211_sched_scan_results(struct ieee80211_hw *hw)
 {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.