xref: /wlan-driver/qcacld-3.0/components/tdls/core/src/wlan_tdls_mgmt.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: wlan_tdls_mgmt.h
22  *
23  * TDLS management frames include file
24  */
25 
26 #ifndef _WLAN_TDLS_MGMT_H_
27 #define _WLAN_TDLS_MGMT_H_
28 
29 #include "wlan_tdls_cmds_process.h"
30 
31 #define TDLS_PUBLIC_ACTION_FRAME_OFFSET 24
32 /* TDLS_PUBLIC_ACTION_FRAME_OFFSET(category[1]) + action[1] + dialog[1]
33  * + cap[2]
34  */
35 #define TDLS_PUBLIC_ACTION_FRAME_TDLS_IE_OFFSET 29
36 #define TDLS_PUBLIC_ACTION_FRAME 4
37 #define TDLS_PUBLIC_ACTION_DISC_RESP 14
38 #define TDLS_ACTION_FRAME 12
39 #define TDLS_80211_PEER_ADDR_OFFSET (TDLS_PUBLIC_ACTION_FRAME + \
40 				     QDF_MAC_ADDR_SIZE)
41 #define TDLS_ACTION_FRAME_TYPE_MAX 11
42 
43 /**
44  * struct tdls_link_identifier - tdls link identifier ie
45  * @id: element id
46  * @len: length
47  * @bssid: bssid
48  * @initsta: the mac address of initiator
49  * @respsta: the mac address of responder
50  */
51 struct tdls_link_identifier {
52 	uint8_t id;
53 	uint8_t len;
54 	uint8_t bssid[6];
55 	uint8_t initsta[6];
56 	uint8_t respsta[6];
57 };
58 
59 /**
60  * struct tdls_rx_mgmt_event - tdls rx mgmt frame event
61  * @tdls_soc_obj: tdls soc private object
62  * @rx_mgmt: tdls rx mgmt frame structure
63  */
64 struct tdls_rx_mgmt_event {
65 	struct tdls_soc_priv_obj *tdls_soc_obj;
66 	struct tdls_rx_mgmt_frame *rx_mgmt;
67 };
68 
69 /**
70  * tdls_process_mgmt_req() - send a TDLS mgmt request to serialize module
71  * @tdls_mgmt_req: tdls management request
72  *
73  * TDLS request API, called from cfg80211 to send a TDLS frame in
74  * serialized manner to PE
75  *
76  *Return: QDF_STATUS
77  */
78 QDF_STATUS tdls_process_mgmt_req(
79 			struct tdls_action_frame_request *tdls_mgmt_req);
80 
81 /**
82  * tdls_process_mlo_cal_tdls_link_score() - process mlo cal tdls link
83  * @vdev: object manager vdev
84  *
85  * Converts rx tdls frame freq to a link score and stores the score
86  * in relative tdls_vdev object.
87  *
88  *Return: QDF_STATUS
89  */
90 QDF_STATUS
91 tdls_process_mlo_cal_tdls_link_score(struct wlan_objmgr_vdev *vdev);
92 
93 /**
94  * tdls_mlo_get_tdls_link_vdev() - wrapper function
95  * @vdev: vdev object
96  *
97  * Return: tdls vdev
98  */
99 struct wlan_objmgr_vdev *
100 tdls_mlo_get_tdls_link_vdev(struct wlan_objmgr_vdev *vdev);
101 
102 /**
103  * tdls_set_remain_links_unforce() - unforce links
104  * @vdev: vdev object
105  *
106  * Return: void
107  */
108 void tdls_set_remain_links_unforce(struct wlan_objmgr_vdev *vdev);
109 
110 /**
111  * tdls_mgmt_rx_ops() - register or unregister rx callback
112  * @psoc: psoc object
113  * @isregister: register if true, unregister if false
114  *
115  * This function registers or unregisters rx callback to mgmt txrx
116  * component.
117  *
118  * Return: QDF_STATUS
119  */
120 QDF_STATUS tdls_mgmt_rx_ops(struct wlan_objmgr_psoc *psoc,
121 	bool isregister);
122 
123 /**
124  * tdls_process_rx_frame() - process tdls rx frames
125  * @msg: scheduler msg
126  *
127  * Return: QDF_STATUS
128  */
129 QDF_STATUS tdls_process_rx_frame(struct scheduler_msg *msg);
130 
131 /**
132  * tdls_set_rssi() - Set TDLS RSSI on peer given by mac
133  * @vdev: vdev object
134  * @mac: MAC address of Peer
135  * @rssi: rssi value
136  *
137  * Set RSSI on TDSL peer
138  *
139  * Return: QDF_STATUS
140  */
141 QDF_STATUS tdls_set_rssi(struct wlan_objmgr_vdev *vdev,
142 			 uint8_t *mac, int8_t rssi);
143 
144 /**
145  * tdls_process_mlo_choice_tdls_vdev() - choice one vdev for tdls vdev
146  * @vdev: object manager vdev
147  *
148  * Return: pointer of vdev object
149  */
150 struct wlan_objmgr_vdev *
151 tdls_process_mlo_choice_tdls_vdev(struct wlan_objmgr_vdev *vdev);
152 
153 /**
154  * tdls_set_no_force_vdev() - set no force for the vdev
155  * @vdev: object manager vdev
156  * @flag: true, set all vdev as no force; false, except the current one.
157  *
158  * Return: void
159  */
160 void tdls_set_no_force_vdev(struct wlan_objmgr_vdev *vdev, bool flag);
161 
162 /**
163  * tdls_set_link_mode() - force active or unfore link for MLO case
164  * @req: the pointer of tdls_action_frame_request
165  *
166  * Return: QDF_STATUS
167  */
168 QDF_STATUS tdls_set_link_mode(struct tdls_action_frame_request *req);
169 #endif
170 
171