xref: /wlan-driver/qcacld-3.0/components/wmi/src/wmi_unified_mlme_tlv.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
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 wmi mlme declarations
20  */
21 
22 #include <wmi_unified_priv.h>
23 #include "wmi.h"
24 #include "wlan_mlme_api.h"
25 #include "wmi_unified_ll_sap_tlv.h"
26 
csa_event_status_ind_tlv(wmi_unified_t wmi_handle,struct csa_event_status_ind params)27 static QDF_STATUS csa_event_status_ind_tlv(wmi_unified_t wmi_handle,
28 					   struct csa_event_status_ind params)
29 {
30 	wmi_csa_event_status_ind_fixed_param *cmd;
31 	wmi_buf_t buf;
32 	QDF_STATUS status;
33 
34 	buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
35 	if (!buf)
36 		return QDF_STATUS_E_FAILURE;
37 
38 	cmd = (wmi_csa_event_status_ind_fixed_param *)wmi_buf_data(buf);
39 	WMITLV_SET_HDR(&cmd->tlv_header,
40 		       WMITLV_TAG_STRUC_wmi_csa_event_status_ind_fixed_param,
41 		       WMITLV_GET_STRUCT_TLVLEN
42 		       (wmi_csa_event_status_ind_fixed_param));
43 
44 	cmd->vdev_id = params.vdev_id;
45 	cmd->status = params.status;
46 
47 	wmi_debug("vdev_id: %d status: %d ", cmd->vdev_id, cmd->status);
48 
49 	status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd),
50 				      WMI_CSA_EVENT_STATUS_INDICATION_CMDID);
51 	if (QDF_IS_STATUS_ERROR(status))
52 		wmi_buf_free(buf);
53 
54 	return status;
55 }
56 
57 #ifdef WLAN_FEATURE_LL_LT_SAP
58 /**
59  * wmi_mlme_attach_ll_lt_sap_tlv() - attach ll_lt_sap tlv handlers
60  * @ops: wmi ops
61  *
62  * Return: void
63  */
wmi_mlme_attach_ll_lt_sap_tlv(struct wmi_ops * ops)64 static void wmi_mlme_attach_ll_lt_sap_tlv(struct wmi_ops *ops)
65 {
66 	ops->send_audio_transport_switch_resp = audio_transport_switch_resp_tlv;
67 	ops->extract_audio_transport_switch_req_event =
68 				extract_audio_transport_switch_req_event_tlv;
69 }
70 #else
wmi_mlme_attach_ll_lt_sap_tlv(struct wmi_ops * ops)71 static inline void wmi_mlme_attach_ll_lt_sap_tlv(struct wmi_ops *ops)
72 {
73 }
74 #endif
75 
76 /**
77  * wmi_mlme_attach_tlv() - attach MLME tlv handlers
78  * @wmi_handle: wmi handle
79  *
80  * Return: void
81  */
wmi_mlme_attach_tlv(wmi_unified_t wmi_handle)82 void wmi_mlme_attach_tlv(wmi_unified_t wmi_handle)
83 {
84 	struct wmi_ops *ops = wmi_handle->ops;
85 
86 	ops->send_csa_event_status_ind = csa_event_status_ind_tlv;
87 	wmi_mlme_attach_ll_lt_sap_tlv(ops);
88 }
89