]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: ieee80211: add more NAN definitions
authorBenjamin Berg <benjamin.berg@intel.com>
Thu, 26 Mar 2026 10:14:32 +0000 (12:14 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 7 Apr 2026 13:36:02 +0000 (15:36 +0200)
These will be needed to implement NAN synchronization in mac80211_hwsim.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260326121156.ebb52db4c1eb.Ie8142cf92fc8c97c744a7c8b0a94ce3da6ff75ec@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/linux/ieee80211-nan.h
include/linux/ieee80211.h

index ebf28ea651f97ddac603e13e329698e556c64552..455033955e545ef35456fae9671a83f121d177ce 100644 (file)
 #define NAN_DEV_CAPA_NDPE_SUPPORTED            0x08
 #define NAN_DEV_CAPA_S3_SUPPORTED              0x10
 
+/* NAN attributes, as defined in Wi-Fi Aware (TM) specification 4.0 Table 42 */
+#define NAN_ATTR_MASTER_INDICATION             0x00
+#define NAN_ATTR_CLUSTER_INFO                  0x01
+
+struct ieee80211_nan_attr {
+       u8 attr;
+       __le16 length;
+       u8 data[];
+} __packed;
+
+struct ieee80211_nan_master_indication {
+       u8 master_pref;
+       u8 random_factor;
+} __packed;
+
+struct ieee80211_nan_anchor_master_info {
+       union {
+               __le64 master_rank;
+               struct {
+                       u8 master_addr[ETH_ALEN];
+                       u8 random_factor;
+                       u8 master_pref;
+               } __packed;
+       } __packed;
+       u8 hop_count;
+       __le32 ambtt;
+} __packed;
+
+#define for_each_nan_attr(_attr, _data, _datalen)                      \
+       for (_attr = (const struct ieee80211_nan_attr *)(_data);        \
+            (const u8 *)(_data) + (_datalen) - (const u8 *)_attr >=    \
+               (int)sizeof(*_attr) &&                                  \
+            (const u8 *)(_data) + (_datalen) - (const u8 *)_attr >=    \
+               (int)sizeof(*_attr) + le16_to_cpu(_attr->length);       \
+            _attr = (const struct ieee80211_nan_attr *)                \
+               (_attr->data + le16_to_cpu(_attr->length)))
+
 #endif /* LINUX_IEEE80211_NAN_H */
index b5d649db123febbabb13a0a2f0af4ec148ddbc91..ffa8f9f77efe44b9a3559f16219a9f941799df26 100644 (file)
@@ -2240,6 +2240,7 @@ struct ieee80211_multiple_bssid_configuration {
 
 #define WLAN_OUI_WFA                   0x506f9a
 #define WLAN_OUI_TYPE_WFA_P2P          9
+#define WLAN_OUI_TYPE_WFA_NAN          0x13
 #define WLAN_OUI_TYPE_WFA_DPP          0x1A
 #define WLAN_OUI_MICROSOFT             0x0050f2
 #define WLAN_OUI_TYPE_MICROSOFT_WPA    1