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