1 From 5a81610acf66c4ad6e1a1fbd09f3f555fca863b1 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 72/77] wifi: ath11k: MBSSID configuration during vdev
7 Configure multiple BSSID flags and index of the transmitting interface
8 in vdev create/start commands depending on the service bit
9 WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT.
11 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
13 Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
14 Co-developed-by: John Crispin <john@phrozen.org>
15 Signed-off-by: John Crispin <john@phrozen.org>
16 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
17 Link: https://lore.kernel.org/r/20230405221648.17950-3-quic_alokad@quicinc.com
19 drivers/net/wireless/ath/ath11k/mac.c | 70 +++++++++++++++++++++++++--
20 drivers/net/wireless/ath/ath11k/wmi.c | 5 ++
21 drivers/net/wireless/ath/ath11k/wmi.h | 19 ++++++++
22 3 files changed, 90 insertions(+), 4 deletions(-)
24 --- a/drivers/net/wireless/ath/ath11k/mac.c
25 +++ b/drivers/net/wireless/ath/ath11k/mac.c
26 @@ -6181,17 +6181,62 @@ static void ath11k_mac_op_stop(struct ie
27 atomic_set(&ar->num_pending_mgmt_tx, 0);
31 -ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif,
32 - struct vdev_create_params *params)
33 +static int ath11k_mac_setup_vdev_params_mbssid(struct ath11k_vif *arvif,
34 + u32 *flags, u32 *tx_vdev_id)
36 + struct ath11k *ar = arvif->ar;
37 + struct ath11k_vif *tx_arvif;
38 + struct ieee80211_vif *tx_vif;
41 + tx_vif = arvif->vif->mbssid_tx_vif;
43 + *flags = WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP;
47 + tx_arvif = (void *)tx_vif->drv_priv;
49 + if (arvif->vif->bss_conf.nontransmitted) {
50 + if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy)
53 + *flags = WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP;
54 + *tx_vdev_id = ath11k_vif_to_arvif(tx_vif)->vdev_id;
55 + } else if (tx_arvif == arvif) {
56 + *flags = WMI_HOST_VDEV_FLAGS_TRANSMIT_AP;
61 + if (arvif->vif->bss_conf.ema_ap)
62 + *flags |= WMI_HOST_VDEV_FLAGS_EMA_MODE;
67 +static int ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif,
68 + struct vdev_create_params *params)
70 struct ath11k *ar = arvif->ar;
71 struct ath11k_pdev *pdev = ar->pdev;
74 params->if_id = arvif->vdev_id;
75 params->type = arvif->vdev_type;
76 params->subtype = arvif->vdev_subtype;
77 params->pdev_id = pdev->pdev_id;
78 + params->mbssid_flags = 0;
79 + params->mbssid_tx_vdev_id = 0;
81 + if (!test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT,
82 + ar->ab->wmi_ab.svc_map)) {
83 + ret = ath11k_mac_setup_vdev_params_mbssid(arvif,
84 + ¶ms->mbssid_flags,
85 + ¶ms->mbssid_tx_vdev_id);
90 if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) {
91 params->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains;
92 @@ -6206,6 +6251,7 @@ ath11k_mac_setup_vdev_create_params(stru
93 params->chains[NL80211_BAND_6GHZ].tx = ar->num_tx_chains;
94 params->chains[NL80211_BAND_6GHZ].rx = ar->num_rx_chains;
99 static void ath11k_mac_op_update_vif_offload(struct ieee80211_hw *hw,
100 @@ -6500,7 +6546,12 @@ static int ath11k_mac_op_add_interface(s
101 for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++)
102 vif->hw_queue[i] = i % (ATH11K_HW_MAX_QUEUES - 1);
104 - ath11k_mac_setup_vdev_create_params(arvif, &vdev_param);
105 + ret = ath11k_mac_setup_vdev_create_params(arvif, &vdev_param);
107 + ath11k_warn(ab, "failed to create vdev parameters %d: %d\n",
108 + arvif->vdev_id, ret);
112 ret = ath11k_wmi_vdev_create(ar, vif->addr, &vdev_param);
114 @@ -6905,6 +6956,17 @@ ath11k_mac_vdev_start_restart(struct ath
115 arg.pref_tx_streams = ar->num_tx_chains;
116 arg.pref_rx_streams = ar->num_rx_chains;
118 + arg.mbssid_flags = 0;
119 + arg.mbssid_tx_vdev_id = 0;
120 + if (test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT,
121 + ar->ab->wmi_ab.svc_map)) {
122 + ret = ath11k_mac_setup_vdev_params_mbssid(arvif,
124 + &arg.mbssid_tx_vdev_id);
129 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
130 arg.ssid = arvif->u.ap.ssid;
131 arg.ssid_len = arvif->u.ap.ssid_len;
132 --- a/drivers/net/wireless/ath/ath11k/wmi.c
133 +++ b/drivers/net/wireless/ath/ath11k/wmi.c
134 @@ -724,6 +724,9 @@ int ath11k_wmi_vdev_create(struct ath11k
135 cmd->vdev_subtype = param->subtype;
136 cmd->num_cfg_txrx_streams = WMI_NUM_SUPPORTED_BAND_MAX;
137 cmd->pdev_id = param->pdev_id;
138 + cmd->mbssid_flags = param->mbssid_flags;
139 + cmd->mbssid_tx_vdev_id = param->mbssid_tx_vdev_id;
141 ether_addr_copy(cmd->vdev_macaddr.addr, macaddr);
143 ptr = skb->data + sizeof(*cmd);
144 @@ -941,6 +944,8 @@ int ath11k_wmi_vdev_start(struct ath11k
145 cmd->cac_duration_ms = arg->cac_duration_ms;
146 cmd->regdomain = arg->regdomain;
147 cmd->he_ops = arg->he_ops;
148 + cmd->mbssid_flags = arg->mbssid_flags;
149 + cmd->mbssid_tx_vdev_id = arg->mbssid_tx_vdev_id;
153 --- a/drivers/net/wireless/ath/ath11k/wmi.h
154 +++ b/drivers/net/wireless/ath/ath11k/wmi.h
155 @@ -137,6 +137,14 @@ enum {
156 WMI_AUTORATE_3200NS_GI = BIT(11),
160 + WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP = 0x00000001,
161 + WMI_HOST_VDEV_FLAGS_TRANSMIT_AP = 0x00000002,
162 + WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP = 0x00000004,
163 + WMI_HOST_VDEV_FLAGS_EMA_MODE = 0x00000008,
164 + WMI_HOST_VDEV_FLAGS_SCAN_MODE_VAP = 0x00000010,
168 * wmi command groups.
170 @@ -2096,6 +2104,7 @@ enum wmi_tlv_service {
171 WMI_TLV_SERVICE_EXT2_MSG = 220,
172 WMI_TLV_SERVICE_PEER_POWER_SAVE_DURATION_SUPPORT = 246,
173 WMI_TLV_SERVICE_SRG_SRP_SPATIAL_REUSE_SUPPORT = 249,
174 + WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT = 253,
175 WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE = 263,
177 /* The second 128 bits */
178 @@ -2583,6 +2592,8 @@ struct vdev_create_params {
180 } chains[NUM_NL80211_BANDS];
183 + u32 mbssid_tx_vdev_id;
186 struct wmi_vdev_create_cmd {
187 @@ -2593,6 +2604,8 @@ struct wmi_vdev_create_cmd {
188 struct wmi_mac_addr vdev_macaddr;
189 u32 num_cfg_txrx_streams;
192 + u32 mbssid_tx_vdev_id;
195 struct wmi_vdev_txrx_streams {
196 @@ -2656,6 +2669,9 @@ struct wmi_vdev_start_request_cmd {
202 + u32 mbssid_tx_vdev_id;
205 #define MGMT_TX_DL_FRM_LEN 64
206 @@ -2825,6 +2841,9 @@ struct wmi_vdev_start_req_arg {
209 u32 num_noa_descriptors;
212 + u32 mbssid_tx_vdev_id;
215 struct peer_create_params {