mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
wifi: mac80211_hwsim: Support NAN deferred schedule completion
Simulate firmware completing a deferred NAN schedule update in mac80211_hwsim by calling ieee80211_nan_sched_update_done() from a delayed work, so that the completion notification reaches user space after the update request returns, as it would with real hardware. This doesn't really implement the schedule update flow and doesn't announce anything to the peers. However, it should be good enough meanwhile for some minimal testing. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20260922144356.81f62b390ef6.I21654fe82a0065a055a1b958297b2beb4337a1f0@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
dc16bea6fe
commit
b4f12aa316
|
|
@ -906,6 +906,18 @@ mac80211_hwsim_nan_discovery_beacon_timer(struct hrtimer *timer)
|
|||
return HRTIMER_RESTART;
|
||||
}
|
||||
|
||||
static void
|
||||
mac80211_hwsim_nan_sched_update_work(struct wiphy *wiphy,
|
||||
struct wiphy_work *work)
|
||||
{
|
||||
struct mac80211_hwsim_data *data =
|
||||
container_of(work, struct mac80211_hwsim_data,
|
||||
nan.sched_update_work.work);
|
||||
|
||||
if (data->nan.device_vif)
|
||||
ieee80211_nan_sched_update_done(data->nan.device_vif);
|
||||
}
|
||||
|
||||
int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct cfg80211_nan_conf *conf)
|
||||
|
|
@ -922,6 +934,9 @@ int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,
|
|||
data->nan.device_vif = vif;
|
||||
data->nan.bands = conf->bands;
|
||||
|
||||
wiphy_delayed_work_init(&data->nan.sched_update_work,
|
||||
mac80211_hwsim_nan_sched_update_work);
|
||||
|
||||
scoped_guard(spinlock_bh, &data->nan.state_lock) {
|
||||
/* Start in the "scan" phase and stay there for a little bit */
|
||||
data->nan.phase = MAC80211_HWSIM_NAN_PHASE_SCAN;
|
||||
|
|
@ -960,6 +975,7 @@ int mac80211_hwsim_nan_stop(struct ieee80211_hw *hw,
|
|||
hrtimer_cancel(&data->nan.slot_timer);
|
||||
hrtimer_cancel(&data->nan.resume_txqs_timer);
|
||||
hrtimer_cancel(&data->nan.discovery_beacon_timer);
|
||||
wiphy_delayed_work_cancel(hw->wiphy, &data->nan.sched_update_work);
|
||||
data->nan.device_vif = NULL;
|
||||
|
||||
return 0;
|
||||
|
|
@ -1296,6 +1312,12 @@ void mac80211_hwsim_nan_local_sched_changed(struct ieee80211_hw *hw,
|
|||
}
|
||||
|
||||
spin_unlock_bh(&data->nan.state_lock);
|
||||
|
||||
/* Simulate firmware completing a deferred schedule update */
|
||||
if (vif->cfg.nan_sched.deferred)
|
||||
wiphy_delayed_work_queue(hw->wiphy,
|
||||
&data->nan.sched_update_work,
|
||||
msecs_to_jiffies(10));
|
||||
}
|
||||
|
||||
int mac80211_hwsim_nan_peer_sched_changed(struct ieee80211_hw *hw,
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@ struct mac80211_hwsim_nan_data {
|
|||
* available in that slot (except DW which is implicit).
|
||||
*/
|
||||
struct cfg80211_chan_def local_sched[CFG80211_NAN_SCHED_NUM_TIME_SLOTS];
|
||||
|
||||
/* Simulates the firmware completing a deferred schedule update */
|
||||
struct wiphy_delayed_work sched_update_work;
|
||||
};
|
||||
|
||||
enum hrtimer_restart
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user