1 /*
2  * Copyright (c) 2018-2019 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 /**
20  * DOC: Implements the unit test framework for serialization module
21  */
22 
23 #include <qdf_status.h>
24 #include <qdf_timer.h>
25 #include <wlan_objmgr_cmn.h>
26 #include <wlan_objmgr_vdev_obj.h>
27 #include <wlan_serialization_api.h>
28 #include "wlan_serialization_main_i.h"
29 #include "wlan_serialization_utf_i.h"
30 
31 struct wlan_ser_utf_vdev_info ser_utf_vdev[WLAN_SER_UTF_MAX_VDEVS];
32 
33 struct wlan_ser_utf_data *
wlan_ser_utf_data_alloc(struct wlan_ser_utf_data ** ser_data,struct wlan_objmgr_vdev * vdev,uint8_t cmd_id)34 wlan_ser_utf_data_alloc(struct wlan_ser_utf_data **ser_data,
35 			struct wlan_objmgr_vdev *vdev,
36 			uint8_t cmd_id)
37 {
38 	struct wlan_ser_utf_data *data;
39 
40 	data = qdf_mem_malloc(sizeof(*data));
41 
42 	if (!data) {
43 		QDF_ASSERT(0);
44 		return data;
45 	}
46 
47 	data->id = cmd_id;
48 	WLAN_SER_DATA_STR(data->str, wlan_vdev_get_id(vdev), cmd_id);
49 
50 	*ser_data = data;
51 	return data;
52 }
53 
54 enum wlan_serialization_status
wlan_ser_utf_add_cmd(struct wlan_serialization_command * cmd)55 wlan_ser_utf_add_cmd(struct wlan_serialization_command *cmd)
56 {
57 	enum wlan_serialization_status status;
58 	struct wlan_ser_utf_data *data = cmd->umac_cmd;
59 
60 	cmd->cmd_timeout_duration = WLAN_SER_UTF_TEST_CMD_TIMEOUT_MS;
61 	cmd->source = WLAN_UMAC_COMP_SERIALIZATION;
62 	cmd->cmd_cb = wlan_ser_utf_cb;
63 
64 	status = wlan_serialization_request(cmd);
65 	ser_debug("ADD : cmd_type:%d %9s %s status: %s",
66 		  cmd->cmd_type, SER_UTF_BLOCK_STR(cmd->is_blocking), data->str,
67 		  wlan_serialization_status_strings[status]);
68 
69 	return status;
70 }
71 
72 enum wlan_serialization_status
wlan_ser_utf_add_scan_cmd(struct wlan_objmgr_vdev * vdev,uint32_t cmd_id,void * umac_cmd,bool is_high_priority)73 wlan_ser_utf_add_scan_cmd(struct wlan_objmgr_vdev *vdev,
74 			  uint32_t cmd_id, void *umac_cmd,
75 			  bool is_high_priority)
76 {
77 	struct wlan_serialization_command cmd;
78 
79 	cmd.vdev = vdev;
80 	cmd.cmd_id = cmd_id;
81 	cmd.umac_cmd = umac_cmd;
82 	cmd.is_high_priority = is_high_priority;
83 	cmd.is_blocking = false;
84 	cmd.cmd_type = WLAN_SER_CMD_SCAN;
85 
86 	return wlan_ser_utf_add_cmd(&cmd);
87 }
88 
89 enum wlan_serialization_status
wlan_ser_utf_add_nonscan_cmd(struct wlan_objmgr_vdev * vdev,uint32_t cmd_id,void * umac_cmd,bool is_high_priority,bool is_blocking)90 wlan_ser_utf_add_nonscan_cmd(struct wlan_objmgr_vdev *vdev,
91 			     uint32_t cmd_id, void *umac_cmd,
92 			     bool is_high_priority, bool is_blocking)
93 {
94 	struct wlan_serialization_command cmd;
95 
96 	cmd.vdev = vdev;
97 	cmd.cmd_id = cmd_id;
98 	cmd.umac_cmd = umac_cmd;
99 	cmd.is_blocking = is_blocking;
100 	cmd.is_high_priority = is_high_priority;
101 	cmd.cmd_type = WLAN_SER_CMD_NONSCAN;
102 
103 	return wlan_ser_utf_add_cmd(&cmd);
104 }
105 
wlan_ser_utf_remove_scan_cmd(struct wlan_objmgr_vdev * vdev,uint32_t cmd_id)106 void wlan_ser_utf_remove_scan_cmd(struct wlan_objmgr_vdev *vdev,
107 				  uint32_t cmd_id)
108 {
109 	struct wlan_serialization_queued_cmd_info cmd;
110 
111 	cmd.vdev = vdev;
112 	cmd.cmd_id = cmd_id;
113 	cmd.cmd_type = WLAN_SER_CMD_SCAN;
114 	cmd.requestor = WLAN_UMAC_COMP_SERIALIZATION;
115 
116 	wlan_serialization_remove_cmd(&cmd);
117 }
118 
wlan_ser_utf_remove_nonscan_cmd(struct wlan_objmgr_vdev * vdev,uint32_t cmd_id)119 void wlan_ser_utf_remove_nonscan_cmd(struct wlan_objmgr_vdev *vdev,
120 				     uint32_t cmd_id)
121 {
122 	struct wlan_serialization_queued_cmd_info cmd;
123 
124 	cmd.vdev = vdev;
125 	cmd.cmd_id = cmd_id;
126 	cmd.cmd_type = WLAN_SER_CMD_NONSCAN;
127 	cmd.requestor = WLAN_UMAC_COMP_SERIALIZATION;
128 
129 	wlan_serialization_remove_cmd(&cmd);
130 }
131 
132 enum wlan_serialization_cmd_status
wlan_ser_utf_cancel_scan_cmd(struct wlan_objmgr_vdev * vdev,uint32_t cmd_id,uint8_t queue_type,enum wlan_serialization_cancel_type req_type)133 wlan_ser_utf_cancel_scan_cmd(struct wlan_objmgr_vdev *vdev,
134 			     uint32_t cmd_id, uint8_t queue_type,
135 			     enum wlan_serialization_cancel_type req_type)
136 {
137 	struct wlan_serialization_queued_cmd_info cmd;
138 
139 	cmd.vdev = vdev;
140 	cmd.cmd_id = cmd_id;
141 	cmd.queue_type = queue_type;
142 	cmd.req_type = req_type;
143 	cmd.cmd_type = WLAN_SER_CMD_SCAN;
144 	cmd.requestor = WLAN_UMAC_COMP_SERIALIZATION;
145 
146 	return wlan_serialization_cancel_request(&cmd);
147 }
148 
149 enum wlan_serialization_cmd_status
wlan_ser_utf_cancel_nonscan_cmd(struct wlan_objmgr_vdev * vdev,uint32_t cmd_id,uint8_t queue_type,enum wlan_serialization_cancel_type req_type)150 wlan_ser_utf_cancel_nonscan_cmd(struct wlan_objmgr_vdev *vdev,
151 				uint32_t cmd_id, uint8_t queue_type,
152 				enum wlan_serialization_cancel_type req_type)
153 {
154 	struct wlan_serialization_queued_cmd_info cmd;
155 
156 	cmd.vdev = vdev;
157 	cmd.cmd_id = cmd_id;
158 	cmd.queue_type = queue_type;
159 	cmd.req_type = req_type;
160 	cmd.cmd_type = WLAN_SER_CMD_NONSCAN;
161 	cmd.requestor = WLAN_UMAC_COMP_SERIALIZATION;
162 
163 	return wlan_serialization_cancel_request(&cmd);
164 }
165 
wlan_ser_utf_remove_start_bss_cmd(struct wlan_objmgr_vdev * vdev,uint32_t cmd_id)166 void wlan_ser_utf_remove_start_bss_cmd(struct wlan_objmgr_vdev *vdev,
167 				       uint32_t cmd_id)
168 {
169 	struct wlan_serialization_queued_cmd_info cmd;
170 
171 	cmd.vdev = vdev;
172 	cmd.cmd_id = cmd_id;
173 	cmd.cmd_type = WLAN_SER_CMD_VDEV_START_BSS;
174 	cmd.requestor = WLAN_UMAC_COMP_SERIALIZATION;
175 
176 	wlan_serialization_remove_cmd(&cmd);
177 }
178 
wlan_ser_utf_remove_stop_bss_cmd(struct wlan_objmgr_vdev * vdev,uint32_t cmd_id)179 void wlan_ser_utf_remove_stop_bss_cmd(struct wlan_objmgr_vdev *vdev,
180 				      uint32_t cmd_id)
181 {
182 	struct wlan_serialization_queued_cmd_info cmd;
183 
184 	cmd.vdev = vdev;
185 	cmd.cmd_id = cmd_id;
186 	cmd.cmd_type = WLAN_SER_CMD_VDEV_STOP_BSS;
187 	cmd.requestor = WLAN_UMAC_COMP_SERIALIZATION;
188 
189 	wlan_serialization_remove_cmd(&cmd);
190 }
191 
192 enum wlan_serialization_cmd_status
wlan_ser_utf_cancel_start_bss_cmd(struct wlan_objmgr_vdev * vdev,uint32_t cmd_id,uint8_t queue_type,enum wlan_serialization_cancel_type req_type)193 wlan_ser_utf_cancel_start_bss_cmd(struct wlan_objmgr_vdev *vdev,
194 				  uint32_t cmd_id, uint8_t queue_type,
195 				  enum wlan_serialization_cancel_type req_type)
196 {
197 	struct wlan_serialization_queued_cmd_info cmd;
198 
199 	cmd.vdev = vdev;
200 	cmd.cmd_id = cmd_id;
201 	cmd.queue_type = queue_type;
202 	cmd.req_type = req_type;
203 	cmd.cmd_type = WLAN_SER_CMD_VDEV_START_BSS;
204 	cmd.requestor = WLAN_UMAC_COMP_SERIALIZATION;
205 
206 	return wlan_serialization_cancel_request(&cmd);
207 }
208 
209 enum wlan_serialization_cmd_status
wlan_ser_utf_cancel_stop_bss_cmd(struct wlan_objmgr_vdev * vdev,uint32_t cmd_id,uint8_t queue_type,enum wlan_serialization_cancel_type req_type)210 wlan_ser_utf_cancel_stop_bss_cmd(struct wlan_objmgr_vdev *vdev,
211 				 uint32_t cmd_id, uint8_t queue_type,
212 				 enum wlan_serialization_cancel_type req_type)
213 {
214 	struct wlan_serialization_queued_cmd_info cmd;
215 
216 	cmd.vdev = vdev;
217 	cmd.cmd_id = cmd_id;
218 	cmd.queue_type = queue_type;
219 	cmd.req_type = req_type;
220 	cmd.cmd_type = WLAN_SER_CMD_VDEV_STOP_BSS;
221 	cmd.requestor = WLAN_UMAC_COMP_SERIALIZATION;
222 
223 	return wlan_serialization_cancel_request(&cmd);
224 }
225 
226 enum wlan_serialization_status
wlan_ser_utf_add_vdev_stop_bss_cmd(struct wlan_objmgr_vdev * vdev,uint32_t cmd_id,void * umac_cmd,bool is_high_priority,bool is_blocking)227 wlan_ser_utf_add_vdev_stop_bss_cmd(struct wlan_objmgr_vdev *vdev,
228 				   uint32_t cmd_id, void *umac_cmd,
229 				   bool is_high_priority, bool is_blocking)
230 {
231 	struct wlan_serialization_command cmd;
232 	uint8_t queue_type;
233 	enum wlan_serialization_cancel_type req_type;
234 
235 	cmd.vdev = vdev;
236 	cmd.cmd_id = cmd_id;
237 	cmd.umac_cmd = umac_cmd;
238 	cmd.is_blocking = is_blocking;
239 	cmd.is_high_priority = is_high_priority;
240 	cmd.cmd_type = WLAN_SER_CMD_VDEV_STOP_BSS;
241 
242 	/* Command filtering logic */
243 	req_type = WLAN_SER_CANCEL_NON_SCAN_CMD;
244 	queue_type = WLAN_SERIALIZATION_PENDING_QUEUE;
245 	wlan_ser_utf_cancel_start_bss_cmd(vdev, cmd_id,
246 					  queue_type, req_type);
247 
248 	wlan_ser_utf_cancel_stop_bss_cmd(vdev, cmd_id,
249 					 queue_type, req_type);
250 
251 	if (wlan_serialization_is_cmd_present_in_active_queue(NULL, &cmd))
252 		return WLAN_SER_CMD_ACTIVE;
253 
254 	return wlan_ser_utf_add_cmd(&cmd);
255 }
256 
257 enum wlan_serialization_status
wlan_ser_utf_add_vdev_start_bss_cmd(struct wlan_objmgr_vdev * vdev,uint32_t cmd_id,void * umac_cmd,bool is_high_priority,bool is_blocking)258 wlan_ser_utf_add_vdev_start_bss_cmd(struct wlan_objmgr_vdev *vdev,
259 				    uint32_t cmd_id, void *umac_cmd,
260 				    bool is_high_priority, bool is_blocking)
261 {
262 	struct wlan_serialization_command cmd;
263 	uint8_t queue_type;
264 	enum wlan_serialization_cancel_type req_type;
265 	struct wlan_ser_utf_data *data;
266 
267 	cmd.vdev = vdev;
268 	cmd.cmd_id = cmd_id;
269 	cmd.umac_cmd = umac_cmd;
270 	cmd.is_blocking = is_blocking;
271 	cmd.is_high_priority = is_high_priority;
272 	cmd.cmd_type = WLAN_SER_CMD_VDEV_START_BSS;
273 
274 	/* Command filtering logic */
275 	req_type = WLAN_SER_CANCEL_NON_SCAN_CMD;
276 	queue_type = WLAN_SERIALIZATION_PENDING_QUEUE;
277 	wlan_ser_utf_cancel_start_bss_cmd(vdev, cmd_id,
278 					  queue_type, req_type);
279 
280 	if (wlan_serialization_is_cmd_present_in_active_queue(NULL, &cmd)) {
281 		cmd.cmd_type = WLAN_SER_CMD_VDEV_STOP_BSS;
282 		if (!wlan_serialization_is_cmd_present_in_pending_queue(
283 					NULL, &cmd)) {
284 		if (!wlan_ser_utf_data_alloc(&data, vdev, cmd_id))
285 			return WLAN_SER_CMD_DENIED_UNSPECIFIED;
286 			wlan_ser_utf_add_vdev_stop_bss_cmd(
287 					vdev, cmd_id, (void *)data,
288 					is_high_priority, is_blocking);
289 		}
290 	}
291 
292 	cmd.cmd_type = WLAN_SER_CMD_VDEV_START_BSS;
293 	return wlan_ser_utf_add_cmd(&cmd);
294 }
295 
wlan_ser_utf_cb(struct wlan_serialization_command * cmd,enum wlan_serialization_cb_reason reason)296 QDF_STATUS wlan_ser_utf_cb(struct wlan_serialization_command *cmd,
297 			   enum wlan_serialization_cb_reason reason)
298 {
299 	QDF_STATUS status = QDF_STATUS_SUCCESS;
300 	uint8_t vdev_id;
301 	struct wlan_ser_utf_data *data;
302 
303 	if (!cmd) {
304 		ser_err("Error: reason:%d", reason);
305 		QDF_ASSERT(0);
306 		return QDF_STATUS_E_NULL_VALUE;
307 	}
308 
309 	vdev_id = wlan_vdev_get_id(cmd->vdev);
310 	data = cmd->umac_cmd;
311 	if (!data) {
312 		ser_err("Error: reason:%d", reason);
313 		QDF_ASSERT(0);
314 		return QDF_STATUS_E_NULL_VALUE;
315 	}
316 
317 	switch (reason) {
318 	case WLAN_SER_CB_ACTIVATE_CMD:
319 		ser_debug("ACTIVATE: cmd_type:%d %9s %s\n", cmd->cmd_type,
320 			  SER_UTF_BLOCK_STR(cmd->is_blocking), data->str);
321 		break;
322 
323 	case WLAN_SER_CB_CANCEL_CMD:
324 		ser_debug("CANCEL  : cmd_type:%d %9s %s", cmd->cmd_type,
325 			  SER_UTF_BLOCK_STR(cmd->is_blocking), data->str);
326 		break;
327 
328 	case WLAN_SER_CB_ACTIVE_CMD_TIMEOUT:
329 		ser_debug("TIMEOUT : cmd_type:%d %9s %s", cmd->cmd_type,
330 			  SER_UTF_BLOCK_STR(cmd->is_blocking), data->str);
331 		qdf_mem_free(data);
332 		QDF_ASSERT(0);
333 		status = QDF_STATUS_E_INVAL;
334 		break;
335 
336 	case WLAN_SER_CB_RELEASE_MEM_CMD:
337 		ser_debug("RELEASE : cmd_type:%d %9s %s", cmd->cmd_type,
338 			  SER_UTF_BLOCK_STR(cmd->is_blocking), data->str);
339 		qdf_mem_free(data);
340 		break;
341 
342 	default:
343 		status = QDF_STATUS_E_INVAL;
344 		break;
345 	}
346 
347 	return status;
348 }
349 
wlan_ser_utf_scan_timer_cb(void * arg)350 static void wlan_ser_utf_scan_timer_cb(void *arg)
351 {
352 	struct wlan_objmgr_vdev *vdev = (struct wlan_objmgr_vdev *)arg;
353 	uint8_t vdev_id = wlan_vdev_get_id(vdev);
354 
355 	wlan_ser_utf_remove_scan_cmd(vdev, ser_utf_vdev[vdev_id].ser_count++);
356 }
357 
wlan_ser_utf_nonscan_timer_cb(void * arg)358 static void wlan_ser_utf_nonscan_timer_cb(void *arg)
359 {
360 	struct wlan_objmgr_vdev *vdev = (struct wlan_objmgr_vdev *)arg;
361 	uint8_t vdev_id = wlan_vdev_get_id(vdev);
362 
363 	wlan_ser_utf_remove_nonscan_cmd(vdev,
364 					ser_utf_vdev[vdev_id].ser_count++);
365 }
366 
wlan_ser_utf_run(struct wlan_objmgr_vdev * vdev,uint8_t scan_cmd,uint8_t max_cmds,bool is_high_priority,bool is_blocking)367 void wlan_ser_utf_run(struct wlan_objmgr_vdev *vdev, uint8_t scan_cmd,
368 		      uint8_t max_cmds,
369 		      bool is_high_priority, bool is_blocking)
370 {
371 	struct wlan_ser_utf_data *data;
372 	uint8_t id;
373 	uint8_t vdev_id = wlan_vdev_get_id(vdev);
374 	enum wlan_serialization_status ret;
375 
376 	if (!max_cmds)
377 		max_cmds = WLAN_SER_UTF_SCAN_CMD_TESTS;
378 
379 	ser_utf_vdev[vdev_id].ser_count = 0;
380 	for (id = 0; id < max_cmds; id++) {
381 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
382 			return;
383 
384 		if (scan_cmd)
385 			ret = wlan_ser_utf_add_scan_cmd(vdev, id, data,
386 							is_high_priority);
387 		else
388 			ret = wlan_ser_utf_add_nonscan_cmd(vdev, id,
389 							   data,
390 							   is_high_priority,
391 							   is_blocking);
392 	}
393 
394 	for (id = 0; id < max_cmds; id++) {
395 		if (scan_cmd)
396 			qdf_timer_mod(
397 			&ser_utf_vdev[vdev_id].utf_scan_timer[id],
398 			WLAN_SER_UTF_TIMER_TIMEOUT_MS);
399 		else
400 			qdf_timer_mod(
401 			&ser_utf_vdev[vdev_id].utf_nonscan_timer[id],
402 			WLAN_SER_UTF_TIMER_TIMEOUT_MS);
403 	}
404 }
405 
wlan_ser_utf_init_iter_op(struct wlan_objmgr_pdev * pdev,void * obj,void * args)406 static void wlan_ser_utf_init_iter_op(struct wlan_objmgr_pdev *pdev,
407 				      void *obj, void *args)
408 {
409 	struct wlan_objmgr_vdev *vdev = (struct wlan_objmgr_vdev *)obj;
410 	uint8_t vdev_id = wlan_vdev_get_id(vdev);
411 	uint8_t id;
412 
413 	ser_utf_vdev[vdev_id].vdev = vdev;
414 	for (id = 0; id < WLAN_SER_UTF_SCAN_CMD_TESTS; id++) {
415 		qdf_timer_init(NULL,
416 			       &ser_utf_vdev[vdev_id].utf_scan_timer[id],
417 			       wlan_ser_utf_scan_timer_cb,
418 			       (void *)vdev, QDF_TIMER_TYPE_WAKE_APPS);
419 		qdf_timer_init(NULL,
420 			       &ser_utf_vdev[vdev_id].utf_nonscan_timer[id],
421 			       wlan_ser_utf_nonscan_timer_cb,
422 			       (void *)vdev, QDF_TIMER_TYPE_WAKE_APPS);
423 	}
424 }
425 
wlan_ser_utf_deinit_iter_op(struct wlan_objmgr_pdev * pdev,void * obj,void * args)426 static void wlan_ser_utf_deinit_iter_op(struct wlan_objmgr_pdev *pdev,
427 					void *obj, void *args)
428 {
429 	struct wlan_objmgr_vdev *vdev = (struct wlan_objmgr_vdev *)obj;
430 	uint8_t vdev_id = wlan_vdev_get_id(vdev);
431 	uint8_t id;
432 
433 	for (id = 0; id < WLAN_SER_UTF_SCAN_CMD_TESTS; id++) {
434 		qdf_timer_free(
435 			&ser_utf_vdev[vdev_id].utf_nonscan_timer[id]);
436 		qdf_timer_free(
437 			&ser_utf_vdev[vdev_id].utf_scan_timer[id]);
438 	}
439 }
440 
wlan_ser_utf_vdev_iter_op(struct wlan_objmgr_pdev * pdev,void * obj,void * args)441 static void wlan_ser_utf_vdev_iter_op(struct wlan_objmgr_pdev *pdev,
442 				      void *obj, void *args)
443 {
444 	struct wlan_objmgr_vdev *vdev = (struct wlan_objmgr_vdev *)obj;
445 	uint8_t is_blocking = *(uint8_t *)args;
446 
447 	wlan_ser_utf_run(vdev, false, 2, false, is_blocking);
448 }
449 
450 /*
451  * List of available APIs
452  * 1. wlan_serialization_request(
453  *	struct wlan_serialization_command *cmd)
454  * 2. wlan_serialization_remove_cmd(
455  *	struct wlan_serialization_queued_cmd_info *cmd_info)
456  * 3. wlan_serialization_cancel_request(
457  *	struct wlan_serialization_queued_cmd_info *cmd_info)
458  *	sub_val:
459  *		1st byte : cmd_id
460  *		2nd byte : scan_cmd
461  *		3rd byte : queue_type
462  *		4th byte : req_type
463  */
wlan_ser_utf_main(struct wlan_objmgr_vdev * vdev,uint8_t val,uint32_t sub_val)464 int wlan_ser_utf_main(struct wlan_objmgr_vdev *vdev, uint8_t val,
465 		      uint32_t sub_val)
466 {
467 	uint8_t id;
468 	uint8_t vdev_id;
469 	static uint8_t wlan_ser_utf_init;
470 	struct wlan_ser_utf_data *data;
471 	bool is_blocking;
472 	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
473 	uint8_t cmd_id = (uint8_t)sub_val;
474 	uint8_t scan_cmd = (uint8_t)(sub_val >> 8);
475 	uint8_t queue_type = (uint8_t)(sub_val >> 16);
476 	enum wlan_serialization_cancel_type req_type = (uint8_t)(sub_val >> 24);
477 
478 	if (wlan_ser_utf_init == 0 && val != 1) {
479 		ser_err("Init UTF before running test cases");
480 		return 0;
481 	}
482 
483 	switch (val) {
484 	case SER_UTF_TC_DEINIT:
485 		if (wlan_objmgr_pdev_try_get_ref(pdev, WLAN_SERIALIZATION_ID) ==
486 				QDF_STATUS_SUCCESS) {
487 			wlan_objmgr_pdev_iterate_obj_list(
488 					pdev, WLAN_VDEV_OP,
489 					wlan_ser_utf_deinit_iter_op,
490 					NULL, 0, WLAN_SERIALIZATION_ID);
491 			wlan_objmgr_pdev_release_ref(pdev,
492 						     WLAN_SERIALIZATION_ID);
493 			ser_err("Serialization Timer Deinit Done");
494 		}
495 		break;
496 	case SER_UTF_TC_INIT:
497 		if (wlan_objmgr_pdev_try_get_ref(pdev, WLAN_SERIALIZATION_ID) ==
498 				QDF_STATUS_SUCCESS) {
499 			wlan_objmgr_pdev_iterate_obj_list(
500 					pdev, WLAN_VDEV_OP,
501 					wlan_ser_utf_init_iter_op,
502 					NULL, 0, WLAN_SERIALIZATION_ID);
503 			wlan_objmgr_pdev_release_ref(pdev,
504 						     WLAN_SERIALIZATION_ID);
505 			wlan_ser_utf_init = 1;
506 			ser_err("Serialization Timer Init Done");
507 		}
508 		break;
509 	case SER_UTF_TC_ADD:
510 		ser_err("Add:%s, id:%d", scan_cmd ? "SCAN" : "NONSCAN", cmd_id);
511 		if (!wlan_ser_utf_data_alloc(&data, vdev, cmd_id))
512 			break;
513 
514 		if (scan_cmd)
515 			wlan_ser_utf_add_scan_cmd(vdev, cmd_id, data, false);
516 		else
517 			wlan_ser_utf_add_nonscan_cmd(vdev, cmd_id, data,
518 						     false, false);
519 		break;
520 	case SER_UTF_TC_REMOVE:
521 		ser_err("Remove:%s, id:%d", scan_cmd ? "SCAN" : "NONSCAN",
522 			cmd_id);
523 		if (scan_cmd)
524 			wlan_ser_utf_remove_scan_cmd(vdev, cmd_id);
525 		else
526 			wlan_ser_utf_remove_nonscan_cmd(vdev, cmd_id);
527 		break;
528 	case SER_UTF_TC_CANCEL:
529 		ser_err("Cancel:%s, id:%d", scan_cmd ? "SCAN" : "NONSCAN",
530 			cmd_id);
531 		if (scan_cmd)
532 			wlan_ser_utf_cancel_scan_cmd(vdev, cmd_id, queue_type,
533 						     req_type);
534 		else
535 			wlan_ser_utf_cancel_nonscan_cmd(vdev, cmd_id,
536 							queue_type, req_type);
537 		break;
538 	case SER_UTF_TC_SINGLE_SCAN:
539 		id = 1;
540 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
541 			break;
542 		wlan_ser_utf_add_scan_cmd(vdev, id, data, false);
543 		wlan_ser_utf_remove_scan_cmd(vdev, id);
544 		break;
545 	case SER_UTF_TC_MULTI_SCAN:
546 		wlan_ser_utf_run(vdev, true, 10, false, false);
547 		break;
548 	case SER_UTF_TC_MAX_SCAN:
549 		wlan_ser_utf_run(vdev, true, 0, false, false);
550 		break;
551 	case SER_UTF_TC_SINGLE_NONSCAN:
552 		id = 1;
553 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
554 			break;
555 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
556 		wlan_ser_utf_remove_nonscan_cmd(vdev, id);
557 		break;
558 	case SER_UTF_TC_MULTI_NONSCAN:
559 		wlan_ser_utf_run(vdev, false, 10, false, false);
560 		break;
561 	case SER_UTF_TC_MAX_NONSCAN:
562 		wlan_ser_utf_run(vdev, false, 0, false, false);
563 		break;
564 	case SER_UTF_TC_MULTI_VDEV_NONSCAN:
565 		is_blocking = false;
566 		if (wlan_objmgr_pdev_try_get_ref(pdev, WLAN_SERIALIZATION_ID) ==
567 				QDF_STATUS_SUCCESS) {
568 			wlan_objmgr_pdev_iterate_obj_list(
569 					pdev, WLAN_VDEV_OP,
570 					wlan_ser_utf_vdev_iter_op,
571 					&is_blocking, 0, WLAN_SERIALIZATION_ID);
572 			wlan_objmgr_pdev_release_ref(pdev,
573 						     WLAN_SERIALIZATION_ID);
574 		}
575 		break;
576 	case SER_UTF_TC_CANCEL_SCAN_AC_SINGLE:
577 		id = 1;
578 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
579 			break;
580 		wlan_ser_utf_add_scan_cmd(vdev, id, data, false);
581 		req_type = WLAN_SER_CANCEL_SINGLE_SCAN;
582 		queue_type = WLAN_SERIALIZATION_ACTIVE_QUEUE;
583 		wlan_ser_utf_cancel_scan_cmd(vdev, id, queue_type,
584 					     req_type);
585 		break;
586 	case SER_UTF_TC_CANCEL_SCAN_AC_PDEV:
587 		wlan_ser_utf_run(vdev, true, 15, false, false);
588 		req_type = WLAN_SER_CANCEL_PDEV_SCANS;
589 		queue_type = WLAN_SERIALIZATION_ACTIVE_QUEUE;
590 		wlan_ser_utf_cancel_scan_cmd(vdev, cmd_id, queue_type,
591 					     req_type);
592 		break;
593 	case SER_UTF_TC_CANCEL_SCAN_AC_VDEV:
594 		wlan_ser_utf_run(vdev, true, 15, false, false);
595 		req_type = WLAN_SER_CANCEL_VDEV_SCANS;
596 		queue_type = WLAN_SERIALIZATION_ACTIVE_QUEUE;
597 		wlan_ser_utf_cancel_scan_cmd(vdev, cmd_id, queue_type,
598 					     req_type);
599 		break;
600 	case SER_UTF_TC_CANCEL_SCAN_PD_SINGLE:
601 		wlan_ser_utf_run(vdev, true, 15, false, false);
602 		req_type = WLAN_SER_CANCEL_SINGLE_SCAN;
603 		queue_type = WLAN_SERIALIZATION_PENDING_QUEUE;
604 		wlan_ser_utf_cancel_scan_cmd(vdev, cmd_id, queue_type,
605 					     req_type);
606 		break;
607 	case SER_UTF_TC_CANCEL_SCAN_PD_PDEV:
608 		wlan_ser_utf_run(vdev, true, 15, false, false);
609 		req_type = WLAN_SER_CANCEL_PDEV_SCANS;
610 		queue_type = WLAN_SERIALIZATION_PENDING_QUEUE;
611 		wlan_ser_utf_cancel_scan_cmd(vdev, cmd_id, queue_type,
612 					     req_type);
613 		break;
614 	case SER_UTF_TC_CANCEL_SCAN_PD_VDEV:
615 		wlan_ser_utf_run(vdev, true, 15, false, false);
616 		req_type = WLAN_SER_CANCEL_VDEV_SCANS;
617 		queue_type = WLAN_SERIALIZATION_PENDING_QUEUE;
618 		wlan_ser_utf_cancel_scan_cmd(vdev, cmd_id, queue_type,
619 					     req_type);
620 		break;
621 	case SER_UTF_TC_CANCEL_NONSCAN_AC_SINGLE:
622 		req_type = WLAN_SER_CANCEL_NON_SCAN_CMD;
623 		queue_type = WLAN_SERIALIZATION_ACTIVE_QUEUE;
624 		wlan_ser_utf_cancel_nonscan_cmd(vdev, cmd_id, queue_type,
625 						req_type);
626 		break;
627 	case SER_UTF_TC_CANCEL_NONSCAN_AC_PDEV:
628 		req_type = WLAN_SER_CANCEL_PDEV_NON_SCAN_CMD;
629 		queue_type = WLAN_SERIALIZATION_ACTIVE_QUEUE;
630 		wlan_ser_utf_cancel_nonscan_cmd(vdev, cmd_id, queue_type,
631 						req_type);
632 		break;
633 	case SER_UTF_TC_CANCEL_NONSCAN_AC_VDEV:
634 		req_type = WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD;
635 		queue_type = WLAN_SERIALIZATION_ACTIVE_QUEUE;
636 		wlan_ser_utf_cancel_nonscan_cmd(vdev, cmd_id, queue_type,
637 						req_type);
638 		break;
639 	case SER_UTF_TC_CANCEL_NONSCAN_PD_SINGLE:
640 		req_type = WLAN_SER_CANCEL_NON_SCAN_CMD;
641 		queue_type = WLAN_SERIALIZATION_PENDING_QUEUE;
642 		wlan_ser_utf_cancel_nonscan_cmd(vdev, cmd_id, queue_type,
643 						req_type);
644 		break;
645 	case SER_UTF_TC_CANCEL_NONSCAN_PD_PDEV:
646 		req_type = WLAN_SER_CANCEL_PDEV_NON_SCAN_CMD;
647 		queue_type = WLAN_SERIALIZATION_PENDING_QUEUE;
648 		wlan_ser_utf_cancel_nonscan_cmd(vdev, cmd_id, queue_type,
649 						req_type);
650 		break;
651 	case SER_UTF_TC_CANCEL_NONSCAN_PD_VDEV:
652 		req_type = WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD;
653 		queue_type = WLAN_SERIALIZATION_PENDING_QUEUE;
654 		wlan_ser_utf_cancel_nonscan_cmd(vdev, cmd_id, queue_type,
655 						req_type);
656 		break;
657 	case SER_UTF_TC_START_BSS_FILTERING:
658 		id = 1;
659 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
660 			break;
661 		wlan_ser_utf_add_vdev_start_bss_cmd(vdev, id, data,
662 						    false, false);
663 
664 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
665 			break;
666 		wlan_ser_utf_add_vdev_start_bss_cmd(vdev, id, data,
667 						    false, false);
668 
669 		wlan_ser_utf_remove_start_bss_cmd(vdev, id);
670 		wlan_ser_utf_remove_stop_bss_cmd(vdev, id);
671 		wlan_ser_utf_remove_start_bss_cmd(vdev, id);
672 		break;
673 	case SER_UTF_TC_STOP_BSS_FILTERING:
674 		id = 1;
675 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
676 			break;
677 		wlan_ser_utf_add_vdev_start_bss_cmd(vdev, id, data,
678 						    false, false);
679 
680 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
681 			break;
682 		wlan_ser_utf_add_vdev_start_bss_cmd(vdev, id, data,
683 						    false, false);
684 
685 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
686 			break;
687 		wlan_ser_utf_add_vdev_stop_bss_cmd(vdev, id, data,
688 						   false, false);
689 
690 		wlan_ser_utf_remove_start_bss_cmd(vdev, id);
691 		wlan_ser_utf_remove_stop_bss_cmd(vdev, id);
692 		break;
693 	case SER_UTF_TC_ADD_BLOCKING_NONSCAN_AC_1:
694 		id = 1;
695 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
696 			break;
697 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, true);
698 		wlan_ser_utf_remove_nonscan_cmd(vdev, id);
699 		break;
700 	case SER_UTF_TC_ADD_BLOCKING_NONSCAN_PD_1:
701 		id = 1;
702 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
703 			break;
704 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, true);
705 
706 		id = 2;
707 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
708 			break;
709 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, true);
710 
711 		wlan_ser_utf_remove_nonscan_cmd(vdev, 1);
712 		wlan_ser_utf_remove_nonscan_cmd(vdev, 2);
713 		break;
714 	case SER_UTF_TC_ADD_BLOCKING_NONSCAN_PD_2:
715 		id = 1;
716 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
717 			break;
718 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
719 
720 		id = 2;
721 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
722 			break;
723 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, true);
724 
725 		wlan_ser_utf_remove_nonscan_cmd(vdev, 1);
726 		wlan_ser_utf_remove_nonscan_cmd(vdev, 2);
727 		break;
728 	case SER_UTF_TC_ADD_BLOCKING_NONSCAN_PD_3:
729 		id = 1;
730 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
731 			break;
732 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
733 
734 		id = 2;
735 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
736 			break;
737 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
738 
739 		id = 3;
740 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
741 			break;
742 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
743 
744 		id = 4;
745 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
746 			break;
747 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, true);
748 
749 		wlan_ser_utf_remove_nonscan_cmd(vdev, 1);
750 		wlan_ser_utf_remove_nonscan_cmd(vdev, 2);
751 		wlan_ser_utf_remove_nonscan_cmd(vdev, 3);
752 		wlan_ser_utf_remove_nonscan_cmd(vdev, 4);
753 		break;
754 	case SER_UTF_TC_ADD_BLOCKING_NONSCAN_PD_4:
755 		id = 1;
756 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
757 			break;
758 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
759 
760 		id = 2;
761 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
762 			break;
763 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
764 
765 		id = 3;
766 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
767 			break;
768 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
769 
770 		id = 4;
771 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
772 			break;
773 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, true);
774 
775 		id = 5;
776 		if (!wlan_ser_utf_data_alloc(&data, vdev, id))
777 			break;
778 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
779 
780 		wlan_ser_utf_remove_nonscan_cmd(vdev, 1);
781 		wlan_ser_utf_remove_nonscan_cmd(vdev, 2);
782 		wlan_ser_utf_remove_nonscan_cmd(vdev, 3);
783 		wlan_ser_utf_remove_nonscan_cmd(vdev, 4);
784 		wlan_ser_utf_remove_nonscan_cmd(vdev, 5);
785 		break;
786 	case SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_1:
787 		if (wlan_pdev_get_vdev_count(pdev) < WLAN_SER_UTF_MAX_VDEVS) {
788 			ser_err("Requires atleast %d vdevs for the given pdev",
789 				WLAN_SER_UTF_MAX_VDEVS);
790 			break;
791 		}
792 		is_blocking = true;
793 		if (wlan_objmgr_pdev_try_get_ref(pdev, WLAN_SERIALIZATION_ID) ==
794 				QDF_STATUS_SUCCESS) {
795 			wlan_objmgr_pdev_iterate_obj_list(
796 					pdev, WLAN_VDEV_OP,
797 					wlan_ser_utf_vdev_iter_op,
798 					&is_blocking, 0, WLAN_SERIALIZATION_ID);
799 			wlan_objmgr_pdev_release_ref(pdev,
800 						     WLAN_SERIALIZATION_ID);
801 		}
802 		break;
803 	case SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_2:
804 		if (wlan_pdev_get_vdev_count(pdev) < WLAN_SER_UTF_MAX_VDEVS) {
805 			ser_err("Requires atleast %d vdevs for the given pdev",
806 				WLAN_SER_UTF_MAX_VDEVS);
807 			break;
808 		}
809 		id = 1;
810 		wlan_ser_utf_data_alloc(&data, ser_utf_vdev[0].vdev, id);
811 		wlan_ser_utf_add_nonscan_cmd(ser_utf_vdev[0].vdev, id,
812 					     data, false, false);
813 
814 		wlan_ser_utf_data_alloc(&data, ser_utf_vdev[1].vdev, id);
815 		wlan_ser_utf_add_nonscan_cmd(ser_utf_vdev[1].vdev, id,
816 					     data, false, false);
817 
818 		wlan_ser_utf_data_alloc(&data, ser_utf_vdev[2].vdev, id);
819 		wlan_ser_utf_add_nonscan_cmd(ser_utf_vdev[2].vdev, id,
820 					     data, false, false);
821 
822 		wlan_ser_utf_data_alloc(&data, ser_utf_vdev[2].vdev, id);
823 		wlan_ser_utf_add_nonscan_cmd(ser_utf_vdev[2].vdev, id,
824 					     data, false, true);
825 
826 		wlan_ser_utf_remove_nonscan_cmd(ser_utf_vdev[0].vdev, id);
827 		wlan_ser_utf_remove_nonscan_cmd(ser_utf_vdev[1].vdev, id);
828 		wlan_ser_utf_remove_nonscan_cmd(ser_utf_vdev[2].vdev, id);
829 		wlan_ser_utf_remove_nonscan_cmd(ser_utf_vdev[2].vdev, id);
830 		break;
831 	case SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_3:
832 		if (wlan_pdev_get_vdev_count(pdev) < WLAN_SER_UTF_MAX_VDEVS) {
833 			ser_err("Requires atleast %d vdevs for the given pdev",
834 				WLAN_SER_UTF_MAX_VDEVS);
835 			break;
836 		}
837 		id = 1;
838 		wlan_ser_utf_data_alloc(&data, ser_utf_vdev[0].vdev, id);
839 		wlan_ser_utf_add_nonscan_cmd(ser_utf_vdev[0].vdev, id,
840 					     data, false, true);
841 
842 		wlan_ser_utf_data_alloc(&data, ser_utf_vdev[0].vdev, id);
843 		wlan_ser_utf_add_nonscan_cmd(ser_utf_vdev[0].vdev, id,
844 					     data, false, false);
845 
846 		wlan_ser_utf_data_alloc(&data, ser_utf_vdev[1].vdev, id);
847 		wlan_ser_utf_add_nonscan_cmd(ser_utf_vdev[1].vdev, id,
848 					     data, false, false);
849 
850 		wlan_ser_utf_data_alloc(&data, ser_utf_vdev[2].vdev, id);
851 		wlan_ser_utf_add_nonscan_cmd(ser_utf_vdev[2].vdev, id,
852 					     data, false, false);
853 
854 		wlan_ser_utf_remove_nonscan_cmd(ser_utf_vdev[0].vdev, id);
855 		wlan_ser_utf_remove_nonscan_cmd(ser_utf_vdev[0].vdev, id);
856 		wlan_ser_utf_remove_nonscan_cmd(ser_utf_vdev[1].vdev, id);
857 		wlan_ser_utf_remove_nonscan_cmd(ser_utf_vdev[2].vdev, id);
858 		break;
859 	case SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_4:
860 		if (wlan_pdev_get_vdev_count(pdev) < WLAN_SER_UTF_MAX_VDEVS) {
861 			ser_err("Requires atleast %d vdevs for the given pdev",
862 				WLAN_SER_UTF_MAX_VDEVS);
863 			break;
864 		}
865 		for (id = 1; id <= 2; id++) {
866 			for (vdev_id = 0; vdev_id < WLAN_SER_UTF_MAX_VDEVS;
867 					vdev_id++) {
868 				wlan_ser_utf_data_alloc(
869 						&data,
870 						ser_utf_vdev[vdev_id].vdev, id);
871 				wlan_ser_utf_add_nonscan_cmd(
872 						ser_utf_vdev[vdev_id].vdev,
873 						id, data, false, false);
874 			}
875 		}
876 
877 		id = 3;
878 		for (vdev_id = 0; vdev_id < WLAN_SER_UTF_MAX_VDEVS; vdev_id++) {
879 			wlan_ser_utf_data_alloc(
880 					&data, ser_utf_vdev[vdev_id].vdev, id);
881 			wlan_ser_utf_add_nonscan_cmd(
882 					ser_utf_vdev[vdev_id].vdev, id,
883 					data, false, true);
884 		}
885 
886 		for (id = 1; id <= 3; id++) {
887 			for (vdev_id = 0; vdev_id < WLAN_SER_UTF_MAX_VDEVS;
888 					vdev_id++)
889 				wlan_ser_utf_remove_nonscan_cmd(
890 						ser_utf_vdev[vdev_id].vdev, id);
891 		}
892 		break;
893 	case SER_UTF_TC_MULTI_VDEV_BL_NONSCAN_5:
894 		if (wlan_pdev_get_vdev_count(pdev) < WLAN_SER_UTF_MAX_VDEVS) {
895 			ser_err("Requires atleast %d vdevs for the given pdev",
896 				WLAN_SER_UTF_MAX_VDEVS);
897 			break;
898 		}
899 		id = 1;
900 		for (vdev_id = 0; vdev_id < WLAN_SER_UTF_MAX_VDEVS;
901 					vdev_id++) {
902 			wlan_ser_utf_data_alloc(
903 					&data,
904 					ser_utf_vdev[vdev_id].vdev, id);
905 			wlan_ser_utf_add_nonscan_cmd(
906 					ser_utf_vdev[vdev_id].vdev,
907 					id, data, false, false);
908 		}
909 		id = 2;
910 		for (vdev_id = 0; vdev_id < WLAN_SER_UTF_MAX_VDEVS;
911 					vdev_id++) {
912 			wlan_ser_utf_data_alloc(
913 					&data,
914 					ser_utf_vdev[vdev_id].vdev, id);
915 			wlan_ser_utf_add_nonscan_cmd(
916 					ser_utf_vdev[vdev_id].vdev,
917 					id, data, false, true);
918 		}
919 		id = 3;
920 		for (vdev_id = 0; vdev_id < WLAN_SER_UTF_MAX_VDEVS;
921 					vdev_id++) {
922 			wlan_ser_utf_data_alloc(
923 					&data,
924 					ser_utf_vdev[vdev_id].vdev, id);
925 			wlan_ser_utf_add_nonscan_cmd(
926 					ser_utf_vdev[vdev_id].vdev,
927 					id, data, false, false);
928 		}
929 
930 		for (id = 1; id <= 3; id++) {
931 			for (vdev_id = 0; vdev_id < WLAN_SER_UTF_MAX_VDEVS;
932 					vdev_id++)
933 				wlan_ser_utf_remove_nonscan_cmd(
934 						ser_utf_vdev[vdev_id].vdev, id);
935 		}
936 		break;
937 	case SER_UTF_TC_HIGH_PRIO_NONSCAN_WO_BL:
938 		id = 1;
939 		wlan_ser_utf_data_alloc(&data, vdev, id);
940 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
941 
942 		id = 2;
943 		wlan_ser_utf_data_alloc(&data, vdev, id);
944 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
945 
946 		id = 3;
947 		wlan_ser_utf_data_alloc(&data, vdev, id);
948 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
949 
950 		id = 4;
951 		wlan_ser_utf_data_alloc(&data, vdev, id);
952 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, true, false);
953 
954 		wlan_ser_utf_remove_nonscan_cmd(vdev, 1);
955 		wlan_ser_utf_remove_nonscan_cmd(vdev, 4);
956 		wlan_ser_utf_remove_nonscan_cmd(vdev, 2);
957 		wlan_ser_utf_remove_nonscan_cmd(vdev, 3);
958 		break;
959 	case SER_UTF_TC_HIGH_PRIO_NONSCAN_W_BL:
960 		id = 1;
961 		wlan_ser_utf_data_alloc(&data, vdev, id);
962 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
963 
964 		id = 2;
965 		wlan_ser_utf_data_alloc(&data, vdev, id);
966 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, true);
967 
968 		id = 3;
969 		wlan_ser_utf_data_alloc(&data, vdev, id);
970 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, true, false);
971 
972 		id = 4;
973 		wlan_ser_utf_data_alloc(&data, vdev, id);
974 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
975 
976 		wlan_ser_utf_remove_nonscan_cmd(vdev, 1);
977 		wlan_ser_utf_remove_nonscan_cmd(vdev, 3);
978 		wlan_ser_utf_remove_nonscan_cmd(vdev, 2);
979 		wlan_ser_utf_remove_nonscan_cmd(vdev, 4);
980 		break;
981 	case SER_UTF_TC_HIGH_PRIO_BL_NONSCAN:
982 		id = 1;
983 		wlan_ser_utf_data_alloc(&data, vdev, id);
984 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
985 
986 		id = 2;
987 		wlan_ser_utf_data_alloc(&data, vdev, id);
988 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
989 
990 		id = 3;
991 		wlan_ser_utf_data_alloc(&data, vdev, id);
992 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, false, false);
993 
994 		id = 4;
995 		wlan_ser_utf_data_alloc(&data, vdev, id);
996 		wlan_ser_utf_add_nonscan_cmd(vdev, id, data, true, true);
997 
998 		wlan_ser_utf_remove_nonscan_cmd(vdev, 1);
999 		wlan_ser_utf_remove_nonscan_cmd(vdev, 4);
1000 		wlan_ser_utf_remove_nonscan_cmd(vdev, 2);
1001 		wlan_ser_utf_remove_nonscan_cmd(vdev, 3);
1002 		break;
1003 	default:
1004 		ser_err("Error: Unknown val");
1005 		break;
1006 	}
1007 
1008 	return 0;
1009 }
1010