xref: /wlan-driver/qcacld-3.0/components/action_oui/core/inc/wlan_action_oui_priv.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-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: Declare private API which shall be used internally only
22  * in action_oui component. This file shall include prototypes of
23  * action_oui parsing and send logic.
24  *
25  * Note: This API should be never accessed out of action_oui component.
26  */
27 
28 #ifndef _WLAN_ACTION_OUI_PRIV_STRUCT_H_
29 #define _WLAN_ACTION_OUI_PRIV_STRUCT_H_
30 
31 #include <qdf_list.h>
32 #include <qdf_types.h>
33 #include "wlan_action_oui_public_struct.h"
34 #include "wlan_action_oui_tgt_api.h"
35 #include "wlan_action_oui_objmgr.h"
36 
37 /**
38  * enum action_oui_token_type - String token types expected.
39  * @ACTION_OUI_TOKEN: oui string
40  * @ACTION_OUI_DATA_LENGTH_TOKEN: data length string
41  * @ACTION_OUI_DATA_TOKEN: OUI data string
42  * @ACTION_OUI_DATA_MASK_TOKEN: data mask string
43  * @ACTION_OUI_INFO_MASK_TOKEN: info mask string
44  * @ACTION_OUI_MAC_ADDR_TOKEN: mac addr string
45  * @ACTION_OUI_MAC_MASK_TOKEN: mac mask string
46  * @ACTION_OUI_CAPABILITY_TOKEN: capability string
47  * @ACTION_OUI_END_TOKEN: end of one oui extension
48  */
49 enum action_oui_token_type {
50 	ACTION_OUI_TOKEN = 1 << 0,
51 	ACTION_OUI_DATA_LENGTH_TOKEN = 1 << 1,
52 	ACTION_OUI_DATA_TOKEN = 1 << 2,
53 	ACTION_OUI_DATA_MASK_TOKEN = 1 << 3,
54 	ACTION_OUI_INFO_MASK_TOKEN = 1 << 4,
55 	ACTION_OUI_MAC_ADDR_TOKEN = 1 << 5,
56 	ACTION_OUI_MAC_MASK_TOKEN = 1 << 6,
57 	ACTION_OUI_CAPABILITY_TOKEN = 1 << 7,
58 	ACTION_OUI_END_TOKEN = 1 << 8,
59 };
60 
61 /**
62  * struct action_oui_extension_priv - Private contents of extension.
63  * @item: list element
64  * @extension: Extension contents
65  *
66  * This structure encapsulates action_oui_extension and list item.
67  */
68 struct action_oui_extension_priv {
69 	qdf_list_node_t item;
70 	struct action_oui_extension extension;
71 };
72 
73 /**
74  * struct action_oui_priv - Each action info.
75  * @id: type of action
76  * @extension_list: list of extensions
77  * @extension_lock: lock to control access to @extension_list
78  *
79  * All extensions of action specified by action_id are stored
80  * at @extension_list as linked list.
81  */
82 struct action_oui_priv {
83 	enum action_oui_id id;
84 	qdf_list_t extension_list;
85 	qdf_mutex_t extension_lock;
86 };
87 
88 /**
89  * struct action_oui_psoc_priv - Private object to be stored in psoc
90  * @psoc: pointer to psoc object
91  * @action_oui_enable: action oui enable
92  * @action_oui_str: oui configuration strings
93  * @total_extensions: total count of extensions from all actions
94  * @host_only_extensions: total host only only extensions from all actions
95  * @max_extensions: Max no. of extensions that can be configured to the firmware
96  * @oui_priv: array of pointers used to refer each action info
97  * @tx_ops: call-back functions to send OUIs to firmware
98  */
99 struct action_oui_psoc_priv {
100 	struct wlan_objmgr_psoc *psoc;
101 	bool action_oui_enable;
102 	uint8_t action_oui_str[ACTION_OUI_MAXIMUM_ID][ACTION_OUI_MAX_STR_LEN];
103 	uint32_t total_extensions;
104 	uint32_t host_only_extensions;
105 	uint32_t max_extensions;
106 	struct action_oui_priv *oui_priv[ACTION_OUI_MAXIMUM_ID];
107 	struct action_oui_tx_ops tx_ops;
108 };
109 
110 /**
111  * action_oui_parse() - Parse action oui string
112  * @psoc_priv: pointer to action_oui psoc priv obj
113  * @oui_string: string to be parsed
114  * @action_id: type of the action to be parsed
115  *
116  * This function parses the action oui string, extracts extensions and
117  * stores them @action_oui_priv using list data structure.
118  *
119  * Return: QDF_STATUS
120  *
121  */
122 QDF_STATUS
123 action_oui_parse(struct action_oui_psoc_priv *psoc_priv,
124 		 uint8_t *oui_string, enum action_oui_id action_id);
125 
126 /**
127  * action_oui_parse_string() - Parse action oui string
128  * @psoc: psoc object
129  * @in_str: string to be parsed
130  * @action_id: type of the action to be parsed
131  *
132  * This function will validate the input string and call action_oui_parse
133  * to parse it.
134  *
135  * Return: QDF_STATUS
136  *
137  */
138 QDF_STATUS
139 action_oui_parse_string(struct wlan_objmgr_psoc *psoc,
140 			const uint8_t *in_str,
141 			enum action_oui_id action_id);
142 
143 /**
144  * action_oui_send() - Send action oui extensions to target_if.
145  * @psoc_priv: pointer to action_oui psoc priv obj
146  * @action_id: type of the action to send
147  *
148  * This function sends action oui extensions to target_if.
149  *
150  * Return: QDF_STATUS
151  *
152  */
153 QDF_STATUS
154 action_oui_send(struct action_oui_psoc_priv *psoc_priv,
155 		enum action_oui_id action_id);
156 
157 /**
158  * action_oui_search() - Check if Vendor OUIs are present in IE buffer
159  * @psoc_priv: pointer to action_oui psoc priv obj
160  * @attr: pointer to structure containing type of action, beacon IE data etc.,
161  * @action_id: type of action to be checked
162  *
163  * This function parses the IE buffer and finds if any of the vendor OUI
164  * and related attributes are present in it.
165  *
166  * Return: If vendor OUI is present return true else false
167  */
168 bool
169 action_oui_search(struct action_oui_psoc_priv *psoc_priv,
170 		  struct action_oui_search_attr *attr,
171 		  enum action_oui_id action_id);
172 
173 /**
174  * action_oui_is_empty() - Check action oui present or not
175  * @psoc_priv: action psoc private object
176  * @action_id: action oui id
177  *
178  * This function will check action oui present or not for specific action type.
179  *
180  * Return: True if no action oui for the action type.
181  */
182 bool
183 action_oui_is_empty(struct action_oui_psoc_priv *psoc_priv,
184 		    enum action_oui_id action_id);
185 #endif /* End  of _WLAN_ACTION_OUI_PRIV_STRUCT_H_ */
186