1 /*
2 * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 *
16 */
17
18 /**
19 * DOC: contains mlme target if declarations
20 */
21
22 #include "target_if_mlme.h"
23 #include <wmi_unified_mlme_api.h>
24
25 static struct wmi_unified
target_if_mlme_get_wmi_handle_from_vdev(struct wlan_objmgr_vdev * vdev)26 *target_if_mlme_get_wmi_handle_from_vdev(struct wlan_objmgr_vdev *vdev)
27 {
28 struct wlan_objmgr_pdev *pdev;
29 struct wmi_unified *wmi_handle;
30
31 pdev = wlan_vdev_get_pdev(vdev);
32 if (!pdev) {
33 target_if_err("PDEV is NULL");
34 return NULL;
35 }
36
37 wmi_handle = get_wmi_unified_hdl_from_pdev(pdev);
38 if (!wmi_handle) {
39 target_if_err("wmi_handle is null");
40 return NULL;
41 }
42
43 return wmi_handle;
44 }
45
46 static QDF_STATUS
target_if_mlme_send_csa_event_status_ind(struct wlan_objmgr_vdev * vdev,uint8_t csa_status)47 target_if_mlme_send_csa_event_status_ind(struct wlan_objmgr_vdev *vdev,
48 uint8_t csa_status)
49 {
50 wmi_unified_t wmi_handle;
51 struct csa_event_status_ind params = {0};
52
53 params.vdev_id = wlan_vdev_get_id(vdev);
54 params.status = csa_status;
55
56 wmi_handle = target_if_mlme_get_wmi_handle_from_vdev(vdev);
57 if (!wmi_handle)
58 return QDF_STATUS_E_FAILURE;
59
60 return wmi_send_csa_event_status_ind(wmi_handle, params);
61 }
62
63 void
target_if_mlme_register_tx_ops(struct wlan_mlme_tx_ops * tx_ops)64 target_if_mlme_register_tx_ops(struct wlan_mlme_tx_ops *tx_ops)
65 {
66 if (!tx_ops) {
67 target_if_err("target if tx ops is NULL!");
68 return;
69 }
70
71 tx_ops->send_csa_event_status_ind =
72 target_if_mlme_send_csa_event_status_ind;
73 }
74
75