8509e55978d75dc12b2d9508feab510a20cf34ed
[openwrt/staging/wigyori.git] / package / kernel / mac80211 / patches / ath11k / 0075-wifi-ath11k-refactor-vif-parameter-configurations.patch
1 From cb9bea773c85e372931cd7a177db4165adf29d95 Mon Sep 17 00:00:00 2001
2 From: Aloka Dixit <quic_alokad@quicinc.com>
3 Date: Fri, 5 May 2023 16:11:28 +0300
4 Subject: [PATCH 75/77] wifi: ath11k: refactor vif parameter configurations
5
6 Security parameters for each non-transmitting profile can be
7 different when MBSSID is enabled and this information is included
8 in the MBSSID element in the Beacon frame. Current implementation
9 to set rsnie_present and wpaie_present does not parse this element
10 hence it applies only to the transmitting interface.
11
12 Move the code to a separate function to make additions for
13 non-transmitting interfaces cleaner.
14
15 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
16
17 Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
18 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
19 Link: https://lore.kernel.org/r/20230405221648.17950-6-quic_alokad@quicinc.com
20 ---
21 drivers/net/wireless/ath/ath11k/mac.c | 41 ++++++++++++++++-----------
22 1 file changed, 24 insertions(+), 17 deletions(-)
23
24 --- a/drivers/net/wireless/ath/ath11k/mac.c
25 +++ b/drivers/net/wireless/ath/ath11k/mac.c
26 @@ -1351,28 +1351,14 @@ err_mon_del:
27 return ret;
28 }
29
30 -static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif)
31 +static void ath11k_mac_set_vif_params(struct ath11k_vif *arvif,
32 + struct sk_buff *bcn)
33 {
34 - struct ath11k *ar = arvif->ar;
35 - struct ath11k_base *ab = ar->ab;
36 - struct ieee80211_hw *hw = ar->hw;
37 - struct ieee80211_vif *vif = arvif->vif;
38 - struct ieee80211_mutable_offsets offs = {};
39 - struct sk_buff *bcn;
40 struct ieee80211_mgmt *mgmt;
41 u8 *ies;
42 - int ret;
43 -
44 - if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
45 - return 0;
46 -
47 - bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0);
48 - if (!bcn) {
49 - ath11k_warn(ab, "failed to get beacon template from mac80211\n");
50 - return -EPERM;
51 - }
52
53 ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn);
54 + mgmt = (struct ieee80211_mgmt *)bcn->data;
55 ies += sizeof(mgmt->u.beacon);
56
57 if (cfg80211_find_ie(WLAN_EID_RSN, ies, (skb_tail_pointer(bcn) - ies)))
58 @@ -1386,7 +1372,28 @@ static int ath11k_mac_setup_bcn_tmpl(str
59 arvif->wpaie_present = true;
60 else
61 arvif->wpaie_present = false;
62 +}
63 +
64 +static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif)
65 +{
66 + struct ath11k *ar = arvif->ar;
67 + struct ath11k_base *ab = ar->ab;
68 + struct ieee80211_hw *hw = ar->hw;
69 + struct ieee80211_vif *vif = arvif->vif;
70 + struct ieee80211_mutable_offsets offs = {};
71 + struct sk_buff *bcn;
72 + int ret;
73 +
74 + if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
75 + return 0;
76 +
77 + bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0);
78 + if (!bcn) {
79 + ath11k_warn(ab, "failed to get beacon template from mac80211\n");
80 + return -EPERM;
81 + }
82
83 + ath11k_mac_set_vif_params(arvif, bcn);
84 ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn);
85
86 kfree_skb(bcn);