xref: /wlan-driver/qcacld-3.0/components/umac/mlme/sap/ll_sap/dispatcher/inc/wlan_ll_sap_public_structs.h (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  * DOC: contains ll_lt_sap structure definitions specific to the bearer
19  * switch and channel selection functionalities
20  */
21 
22 #ifndef _WLAN_LL_SAP_PUBLIC_STRUCTS_H_
23 #define _WLAN_LL_SAP_PUBLIC_STRUCTS_H_
24 
25 #include "wlan_objmgr_psoc_obj.h"
26 #include <qdf_status.h>
27 
28 /* Indicates MAX bearer switch requesters at a time */
29 #define MAX_BEARER_SWITCH_REQUESTERS 5
30 #define BS_REQ_ID_INVALID 0xFFFFFFFF
31 typedef uint32_t wlan_bs_req_id;
32 
33 /**
34  * enum bearer_switch_req_type: Bearer switch request type
35  * @WLAN_BS_REQ_TO_NON_WLAN: Bearer switch request to non-wlan
36  * @WLAN_BS_REQ_TO_WLAN: Bearer switch request to wlan
37  * @WLAN_BS_REQ_INVALID: Invalid bearer switch request
38  */
39 enum bearer_switch_req_type {
40 	WLAN_BS_REQ_TO_NON_WLAN = 0,
41 	WLAN_BS_REQ_TO_WLAN = 1,
42 	WLAN_BS_REQ_INVALID,
43 };
44 
45 /**
46  * enum bearer_switch_status: Bearer switch status
47  * @WLAN_BS_STATUS_REJECTED: Bearer switch request rejected
48  * @WLAN_BS_STATUS_COMPLETED: Bearer switch request completed
49  * @WLAN_BS_STATUS_INVALID: Invalid bearer switch request
50  * @WLAN_BS_STATUS_TIMEOUT: Bearer switch request timedout
51  */
52 enum bearer_switch_status {
53 	WLAN_BS_STATUS_REJECTED = 0,
54 	WLAN_BS_STATUS_COMPLETED = 1,
55 	WLAN_BS_STATUS_TIMEOUT = 2,
56 	WLAN_BS_STATUS_INVALID,
57 };
58 
59 /**
60  * enum bearer_switch_req_source: Bearer switch requester source
61  * @BEARER_SWITCH_REQ_CONNECT: Bearer switch requester is connect
62  * @BEARER_SWITCH_REQ_CSA: Bearer switch requester is CSA
63  * @BEARER_SWITCH_REQ_FW: Bearer switch requester is FW
64  * @BEARER_SWITCH_REQ_MAX: Indicates MAX bearer switch requester
65  */
66 enum bearer_switch_req_source {
67 	BEARER_SWITCH_REQ_CONNECT,
68 	BEARER_SWITCH_REQ_CSA,
69 	BEARER_SWITCH_REQ_FW,
70 	BEARER_SWITCH_REQ_MAX,
71 };
72 
73 /**
74  * struct wlan_ll_lt_sap_mac_freq: LL_LT_SAP mac frequency
75  * @freq_5GHz_low: Low 5GHz frequency
76  * @freq_5GHz_high: High 5GHz frequency
77  * @freq_6GHz: 6GHz frequency
78  * @weight_5GHz_low: Weight of 5GHz low frequency
79  * @weight_5GHz_high: Weight of 5GHz high frequency
80  * @weight_6GHz: Weight of 6GHz frequency
81  */
82 struct wlan_ll_lt_sap_mac_freq {
83 	qdf_freq_t freq_5GHz_low;
84 	qdf_freq_t freq_5GHz_high;
85 	qdf_freq_t freq_6GHz;
86 	uint32_t weight_5GHz_low;
87 	uint32_t weight_5GHz_high;
88 	uint32_t weight_6GHz;
89 };
90 
91 /**
92  * struct wlan_ll_lt_sap_freq_list: LL_LT_SAP frequency list structure
93  * @standalone_mac: Select frequency from mac which doesn't have any
94  * concurrent interface present.
95  * @shared_mac: Select frequency from mac which has one concurrent
96  * interface present.
97  * @best_freq: Best freq present in ACS final list. This freq can be
98  * use to bring LL_LT_SAP if none of the above channels are present
99  * @prev_freq: Previous/current freq on which LL_LT_SAP is present.
100  * This will be use to avoid SCC channel selection while updating this
101  * list. This freq should be filled by user.
102  * @weight_best_freq: Weight of best frequency
103  */
104 struct wlan_ll_lt_sap_freq_list {
105 	struct wlan_ll_lt_sap_mac_freq standalone_mac;
106 	struct wlan_ll_lt_sap_mac_freq shared_mac;
107 	qdf_freq_t best_freq;
108 	qdf_freq_t prev_freq;
109 	uint32_t weight_best_freq;
110 };
111 
112 /**
113  * typedef bearer_switch_requester_cb() - Callback function, which will
114  * be invoked with the bearer switch request status.
115  * @psoc: Psoc pointer
116  * @vdev_id: vdev id of the requester
117  * @request_id: Request ID
118  * @status: Status of the bearer switch request
119  * @req_value: Request value for the bearer switch request
120  * @request_params: Request params for the bearer switch request
121  *
122  * Return: None
123  */
124 typedef void (*bearer_switch_requester_cb)(struct wlan_objmgr_psoc *psoc,
125 					   uint8_t vdev_id,
126 					   wlan_bs_req_id request_id,
127 					   QDF_STATUS status,
128 					   uint32_t req_value,
129 					   void *request_params);
130 
131 /**
132  * struct wlan_bearer_switch_request - Data structure to store the bearer switch
133  * request
134  * @vdev_id: Vdev id of the requester
135  * @request_id: Unique value to identify the request
136  * @req_type: Type of the request,  bearer switch to wlan or bearer switch
137  * to non-wlan
138  * @source: Bearer switch request source
139  * @requester_cb: Callback which needs to be invoked to indicate the status of
140  * the request to the requester, this callback will be passed by the requester
141  * when requester will send the request.
142  * @arg_value: argument value passed by requester, this will be returned back
143  * in the callback
144  * @arg: Argument passed by requester, this will be returned back in the
145  * callback
146  */
147 struct wlan_bearer_switch_request {
148 	uint8_t vdev_id;
149 	wlan_bs_req_id request_id;
150 	enum bearer_switch_req_type req_type;
151 	enum bearer_switch_req_source source;
152 	bearer_switch_requester_cb requester_cb;
153 	uint32_t arg_value;
154 	void *arg;
155 };
156 
157 /**
158  * struct wlan_ll_sap_tx_ops - defines southbound tx callbacks for
159  * LL_SAP (low latency sap) component
160  * @send_audio_transport_switch_resp: function pointer to indicate audio
161  * transport switch response to FW
162  */
163 struct wlan_ll_sap_tx_ops {
164 	QDF_STATUS (*send_audio_transport_switch_resp)(
165 					struct wlan_objmgr_psoc *psoc,
166 					enum bearer_switch_req_type req_type,
167 					enum bearer_switch_status status);
168 };
169 
170 /**
171  * struct wlan_ll_sap_rx_ops - defines southbound rx callbacks for
172  * LL_SAP (low latency SAP) component
173  * @audio_transport_switch_req: function pointer to indicate audio
174  * transport switch request from FW
175  */
176 struct wlan_ll_sap_rx_ops {
177 	QDF_STATUS (*audio_transport_switch_req)(
178 					struct wlan_objmgr_psoc *psoc,
179 					enum bearer_switch_req_type req_type);
180 };
181 
182 /**
183  * struct ll_sap_ops - ll_sap osif callbacks
184  * @ll_sap_send_audio_transport_switch_req_cb: Send audio transport request to
185  * userspace
186  */
187 struct ll_sap_ops {
188 		void (*ll_sap_send_audio_transport_switch_req_cb)(
189 					struct wlan_objmgr_vdev *vdev,
190 					enum bearer_switch_req_type req_type);
191 };
192 #endif /* _WLAN_LL_SAP_PUBLIC_STRUCTS_H_ */
193