xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/serialization/src/wlan_serialization_main_i.h (revision dce49ecf59c14c92bd781c4b572279dfb68173a3)
1 /*
2  * Copyright (c) 2017 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 /**
19  * DOC: wlan_serialization_main.h
20  * This file contains all the prototype definitions necessary for the
21  * serialization component's internal functions
22  */
23 #ifndef __WLAN_SERIALIZATION_MAIN_I_H
24 #define __WLAN_SERIALIZATION_MAIN_I_H
25 /* Include files */
26 #include "wlan_objmgr_cmn.h"
27 #include "wlan_objmgr_psoc_obj.h"
28 #include "wlan_objmgr_pdev_obj.h"
29 #include "wlan_serialization_api.h"
30 #include "wlan_serialization_rules_i.h"
31 #include "wlan_serialization_utils_i.h"
32 #include "qdf_mc_timer.h"
33 
34 #define WLAN_SERIALIZATION_MAX_GLOBAL_POOL_CMDS 24
35 #define WLAN_SERIALIZATION_MAX_ACTIVE_CMDS 1
36 #define WLAN_SERIALIZATION_MAX_ACTIVE_SCAN_CMDS 8
37 
38 #define serialization_log(level, args...) \
39 	QDF_TRACE(QDF_MODULE_ID_SERIALIZATION, level, ## args)
40 #define serialization_logfl(level, format, args...) \
41 	serialization_log(level, FL(format), ## args)
42 
43 #define serialization_alert(format, args...) \
44 	serialization_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
45 #define serialization_err(format, args...) \
46 	serialization_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
47 #define serialization_warn(format, args...) \
48 	serialization_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
49 #define serialization_notice(format, args...) \
50 	serialization_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
51 #define serialization_info(format, args...) \
52 	serialization_logfl(QDF_TRACE_LEVEL_INFO_HIGH, format, ## args)
53 #define serialization_debug(format, args...) \
54 	serialization_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
55 
56 
57 /**
58  * struct wlan_serialization_timer - Timer used for serialization
59  * @cmd:      Cmd to which the timer is linked
60  * @timer:    Timer associated with the command
61  *
62  * Timers are allocated statically during init, one each for the
63  * maximum active commands permitted in the system. Once a cmd is
64  * moved from pending list to active list, the timer is activated
65  * and once the cmd is completed, the timer is cancelled. Timer is
66  * also cancelled if the command is aborted
67  *
68  * The timers are maintained per psoc. A timer is associated to
69  * unique combination of pdev, cmd_type and cmd_id.
70  */
71 struct wlan_serialization_timer {
72 	struct wlan_serialization_command *cmd;
73 	qdf_mc_timer_t timer;
74 };
75 
76 /**
77  * struct wlan_serialization_command_list - List of commands to be serialized
78  * @node: Node identifier in the list
79  * @cmd: Command to be serialized
80  */
81 struct wlan_serialization_command_list {
82 	qdf_list_node_t node;
83 	struct wlan_serialization_command cmd;
84 };
85 
86 /**
87  * wlan_serialization_psoc_obj_create_notification() - PSOC obj create callback
88  * @psoc: PSOC object
89  * @arg_list: Variable argument list
90  *
91  * This callback is registered with object manager during initialization and
92  * when obj manager gets its turn to create the object, it would notify each
93  * component with the corresponding callback registered to inform the
94  * completion of the creation of the respective object.
95  *
96  * Return: QDF Status
97  */
98 QDF_STATUS wlan_serialization_psoc_obj_create_notification(
99 		struct wlan_objmgr_psoc *psoc, void *arg_list);
100 
101 /**
102  * wlan_serialization_psoc_obj_destroy_notification() - PSOC obj delete callback
103  * @psoc: PSOC object
104  * @arg_list: Variable argument list
105  *
106  * This callback is registered with object manager during initialization and
107  * when obj manager gets its turn to delete the object, it would notify each
108  * component with the corresponding callback registered to inform the
109  * completion of the deletion of the respective object.
110  *
111  * Return: QDF Status
112  */
113 QDF_STATUS  wlan_serialization_psoc_obj_destroy_notification(
114 		struct wlan_objmgr_psoc *psoc, void *arg_list);
115 
116 /**
117  * wlan_serialization_pdev_obj_create_notification() - PDEV obj create callback
118  * @psoc: PDEV object
119  * @arg_list: Variable argument list
120  *
121  * This callback is registered with object manager during initialization and
122  * when obj manager gets its turn to create the object, it would notify each
123  * component with the corresponding callback registered to inform the
124  * completion of the creation of the respective object.
125  *
126  * Return: QDF Status
127  */
128 QDF_STATUS wlan_serialization_pdev_obj_create_notification(
129 		struct wlan_objmgr_pdev *pdev, void *arg_list);
130 
131 /**
132  * wlan_serialization_pdev_obj_destroy_notification() - PSOC obj delete callback
133  * @pdev: PDEV object
134  * @arg_list: Variable argument list
135  *
136  * This callback is registered with object manager during initialization and
137  * when obj manager gets its turn to delete the object, it would notify each
138  * component with the corresponding callback registered to inform the
139  * completion of the deletion of the respective object.
140  *
141  * Return: QDF Status
142  */
143 QDF_STATUS wlan_serialization_pdev_obj_destroy_notification(
144 		struct wlan_objmgr_pdev *pdev, void *arg_list);
145 
146 #endif
147