xref: /wlan-driver/qca-wifi-host-cmn/umac/mlme/psoc_mgr/dispatcher/inc/wlan_psoc_mlme_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC: Define PSOC MLME public APIs
20  */
21 
22 #ifndef _WLAN_PSOC_MLME_API_H_
23 #define _WLAN_PSOC_MLME_API_H_
24 
25 #include <include/wlan_psoc_mlme.h>
26 
27 #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
28 #define MAX_PEER_HIST_LIST_SIZE 256
29 #endif
30 
31 /**
32  * wlan_psoc_mlme_get_cmpt_obj() - Returns PSOC MLME component object
33  * @psoc: PSOC object
34  *
35  * Retrieves MLME component object from PSOC object
36  *
37  * Return: comp handle on SUCCESS
38  *         NULL, if it fails to retrieve
39  */
40 struct psoc_mlme_obj *wlan_psoc_mlme_get_cmpt_obj(
41 						struct wlan_objmgr_psoc *psoc);
42 
43 #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
44 /**
45  * wlan_mlme_psoc_init_peer_trans_history() - Initialize PSOC peer trans history
46  * @psoc_mlme: PSOC MLME priv object
47  *
48  * Return: void
49  */
50 static inline void
wlan_mlme_psoc_init_peer_trans_history(struct psoc_mlme_obj * psoc_mlme)51 wlan_mlme_psoc_init_peer_trans_history(struct psoc_mlme_obj *psoc_mlme)
52 {
53 	qdf_list_create(&psoc_mlme->peer_history_list, 0);
54 }
55 
56 /**
57  * wlan_mlme_psoc_peer_trans_hist_remove_back() - Remove entry from peer history
58  * @peer_history: Peer history list
59  *
60  * Removes one entry from back in the @peer_history list and free the memory
61  *
62  * Returns: void
63  */
64 void wlan_mlme_psoc_peer_trans_hist_remove_back(qdf_list_t *peer_history);
65 
66 /**
67  * wlan_mlme_psoc_peer_tbl_trans_add_entry() - Add entry to peer history table
68  * @psoc: PSOC object manager pointer
69  * @peer_trans_entry: Entry to add.
70  *
71  * Adds the entry pointed by @peer_trans_entry to peer_history table in PSOC
72  * MLME. The new node is added to the front and if the list size becomes more
73  * than MAX_PEER_HIST_LIST_SIZE, then entry existing at the back of the list
74  * will be flushed before adding this entry.
75  *
76  * Caller to take care of mem_free of buffer pointed by @peer_trans_entry
77  * in case of error.
78  *
79  * Return: QDF_STATUS
80  */
81 QDF_STATUS
82 wlan_mlme_psoc_peer_tbl_trans_add_entry(struct wlan_objmgr_psoc *psoc,
83 					struct wlan_peer_tbl_trans_entry *peer_trans_entry);
84 
85 /**
86  * wlan_mlme_psoc_flush_peer_trans_history() - Flush the peer trans table
87  * @psoc: PSOC object manager pointer
88  *
89  * Flush all the entries of peer transition table and free the memory.
90  */
91 void wlan_mlme_psoc_flush_peer_trans_history(struct wlan_objmgr_psoc *psoc);
92 #else
93 static inline void
wlan_mlme_psoc_init_peer_trans_history(struct psoc_mlme_obj * psoc_mlme)94 wlan_mlme_psoc_init_peer_trans_history(struct psoc_mlme_obj *psoc_mlme)
95 {
96 }
97 
98 static inline void
wlan_mlme_psoc_flush_peer_trans_history(struct wlan_objmgr_psoc * psoc)99 wlan_mlme_psoc_flush_peer_trans_history(struct wlan_objmgr_psoc *psoc)
100 {
101 }
102 #endif
103 /**
104  * wlan_psoc_mlme_get_ext_hdl() - Returns legacy handle
105  * @psoc: PSOC object
106  *
107  * Retrieves legacy handle from psoc mlme component object
108  *
109  * Return: legacy handle on SUCCESS
110  *         NULL, if it fails to retrieve
111  */
112 mlme_psoc_ext_t *wlan_psoc_mlme_get_ext_hdl(struct wlan_objmgr_psoc *psoc);
113 
114 /**
115  * wlan_psoc_mlme_set_ext_hdl() - Set legacy handle
116  * @psoc_mlme: psoc_mlme object
117  * @psoc_ext_hdl: PSOC level legacy handle
118  *
119  * Sets legacy handle in psoc mlme component object
120  *
121  * Return: Void
122  */
123 void wlan_psoc_mlme_set_ext_hdl(struct psoc_mlme_obj *psoc_mlme,
124 				mlme_psoc_ext_t *psoc_ext_hdl);
125 
126 /**
127  * wlan_psoc_set_phy_config() - Init psoc phy related configs
128  * @psoc: pointer to psoc object
129  * @phy_config: phy related configs score config
130  *
131  * Return: void
132  */
133 void wlan_psoc_set_phy_config(struct wlan_objmgr_psoc *psoc,
134 			      struct psoc_phy_config *phy_config);
135 
136 /**
137  * mlme_psoc_open() - MLME component Open
138  * @psoc: pointer to psoc object
139  *
140  * Open the MLME component and initialize the MLME structure
141  *
142  * Return: QDF Status
143  */
144 QDF_STATUS mlme_psoc_open(struct wlan_objmgr_psoc *psoc);
145 
146 /**
147  * mlme_psoc_close() - MLME component close
148  * @psoc: pointer to psoc object
149  *
150  * Open the MLME component and initialize the MLME structure
151  *
152  * Return: QDF Status
153  */
154 QDF_STATUS mlme_psoc_close(struct wlan_objmgr_psoc *psoc);
155 
156 /**
157  * wlan_psoc_mlme_get_11be_capab() - Get the 11be capability for target
158  * @psoc: psoc handle
159  * @val: pointer to the output variable
160  *
161  * return: QDF_STATUS
162  */
163 QDF_STATUS
164 wlan_psoc_mlme_get_11be_capab(struct wlan_objmgr_psoc *psoc, bool *val);
165 
166 /**
167  * wlan_psoc_mlme_set_11be_capab() - Set the 11be capability for target
168  * @psoc: psoc handle
169  * @val: pointer to the output variable
170  *
171  * return: QDF_STATUS
172  */
173 QDF_STATUS
174 wlan_psoc_mlme_set_11be_capab(struct wlan_objmgr_psoc *psoc, bool val);
175 #endif
176