wifi: mac80211_hwsim: some more NAN patches
Subsystems (2)
v2 cover wifi: mac80211_hwsim: some more NAN patches
Hi,
This series completes the hwsim support for NAN.
Thanks,
Miri
---
Benjamin Berg (5):
wifi: mac80211_hwsim: limit TX of frames to the NAN DW
wifi: mac80211_hwsim: select NAN TX channel based on current TSF
wifi: mac80211_hwsim: only RX on NAN when active on a slot
wifi: mac80211_hwsim: protect tsf_offset using a spinlock
wifi: mac80211_hwsim: implement NAN synchronization
Daniel Gabay (7):
wifi: mac80211_hwsim: add NAN_DATA interface limits
wifi: mac80211_hwsim: add NAN PHY capabilities
wifi: mac80211_hwsim: implement NAN schedule callbacks
wifi: mac80211_hwsim: set HAS_RATE_CONTROL when using NAN
wifi: mac80211_hwsim: add NAN data path TX/RX support
wifi: mac80211_hwsim: Declare support for secure NAN
wifi: mac80211_hwsim: enable NAN_DATA interface simulation support
Ilan Peer (2):
wifi: mac80211_hwsim: Do not declare support for NDPE
wifi: mac80211_hwsim: Support Tx of multicast data on NAN
.../net/wireless/virtual/mac80211_hwsim_i.h | 33 +- .../wireless/virtual/mac80211_hwsim_main.c | 263 +++- .../net/wireless/virtual/mac80211_hwsim_nan.c | 1191 ++++++++++++++++- .../net/wireless/virtual/mac80211_hwsim_nan.h | 74 +- 4 files changed, 1454 insertions(+), 107 deletions(-)
Signature · 3 lines
2.34.1 --- v2: fix checkpatch in one of the patches
PATCH v2 1/14 wifi: mac80211_hwsim: limit TX of frames to the NAN DW
From: Benjamin Berg <[email protected]>
Frames submitted on the NAN device interface should only be transmitted during one of the discovery windows (DWs). It is assumed that software submits frames from the DW end notifications for the next DW period.
Simulate this behaviour by checking that we are currently in a DW before transmitting from ieee80211_hwsim_wake_tx_queue. As frames will be queued up at the start of a DW, wake the management TX queue every time a DW is started. Do so with a randomized offset just to avoid every client transmitting at the same time.
--- .../net/wireless/virtual/mac80211_hwsim_i.h | 3 + .../wireless/virtual/mac80211_hwsim_main.c | 11 ++- .../net/wireless/virtual/mac80211_hwsim_nan.c | 79 +++++++++++++++++++ .../net/wireless/virtual/mac80211_hwsim_nan.h | 6 ++ 4 files changed, 97 insertions(+), 2 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_i.h +3 -0
@@ -136,4 +136,7 @@ u64 mac80211_hwsim_boottime_to_tsf(struct mac80211_hwsim_data *data,u64 mac80211_hwsim_get_tsf (struct ieee80211_hw *hw,struct ieee80211_vif *vif); +void ieee80211_hwsim_wake_tx_queue (struct ieee80211_hw *hw, +struct ieee80211_txq *txq); +#endif /* __MAC80211_HWSIM_I_H */
drivers/net/wireless/virtual/mac80211_hwsim_main.c +9 -2
@@ -2235,14 +2235,18 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw,ieee80211_tx_status_irqsafe (hw, skb); } -static void ieee80211_hwsim_wake_tx_queue (struct ieee80211_hw *hw, -struct ieee80211_txq *txq) +void ieee80211_hwsim_wake_tx_queue (struct ieee80211_hw *hw, +struct ieee80211_txq *txq) {struct ieee80211_tx_control control = { .sta = txq->sta, };struct sk_buff *skb; +if (txq->vif->type ==NL80211_IFTYPE_NAN && + !mac80211_hwsim_nan_txq_transmitting (hw, txq)) +return ; +while ((skb =ieee80211_tx_dequeue (hw, txq)))mac80211_hwsim_tx (hw, &control, skb); }
@@ -5603,6 +5607,9 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,hrtimer_setup (&data->nan.slot_timer, mac80211_hwsim_nan_slot_timer,CLOCK_BOOTTIME ,HRTIMER_MODE_ABS_SOFT ); +hrtimer_setup (&data->nan.resume_txqs_timer, + mac80211_hwsim_nan_resume_txqs_timer, +CLOCK_BOOTTIME ,HRTIMER_MODE_ABS_SOFT ); } data->if_combination.radar_detect_widths =
drivers/net/wireless/virtual/mac80211_hwsim_nan.c +79 -0
102 lines not on this page · raw message
drivers/net/wireless/virtual/mac80211_hwsim_nan.h +6 -0
@@ -15,11 +15,14 @@ struct mac80211_hwsim_nan_data {struct ieee80211_channel *channel;struct hrtimer slot_timer; +struct hrtimer resume_txqs_timer;bool notify_dw; };enum hrtimer_restart mac80211_hwsim_nan_slot_timer (struct hrtimer *timer); +enum hrtimer_restart +mac80211_hwsim_nan_resume_txqs_timer (struct hrtimer *timer); int mac80211_hwsim_nan_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -33,4 +36,7 @@ int mac80211_hwsim_nan_change_config(struct ieee80211_hw *hw,struct cfg80211_nan_conf *conf, u32 changes); +bool mac80211_hwsim_nan_txq_transmitting (struct ieee80211_hw *hw, +struct ieee80211_txq *txq); +#endif /* __MAC80211_HWSIM_NAN_H */
Signature · 1 line
2.34.1
PATCH v2 2/14 wifi: mac80211_hwsim: select NAN TX channel based on current TSF
In reply to Miri KorenblitFrom: Benjamin Berg <[email protected]>
Move the TX channel selection into the NAN specific file and select the channel based on the current slot.
--- .../net/wireless/virtual/mac80211_hwsim_main.c | 6 +----- .../net/wireless/virtual/mac80211_hwsim_nan.c | 18 ++++++++++++++++++ .../net/wireless/virtual/mac80211_hwsim_nan.h | 3 +++ 3 files changed, 22 insertions(+), 5 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_main.c +1 -5
@@ -2084,11 +2084,7 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw, hdr = (void *)skb->data;if (vif && vif->type ==NL80211_IFTYPE_NAN && !data->tmp_chan) { -/* For NAN Device simulation purposes, assume that NAN is always -* on channel 6 or channel 149, unless a ROC is in progress (for -* USD use cases). -*/ - channel = data->nan.channel; + channel =mac80211_hwsim_nan_get_tx_channel (hw);if (WARN_ON (!channel)) {ieee80211_free_txskb (hw, skb);
drivers/net/wireless/virtual/mac80211_hwsim_nan.c +18 -0
@@ -310,3 +310,21 @@ bool mac80211_hwsim_nan_txq_transmitting(struct ieee80211_hw *hw,return true; } + +struct ieee80211_channel * +mac80211_hwsim_nan_get_tx_channel (struct ieee80211_hw *hw) +{ +struct mac80211_hwsim_data *data = hw->priv; +u64 tsf =mac80211_hwsim_get_tsf (data->hw, data->nan.device_vif); +u8 slot =hwsim_nan_slot_from_tsf (tsf); + +if (slot ==SLOT_24GHZ_DW ) +return ieee80211_get_channel (hw->wiphy,2437 ); + +if (slot ==SLOT_5GHZ_DW && + data->nan.bands &BIT (NL80211_BAND_5GHZ )) +return ieee80211_get_channel (hw->wiphy,5745 ); + +/* drop frame and warn, NAN_CHAN_SWITCH_TIME_US should avoid races */ +return NULL ; +}
drivers/net/wireless/virtual/mac80211_hwsim_nan.h +3 -0
@@ -39,4 +39,7 @@ int mac80211_hwsim_nan_change_config(struct ieee80211_hw *hw,bool mac80211_hwsim_nan_txq_transmitting (struct ieee80211_hw *hw,struct ieee80211_txq *txq); +struct ieee80211_channel * +mac80211_hwsim_nan_get_tx_channel (struct ieee80211_hw *hw); +#endif /* __MAC80211_HWSIM_NAN_H */
Signature · 1 line
2.34.1
PATCH v2 3/14 wifi: mac80211_hwsim: only RX on NAN when active on a slot
In reply to Miri KorenblitFrom: Benjamin Berg <[email protected]>
This moves the NAN receive into the main code and changes it so that frame RX only happens when the device is active on the channel. This limits RX to the DW slots as there is currently no datapath.
With this the globally stored channel is obsolete, remove it.
--- .../wireless/virtual/mac80211_hwsim_main.c | 26 ++++++++---- .../net/wireless/virtual/mac80211_hwsim_nan.c | 41 +++++++++++++++++-- .../net/wireless/virtual/mac80211_hwsim_nan.h | 7 ++-- 3 files changed, 58 insertions(+), 16 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_main.c +17 -9
@@ -1731,6 +1731,8 @@ static bool hwsim_chans_compat(struct ieee80211_channel *c1,struct tx_iter_data {struct ieee80211_channel *channel; +struct ieee80211_rx_status *rx_status; +struct ieee80211_hw *hw;bool receive; };
@@ -1740,13 +1742,10 @@ static void mac80211_hwsim_tx_iter(void *_data, u8 *addr,struct tx_iter_data *data = _data;int i; -/* For NAN Device simulation purposes, assume that NAN is always -* on channel 6 or channel 149. -*/ if (vif->type ==NL80211_IFTYPE_NAN ) { - data->receive = (data->channel && - (data->channel->center_freq ==2437 || - data->channel->center_freq ==5745 )); + data->receive =mac80211_hwsim_nan_receive (data->hw, + data->channel, + data->rx_status);return ; }
@@ -1923,7 +1922,9 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,struct sk_buff *nskb;struct tx_iter_data tx_iter_data = { .receive = false, + .hw = data2->hw, .channel = chan, + .rx_status = &rx_status, };if (data == data2)
@@ -1939,6 +1940,12 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,if (data->netgroup != data2->netgroup)continue ; +/* +* Set mactime early since NAN RX filtering relies on it +* for slot calculation +*/ + rx_status.mactime = sim_tsf + data2->tsf_offset; +if (!hwsim_chans_compat (chan, data2->tmp_chan) && !hwsim_chans_compat (chan, data2->channel)) { ieee80211_iterate_active_interfaces_atomic(
@@ -1975,8 +1982,6 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,if (mac80211_hwsim_addr_match (data2, hdr->addr1)) ack = true; - rx_status.mactime = sim_tsf + data2->tsf_offset; -mac80211_hwsim_rx (data2, &rx_status, nskb); }spin_unlock (&hwsim_radio_lock);
@@ -6286,7 +6291,10 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,/* A frame is received from user space */ memset (&rx_status,0 ,sizeof (rx_status));if (info->attrs[HWSIM_ATTR_FREQ ]) { -struct tx_iter_data iter_data = {}; +struct tx_iter_data iter_data = { + .hw = data2->hw, + .rx_status = &rx_status, + };/* throw away off-channel packets, but allow both the temporary * ("hw" scan/remain-on-channel), regular channels and links,
drivers/net/wireless/virtual/mac80211_hwsim_nan.c +37 -4
62 lines not on this page · raw message
drivers/net/wireless/virtual/mac80211_hwsim_nan.h +4 -3
@@ -11,9 +11,6 @@ struct mac80211_hwsim_nan_data {struct ieee80211_vif *device_vif;u8 bands; -/* Current channel of the NAN device */ -struct ieee80211_channel *channel; -struct hrtimer slot_timer;struct hrtimer resume_txqs_timer;bool notify_dw;
@@ -42,4 +39,8 @@ bool mac80211_hwsim_nan_txq_transmitting(struct ieee80211_hw *hw,struct ieee80211_channel *mac80211_hwsim_nan_get_tx_channel (struct ieee80211_hw *hw); +bool mac80211_hwsim_nan_receive (struct ieee80211_hw *hw, +struct ieee80211_channel *channel, +struct ieee80211_rx_status *rx_status); +#endif /* __MAC80211_HWSIM_NAN_H */
Signature · 1 line
2.34.1
PATCH v2 4/14 wifi: mac80211_hwsim: protect tsf_offset using a spinlock
In reply to Miri KorenblitFrom: Benjamin Berg <[email protected]>
To implement NAN synchronization in hwsim, the TSF needs to be adjusted regularly from the RX path. Add a spinlock so that this can be done in a safe manner.
--- .../net/wireless/virtual/mac80211_hwsim_i.h | 1 + .../wireless/virtual/mac80211_hwsim_main.c | 34 ++++++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_i.h +1 -0
@@ -102,6 +102,7 @@ struct mac80211_hwsim_data {u32 wmediumd;/* difference between this hw's clock and the real clock, in usecs */ +spinlock_t tsf_offset_lock;s64 tsf_offset;/* Stats */
drivers/net/wireless/virtual/mac80211_hwsim_main.c +25 -9
@@ -1256,13 +1256,17 @@ static inline u64 mac80211_hwsim_get_sim_tsf(void)ktime_t mac80211_hwsim_tsf_to_boottime (struct mac80211_hwsim_data *data,u64 tsf) { -return us_to_ktime (tsf - data->tsf_offset); + scoped_guard(spinlock_bh, &data->tsf_offset_lock) { +return us_to_ktime (tsf - data->tsf_offset); + } }u64 mac80211_hwsim_boottime_to_tsf (struct mac80211_hwsim_data *data,ktime_t ts) { -return ktime_to_us (ts + data->tsf_offset); + scoped_guard(spinlock_bh, &data->tsf_offset_lock) { +return ktime_to_us (ts) + data->tsf_offset; + } } u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw,
@@ -1271,14 +1275,18 @@ u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw,struct mac80211_hwsim_data *data = hw->priv;u64 sim_time =mac80211_hwsim_get_sim_tsf (); -return sim_time + data->tsf_offset; + scoped_guard(spinlock_bh, &data->tsf_offset_lock) { +return sim_time + data->tsf_offset; + } }static __le64 __mac80211_hwsim_get_tsf (struct mac80211_hwsim_data *data) {u64 sim_time =mac80211_hwsim_get_sim_tsf (); -return cpu_to_le64 (sim_time + data->tsf_offset); + scoped_guard(spinlock_bh, &data->tsf_offset_lock) { +return cpu_to_le64 (sim_time + data->tsf_offset); + } } static void mac80211_hwsim_set_tsf(struct ieee80211_hw *hw,
@@ -1293,11 +1301,13 @@ static void mac80211_hwsim_set_tsf(struct ieee80211_hw *hw,if (conf && !conf->enable_beacon)return ; -/* adjust after beaconing with new timestamp at old TBTT */ -if (tsf > now) - data->tsf_offset += delta; -else - data->tsf_offset -= delta; + scoped_guard(spinlock_bh, &data->tsf_offset_lock) { +/* adjust after beaconing with new timestamp at old TBTT */ +if (tsf > now) + data->tsf_offset += delta; +else + data->tsf_offset -= delta; + } } static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw,
@@ -1577,6 +1587,8 @@ static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,/* TODO: get MCS */ int bitrate =100 ; +spin_lock_bh (&data->tsf_offset_lock); + txrate =ieee80211_get_tx_rate (data->hw, info);if (txrate) bitrate = txrate->bitrate;
@@ -1602,6 +1614,8 @@ static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,10 *8 *10 / bitrate); } + +spin_unlock_bh (&data->tsf_offset_lock); } static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
@@ -5664,6 +5678,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, hw->wiphy->mbssid_max_interfaces =8 ; hw->wiphy->ema_max_profile_periodicity =3 ; +spin_lock_init (&data->tsf_offset_lock); + data->rx_rssi =DEFAULT_RX_RSSI ;INIT_DELAYED_WORK (&data->roc_start, hw_roc_start);
Signature · 1 line
2.34.1
PATCH v2 5/14 wifi: mac80211_hwsim: implement NAN synchronization
In reply to Miri KorenblitFrom: Benjamin Berg <[email protected]>
Add all the handling to do NAN synchronization on 2.4 GHz including sending out beacons. With this, the mac80211_hwsim NAN device also works when used in conjunction with an external medium simulation.
Note that the TSF sync is not ideal in case of an external medium simulation. This is because the mactime for received frames needs to be estimated and the simulation may not update the timestamp of beacons to the actual time that the frame was transmitted.
The implementation has an initial short phase where it scans for clusters. This facilitates cluster joining and avoids creating a new cluster immediately, which would result in two cluster join notifications. It does not scan otherwise and will only see another cluster appearing if a discovery beacon happens to be sent during the 2.4 GHz discovery window (DW).
--- .../net/wireless/virtual/mac80211_hwsim_i.h | 4 + .../wireless/virtual/mac80211_hwsim_main.c | 18 +- .../net/wireless/virtual/mac80211_hwsim_nan.c | 723 +++++++++++++++++- .../net/wireless/virtual/mac80211_hwsim_nan.h | 43 ++ 4 files changed, 743 insertions(+), 45 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_i.h +4 -0
@@ -137,6 +137,10 @@ u64 mac80211_hwsim_boottime_to_tsf(struct mac80211_hwsim_data *data,u64 mac80211_hwsim_get_tsf (struct ieee80211_hw *hw,struct ieee80211_vif *vif); +void mac80211_hwsim_tx_frame (struct ieee80211_hw *hw, +struct sk_buff *skb, +struct ieee80211_channel *chan); +void ieee80211_hwsim_wake_tx_queue (struct ieee80211_hw *hw,struct ieee80211_txq *txq);
drivers/net/wireless/virtual/mac80211_hwsim_main.c +11 -7
@@ -957,10 +957,6 @@ static int hwsim_get_chanwidth(enum nl80211_chan_width bw)return INT_MAX ; } -static void mac80211_hwsim_tx_frame (struct ieee80211_hw *hw, -struct sk_buff *skb, -struct ieee80211_channel *chan); -/* sysfs attributes */ static void hwsim_send_ps_poll (void *dat,u8 *mac,struct ieee80211_vif *vif) {
@@ -1865,6 +1861,9 @@ static void mac80211_hwsim_rx(struct mac80211_hwsim_data *data,mac80211_hwsim_add_vendor_rtap (skb); +if (data->nan.device_vif) +mac80211_hwsim_nan_rx (data->hw, skb); + data->rx_pkts++; data->rx_bytes += skb->len;ieee80211_rx_irqsafe (data->hw, skb);
@@ -2359,9 +2358,9 @@ static void mac80211_hwsim_remove_interface(mac80211_hwsim_config_mac_nl (hw, vif->addr, false); } -static void mac80211_hwsim_tx_frame (struct ieee80211_hw *hw, -struct sk_buff *skb, -struct ieee80211_channel *chan) +void mac80211_hwsim_tx_frame (struct ieee80211_hw *hw, +struct sk_buff *skb, +struct ieee80211_channel *chan) {struct mac80211_hwsim_data *data = hw->priv;u32 _portid =READ_ONCE (data->wmediumd);
@@ -5625,6 +5624,11 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,hrtimer_setup (&data->nan.resume_txqs_timer, mac80211_hwsim_nan_resume_txqs_timer,CLOCK_BOOTTIME ,HRTIMER_MODE_ABS_SOFT ); +hrtimer_setup (&data->nan.discovery_beacon_timer, + mac80211_hwsim_nan_discovery_beacon_timer, +CLOCK_BOOTTIME ,HRTIMER_MODE_ABS_SOFT ); + +spin_lock_init (&data->nan.state_lock); } data->if_combination.radar_detect_widths =
drivers/net/wireless/virtual/mac80211_hwsim_nan.c +685 -38
846 lines not on this page · raw message
drivers/net/wireless/virtual/mac80211_hwsim_nan.h +43 -0
65 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 6/14 wifi: mac80211_hwsim: add NAN_DATA interface limits
In reply to Miri KorenblitFrom: Daniel Gabay <[email protected]>
Increase interface limits for NAN_DATA interface.
--- drivers/net/wireless/virtual/mac80211_hwsim_i.h | 4 ++-- drivers/net/wireless/virtual/mac80211_hwsim_main.c | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_i.h +2 -2
@@ -4,7 +4,7 @@* Copyright (c) 2008, Jouni Malinen <[email protected]> * Copyright (c) 2011, Javier Lopez <[email protected]> * Copyright (c) 2016 - 2017 Intel Deutschland GmbH -* Copyright (C) 2018 - 2025 Intel Corporation +* Copyright (C) 2018 - 2026 Intel Corporation */ #ifndef __MAC80211_HWSIM_I_H
@@ -39,7 +39,7 @@ struct mac80211_hwsim_data {struct ieee80211_channel channels_s1g[HWSIM_NUM_S1G_CHANNELS_US ];struct ieee80211_rate rates[HWSIM_NUM_RATES ];struct ieee80211_iface_combination if_combination; -struct ieee80211_iface_limit if_limits[4 ]; +struct ieee80211_iface_limit if_limits[5 ];int n_if_limits;/* Storage space for channels, etc. */ struct mac80211_hwsim_phy_data *phy_data;
drivers/net/wireless/virtual/mac80211_hwsim_main.c +7 -1
@@ -4,7 +4,7 @@* Copyright (c) 2008, Jouni Malinen <[email protected]> * Copyright (c) 2011, Javier Lopez <[email protected]> * Copyright (c) 2016 - 2017 Intel Deutschland GmbH -* Copyright (C) 2018 - 2025 Intel Corporation +* Copyright (C) 2018 - 2026 Intel Corporation */ /*
@@ -5631,6 +5631,12 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,spin_lock_init (&data->nan.state_lock); } +if (param->iftypes &BIT (NL80211_IFTYPE_NAN_DATA )) { + data->if_limits[n_limits].max =2 ; + data->if_limits[n_limits].types =BIT (NL80211_IFTYPE_NAN_DATA ); + n_limits++; + } + data->if_combination.radar_detect_widths =BIT (NL80211_CHAN_WIDTH_5 ) | BIT(NL80211_CHAN_WIDTH_10) |
Signature · 1 line
2.34.1
PATCH v2 7/14 wifi: mac80211_hwsim: add NAN PHY capabilities
In reply to Miri KorenblitFrom: Daniel Gabay <[email protected]>
Add static HT, VHT and HE PHY capabilities to the NAN capabilities structure. These are based on the existing band capability structures and initialization in mac80211_hwsim.
The NAN PHY capabilities are used by mac80211 and nl80211 to advertise device capabilities for NAN data interfaces.
--- .../wireless/virtual/mac80211_hwsim_main.c | 102 ++++++++++++++++-- 1 file changed, 94 insertions(+), 8 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_main.c +94 -8
@@ -5412,6 +5412,95 @@ static const struct ieee80211_sband_iftype_data sband_capa_6ghz[] = {#endif }; +#define HWSIM_VHT_MCS_MAP \ + (IEEE80211_VHT_MCS_SUPPORT_0_9 << 0 | \ + IEEE80211_VHT_MCS_SUPPORT_0_9 << 2 | \ + IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 | \ + IEEE80211_VHT_MCS_SUPPORT_0_9 << 6 | \ + IEEE80211_VHT_MCS_SUPPORT_0_9 << 8 | \ + IEEE80211_VHT_MCS_SUPPORT_0_9 << 10 | \ + IEEE80211_VHT_MCS_SUPPORT_0_9 << 12 | \ + IEEE80211_VHT_MCS_SUPPORT_0_9 << 14) + +static const struct ieee80211_sta_ht_cap hwsim_nan_ht_cap = { + .ht_supported = true, + .cap =IEEE80211_HT_CAP_SUP_WIDTH_20_40 | +IEEE80211_HT_CAP_GRN_FLD | +IEEE80211_HT_CAP_SGI_20 | +IEEE80211_HT_CAP_SGI_40 | +IEEE80211_HT_CAP_DSSSCCK40 , + .ampdu_factor =0x3 , + .ampdu_density =0x6 , + .mcs = { + .rx_mask = {0xff ,0xff }, + .tx_params =IEEE80211_HT_MCS_TX_DEFINED , + }, +}; + +static const struct ieee80211_sta_vht_cap hwsim_nan_vht_cap = { + .vht_supported = true, + .cap =IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 | +IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ | +IEEE80211_VHT_CAP_RXLDPC | +IEEE80211_VHT_CAP_SHORT_GI_80 | +IEEE80211_VHT_CAP_SHORT_GI_160 | +IEEE80211_VHT_CAP_TXSTBC | +IEEE80211_VHT_CAP_RXSTBC_4 | +IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK , + .vht_mcs = { + .rx_mcs_map =cpu_to_le16 (HWSIM_VHT_MCS_MAP ), + .tx_mcs_map =cpu_to_le16 (HWSIM_VHT_MCS_MAP ), + }, +}; + +static const struct ieee80211_sta_he_cap hwsim_nan_he_cap = { + .has_he = true, + .he_cap_elem = { + .mac_cap_info[0 ] = +IEEE80211_HE_MAC_CAP0_HTC_HE , + .mac_cap_info[1 ] = +IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | +IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8 , + .mac_cap_info[2 ] = +IEEE80211_HE_MAC_CAP2_BSR | +IEEE80211_HE_MAC_CAP2_MU_CASCADING | +IEEE80211_HE_MAC_CAP2_ACK_EN , + .mac_cap_info[3 ] = +IEEE80211_HE_MAC_CAP3_OMI_CONTROL | +IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3 , + .mac_cap_info[4 ] =IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU , + .phy_cap_info[0 ] = +IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | +IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G | +IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G , + .phy_cap_info[1 ] = +IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | +IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | +IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD | +IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS , + .phy_cap_info[2 ] = + IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US | +IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ | +IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ | +IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO | +IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO , + +/* +* Leave all the other PHY capability bytes +* unset, as DCM, beam forming, RU and PPE +* threshold information are not supported +*/ + }, + .he_mcs_nss_supp = { + .rx_mcs_80 =cpu_to_le16 (0xfffa ), + .tx_mcs_80 =cpu_to_le16 (0xfffa ), + .rx_mcs_160 =cpu_to_le16 (0xfffa ), + .tx_mcs_160 =cpu_to_le16 (0xfffa ), + .rx_mcs_80p80 =cpu_to_le16 (0xfffa ), + .tx_mcs_80p80 =cpu_to_le16 (0xfffa ), + }, +}; +static void mac80211_hwsim_sband_capab (struct ieee80211_supported_band *sband) {switch (sband->band) {
@@ -5635,6 +5724,10 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, data->if_limits[n_limits].max =2 ; data->if_limits[n_limits].types =BIT (NL80211_IFTYPE_NAN_DATA ); n_limits++; + + hw->wiphy->nan_capa.phy.ht = hwsim_nan_ht_cap; + hw->wiphy->nan_capa.phy.vht = hwsim_nan_vht_cap; + hw->wiphy->nan_capa.phy.he = hwsim_nan_he_cap; } data->if_combination.radar_detect_widths =
@@ -5816,14 +5909,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,IEEE80211_VHT_CAP_RXSTBC_4 |IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK ; sband->vht_cap.vht_mcs.rx_mcs_map = -cpu_to_le16 (IEEE80211_VHT_MCS_SUPPORT_0_9 <<0 | -IEEE80211_VHT_MCS_SUPPORT_0_9 <<2 | -IEEE80211_VHT_MCS_SUPPORT_0_9 <<4 | -IEEE80211_VHT_MCS_SUPPORT_0_9 <<6 | -IEEE80211_VHT_MCS_SUPPORT_0_9 <<8 | -IEEE80211_VHT_MCS_SUPPORT_0_9 <<10 | -IEEE80211_VHT_MCS_SUPPORT_0_9 <<12 | -IEEE80211_VHT_MCS_SUPPORT_0_9 <<14 ); +cpu_to_le16 (HWSIM_VHT_MCS_MAP ); sband->vht_cap.vht_mcs.tx_mcs_map = sband->vht_cap.vht_mcs.rx_mcs_map;break ;
Signature · 1 line
2.34.1
PATCH v2 8/14 wifi: mac80211_hwsim: implement NAN schedule callbacks
In reply to Miri KorenblitFrom: Daniel Gabay <[email protected]>
Implement mac80211 schedule callbacks for NAN Data Path support:
- Track local schedule via BSS_CHANGED_NAN_LOCAL_SCHED, caching the channel for each 16TU time slot.
- Copy peer schedule to driver-private storage in nan_peer_sched_changed callback for use in TX availability decisions.
--- .../net/wireless/virtual/mac80211_hwsim_i.h | 21 +++++ .../wireless/virtual/mac80211_hwsim_main.c | 14 ++-- .../net/wireless/virtual/mac80211_hwsim_nan.c | 80 +++++++++++++++++++ .../net/wireless/virtual/mac80211_hwsim_nan.h | 15 +++- 4 files changed, 121 insertions(+), 9 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_i.h +21 -0
@@ -14,6 +14,27 @@#include "mac80211_hwsim.h" #include "mac80211_hwsim_nan.h" +struct hwsim_sta_nan_sched { +/* Later members are protected by this lock */ +spinlock_t lock; +u16 committed_dw; +struct { +u8 map_id; +struct cfg80211_chan_def chans[CFG80211_NAN_SCHED_NUM_TIME_SLOTS ]; + } maps[CFG80211_NAN_MAX_PEER_MAPS ]; +}; + +struct hwsim_sta_priv { +u32 magic; +unsigned int last_link; +u16 active_links_rx; + +/* NAN peer schedule - must be accessed under nan_sched.lock */ +struct hwsim_sta_nan_sched nan_sched; +}; + +#define HWSIM_STA_MAGIC 0x6d537749 +struct mac80211_hwsim_link_data {u32 link_id;u64 beacon_int/* beacon interval in us */ ;
drivers/net/wireless/virtual/mac80211_hwsim_main.c +6 -8
@@ -252,14 +252,6 @@ static inline void hwsim_clear_magic(struct ieee80211_vif *vif) vp->magic =0 ; } -struct hwsim_sta_priv { -u32 magic; -unsigned int last_link; -u16 active_links_rx; -}; - -#define HWSIM_STA_MAGIC 0x6d537749 -static inline void hwsim_check_sta_magic (struct ieee80211_sta *sta) {struct hwsim_sta_priv *sp = (void *)sta->drv_priv;
@@ -2652,6 +2644,9 @@ static void mac80211_hwsim_vif_info_changed(struct ieee80211_hw *hw, vp->aid = vif->cfg.aid; } +if (changed &BSS_CHANGED_NAN_LOCAL_SCHED ) +mac80211_hwsim_nan_local_sched_changed (hw, vif); +if (vif->type ==NL80211_IFTYPE_STATION && changed & (BSS_CHANGED_MLD_VALID_LINKS |BSS_CHANGED_MLD_TTLM )) {u16 usable_links =ieee80211_vif_usable_links (vif);
@@ -2818,6 +2813,8 @@ static int mac80211_hwsim_sta_add(struct ieee80211_hw *hw, sp->active_links_rx = sta->valid_links; } +spin_lock_init (&sp->nan_sched.lock); +return 0 ; }
@@ -4245,6 +4242,7 @@ static int mac80211_hwsim_set_radar_background(struct ieee80211_hw *hw, .start_nan = mac80211_hwsim_nan_start, \ .stop_nan = mac80211_hwsim_nan_stop, \ .nan_change_conf = mac80211_hwsim_nan_change_config, \ + .nan_peer_sched_changed = mac80211_hwsim_nan_peer_sched_changed, \ HWSIM_DEBUGFS_OPS#define HWSIM_NON_MLO_OPS \
drivers/net/wireless/virtual/mac80211_hwsim_nan.c +80 -0
83 lines not on this page · raw message
drivers/net/wireless/virtual/mac80211_hwsim_nan.h +14 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * mac80211_hwsim_nan - NAN software simulation for mac80211_hwsim -* Copyright (C) 2025 Intel Corporation +* Copyright (C) 2025-2026 Intel Corporation */ #ifndef __MAC80211_HWSIM_NAN_H
@@ -52,6 +52,13 @@ struct mac80211_hwsim_nan_data {bool tsf_adjusted;bool tsf_discontinuity; + +/* +* Local schedule - stores channel definition for each 16TU slot. +* Derived from NMI vif->cfg.nan_schedule. chan == NULL means not +* available in that slot (except DW which is implicit). +*/ +struct cfg80211_chan_def local_sched[CFG80211_NAN_SCHED_NUM_TIME_SLOTS ]; };enum hrtimer_restart
@@ -73,6 +80,9 @@ int mac80211_hwsim_nan_change_config(struct ieee80211_hw *hw,struct cfg80211_nan_conf *conf, u32 changes); +int mac80211_hwsim_nan_peer_sched_changed (struct ieee80211_hw *hw, +struct ieee80211_sta *sta); +bool mac80211_hwsim_nan_txq_transmitting (struct ieee80211_hw *hw,struct ieee80211_txq *txq);
@@ -86,4 +96,7 @@ bool mac80211_hwsim_nan_receive(struct ieee80211_hw *hw,void mac80211_hwsim_nan_rx (struct ieee80211_hw *hw,struct sk_buff *skb); +void mac80211_hwsim_nan_local_sched_changed (struct ieee80211_hw *hw, +struct ieee80211_vif *vif); +#endif /* __MAC80211_HWSIM_NAN_H */
Signature · 1 line
2.34.1
PATCH v2 9/14 wifi: mac80211_hwsim: set HAS_RATE_CONTROL when using NAN
In reply to Miri KorenblitFrom: Daniel Gabay <[email protected]>
- NAN switches between bands/channels per its schedule, so mac80211 rate control can't work, set HAS_RATE_CONTROL instead.
- Skip rate control checks for NAN interfaces in mac80211_hwsim_sta_rc_update() as it's not relevant.
- Move set_rts_threshold stub to HWSIM_COMMON_OPS and return 0 instead of -EOPNOTSUPP to prevent failures in non-MLO tests that set RTS threshold (hwsim ignores the use_rts instruction from mac80211 anyway).
--- .../net/wireless/virtual/mac80211_hwsim_main.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_main.c +13 -2
@@ -2747,6 +2747,10 @@ mac80211_hwsim_sta_rc_update(struct ieee80211_hw *hw,u32 bw =U32_MAX ;int link_id; +if (vif->type ==NL80211_IFTYPE_NAN || + vif->type ==NL80211_IFTYPE_NAN_DATA ) +return ; +rcu_read_lock (); for (link_id = 0; link_id < ARRAY_SIZE(vif->link_conf);
@@ -3475,7 +3479,8 @@ static int mac80211_hwsim_tx_last_beacon(struct ieee80211_hw *hw)static int mac80211_hwsim_set_rts_threshold (struct ieee80211_hw *hw,int radio_idx,u32 value) { -return -EOPNOTSUPP ; +/* hwsim ignores the use_rts instruction from mac80211 anyway */ +return 0 ; } static int mac80211_hwsim_change_vif_links(struct ieee80211_hw *hw,
@@ -4239,6 +4244,7 @@ static int mac80211_hwsim_set_radar_background(struct ieee80211_hw *hw, .abort_pmsr = mac80211_hwsim_abort_pmsr, \ .set_radar_background = mac80211_hwsim_set_radar_background, \ .set_key = mac80211_hwsim_set_key, \ + .set_rts_threshold = mac80211_hwsim_set_rts_threshold, \ .start_nan = mac80211_hwsim_nan_start, \ .stop_nan = mac80211_hwsim_nan_stop, \ .nan_change_conf = mac80211_hwsim_nan_change_config, \
@@ -4284,7 +4290,6 @@ static const struct ieee80211_ops mac80211_hwsim_mchan_ops = {static const struct ieee80211_ops mac80211_hwsim_mlo_ops = { HWSIM_COMMON_OPSHWSIM_CHANCTX_OPS - .set_rts_threshold = mac80211_hwsim_set_rts_threshold, .change_vif_links = mac80211_hwsim_change_vif_links, .change_sta_links = mac80211_hwsim_change_sta_links, .sta_state = mac80211_hwsim_sta_state,
@@ -5726,6 +5731,12 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, hw->wiphy->nan_capa.phy.ht = hwsim_nan_ht_cap; hw->wiphy->nan_capa.phy.vht = hwsim_nan_vht_cap; hw->wiphy->nan_capa.phy.he = hwsim_nan_he_cap; + +/* +* NAN switches between bands/channels per its schedule, +* so mac80211 rate control can't work here. +*/ +ieee80211_hw_set (hw,HAS_RATE_CONTROL ); } data->if_combination.radar_detect_widths =
Signature · 1 line
2.34.1
PATCH v2 10/14 wifi: mac80211_hwsim: add NAN data path TX/RX support
In reply to Miri KorenblitFrom: Daniel Gabay <[email protected]>
Implement TX and RX path handling for NAN Data Path (NDP) frames, enabling data communication between NAN peers during scheduled availability windows.
TX path:
- Select TX channel based on current time slot: use DW channel during Discovery Windows, or FAW channel from local schedule during Further Availability Windows.
- Verify peer availability before transmission by checking committed DW schedule or FAW of the peer schedule.
RX path:
- Extend NAN receive filtering to handle NAN_DATA interface frames.
- Accept incoming frames during FAW slots when channel matches local schedule.
--- .../wireless/virtual/mac80211_hwsim_main.c | 18 +- .../net/wireless/virtual/mac80211_hwsim_nan.c | 250 ++++++++++++++++-- .../net/wireless/virtual/mac80211_hwsim_nan.h | 4 +- 3 files changed, 243 insertions(+), 29 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_main.c +13 -5
@@ -1744,7 +1744,8 @@ static void mac80211_hwsim_tx_iter(void *_data, u8 *addr,struct tx_iter_data *data = _data;int i; -if (vif->type ==NL80211_IFTYPE_NAN ) { +if (vif->type ==NL80211_IFTYPE_NAN || + vif->type ==NL80211_IFTYPE_NAN_DATA ) { data->receive =mac80211_hwsim_nan_receive (data->hw, data->channel, data->rx_status);
@@ -2093,13 +2094,19 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw,/* re-assign hdr since skb data may have shifted after encryption */ hdr = (void *)skb->data; -if (vif && vif->type ==NL80211_IFTYPE_NAN && !data->tmp_chan) { - channel =mac80211_hwsim_nan_get_tx_channel (hw); +if (vif && !data->tmp_chan && + (vif->type ==NL80211_IFTYPE_NAN || + vif->type ==NL80211_IFTYPE_NAN_DATA )) { +struct cfg80211_chan_def chandef; -if (WARN_ON (!channel)) { +mac80211_hwsim_nan_get_tx_chandef (hw, &chandef); +if (WARN_ON (!chandef.chan)) { +/* No valid channel in current slot, drop frame */ ieee80211_free_txskb (hw, skb);return ; } + channel = chandef.chan; + confbw = chandef.width; }else if (!data->use_chanctx) { channel = data->channel; confbw = data->bw;
@@ -2249,7 +2256,8 @@ void ieee80211_hwsim_wake_tx_queue(struct ieee80211_hw *hw, };struct sk_buff *skb; -if (txq->vif->type ==NL80211_IFTYPE_NAN && +if ((txq->vif->type ==NL80211_IFTYPE_NAN || + txq->vif->type ==NL80211_IFTYPE_NAN_DATA ) && !mac80211_hwsim_nan_txq_transmitting (hw, txq))return ;
drivers/net/wireless/virtual/mac80211_hwsim_nan.c +228 -22
316 lines not on this page · raw message
drivers/net/wireless/virtual/mac80211_hwsim_nan.h +2 -2
@@ -86,8 +86,8 @@ int mac80211_hwsim_nan_peer_sched_changed(struct ieee80211_hw *hw,bool mac80211_hwsim_nan_txq_transmitting (struct ieee80211_hw *hw,struct ieee80211_txq *txq); -struct ieee80211_channel * -mac80211_hwsim_nan_get_tx_channel (struct ieee80211_hw *hw); +void mac80211_hwsim_nan_get_tx_chandef (struct ieee80211_hw *hw, +struct cfg80211_chan_def *chandef); bool mac80211_hwsim_nan_receive(struct ieee80211_hw *hw, struct ieee80211_channel *channel,
Signature · 1 line
2.34.1
PATCH v2 11/14 wifi: mac80211_hwsim: Declare support for secure NAN
In reply to Miri KorenblitFrom: Daniel Gabay <[email protected]>
Advertise NL80211_EXT_FEATURE_SECURE_NAN to indicate support for NAN Pairing, enabling peer authentication and secure data path establishment.
--- drivers/net/wireless/virtual/mac80211_hwsim_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/virtual/mac80211_hwsim_main.c +3 -0
@@ -5718,6 +5718,9 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,NAN_DEV_CAPA_EXT_KEY_ID_SUPPORTED |NAN_DEV_CAPA_NDPE_SUPPORTED ; +wiphy_ext_feature_set (hw->wiphy, +NL80211_EXT_FEATURE_SECURE_NAN ); +hrtimer_setup (&data->nan.slot_timer, mac80211_hwsim_nan_slot_timer,CLOCK_BOOTTIME ,HRTIMER_MODE_ABS_SOFT );
Signature · 1 line
2.34.1
PATCH v2 12/14 wifi: mac80211_hwsim: enable NAN_DATA interface simulation support
In reply to Miri KorenblitFrom: Daniel Gabay <[email protected]>
Enable NAN_DATA interface simulation support by adding it to the supported interface types. This completes the NAN Data Path simulation introduced in the previous patches.
--- drivers/net/wireless/virtual/mac80211_hwsim_main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_main.c +3 -6
@@ -6765,12 +6765,9 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info) param.p2p_device = true; } -/* ensure both flag and iftype support is honored */ -if (param.nan_device || - param.iftypes &BIT (NL80211_IFTYPE_NAN )) { - param.iftypes |=BIT (NL80211_IFTYPE_NAN ); - param.nan_device = true; - } +if (param.nan_device) + param.iftypes |=BIT (NL80211_IFTYPE_NAN ) | +BIT (NL80211_IFTYPE_NAN_DATA );if (info->attrs[HWSIM_ATTR_CIPHER_SUPPORT ]) {u32 len =nla_len (info->attrs[HWSIM_ATTR_CIPHER_SUPPORT ]);
Signature · 1 line
2.34.1
PATCH v2 13/14 wifi: mac80211_hwsim: Do not declare support for NDPE
In reply to Miri KorenblitFrom: Ilan Peer <[email protected]>
Do not declare support for NAN Data Path Extension attribute as this is handled by user space and should be set by it.
--- drivers/net/wireless/virtual/mac80211_hwsim_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_main.c +1 -2
@@ -5715,8 +5715,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, hw->wiphy->nan_capa.n_antennas =0x22 ; hw->wiphy->nan_capa.max_channel_switch_time =0 ; hw->wiphy->nan_capa.dev_capabilities = -NAN_DEV_CAPA_EXT_KEY_ID_SUPPORTED | -NAN_DEV_CAPA_NDPE_SUPPORTED ; +NAN_DEV_CAPA_EXT_KEY_ID_SUPPORTED ;wiphy_ext_feature_set (hw->wiphy,NL80211_EXT_FEATURE_SECURE_NAN );
Signature · 1 line
2.34.1
PATCH v2 14/14 wifi: mac80211_hwsim: Support Tx of multicast data on NAN
In reply to Miri KorenblitFrom: Ilan Peer <[email protected]>
Add support for transmitting multicast data frames. These frames can be transmitted when all the peer NDI stations on the interface are available at the current slot.
--- .../net/wireless/virtual/mac80211_hwsim_nan.c | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_nan.c +53 -3
@@ -41,6 +41,13 @@ struct hwsim_nan_sta_iter_ctx {bool can_tx; }; +struct hwsim_nan_mcast_data_iter_ctx { +struct ieee80211_hw *hw; +struct ieee80211_vif *vif; +size_t n_vif_sta; +size_t n_sta_can_tx; +}; +static void mac80211_hwsim_nan_resume_txqs (struct mac80211_hwsim_data *data);static u64 hwsim_nan_get_timer_tsf (struct mac80211_hwsim_data *data)
@@ -1103,6 +1110,42 @@ mac80211_hwsim_nan_resume_txqs_timer(struct hrtimer *timer)return HRTIMER_NORESTART ; } +static void +hwsim_nan_can_mcast_sta_transmit (void *_ctx,struct ieee80211_sta *sta) +{ +struct hwsim_nan_mcast_data_iter_ctx *ctx = _ctx; +struct ieee80211_txq *txq = sta->txq[0 ]; + +if (!txq || txq->vif != ctx->vif) +return ; + + ctx->n_vif_sta++; +if (mac80211_hwsim_nan_txq_transmitting (ctx->hw, txq)) + ctx->n_sta_can_tx++; +} + +static bool +mac80211_hwsim_nan_mcast_data_transmitting (struct ieee80211_hw *hw, +struct ieee80211_txq *txq) +{ +struct mac80211_hwsim_data *data = hw->priv; +struct hwsim_nan_mcast_data_iter_ctx ctx = { + .hw = hw, + .vif = txq->vif, + .n_sta_can_tx =0 , + .n_vif_sta =0 , + }; + +/* Check if all the stations associated with the current +* interface are available. +*/ +ieee80211_iterate_stations_atomic (data->hw, + hwsim_nan_can_mcast_sta_transmit, + &ctx); + +return ctx.n_vif_sta && ctx.n_sta_can_tx == ctx.n_vif_sta; +} +bool mac80211_hwsim_nan_txq_transmitting (struct ieee80211_hw *hw,struct ieee80211_txq *txq) {
@@ -1125,9 +1168,16 @@ bool mac80211_hwsim_nan_txq_transmitting(struct ieee80211_hw *hw, is_dw_slot =mac80211_hwsim_nan_is_dw_slot (data, slot); -/* Non-STA TXQ: allow management frames during DW */ -if (!txq->sta) -return is_dw_slot; +if (!txq->sta) { +/* Non-STA TXQ: allow management frames during DW */ +if (txq->vif->type ==NL80211_IFTYPE_NAN ) +return is_dw_slot; + +/* Allow multicast data when all the peers are available +* on this slot +*/ +return mac80211_hwsim_nan_mcast_data_transmitting (hw, txq); + }/* STA TXQ: need peer schedule for availability check */ nmi_sta =rcu_dereference (txq->sta->nmi) ?: txq->sta;
Signature · 1 line
2.34.1