xref: /wlan-driver/qcacld-3.0/components/action_oui/core/inc/wlan_action_oui_main.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 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  * various notification handlers and logging functions.
24  *
25  * Note: This API should be never accessed out of action_oui component.
26  */
27 
28 #ifndef _WLAN_ACTION_OUI_MAIN_H_
29 #define _WLAN_ACTION_OUI_MAIN_H_
30 
31 #include <qdf_types.h>
32 #include "wlan_action_oui_public_struct.h"
33 #include "wlan_action_oui_priv.h"
34 #include "wlan_action_oui_objmgr.h"
35 
36 #define action_oui_log(level, args...) \
37 	QDF_TRACE(QDF_MODULE_ID_ACTION_OUI, level, ## args)
38 
39 #define action_oui_logfl(level, format, args...) \
40 	action_oui_log(level, FL(format), ## args)
41 
42 #define action_oui_fatal(format, args...) \
43 		action_oui_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
44 #define action_oui_err(format, args...) \
45 		action_oui_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
46 #define action_oui_warn(format, args...) \
47 		action_oui_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
48 #define action_oui_info(format, args...) \
49 		action_oui_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
50 #define action_oui_debug(format, args...) \
51 		action_oui_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
52 
53 #define ACTION_OUI_ENTER() action_oui_debug("enter")
54 #define ACTION_OUI_EXIT() action_oui_debug("exit")
55 
56 /**
57  * action_oui_psoc_create_notification(): Handler for psoc create notify.
58  * @psoc: psoc which is going to be created by objmgr
59  * @arg: argument for notification handler.
60  *
61  * Allocate and attach psoc private object.
62  *
63  * Return: QDF_STATUS status in case of success else return error.
64  */
65 QDF_STATUS
66 action_oui_psoc_create_notification(struct wlan_objmgr_psoc *psoc, void *arg);
67 
68 /**
69  * action_oui_psoc_destroy_notification(): Handler for psoc destroy notify.
70  * @psoc: psoc which is going to be destroyed by objmgr
71  * @arg: argument for notification handler.
72  *
73  * Deallocate and detach psoc private object.
74  *
75  * Return QDF_STATUS status in case of success else return error
76  */
77 QDF_STATUS
78 action_oui_psoc_destroy_notification(struct wlan_objmgr_psoc *psoc, void *arg);
79 
80 /**
81  * wlan_action_oui_search() - Check for OUIs and related info in IE data.
82  * @psoc: objmgr psoc object
83  * @attr: pointer to structure containing type of action, beacon IE data etc.,
84  * @action_id: type of action to be checked
85  *
86  * This is a wrapper function which invokes internal function to search
87  * for OUIs and related info (specified from ini file) in vendor specific
88  * data of beacon IE for given action.
89  *
90  * Return: If search is successful return true else false.
91  */
92 #ifdef WLAN_FEATURE_ACTION_OUI
93 bool wlan_action_oui_search(struct wlan_objmgr_psoc *psoc,
94 			    struct action_oui_search_attr *attr,
95 			    enum action_oui_id action_id);
96 
97 /**
98  * wlan_action_oui_is_empty() - Check action oui present or not
99  * @psoc: psoc object
100  * @action_id: action oui id
101  *
102  * This function will check action oui present or not for specific action type.
103  *
104  * Return: True if no action oui for the action type.
105  */
106 bool wlan_action_oui_is_empty(struct wlan_objmgr_psoc *psoc,
107 			      enum action_oui_id action_id);
108 
109 /**
110  * wlan_action_oui_cleanup() - Remove all of existing oui entry.
111  * @psoc_priv: action oui objmgr private context
112  * @action_id: type of action to be removed
113  *
114  * This is a wrapper function which invokes internal function to remove
115  * all of existing oui entry.
116  *
117  * Return: QDF_STATUS_SUCCESS If remove is successful.
118  */
119 QDF_STATUS
120 wlan_action_oui_cleanup(struct action_oui_psoc_priv *psoc_priv,
121 			enum action_oui_id action_id);
122 
123 /**
124  * action_oui_psoc_enable() - Notify action OUI psoc enable
125  * @psoc: objmgr psoc object
126  *
127  * Return: void
128  */
129 void action_oui_psoc_enable(struct wlan_objmgr_psoc *psoc);
130 
131 /**
132  * action_oui_psoc_disable() - Notify action OUI psoc disable
133  * @psoc: objmgr psoc object
134  *
135  * Return: void
136  */
137 void action_oui_psoc_disable(struct wlan_objmgr_psoc *psoc);
138 
139 #else
140 static inline
wlan_action_oui_search(struct wlan_objmgr_psoc * psoc,struct action_oui_search_attr * attr,enum action_oui_id action_id)141 bool wlan_action_oui_search(struct wlan_objmgr_psoc *psoc,
142 			    struct action_oui_search_attr *attr,
143 			    enum action_oui_id action_id)
144 {
145 	return false;
146 }
147 
148 static inline
wlan_action_oui_is_empty(struct wlan_objmgr_psoc * psoc,enum action_oui_id action_id)149 bool wlan_action_oui_is_empty(struct wlan_objmgr_psoc *psoc,
150 			      enum action_oui_id action_id)
151 {
152 	return true;
153 }
154 
155 static inline QDF_STATUS
wlan_action_oui_cleanup(struct action_oui_psoc_priv * psoc_priv,enum action_oui_id action_id)156 wlan_action_oui_cleanup(struct action_oui_psoc_priv *psoc_priv,
157 			enum action_oui_id action_id)
158 {
159 	return QDF_STATUS_SUCCESS;
160 }
161 
162 static inline
action_oui_psoc_enable(struct wlan_objmgr_psoc * psoc)163 void action_oui_psoc_enable(struct wlan_objmgr_psoc *psoc)
164 {
165 }
166 
167 static inline
action_oui_psoc_disable(struct wlan_objmgr_psoc * psoc)168 void action_oui_psoc_disable(struct wlan_objmgr_psoc *psoc)
169 {
170 }
171 
172 #endif
173 #endif /* end  of _WLAN_ACTION_OUI_MAIN_H_ */
174