From ae1949717e4f11f16ad6450a3ef91829567283cb Mon Sep 17 00:00:00 2001 From: Aloka Dixit Date: Fri, 21 Jan 2022 12:11:09 -0800 Subject: [PATCH 08/14] ath11k: move vif parameter setting in a different function Move the configuration of struct ath11k_vif parameters rsnie_present, wpaie_present and vht_cap to a separate function. Signed-off-by: Aloka Dixit --- drivers/net/wireless/ath/ath11k/mac.c | 44 ++++++++++++++++----------- 1 file changed, 27 insertions(+), 17 deletions(-) --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -1521,32 +1521,16 @@ err_mon_del: mutex_unlock(&ar->conf_mutex); return ret; } - -static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) +static void ath11k_mac_setup_bcn_tmpl_vif_params(struct ath11k_vif *arvif, + struct sk_buff *bcn) { - struct ath11k *ar = arvif->ar; - struct ath11k_base *ab = ar->ab; - struct ieee80211_hw *hw = ar->hw; - struct ieee80211_vif *vif = arvif->vif; - struct ieee80211_mutable_offsets offs = {}; - struct sk_buff *bcn; struct ieee80211_mgmt *mgmt; struct ieee80211_vht_cap *vht_cap; u8 *ies; - int ret; const u8 *vht_cap_ie; - u64 adjusted_tsf; - - if (arvif->vdev_type != WMI_VDEV_TYPE_AP) - return 0; - - bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0); - if (!bcn) { - ath11k_warn(ab, "failed to get beacon template from mac80211\n"); - return -EPERM; - } ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); + mgmt = (struct ieee80211_mgmt *)bcn->data; ies += sizeof(mgmt->u.beacon); if (cfg80211_find_ie(WLAN_EID_RSN, ies, (skb_tail_pointer(bcn) - ies))) @@ -1572,10 +1556,32 @@ static int ath11k_mac_setup_bcn_tmpl(str * staggered batch have the same TSF. */ if (arvif->tbtt_offset) { - adjusted_tsf = cpu_to_le64(0ULL - arvif->tbtt_offset); - mgmt = (void *)bcn->data; + u64 adjusted_tsf = cpu_to_le64(0ULL - arvif->tbtt_offset); memcpy(&mgmt->u.beacon.timestamp, &adjusted_tsf, sizeof(adjusted_tsf)); } + +} + +static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) +{ + struct ath11k *ar = arvif->ar; + struct ath11k_base *ab = ar->ab; + struct ieee80211_hw *hw = ar->hw; + struct ieee80211_vif *vif = arvif->vif; + struct ieee80211_mutable_offsets offs = {}; + struct sk_buff *bcn; + int ret; + + if (arvif->vdev_type != WMI_VDEV_TYPE_AP) + return 0; + + bcn = ieee80211_beacon_get_template(hw, vif, &offs); + if (!bcn) { + ath11k_warn(ab, "failed to get beacon template from mac80211\n"); + return -EPERM; + } + + ath11k_mac_setup_bcn_tmpl_vif_params(arvif, bcn); ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); kfree_skb(bcn);