1 /*
2 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
3 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18 /*
19 * DOC: wlan_cm_tgt_if_tx_api.c
20 *
21 * Implementation for the Common Roaming interfaces.
22 */
23
24 #include "wlan_objmgr_psoc_obj.h"
25 #include "wlan_psoc_mlme_api.h"
26 #include "wlan_policy_mgr_api.h"
27 #include "wlan_mlme_ucfg_api.h"
28 #include "wlan_reg_services_api.h"
29 #include "wlan_cm_tgt_if_tx_api.h"
30 #include "wlan_mlme_public_struct.h"
31 #include "wma.h"
32
33 static inline
wlan_cm_roam_get_tx_ops_from_vdev(struct wlan_objmgr_vdev * vdev)34 struct wlan_cm_roam_tx_ops *wlan_cm_roam_get_tx_ops_from_vdev(
35 struct wlan_objmgr_vdev *vdev)
36 {
37 struct wlan_mlme_psoc_ext_obj *psoc_ext_priv;
38 struct wlan_cm_roam_tx_ops *tx_ops;
39 struct wlan_objmgr_psoc *psoc;
40
41 psoc = wlan_vdev_get_psoc(vdev);
42 if (!psoc) {
43 mlme_legacy_err("psoc object is NULL");
44 return NULL;
45 }
46 psoc_ext_priv = wlan_psoc_mlme_get_ext_hdl(psoc);
47 if (!psoc_ext_priv) {
48 mlme_legacy_err("psoc legacy private object is NULL");
49 return NULL;
50 }
51
52 tx_ops = &psoc_ext_priv->rso_tx_ops;
53
54 return tx_ops;
55 }
56
57 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
58 QDF_STATUS
wlan_cm_roam_send_set_vdev_pcl(struct wlan_objmgr_psoc * psoc,struct set_pcl_req * pcl_req)59 wlan_cm_roam_send_set_vdev_pcl(struct wlan_objmgr_psoc *psoc,
60 struct set_pcl_req *pcl_req)
61 {
62 struct wlan_cm_roam_tx_ops *roam_tx_ops;
63 struct fw_scan_channels *freq_list;
64 struct wlan_objmgr_vdev *vdev;
65 struct wmi_pcl_chan_weights *weights;
66 struct wlan_objmgr_pdev *pdev;
67 QDF_STATUS status = QDF_STATUS_E_FAILURE;
68 uint32_t band_capability;
69 uint16_t i;
70 bool is_channel_allowed;
71
72 /*
73 * If vdev_id is WLAN_UMAC_VDEV_ID_MAX, then PDEV pcl command
74 * needs to be sent
75 */
76 if (!pcl_req || pcl_req->vdev_id == WLAN_UMAC_VDEV_ID_MAX)
77 return QDF_STATUS_E_FAILURE;
78
79 status = ucfg_mlme_get_band_capability(psoc, &band_capability);
80 if (QDF_IS_STATUS_ERROR(status))
81 return QDF_STATUS_E_FAILURE;
82
83 mlme_debug("RSO_CFG: band_capability:%d band_mask:%d for vdev[%d]",
84 band_capability, pcl_req->band_mask, pcl_req->vdev_id);
85
86 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, pcl_req->vdev_id,
87 WLAN_MLME_SB_ID);
88 if (!vdev) {
89 mlme_err("vdev object is NULL");
90 status = QDF_STATUS_E_FAILURE;
91 return status;
92 }
93
94 pdev = wlan_vdev_get_pdev(vdev);
95 if (!pdev) {
96 mlme_err("pdev object is NULL");
97 status = QDF_STATUS_E_FAILURE;
98 return status;
99 }
100
101 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
102 if (!roam_tx_ops || !roam_tx_ops->send_vdev_set_pcl_cmd) {
103 mlme_err("send_vdev_set_pcl_cmd is NULL");
104 status = QDF_STATUS_E_FAILURE;
105 goto end;
106 }
107
108 freq_list = qdf_mem_malloc(sizeof(*freq_list));
109 if (!freq_list) {
110 status = QDF_STATUS_E_FAILURE;
111 goto end;
112 }
113
114 mlme_get_fw_scan_channels(psoc, freq_list->freq,
115 &freq_list->num_channels);
116
117 weights = &pcl_req->chan_weights;
118 for (i = 0; i < freq_list->num_channels; i++)
119 weights->saved_chan_list[i] = freq_list->freq[i];
120
121 weights->saved_num_chan = freq_list->num_channels;
122 if (pcl_req->clear_vdev_pcl)
123 weights->saved_num_chan = 0;
124
125 status = policy_mgr_get_valid_chan_weights(
126 psoc, (struct policy_mgr_pcl_chan_weights *)weights,
127 PM_STA_MODE, vdev);
128
129 qdf_mem_free(freq_list);
130
131 for (i = 0; i < weights->saved_num_chan; i++) {
132 weights->weighed_valid_list[i] =
133 wma_map_pcl_weights(weights->weighed_valid_list[i]);
134
135 /* Dont allow roaming on 2G when 5G_ONLY configured */
136 if ((band_capability == BIT(REG_BAND_5G) ||
137 band_capability == BIT(REG_BAND_6G) ||
138 pcl_req->band_mask == BIT(REG_BAND_5G) ||
139 pcl_req->band_mask == BIT(REG_BAND_6G)) &&
140 WLAN_REG_IS_24GHZ_CH_FREQ(weights->saved_chan_list[i]))
141 weights->weighed_valid_list[i] =
142 WEIGHT_OF_DISALLOWED_CHANNELS;
143
144 if ((band_capability == BIT(REG_BAND_2G) ||
145 pcl_req->band_mask == BIT(REG_BAND_2G)) &&
146 !WLAN_REG_IS_24GHZ_CH_FREQ(weights->saved_chan_list[i]))
147 weights->weighed_valid_list[i] =
148 WEIGHT_OF_DISALLOWED_CHANNELS;
149
150 is_channel_allowed =
151 policy_mgr_is_sta_chan_valid_for_connect_and_roam(
152 pdev, weights->saved_chan_list[i]);
153 if (!is_channel_allowed)
154 weights->weighed_valid_list[i] =
155 WEIGHT_OF_DISALLOWED_CHANNELS;
156 }
157
158 if (QDF_IS_STATUS_ERROR(status)) {
159 mlme_err("Error in creating weighed pcl");
160 goto end;
161 }
162
163 mlme_debug("RSO_CFG: Dump Vdev PCL weights for vdev[%d]",
164 pcl_req->vdev_id);
165 policy_mgr_dump_channel_list(weights->saved_num_chan,
166 weights->saved_chan_list,
167 weights->weighed_valid_list);
168
169 status = roam_tx_ops->send_vdev_set_pcl_cmd(vdev, pcl_req);
170 if (QDF_IS_STATUS_ERROR(status))
171 mlme_err("set vdev PCL failed");
172
173 end:
174 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_SB_ID);
175
176 return status;
177 }
178
wlan_cm_tgt_send_roam_rt_stats_config(struct wlan_objmgr_psoc * psoc,struct roam_disable_cfg * req)179 QDF_STATUS wlan_cm_tgt_send_roam_rt_stats_config(struct wlan_objmgr_psoc *psoc,
180 struct roam_disable_cfg *req)
181 {
182 QDF_STATUS status;
183 struct wlan_cm_roam_tx_ops *roam_tx_ops;
184 struct wlan_objmgr_vdev *vdev;
185
186 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, req->vdev_id,
187 WLAN_MLME_NB_ID);
188 if (!vdev)
189 return QDF_STATUS_E_INVAL;
190
191 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
192 if (!roam_tx_ops || !roam_tx_ops->send_roam_rt_stats_config) {
193 mlme_err("vdev %d send_roam_rt_stats_config is NULL",
194 req->vdev_id);
195 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
196 return QDF_STATUS_E_INVAL;
197 }
198
199 status = roam_tx_ops->send_roam_rt_stats_config(vdev,
200 req->vdev_id, req->cfg);
201 if (QDF_IS_STATUS_ERROR(status))
202 mlme_debug("vdev %d fail to send roam rt stats config",
203 req->vdev_id);
204
205 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
206
207 return status;
208 }
209
wlan_cm_tgt_send_roam_ho_delay_config(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,uint16_t roam_ho_delay)210 QDF_STATUS wlan_cm_tgt_send_roam_ho_delay_config(struct wlan_objmgr_psoc *psoc,
211 uint8_t vdev_id,
212 uint16_t roam_ho_delay)
213 {
214 QDF_STATUS status;
215 struct wlan_cm_roam_tx_ops *roam_tx_ops;
216 struct wlan_objmgr_vdev *vdev;
217
218 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
219 WLAN_MLME_NB_ID);
220 if (!vdev)
221 return QDF_STATUS_E_INVAL;
222
223 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
224 if (!roam_tx_ops || !roam_tx_ops->send_roam_ho_delay_config) {
225 mlme_err("vdev %d send_roam_ho_delay_config is NULL", vdev_id);
226 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
227 return QDF_STATUS_E_INVAL;
228 }
229
230 status = roam_tx_ops->send_roam_ho_delay_config(vdev, vdev_id,
231 roam_ho_delay);
232 if (QDF_IS_STATUS_ERROR(status))
233 mlme_debug("vdev %d fail to send roam HO delay config",
234 vdev_id);
235
236 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
237
238 return status;
239 }
240
241 QDF_STATUS
wlan_cm_tgt_exclude_rm_partial_scan_freq(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,uint8_t exclude_rm_partial_scan_freq)242 wlan_cm_tgt_exclude_rm_partial_scan_freq(struct wlan_objmgr_psoc *psoc,
243 uint8_t vdev_id,
244 uint8_t exclude_rm_partial_scan_freq)
245 {
246 QDF_STATUS status;
247 struct wlan_cm_roam_tx_ops *roam_tx_ops;
248 struct wlan_objmgr_vdev *vdev;
249
250 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
251 WLAN_MLME_NB_ID);
252 if (!vdev)
253 return QDF_STATUS_E_INVAL;
254
255 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
256 if (!roam_tx_ops || !roam_tx_ops->send_exclude_rm_partial_scan_freq) {
257 mlme_err("vdev %d send_exclude_rm_partial_scan_freq is NULL",
258 vdev_id);
259 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
260 return QDF_STATUS_E_INVAL;
261 }
262
263 status = roam_tx_ops->send_exclude_rm_partial_scan_freq(
264 vdev, exclude_rm_partial_scan_freq);
265 if (QDF_IS_STATUS_ERROR(status))
266 mlme_debug("vdev %d fail to exclude roam partial scan freq",
267 vdev_id);
268
269 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
270
271 return status;
272 }
273
wlan_cm_tgt_send_roam_full_scan_6ghz_on_disc(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,uint8_t roam_full_scan_6ghz_on_disc)274 QDF_STATUS wlan_cm_tgt_send_roam_full_scan_6ghz_on_disc(
275 struct wlan_objmgr_psoc *psoc,
276 uint8_t vdev_id,
277 uint8_t roam_full_scan_6ghz_on_disc)
278 {
279 QDF_STATUS status;
280 struct wlan_cm_roam_tx_ops *roam_tx_ops;
281 struct wlan_objmgr_vdev *vdev;
282
283 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
284 WLAN_MLME_NB_ID);
285 if (!vdev)
286 return QDF_STATUS_E_INVAL;
287
288 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
289 if (!roam_tx_ops || !roam_tx_ops->send_roam_full_scan_6ghz_on_disc) {
290 mlme_err("vdev %d send_roam_full_scan_6ghz_on_disc is NULL",
291 vdev_id);
292 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
293 return QDF_STATUS_E_INVAL;
294 }
295
296 status = roam_tx_ops->send_roam_full_scan_6ghz_on_disc(
297 vdev, roam_full_scan_6ghz_on_disc);
298 if (QDF_IS_STATUS_ERROR(status))
299 mlme_debug("vdev %d fail to send inclusion of 6 GHz channels",
300 vdev_id);
301
302 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
303
304 return status;
305 }
306
307 #ifdef FEATURE_RX_LINKSPEED_ROAM_TRIGGER
wlan_cm_tgt_send_roam_linkspeed_state(struct wlan_objmgr_psoc * psoc,struct roam_disable_cfg * req)308 QDF_STATUS wlan_cm_tgt_send_roam_linkspeed_state(struct wlan_objmgr_psoc *psoc,
309 struct roam_disable_cfg *req)
310 {
311 QDF_STATUS status;
312 struct wlan_cm_roam_tx_ops *roam_tx_ops;
313 struct wlan_objmgr_vdev *vdev;
314
315 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, req->vdev_id,
316 WLAN_MLME_NB_ID);
317 if (!vdev)
318 return QDF_STATUS_E_INVAL;
319
320 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
321 if (!roam_tx_ops || !roam_tx_ops->send_roam_linkspeed_state) {
322 mlme_err("vdev %d send_roam_linkspeed_state is NULL",
323 req->vdev_id);
324 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
325 return QDF_STATUS_E_INVAL;
326 }
327
328 status = roam_tx_ops->send_roam_linkspeed_state(vdev,
329 req->vdev_id, req->cfg);
330 if (QDF_IS_STATUS_ERROR(status))
331 mlme_debug("vdev %d fail to send roam linkspeed state",
332 req->vdev_id);
333
334 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
335
336 return status;
337 }
338 #endif
339
340 QDF_STATUS
wlan_cm_tgt_send_roam_scan_offload_rssi_params(struct wlan_objmgr_vdev * vdev,struct wlan_roam_offload_scan_rssi_params * roam_rssi_params)341 wlan_cm_tgt_send_roam_scan_offload_rssi_params(
342 struct wlan_objmgr_vdev *vdev,
343 struct wlan_roam_offload_scan_rssi_params *roam_rssi_params)
344 {
345 QDF_STATUS status;
346 uint8_t vdev_id;
347 struct wlan_cm_roam_tx_ops *roam_tx_ops;
348
349 vdev_id = wlan_vdev_get_id(vdev);
350
351 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
352 if (!roam_tx_ops || !roam_tx_ops->send_roam_scan_offload_rssi_params) {
353 mlme_err("vdev %d send_roam_scan_offload_rssi_params is NULL",
354 vdev_id);
355 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
356 return QDF_STATUS_E_INVAL;
357 }
358
359 status = roam_tx_ops->send_roam_scan_offload_rssi_params(
360 vdev, roam_rssi_params);
361 if (QDF_IS_STATUS_ERROR(status))
362 mlme_debug("vdev %d fail to send roam scan offload RSSI params",
363 vdev_id);
364
365 return status;
366 }
367 #endif
368
369 #ifdef WLAN_VENDOR_HANDOFF_CONTROL
370 QDF_STATUS
wlan_cm_tgt_send_roam_vendor_handoff_config(struct wlan_objmgr_psoc * psoc,struct vendor_handoff_cfg * req)371 wlan_cm_tgt_send_roam_vendor_handoff_config(struct wlan_objmgr_psoc *psoc,
372 struct vendor_handoff_cfg *req)
373 {
374 QDF_STATUS status;
375 struct wlan_cm_roam_tx_ops *roam_tx_ops;
376 struct wlan_objmgr_vdev *vdev;
377
378 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, req->vdev_id,
379 WLAN_MLME_NB_ID);
380 if (!vdev)
381 return QDF_STATUS_E_INVAL;
382
383 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
384 if (!roam_tx_ops || !roam_tx_ops->send_roam_vendor_handoff_config) {
385 mlme_err("vdev %d send_roam_vendor_handoff_config is NULL",
386 req->vdev_id);
387 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
388 return QDF_STATUS_E_INVAL;
389 }
390
391 status = roam_tx_ops->send_roam_vendor_handoff_config(vdev,
392 req->vdev_id,
393 req->param_id);
394 if (QDF_IS_STATUS_ERROR(status))
395 mlme_debug("vdev %d fail to send roam vendor handoff config",
396 req->vdev_id);
397
398 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
399
400 return status;
401 }
402 #endif
403
404 #if defined(WLAN_FEATURE_HOST_ROAM) || defined(WLAN_FEATURE_ROAM_OFFLOAD)
wlan_cm_tgt_send_roam_offload_init(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,bool is_init)405 QDF_STATUS wlan_cm_tgt_send_roam_offload_init(struct wlan_objmgr_psoc *psoc,
406 uint8_t vdev_id, bool is_init)
407 {
408 QDF_STATUS status;
409 struct wlan_cm_roam_tx_ops *roam_tx_ops;
410 struct wlan_objmgr_vdev *vdev;
411 struct wlan_roam_offload_init_params init_msg = {0};
412 uint32_t disable_4way_hs_offload;
413 bool bmiss_skip_full_scan;
414
415 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
416 WLAN_MLME_NB_ID);
417 if (!vdev)
418 return QDF_STATUS_E_INVAL;
419
420 if (wlan_vdev_mlme_get_opmode(vdev) != QDF_STA_MODE) {
421 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
422 return QDF_STATUS_E_INVAL;
423 }
424
425 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
426 if (!roam_tx_ops || !roam_tx_ops->send_roam_offload_init_req) {
427 mlme_err("CM_RSO: vdev%d send_roam_offload_init_req is NULL",
428 vdev_id);
429 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
430 return QDF_STATUS_E_INVAL;
431 }
432
433 init_msg.vdev_id = vdev_id;
434 if (is_init) {
435 init_msg.roam_offload_flag = WLAN_ROAM_FW_OFFLOAD_ENABLE |
436 WLAN_ROAM_BMISS_FINAL_SCAN_ENABLE;
437
438 wlan_mlme_get_4way_hs_offload(psoc, &disable_4way_hs_offload);
439 if (!disable_4way_hs_offload)
440 init_msg.roam_offload_flag |=
441 WLAN_ROAM_SKIP_SAE_ROAM_4WAY_HANDSHAKE;
442 if (disable_4way_hs_offload &
443 CFG_DISABLE_4WAY_HS_OFFLOAD_DEFAULT)
444 init_msg.roam_offload_flag |=
445 (WLAN_ROAM_SKIP_EAPOL_4WAY_HANDSHAKE |
446 WLAN_ROAM_SKIP_SAE_ROAM_4WAY_HANDSHAKE);
447
448 wlan_mlme_get_bmiss_skip_full_scan_value(psoc,
449 &bmiss_skip_full_scan);
450 if (bmiss_skip_full_scan)
451 init_msg.roam_offload_flag |=
452 WLAN_ROAM_BMISS_FINAL_SCAN_TYPE;
453 }
454 mlme_debug("vdev_id:%d, is_init:%d, flag:%d", vdev_id, is_init,
455 init_msg.roam_offload_flag);
456
457 status = roam_tx_ops->send_roam_offload_init_req(vdev, &init_msg);
458 if (QDF_IS_STATUS_ERROR(status))
459 mlme_err("CM_RSO: vdev%d fail to send rso init", vdev_id);
460
461 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
462
463 return status;
464 }
465
wlan_cm_tgt_send_roam_start_req(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,struct wlan_roam_start_config * req)466 QDF_STATUS wlan_cm_tgt_send_roam_start_req(struct wlan_objmgr_psoc *psoc,
467 uint8_t vdev_id,
468 struct wlan_roam_start_config *req)
469 {
470 QDF_STATUS status;
471 struct wlan_cm_roam_tx_ops *roam_tx_ops;
472 struct wlan_objmgr_vdev *vdev;
473
474 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
475 WLAN_MLME_NB_ID);
476 if (!vdev)
477 return QDF_STATUS_E_INVAL;
478
479 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
480 if (!roam_tx_ops || !roam_tx_ops->send_roam_start_req) {
481 mlme_err("CM_RSO: vdev %d send_roam_start_req is NULL",
482 vdev_id);
483 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
484 return QDF_STATUS_E_INVAL;
485 }
486
487 status = roam_tx_ops->send_roam_start_req(vdev, req);
488 if (QDF_IS_STATUS_ERROR(status))
489 mlme_err("CM_RSO: vdev %d fail to send roam start", vdev_id);
490
491 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
492
493 return status;
494 }
495
wlan_cm_tgt_send_roam_stop_req(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,struct wlan_roam_stop_config * req)496 QDF_STATUS wlan_cm_tgt_send_roam_stop_req(struct wlan_objmgr_psoc *psoc,
497 uint8_t vdev_id,
498 struct wlan_roam_stop_config *req)
499 {
500 QDF_STATUS status;
501 struct wlan_cm_roam_tx_ops *roam_tx_ops;
502 struct wlan_objmgr_vdev *vdev;
503
504 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
505 WLAN_MLME_NB_ID);
506 if (!vdev)
507 return QDF_STATUS_E_INVAL;
508
509 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
510 if (!roam_tx_ops || !roam_tx_ops->send_roam_stop_offload) {
511 mlme_err("CM_RSO: vdev %d send_roam_stop_offload is NULL",
512 vdev_id);
513 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
514 return QDF_STATUS_E_INVAL;
515 }
516
517 status = roam_tx_ops->send_roam_stop_offload(vdev, req);
518 if (QDF_IS_STATUS_ERROR(status))
519 mlme_err("CM_RSO: vdev %d fail to send roam stop", vdev_id);
520
521 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
522
523 return status;
524 }
525
wlan_cm_tgt_send_roam_update_req(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,struct wlan_roam_update_config * req)526 QDF_STATUS wlan_cm_tgt_send_roam_update_req(struct wlan_objmgr_psoc *psoc,
527 uint8_t vdev_id,
528 struct wlan_roam_update_config *req)
529 {
530 QDF_STATUS status;
531 struct wlan_cm_roam_tx_ops *roam_tx_ops;
532 struct wlan_objmgr_vdev *vdev;
533
534 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
535 WLAN_MLME_NB_ID);
536 if (!vdev)
537 return QDF_STATUS_E_INVAL;
538
539 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
540 if (!roam_tx_ops || !roam_tx_ops->send_roam_update_config) {
541 mlme_err("CM_RSO: vdev %d send_roam_update_config is NULL",
542 vdev_id);
543 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
544 return QDF_STATUS_E_INVAL;
545 }
546
547 status = roam_tx_ops->send_roam_update_config(vdev, req);
548 if (QDF_IS_STATUS_ERROR(status))
549 mlme_err("CM_RSO: vdev %d fail to send roam update", vdev_id);
550
551 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
552
553 return status;
554 }
555
556 QDF_STATUS
wlan_cm_tgt_send_roam_freqs(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,struct wlan_roam_scan_channel_list * req)557 wlan_cm_tgt_send_roam_freqs(struct wlan_objmgr_psoc *psoc,
558 uint8_t vdev_id,
559 struct wlan_roam_scan_channel_list *req)
560 {
561 QDF_STATUS status;
562 struct wlan_cm_roam_tx_ops *roam_tx_ops;
563 struct wlan_objmgr_vdev *vdev;
564
565 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
566 WLAN_MLME_NB_ID);
567 if (!vdev)
568 return QDF_STATUS_E_INVAL;
569
570 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
571 if (!roam_tx_ops || !roam_tx_ops->send_roam_frequencies) {
572 mlme_err("CM_RSO: vdev %d send_roam_frequencies is NULL",
573 vdev_id);
574 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
575 return QDF_STATUS_E_INVAL;
576 }
577
578 status = roam_tx_ops->send_roam_frequencies(vdev, req);
579 if (QDF_IS_STATUS_ERROR(status))
580 mlme_err("CM_RSO: vdev %d fail to send roam freqs", vdev_id);
581
582 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
583
584 return status;
585 }
586
wlan_cm_tgt_send_roam_abort_req(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)587 QDF_STATUS wlan_cm_tgt_send_roam_abort_req(struct wlan_objmgr_psoc *psoc,
588 uint8_t vdev_id)
589 {
590 QDF_STATUS status;
591 struct wlan_cm_roam_tx_ops *roam_tx_ops;
592 struct wlan_objmgr_vdev *vdev;
593
594 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
595 WLAN_MLME_NB_ID);
596 if (!vdev)
597 return QDF_STATUS_E_INVAL;
598
599 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
600 if (!roam_tx_ops || !roam_tx_ops->send_roam_abort) {
601 mlme_err("CM_RSO: vdev %d send_roam_abort is NULL", vdev_id);
602 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
603 return QDF_STATUS_E_INVAL;
604 }
605
606 status = roam_tx_ops->send_roam_abort(vdev, vdev_id);
607 if (QDF_IS_STATUS_ERROR(status))
608 mlme_err("CM_RSO: vdev %d fail to send roam abort", vdev_id);
609
610 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
611
612 return status;
613 }
614
wlan_cm_tgt_send_roam_per_config(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,struct wlan_per_roam_config_req * req)615 QDF_STATUS wlan_cm_tgt_send_roam_per_config(struct wlan_objmgr_psoc *psoc,
616 uint8_t vdev_id,
617 struct wlan_per_roam_config_req *req)
618 {
619 QDF_STATUS status;
620 struct wlan_cm_roam_tx_ops *roam_tx_ops;
621 struct wlan_objmgr_vdev *vdev;
622
623 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
624 WLAN_MLME_NB_ID);
625 if (!vdev)
626 return QDF_STATUS_E_INVAL;
627
628 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
629 if (!roam_tx_ops || !roam_tx_ops->send_roam_per_config) {
630 mlme_err("CM_RSO: vdev %d send_roam_per_config is NULL",
631 vdev_id);
632 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
633 return QDF_STATUS_E_INVAL;
634 }
635
636 status = roam_tx_ops->send_roam_per_config(vdev, req);
637 if (QDF_IS_STATUS_ERROR(status))
638 mlme_err("CM_RSO: vdev %d fail to send per config", vdev_id);
639
640 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
641
642 return status;
643 }
644
wlan_cm_tgt_send_roam_triggers(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,struct wlan_roam_triggers * req)645 QDF_STATUS wlan_cm_tgt_send_roam_triggers(struct wlan_objmgr_psoc *psoc,
646 uint8_t vdev_id,
647 struct wlan_roam_triggers *req)
648 {
649 QDF_STATUS status;
650 struct wlan_cm_roam_tx_ops *roam_tx_ops;
651 struct wlan_objmgr_vdev *vdev;
652
653 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
654 WLAN_MLME_NB_ID);
655 if (!vdev)
656 return QDF_STATUS_E_INVAL;
657
658 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
659 if (!roam_tx_ops || !roam_tx_ops->send_roam_triggers) {
660 mlme_err("CM_RSO: vdev %d send_roam_triggers is NULL",
661 vdev_id);
662 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
663 return QDF_STATUS_E_INVAL;
664 }
665
666 status = roam_tx_ops->send_roam_triggers(vdev, req);
667 if (QDF_IS_STATUS_ERROR(status))
668 mlme_err("CM_RSO: vdev %d fail to send roamtrigger", vdev_id);
669
670 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
671
672 return status;
673 }
674 #endif
675
676 #ifdef WLAN_FEATURE_11BE_MLO
wlan_cm_tgt_send_roam_mlo_config(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,struct wlan_roam_mlo_config * req)677 QDF_STATUS wlan_cm_tgt_send_roam_mlo_config(struct wlan_objmgr_psoc *psoc,
678 uint8_t vdev_id,
679 struct wlan_roam_mlo_config *req)
680 {
681 QDF_STATUS status;
682 struct wlan_cm_roam_tx_ops *roam_tx_ops;
683 struct wlan_objmgr_vdev *vdev;
684
685 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
686 WLAN_MLME_NB_ID);
687 if (!vdev)
688 return QDF_STATUS_E_INVAL;
689
690 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
691 if (!roam_tx_ops || !roam_tx_ops->send_roam_mlo_config) {
692 mlme_err("CM_RSO: vdev %d send_roam_mlo_config is NULL",
693 vdev_id);
694 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
695 return QDF_STATUS_E_INVAL;
696 }
697
698 status = roam_tx_ops->send_roam_mlo_config(vdev, req);
699 if (QDF_IS_STATUS_ERROR(status))
700 mlme_err("CM_RSO: vdev %d fail to send roam mlo config",
701 vdev_id);
702
703 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
704
705 return status;
706 }
707 #endif
708
wlan_cm_tgt_send_roam_disable_config(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,struct roam_disable_cfg * req)709 QDF_STATUS wlan_cm_tgt_send_roam_disable_config(struct wlan_objmgr_psoc *psoc,
710 uint8_t vdev_id,
711 struct roam_disable_cfg *req)
712 {
713 QDF_STATUS status;
714 struct wlan_cm_roam_tx_ops *roam_tx_ops;
715 struct wlan_objmgr_vdev *vdev;
716
717 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
718 WLAN_MLME_NB_ID);
719 if (!vdev)
720 return QDF_STATUS_E_INVAL;
721
722 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
723 if (!roam_tx_ops || !roam_tx_ops->send_roam_disable_config) {
724 mlme_err("CM_RSO: vdev %d send_roam_disable_config is NULL",
725 vdev_id);
726 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
727 return QDF_STATUS_E_INVAL;
728 }
729
730 status = roam_tx_ops->send_roam_disable_config(vdev, req);
731 if (QDF_IS_STATUS_ERROR(status))
732 mlme_debug("CM_RSO: vdev %d fail to send roam disable config",
733 vdev_id);
734
735 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
736
737 return status;
738 }
739
740 QDF_STATUS
wlan_cm_tgt_send_roam_invoke_req(struct wlan_objmgr_psoc * psoc,struct roam_invoke_req * roam_invoke_req)741 wlan_cm_tgt_send_roam_invoke_req(struct wlan_objmgr_psoc *psoc,
742 struct roam_invoke_req *roam_invoke_req)
743 {
744 QDF_STATUS status;
745 struct wlan_cm_roam_tx_ops *roam_tx_ops;
746 struct wlan_objmgr_vdev *vdev;
747
748 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc,
749 roam_invoke_req->vdev_id,
750 WLAN_MLME_NB_ID);
751 if (!vdev)
752 return QDF_STATUS_E_INVAL;
753
754 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
755
756 if (!roam_tx_ops || !roam_tx_ops->send_roam_invoke_cmd) {
757 mlme_err("CM_RSO: vdev %d send_roam_invoke_cmd is NULL",
758 roam_invoke_req->vdev_id);
759 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
760 return QDF_STATUS_E_INVAL;
761 }
762
763 status = roam_tx_ops->send_roam_invoke_cmd(vdev, roam_invoke_req);
764 if (QDF_IS_STATUS_ERROR(status))
765 mlme_debug("CM_RSO: vdev %d fail to send roam invoke cmd",
766 roam_invoke_req->vdev_id);
767
768 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
769
770 return status;
771 }
772
773 QDF_STATUS
wlan_cm_tgt_send_roam_sync_complete_cmd(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)774 wlan_cm_tgt_send_roam_sync_complete_cmd(struct wlan_objmgr_psoc *psoc,
775 uint8_t vdev_id)
776 {
777 QDF_STATUS status;
778 struct wlan_cm_roam_tx_ops *roam_tx_ops;
779 struct wlan_objmgr_vdev *vdev;
780
781 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc,
782 vdev_id,
783 WLAN_MLME_NB_ID);
784 if (!vdev)
785 return QDF_STATUS_E_INVAL;
786
787 roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
788
789 if (!roam_tx_ops || !roam_tx_ops->send_roam_sync_complete_cmd) {
790 mlme_err("CM_RSO: vdev %d send_roam_sync_complete_cmd is NULL",
791 vdev_id);
792 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
793 return QDF_STATUS_E_INVAL;
794 }
795
796 status = roam_tx_ops->send_roam_sync_complete_cmd(vdev);
797 if (QDF_IS_STATUS_ERROR(status))
798 mlme_debug("CM_RSO: vdev %d fail to send roam sync complete cmd",
799 vdev_id);
800
801 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
802
803 return status;
804 }
805