bede4819ca4072a236f7a5d80532f70938b86710
[openwrt/staging/hauke.git] / package / kernel / mac80211 / patches / ath11k / 0071-wifi-ath11k-driver-settings-for-MBSSID-and-EMA.patch
1 From a08dbb04d7365a04d52882143cf196005bfc88c3 Mon Sep 17 00:00:00 2001
2 From: Aloka Dixit <quic_alokad@quicinc.com>
3 Date: Fri, 5 May 2023 16:11:27 +0300
4 Subject: [PATCH 71/77] wifi: ath11k: driver settings for MBSSID and EMA
5
6 Advertise the driver support for multiple BSSID (MBSSID) and
7 enhanced multi-BSSID advertisements (EMA) by setting extended
8 capabilities.
9
10 Configure mbssid_max_interfaces and ema_max_profile_periodicity
11 fields in structure wiphy which are used to advertise maximum number
12 of interfaces and profile periodicity supported by the driver.
13
14 Add new WMI fields to configure maximum vdev count supported for
15 MBSSID and profile periodicity in case of EMA.
16 Setting WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET flag
17 indicates that the firmware should track and update the DTIM counts
18 for each non-transmitted profile.
19
20 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
21
22 Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
23 Co-developed-by: John Crispin <john@phrozen.org>
24 Signed-off-by: John Crispin <john@phrozen.org>
25 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
26 Link: https://lore.kernel.org/r/20230405221648.17950-2-quic_alokad@quicinc.com
27 ---
28 drivers/net/wireless/ath/ath11k/hw.c | 3 +++
29 drivers/net/wireless/ath/ath11k/hw.h | 1 +
30 drivers/net/wireless/ath/ath11k/mac.c | 7 +++++++
31 drivers/net/wireless/ath/ath11k/wmi.c | 3 +++
32 drivers/net/wireless/ath/ath11k/wmi.h | 6 ++++++
33 5 files changed, 20 insertions(+)
34
35 --- a/drivers/net/wireless/ath/ath11k/hw.c
36 +++ b/drivers/net/wireless/ath/ath11k/hw.c
37 @@ -202,6 +202,9 @@ static void ath11k_init_wmi_config_ipq80
38 config->twt_ap_sta_count = 1000;
39 config->flag1 |= WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64;
40 config->flag1 |= WMI_RSRC_CFG_FLAG1_ACK_RSSI;
41 + config->ema_max_vap_cnt = ab->num_radios;
42 + config->ema_max_profile_period = TARGET_EMA_MAX_PROFILE_PERIOD;
43 + config->beacon_tx_offload_max_vdev += config->ema_max_vap_cnt;
44 }
45
46 static int ath11k_hw_mac_id_to_pdev_id_ipq8074(struct ath11k_hw_params *hw,
47 --- a/drivers/net/wireless/ath/ath11k/hw.h
48 +++ b/drivers/net/wireless/ath/ath11k/hw.h
49 @@ -64,6 +64,7 @@
50 #define TARGET_NUM_WDS_ENTRIES 32
51 #define TARGET_DMA_BURST_SIZE 1
52 #define TARGET_RX_BATCHMODE 1
53 +#define TARGET_EMA_MAX_PROFILE_PERIOD 8
54
55 #define ATH11K_HW_MAX_QUEUES 4
56 #define ATH11K_QUEUE_LEN 4096
57 --- a/drivers/net/wireless/ath/ath11k/mac.c
58 +++ b/drivers/net/wireless/ath/ath11k/mac.c
59 @@ -9001,19 +9001,23 @@ static int ath11k_mac_setup_iface_combin
60
61 static const u8 ath11k_if_types_ext_capa[] = {
62 [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
63 + [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
64 [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
65 };
66
67 static const u8 ath11k_if_types_ext_capa_sta[] = {
68 [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
69 + [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
70 [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
71 [9] = WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT,
72 };
73
74 static const u8 ath11k_if_types_ext_capa_ap[] = {
75 [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
76 + [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
77 [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
78 [9] = WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT,
79 + [10] = WLAN_EXT_CAPA11_EMA_SUPPORT,
80 };
81
82 static const struct wiphy_iftype_ext_capab ath11k_iftypes_ext_capa[] = {
83 @@ -9251,6 +9255,9 @@ static int __ath11k_mac_register(struct
84 wiphy_ext_feature_set(ar->hw->wiphy,
85 NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
86
87 + ar->hw->wiphy->mbssid_max_interfaces = TARGET_NUM_VDEVS(ab);
88 + ar->hw->wiphy->ema_max_profile_periodicity = TARGET_EMA_MAX_PROFILE_PERIOD;
89 +
90 ath11k_reg_init(ar);
91
92 if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) {
93 --- a/drivers/net/wireless/ath/ath11k/wmi.c
94 +++ b/drivers/net/wireless/ath/ath11k/wmi.c
95 @@ -3987,6 +3987,9 @@ ath11k_wmi_copy_resource_config(struct w
96 ~(1 << WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT);
97 wmi_cfg->host_service_flags |= (tg_cfg->is_reg_cc_ext_event_supported <<
98 WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT);
99 + wmi_cfg->flags2 = WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET;
100 + wmi_cfg->ema_max_vap_cnt = tg_cfg->ema_max_vap_cnt;
101 + wmi_cfg->ema_max_profile_period = tg_cfg->ema_max_profile_period;
102 }
103
104 static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi,
105 --- a/drivers/net/wireless/ath/ath11k/wmi.h
106 +++ b/drivers/net/wireless/ath/ath11k/wmi.h
107 @@ -2317,6 +2317,7 @@ struct wmi_init_cmd {
108 } __packed;
109
110 #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5)
111 +#define WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET BIT(9)
112 #define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18)
113
114 #define WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT 4
115 @@ -2389,6 +2390,9 @@ struct wmi_resource_config {
116 u32 msdu_flow_override_config1;
117 u32 flags2;
118 u32 host_service_flags;
119 + u32 max_rnr_neighbours;
120 + u32 ema_max_vap_cnt;
121 + u32 ema_max_profile_period;
122 } __packed;
123
124 struct wmi_service_ready_event {
125 @@ -5646,6 +5650,8 @@ struct target_resource_config {
126 u32 twt_ap_pdev_count;
127 u32 twt_ap_sta_count;
128 u8 is_reg_cc_ext_event_supported;
129 + u32 ema_max_vap_cnt;
130 + u32 ema_max_profile_period;
131 };
132
133 enum wmi_debug_log_param {