From: Aloka Dixit Date: Tue, 6 Dec 2022 00:50:38 +0000 (-0800) Subject: wifi: mac80211_hwsim: move beacon transmission to a separate function X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b3a912e3e220257a25219cd81b9aa8a639cb1e18;p=linux.git wifi: mac80211_hwsim: move beacon transmission to a separate function Move the beacon transmission to a separate function to facilitate addition of EMA beacon transmission. Signed-off-by: Aloka Dixit Link: https://lore.kernel.org/r/20221206005040.3177-3-quic_alokad@quicinc.com Signed-off-by: Johannes Berg --- diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c index f4bdc243ea0d1..0b4f489c80368 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim.c @@ -2055,38 +2055,18 @@ static void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, dev_kfree_skb(skb); } -static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, - struct ieee80211_vif *vif) +static void __mac80211_hwsim_beacon_tx(struct ieee80211_bss_conf *link_conf, + struct mac80211_hwsim_data *data, + struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct sk_buff *skb) { - struct mac80211_hwsim_link_data *link_data = arg; - u32 link_id = link_data->link_id; - struct ieee80211_bss_conf *link_conf; - struct mac80211_hwsim_data *data = - container_of(link_data, struct mac80211_hwsim_data, - link_data[link_id]); - struct ieee80211_hw *hw = data->hw; struct ieee80211_tx_info *info; struct ieee80211_rate *txrate; struct ieee80211_mgmt *mgmt; - struct sk_buff *skb; /* TODO: get MCS */ int bitrate = 100; - hwsim_check_magic(vif); - - link_conf = rcu_dereference(vif->link_conf[link_id]); - if (!link_conf) - return; - - if (vif->type != NL80211_IFTYPE_AP && - vif->type != NL80211_IFTYPE_MESH_POINT && - vif->type != NL80211_IFTYPE_ADHOC && - vif->type != NL80211_IFTYPE_OCB) - return; - - skb = ieee80211_beacon_get(hw, vif, link_data->link_id); - if (skb == NULL) - return; info = IEEE80211_SKB_CB(skb); if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE)) ieee80211_get_tx_rates(vif, NULL, skb, @@ -2116,6 +2096,37 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, mac80211_hwsim_tx_frame(hw, skb, rcu_dereference(link_conf->chanctx_conf)->def.chan); +} + +static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, + struct ieee80211_vif *vif) +{ + struct mac80211_hwsim_link_data *link_data = arg; + u32 link_id = link_data->link_id; + struct ieee80211_bss_conf *link_conf; + struct mac80211_hwsim_data *data = + container_of(link_data, struct mac80211_hwsim_data, + link_data[link_id]); + struct ieee80211_hw *hw = data->hw; + struct sk_buff *skb; + + hwsim_check_magic(vif); + + link_conf = rcu_dereference(vif->link_conf[link_id]); + if (!link_conf) + return; + + if (vif->type != NL80211_IFTYPE_AP && + vif->type != NL80211_IFTYPE_MESH_POINT && + vif->type != NL80211_IFTYPE_ADHOC && + vif->type != NL80211_IFTYPE_OCB) + return; + + skb = ieee80211_beacon_get(hw, vif, link_id); + if (!skb) + return; + + __mac80211_hwsim_beacon_tx(link_conf, data, hw, vif, skb); while ((skb = ieee80211_get_buffered_bc(hw, vif)) != NULL) { mac80211_hwsim_tx_frame(hw, skb,