Commit b3a912e3 authored by Aloka Dixit's avatar Aloka Dixit Committed by Johannes Berg
Browse files

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: default avatarAloka Dixit <quic_alokad@quicinc.com>
Link: https://lore.kernel.org/r/20221206005040.3177-3-quic_alokad@quicinc.com


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent bd54f3c2
Loading
Loading
Loading
Loading
+36 −25
Original line number Diff line number Diff line
@@ -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,