mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
wifi: mac80211_hwsim: select NAN TX channel based on current TSF
Move the TX channel selection into the NAN specific file and select the channel based on the current slot. Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20260506064301.c235b5a78b98.I5ec4076a8a9445233dc414c6ecaa39f32f1e9595@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
f9aeb3a234
commit
61de252f99
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user