git: a0112b013f93 - main - LinuxKPI: 802.11: Add structures and functions for NAN support
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 18 Apr 2026 12:00:15 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=a0112b013f93a47489051fed54ea48c077e59de4
commit a0112b013f93a47489051fed54ea48c077e59de4
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-04-18 11:26:59 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-04-18 12:00:00 +0000
LinuxKPI: 802.11: Add structures and functions for NAN support
In Linux v7.0 iwlwifi(4) started to add support for Wi-Fi Aware(tm)
also known as Neighbor Awareness Networking (NAN).
Add structures and fields for this as needed so far to keep the driver
compiling. net80211 has no support for it as a new mode.
We may consider a dedicated header file for these parts in the future
depending on how much more is to come.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
---
sys/compat/linuxkpi/common/include/net/cfg80211.h | 66 +++++++++++++++++++++++
sys/compat/linuxkpi/common/include/net/mac80211.h | 11 ++++
2 files changed, 77 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h
index 5c8c914bdee7..24b57ea1f001 100644
--- a/sys/compat/linuxkpi/common/include/net/cfg80211.h
+++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h
@@ -328,6 +328,53 @@ struct cfg80211_chan_def {
uint16_t punctured;
};
+struct cfg80211_nan_band_config {
+ /* XXX TODO */
+ struct linuxkpi_ieee80211_channel *chan;
+ uint8_t rssi_middle;
+ uint8_t rssi_close;
+ uint8_t awake_dw_interval;
+};
+
+struct cfg80211_nan_conf {
+ uint8_t bands;
+ uint8_t discovery_beacon_interval;
+ uint8_t master_pref;
+ bool enable_dw_notification;
+
+ uint16_t scan_dwell_time;
+ uint16_t scan_period;
+ uint16_t extra_nan_attrs_len;
+ uint16_t vendor_elems_len;
+
+ uint8_t *cluster_id;
+ struct cfg80211_nan_band_config band_cfgs[NUM_NL80211_BANDS];
+ uint8_t *extra_nan_attrs;
+ uint8_t *vendor_elems;
+};
+
+enum wiphy_nan_flags {
+ WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC = BIT(0),
+ WIPHY_NAN_FLAGS_USERSPACE_DE = BIT(1),
+};
+
+/* Wi-Fi Aware (TM) specification, 9.5.15 Device Capability attribute. */
+/* Misplaced here for the moment. */
+#define NAN_OP_MODE_PHY_MODE_MASK 0x11 /* b0 0=HT, 1=VHT, b4=1 HE supported */
+#define NAN_OP_MODE_80P80MHZ 0x2 /* b1 */
+#define NAN_OP_MODE_160MHZ 0x4 /* b2 */
+
+#define NAN_DEV_CAPA_EXT_KEY_ID_SUPPORTED 0x2 /* b1 */
+#define NAN_DEV_CAPA_NDPE_SUPPORTED 0x8 /* b3 */
+
+struct wiphy_nan_capa {
+ uint32_t flags; /* enum wiphy_nan_flags */
+ uint8_t op_mode;
+ uint8_t dev_capabilities;
+ uint8_t n_antennas; /* Tx/Rx bitmask, e.g., 0x22 */
+ uint16_t max_channel_switch_time;
+};
+
struct cfg80211_ftm_responder_stats {
/* XXX TODO */
int asap_num, failed_num, filled, non_asap_num, out_of_window_triggers_num, partial_num, reschedule_requests_num, success_num, total_duration_ms, unknown_triggers_num;
@@ -1152,6 +1199,9 @@ struct wiphy {
uint32_t bss_param_support; /* enum wiphy_bss_param_flags */
+ uint8_t nan_supported_bands;
+ struct wiphy_nan_capa nan_capa;
+
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;
@@ -2207,6 +2257,22 @@ cfg80211_cqm_rssi_notify(struct net_device *dev,
/* -------------------------------------------------------------------------- */
+static inline void
+cfg80211_nan_cluster_joined(struct wireless_dev *wdev, const uint8_t *cluster_id,
+ bool new_cluster, gfp_t gfp)
+{
+ TODO("NAN");
+}
+
+static inline void
+cfg80211_next_nan_dw_notif(struct wireless_dev *wdev,
+ struct linuxkpi_ieee80211_channel *chan, gfp_t gfp)
+{
+ TODO("NAN");
+}
+
+/* -------------------------------------------------------------------------- */
+
static inline void
wiphy_work_init(struct wiphy_work *wwk, wiphy_work_fn fn)
{
diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index c637e13a496d..4943570d6c40 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -1104,6 +1104,10 @@ struct ieee80211_ops {
int (*net_fill_forward_path)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct net_device_path_ctx *, struct net_device_path *);
+ int (*start_nan)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_nan_conf *);
+ int (*stop_nan)(struct ieee80211_hw *, struct ieee80211_vif *);
+ int (*nan_change_conf)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_nan_conf *, uint32_t changes);
+
/* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change depending on compile-time option. */
void (*sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct dentry *);
void (*vif_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *);
@@ -2650,4 +2654,11 @@ ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp __unused)
/* -------------------------------------------------------------------------- */
+static inline bool
+ieee80211_vif_nan_started(struct ieee80211_vif *vif)
+{
+ IMPROVE("NAN");
+ return (false);
+}
+
#endif /* _LINUXKPI_NET_MAC80211_H */