1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * mac80211_hwsim_nan - NAN software simulation for mac80211_hwsim 4 * Copyright (C) 2025-2026 Intel Corporation 5 */ 6 7 #ifndef __MAC80211_HWSIM_NAN_H 8 #define __MAC80211_HWSIM_NAN_H 9 10 enum mac80211_hwsim_nan_phase { 11 MAC80211_HWSIM_NAN_PHASE_SCAN, 12 MAC80211_HWSIM_NAN_PHASE_WARMUP, 13 MAC80211_HWSIM_NAN_PHASE_UP, 14 }; 15 16 enum mac80211_hwsim_nan_role { 17 MAC80211_HWSIM_NAN_ROLE_MASTER, 18 MAC80211_HWSIM_NAN_ROLE_SYNC, 19 MAC80211_HWSIM_NAN_ROLE_NON_SYNC, 20 }; 21 22 struct mac80211_hwsim_nan_data { 23 struct ieee80211_vif *device_vif; 24 u8 bands; 25 26 struct hrtimer slot_timer; 27 struct hrtimer resume_txqs_timer; 28 bool notify_dw; 29 30 struct hrtimer discovery_beacon_timer; 31 32 /* Later members are protected by this lock */ 33 spinlock_t state_lock; 34 35 u8 master_pref; 36 u8 random_factor; 37 38 u8 random_factor_valid_dwst; 39 40 enum mac80211_hwsim_nan_phase phase; 41 enum mac80211_hwsim_nan_role role; 42 43 u8 cluster_id[ETH_ALEN]; 44 45 struct ieee80211_nan_anchor_master_info current_ami; 46 struct ieee80211_nan_anchor_master_info last_ami; 47 48 /* Wi-Fi Aware version 4.0, section 3.3.6.1 and 3.3.6.2 */ 49 int master_transition_score; 50 /* Wi-Fi Aware version 4.0, section 3.3.6.3 and 3.3.6.4 */ 51 int sync_transition_score; 52 53 bool tsf_adjusted; 54 bool tsf_discontinuity; 55 56 /* 57 * Local schedule - stores channel definition for each 16TU slot. 58 * Derived from NMI vif->cfg.nan_schedule. chan == NULL means not 59 * available in that slot (except DW which is implicit). 60 */ 61 struct cfg80211_chan_def local_sched[CFG80211_NAN_SCHED_NUM_TIME_SLOTS]; 62 }; 63 64 enum hrtimer_restart 65 mac80211_hwsim_nan_slot_timer(struct hrtimer *timer); 66 enum hrtimer_restart 67 mac80211_hwsim_nan_resume_txqs_timer(struct hrtimer *timer); 68 enum hrtimer_restart 69 mac80211_hwsim_nan_discovery_beacon_timer(struct hrtimer *timer); 70 71 int mac80211_hwsim_nan_start(struct ieee80211_hw *hw, 72 struct ieee80211_vif *vif, 73 struct cfg80211_nan_conf *conf); 74 75 int mac80211_hwsim_nan_stop(struct ieee80211_hw *hw, 76 struct ieee80211_vif *vif); 77 78 int mac80211_hwsim_nan_change_config(struct ieee80211_hw *hw, 79 struct ieee80211_vif *vif, 80 struct cfg80211_nan_conf *conf, 81 u32 changes); 82 83 int mac80211_hwsim_nan_peer_sched_changed(struct ieee80211_hw *hw, 84 struct ieee80211_sta *sta); 85 86 bool mac80211_hwsim_nan_txq_transmitting(struct ieee80211_hw *hw, 87 struct ieee80211_txq *txq); 88 89 void mac80211_hwsim_nan_get_tx_chandef(struct ieee80211_hw *hw, 90 struct cfg80211_chan_def *chandef); 91 92 bool mac80211_hwsim_nan_receive(struct ieee80211_hw *hw, 93 struct ieee80211_channel *channel, 94 struct ieee80211_rx_status *rx_status); 95 96 void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw, 97 struct sk_buff *skb); 98 99 void mac80211_hwsim_nan_local_sched_changed(struct ieee80211_hw *hw, 100 struct ieee80211_vif *vif); 101 102 #endif /* __MAC80211_HWSIM_NAN_H */ 103