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