xref: /wlan-driver/qca-wifi-host-cmn/umac/cmn_services/serialization/src/wlan_serialization_utf_i.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name 
20*5113495bSYour Name /**
21*5113495bSYour Name  * DOC: Defines the data structures used by the unit test framework for
22*5113495bSYour Name  * serialization module
23*5113495bSYour Name  */
24*5113495bSYour Name 
25*5113495bSYour Name #ifndef _WLAN_SERIALIZATION_UTF_I_H_
26*5113495bSYour Name #define _WLAN_SERIALIZATION_UTF_I_H_
27*5113495bSYour Name 
28*5113495bSYour Name #define WLAN_SER_UTF_MAX_VDEVS 4
29*5113495bSYour Name #define WLAN_SER_UTF_SCAN_CMD_TESTS 33
30*5113495bSYour Name #define WLAN_SER_UTF_TIMER_TIMEOUT_MS 5000
31*5113495bSYour Name #define WLAN_SER_UTF_TEST_CMD_TIMEOUT_MS 30000
32*5113495bSYour Name 
33*5113495bSYour Name /* Sample string: SER_Vxx_Cxx */
34*5113495bSYour Name #define WLAN_SER_UTF_STR_SIZE 15
35*5113495bSYour Name #define WLAN_SER_DATA_STR(_s, _v, _i) \
36*5113495bSYour Name 	scnprintf(_s, WLAN_SER_UTF_STR_SIZE, "SER_V%u_C%u", _v, _i)
37*5113495bSYour Name 
38*5113495bSYour Name #define SER_UTF_BLOCK_STR(_x) (_x ? "BLOCK" : "NON-BLOCK")
39*5113495bSYour Name 
40*5113495bSYour Name char *wlan_serialization_status_strings[] = {
41*5113495bSYour Name 	"WLAN_SER_CMD_PENDING",
42*5113495bSYour Name 	"WLAN_SER_CMD_ACTIVE",
43*5113495bSYour Name 	"WLAN_SER_CMD_DENIED_RULES_FAILED",
44*5113495bSYour Name 	"WLAN_SER_CMD_DENIED_LIST_FULL",
45*5113495bSYour Name 	"WLAN_SER_CMD_DENIED_UNSPECIFIED",
46*5113495bSYour Name };
47*5113495bSYour Name 
48*5113495bSYour Name /**
49*5113495bSYour Name  * enum wlan_ser_utf_tc_id - Test case id
50*5113495bSYour Name  * @SER_UTF_TC_DEINIT: Deinit UTF
51*5113495bSYour Name  * @SER_UTF_TC_INIT: Init UTF
52*5113495bSYour Name  * @SER_UTF_TC_ADD: Add a custom cmd to queue
53*5113495bSYour Name  * @SER_UTF_TC_REMOVE: Remove a custom cmd from queue
54*5113495bSYour Name  * @SER_UTF_TC_CANCEL: Cancel a custom cmd from queue
55*5113495bSYour Name  * @SER_UTF_TC_SINGLE_SCAN: Add and remove a single scan cmd
56*5113495bSYour Name  * @SER_UTF_TC_MULTI_SCAN: Add and remove a multiple scan cmd
57*5113495bSYour Name  * @SER_UTF_TC_MAX_SCAN: Add and remove a maximum scan cmd
58*5113495bSYour Name  * @SER_UTF_TC_SINGLE_NONSCAN: Add and remove a single nonscan cmd
59*5113495bSYour Name  * @SER_UTF_TC_MULTI_NONSCAN: Add and remove a multiple nonscan cmd
60*5113495bSYour Name  * @SER_UTF_TC_MAX_NONSCAN: Add and remove a maximum nonscan cmd
61*5113495bSYour Name  * @SER_UTF_TC_MULTI_VDEV_NONSCAN: Add nonscan cmd across multiple vdev
62*5113495bSYour Name  * @SER_UTF_TC_CANCEL_SCAN_AC_SINGLE: Cancel single scan from active queue
63*5113495bSYour Name  * @SER_UTF_TC_CANCEL_SCAN_AC_PDEV: Cancel pdev scan from active queue
64*5113495bSYour Name  * @SER_UTF_TC_CANCEL_SCAN_AC_VDEV: Cancel vdev scan from active queue
65*5113495bSYour Name  * @SER_UTF_TC_CANCEL_SCAN_PD_SINGLE: Cancel single scan from pending queue
66*5113495bSYour Name  * @SER_UTF_TC_CANCEL_SCAN_PD_PDEV: Cancel pdev scan from pending queue
67*5113495bSYour Name  * @SER_UTF_TC_CANCEL_SCAN_PD_VDEV: Cancel vdev scan from pending queue
68*5113495bSYour Name  * @SER_UTF_TC_CANCEL_NONSCAN_AC_SINGLE: Cancel single nonscan from active queue
69*5113495bSYour Name  * @SER_UTF_TC_CANCEL_NONSCAN_AC_PDEV: Cancel pdev nonscan from active queue
70*5113495bSYour Name  * @SER_UTF_TC_CANCEL_NONSCAN_AC_VDEV: Cancel vdev nonscan from active queue
71*5113495bSYour Name  * @SER_UTF_TC_CANCEL_NONSCAN_PD_SINGLE: Cancel nonscan from pending queue
72*5113495bSYour Name  * @SER_UTF_TC_CANCEL_NONSCAN_PD_PDEV: Cancel pdev nonscan from pending queue
73*5113495bSYour Name  * @SER_UTF_TC_CANCEL_NONSCAN_PD_VDEV: Cancel vdev nonscan from pending queue
74*5113495bSYour Name  * @SER_UTF_TC_START_BSS_FILTERING: Test start_bss filtering logic
75*5113495bSYour Name  * @SER_UTF_TC_STOP_BSS_FILTERING: Test stop_bss filtering logic
76*5113495bSYour Name  * @SER_UTF_TC_ADD_BLOCKING_NONSCAN_AC_1: Add blocking cmd to active queue
77*5113495bSYour Name  * @SER_UTF_TC_ADD_BLOCKING_NONSCAN_PD_1: Add blocking cmd to pending queue with
78*5113495bSYour Name  *			blocking cmd in active queue
79*5113495bSYour Name  * @SER_UTF_TC_ADD_BLOCKING_NONSCAN_PD_2: Add blocking cmd to pending queue with
80*5113495bSYour Name  *			non-blocking cmd in active queue
81*5113495bSYour Name  * @SER_UTF_TC_ADD_BLOCKING_NONSCAN_PD_3: Add blocking cmd to tail of
82*5113495bSYour Name  *			pending queue with non-blocking cmd in active queue
83*5113495bSYour Name  * @SER_UTF_TC_ADD_BLOCKING_NONSCAN_PD_4: Add blocking cmd to pending between
84*5113495bSYour Name  *			non-blocking cmd in pending and active queue
85*5113495bSYour Name  * @SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_1: Add blocking nonscan cmd
86*5113495bSYour Name  *			across multiple vdev
87*5113495bSYour Name  * @SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_2: Add blocking nonscan cmd
88*5113495bSYour Name  *		to a pending queue of vdev with non-blocking across multi vdev
89*5113495bSYour Name  * @SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_3: Add blocking nonscan cmd
90*5113495bSYour Name  *		to a active queue of vdev with non-blocking across multiple vdev
91*5113495bSYour Name  * @SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_4: Add blocking nonscan cmd to the
92*5113495bSYour Name  *		pending queue of multi vdev with non-blocking across multi vdev
93*5113495bSYour Name  * @SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_5: Add blocking nonscan cmd to the
94*5113495bSYour Name  *		pending queue of multi vdev with non-blocking across multi vdev
95*5113495bSYour Name  *		in pending and active queue
96*5113495bSYour Name  * @SER_UTF_TC_HIGH_PRIO_NONSCAN_WO_BL: Add high priority nonscan cmd
97*5113495bSYour Name  *		to the tail of pending queue
98*5113495bSYour Name  * @SER_UTF_TC_HIGH_PRIO_NONSCAN_W_BL: Add high priority nonscan cmd
99*5113495bSYour Name  *		to the pending queue between normal priority command
100*5113495bSYour Name  * @SER_UTF_TC_HIGH_PRIO_BL_NONSCAN: Add high priority blocking
101*5113495bSYour Name  *		nonscan cmd to the tail of pending queue
102*5113495bSYour Name  */
103*5113495bSYour Name enum wlan_ser_utf_tc_id {
104*5113495bSYour Name 	SER_UTF_TC_DEINIT,
105*5113495bSYour Name 	SER_UTF_TC_INIT,
106*5113495bSYour Name 	SER_UTF_TC_ADD,
107*5113495bSYour Name 	SER_UTF_TC_REMOVE,
108*5113495bSYour Name 	SER_UTF_TC_CANCEL,
109*5113495bSYour Name 	SER_UTF_TC_SINGLE_SCAN,
110*5113495bSYour Name 	SER_UTF_TC_MULTI_SCAN,
111*5113495bSYour Name 	SER_UTF_TC_MAX_SCAN,
112*5113495bSYour Name 	SER_UTF_TC_SINGLE_NONSCAN,
113*5113495bSYour Name 	SER_UTF_TC_MULTI_NONSCAN,
114*5113495bSYour Name 	SER_UTF_TC_MAX_NONSCAN,
115*5113495bSYour Name 	SER_UTF_TC_MULTI_VDEV_NONSCAN,
116*5113495bSYour Name 	SER_UTF_TC_CANCEL_SCAN_AC_SINGLE,
117*5113495bSYour Name 	SER_UTF_TC_CANCEL_SCAN_AC_PDEV,
118*5113495bSYour Name 	SER_UTF_TC_CANCEL_SCAN_AC_VDEV,
119*5113495bSYour Name 	SER_UTF_TC_CANCEL_SCAN_PD_SINGLE,
120*5113495bSYour Name 	SER_UTF_TC_CANCEL_SCAN_PD_PDEV,
121*5113495bSYour Name 	SER_UTF_TC_CANCEL_SCAN_PD_VDEV,
122*5113495bSYour Name 	SER_UTF_TC_CANCEL_NONSCAN_AC_SINGLE,
123*5113495bSYour Name 	SER_UTF_TC_CANCEL_NONSCAN_AC_PDEV,
124*5113495bSYour Name 	SER_UTF_TC_CANCEL_NONSCAN_AC_VDEV,
125*5113495bSYour Name 	SER_UTF_TC_CANCEL_NONSCAN_PD_SINGLE,
126*5113495bSYour Name 	SER_UTF_TC_CANCEL_NONSCAN_PD_PDEV,
127*5113495bSYour Name 	SER_UTF_TC_CANCEL_NONSCAN_PD_VDEV,
128*5113495bSYour Name 	SER_UTF_TC_START_BSS_FILTERING,
129*5113495bSYour Name 	SER_UTF_TC_STOP_BSS_FILTERING,
130*5113495bSYour Name 	SER_UTF_TC_ADD_BLOCKING_NONSCAN_AC_1,
131*5113495bSYour Name 	SER_UTF_TC_ADD_BLOCKING_NONSCAN_PD_1,
132*5113495bSYour Name 	SER_UTF_TC_ADD_BLOCKING_NONSCAN_PD_2,
133*5113495bSYour Name 	SER_UTF_TC_ADD_BLOCKING_NONSCAN_PD_3,
134*5113495bSYour Name 	SER_UTF_TC_ADD_BLOCKING_NONSCAN_PD_4,
135*5113495bSYour Name 	SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_1,
136*5113495bSYour Name 	SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_2,
137*5113495bSYour Name 	SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_3,
138*5113495bSYour Name 	SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_4,
139*5113495bSYour Name 	SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_5,
140*5113495bSYour Name 	SER_UTF_TC_HIGH_PRIO_NONSCAN_WO_BL,
141*5113495bSYour Name 	SER_UTF_TC_HIGH_PRIO_NONSCAN_W_BL,
142*5113495bSYour Name 	SER_UTF_TC_HIGH_PRIO_BL_NONSCAN,
143*5113495bSYour Name };
144*5113495bSYour Name 
145*5113495bSYour Name /**
146*5113495bSYour Name  * struct wlan_ser_utf_data - Test data
147*5113495bSYour Name  * @id: Test variable
148*5113495bSYour Name  * @str: String tag associated with the command
149*5113495bSYour Name  */
150*5113495bSYour Name struct wlan_ser_utf_data {
151*5113495bSYour Name 	uint8_t id;
152*5113495bSYour Name 	char str[WLAN_SER_UTF_STR_SIZE + 1];
153*5113495bSYour Name };
154*5113495bSYour Name 
155*5113495bSYour Name /**
156*5113495bSYour Name  * struct wlan_ser_utf_vdev_info - Information used by the vdevs
157*5113495bSYour Name  * @vdev: Vdev object manager information
158*5113495bSYour Name  * @ser_count: Serialization command count for the vdev
159*5113495bSYour Name  * @utf_scan_timer: Timer for scan commands
160*5113495bSYour Name  * @utf_nonscan_timer: Timer for non-scan commands
161*5113495bSYour Name  */
162*5113495bSYour Name struct wlan_ser_utf_vdev_info {
163*5113495bSYour Name 	struct wlan_objmgr_vdev *vdev;
164*5113495bSYour Name 	uint8_t ser_count;
165*5113495bSYour Name 	qdf_timer_t utf_scan_timer[WLAN_SER_UTF_SCAN_CMD_TESTS];
166*5113495bSYour Name 	qdf_timer_t utf_nonscan_timer[WLAN_SER_UTF_SCAN_CMD_TESTS];
167*5113495bSYour Name };
168*5113495bSYour Name 
169*5113495bSYour Name /**
170*5113495bSYour Name  * wlan_ser_utf_cb() - Serialization callback function
171*5113495bSYour Name  * @cmd: Serialization command info
172*5113495bSYour Name  * @reason: Serialization reason for callback execution
173*5113495bSYour Name  *
174*5113495bSYour Name  * Return: Status of callback execution
175*5113495bSYour Name  */
176*5113495bSYour Name QDF_STATUS wlan_ser_utf_cb(struct wlan_serialization_command *cmd,
177*5113495bSYour Name 			   enum wlan_serialization_cb_reason reason);
178*5113495bSYour Name 
179*5113495bSYour Name #endif /* _WLAN_SERIALIZATION_UTF_I_H_ */
180*5113495bSYour Name 
181