4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #include <cmdline_rdline.h>
40 #include <cmdline_parse.h>
41 #include <cmdline_parse_num.h>
42 #include <cmdline_parse_string.h>
43 #include <cmdline_socket.h>
48 /* *** Help command with introduction. *** */
49 struct cmd_help_result
{
50 cmdline_fixed_string_t help
;
53 static void cmd_help_parsed(__attribute__((unused
)) void *parsed_result
,
55 __attribute__((unused
)) void *data
)
60 "The following commands are currently available:\n\n"
62 " quit : Quit the application.\n"
64 " stats app : Show app statistics.\n"
65 " stats port X subport Y : Show stats of a specific subport.\n"
66 " stats port X subport Y pipe Z : Show stats of a specific pipe.\n"
67 "\nAverage queue size:\n"
68 " qavg port X subport Y : Show average queue size per subport.\n"
69 " qavg port X subport Y tc Z : Show average queue size per subport and TC.\n"
70 " qavg port X subport Y pipe Z : Show average queue size per pipe.\n"
71 " qavg port X subport Y pipe Z tc A : Show average queue size per pipe and TC.\n"
72 " qavg port X subport Y pipe Z tc A q B : Show average queue size of a specific queue.\n"
73 " qavg [n|period] X : Set number of times and peiod (us).\n\n"
78 cmdline_parse_token_string_t cmd_help_help
=
79 TOKEN_STRING_INITIALIZER(struct cmd_help_result
, help
, "help");
81 cmdline_parse_inst_t cmd_help
= {
84 .help_str
= "show help",
86 (void *)&cmd_help_help
,
92 struct cmd_quit_result
{
93 cmdline_fixed_string_t quit
;
96 static void cmd_quit_parsed(__attribute__((unused
)) void *parsed_result
,
98 __attribute__((unused
)) void *data
)
103 cmdline_parse_token_string_t cmd_quit_quit
=
104 TOKEN_STRING_INITIALIZER(struct cmd_quit_result
, quit
, "quit");
106 cmdline_parse_inst_t cmd_quit
= {
107 .f
= cmd_quit_parsed
,
109 .help_str
= "exit application",
111 (void *)&cmd_quit_quit
,
116 /* *** SET QAVG PARAMETERS *** */
117 struct cmd_setqavg_result
{
118 cmdline_fixed_string_t qavg_string
;
119 cmdline_fixed_string_t param_string
;
123 static void cmd_setqavg_parsed(void *parsed_result
,
124 __attribute__((unused
)) struct cmdline
*cl
,
125 __attribute__((unused
)) void *data
)
127 struct cmd_setqavg_result
*res
= parsed_result
;
129 if (!strcmp(res
->param_string
, "period"))
130 qavg_period
= res
->number
;
131 else if (!strcmp(res
->param_string
, "n"))
132 qavg_ntimes
= res
->number
;
134 printf("\nUnknown parameter.\n\n");
137 cmdline_parse_token_string_t cmd_setqavg_qavg_string
=
138 TOKEN_STRING_INITIALIZER(struct cmd_setqavg_result
, qavg_string
,
140 cmdline_parse_token_string_t cmd_setqavg_param_string
=
141 TOKEN_STRING_INITIALIZER(struct cmd_setqavg_result
, param_string
,
143 cmdline_parse_token_num_t cmd_setqavg_number
=
144 TOKEN_NUM_INITIALIZER(struct cmd_setqavg_result
, number
,
147 cmdline_parse_inst_t cmd_setqavg
= {
148 .f
= cmd_setqavg_parsed
,
150 .help_str
= "Show subport stats.",
152 (void *)&cmd_setqavg_qavg_string
,
153 (void *)&cmd_setqavg_param_string
,
154 (void *)&cmd_setqavg_number
,
159 /* *** SHOW APP STATS *** */
160 struct cmd_appstats_result
{
161 cmdline_fixed_string_t stats_string
;
162 cmdline_fixed_string_t app_string
;
165 static void cmd_appstats_parsed(__attribute__((unused
)) void *parsed_result
,
166 __attribute__((unused
)) struct cmdline
*cl
,
167 __attribute__((unused
)) void *data
)
172 cmdline_parse_token_string_t cmd_appstats_stats_string
=
173 TOKEN_STRING_INITIALIZER(struct cmd_appstats_result
, stats_string
,
175 cmdline_parse_token_string_t cmd_appstats_app_string
=
176 TOKEN_STRING_INITIALIZER(struct cmd_appstats_result
, app_string
,
179 cmdline_parse_inst_t cmd_appstats
= {
180 .f
= cmd_appstats_parsed
,
182 .help_str
= "Show app stats.",
184 (void *)&cmd_appstats_stats_string
,
185 (void *)&cmd_appstats_app_string
,
190 /* *** SHOW SUBPORT STATS *** */
191 struct cmd_subportstats_result
{
192 cmdline_fixed_string_t stats_string
;
193 cmdline_fixed_string_t port_string
;
195 cmdline_fixed_string_t subport_string
;
196 uint32_t subport_number
;
199 static void cmd_subportstats_parsed(void *parsed_result
,
200 __attribute__((unused
)) struct cmdline
*cl
,
201 __attribute__((unused
)) void *data
)
203 struct cmd_subportstats_result
*res
= parsed_result
;
205 if (subport_stat(res
->port_number
, res
->subport_number
) < 0)
206 printf ("\nStats not available for these parameters. Check that both the port and subport are correct.\n\n");
209 cmdline_parse_token_string_t cmd_subportstats_stats_string
=
210 TOKEN_STRING_INITIALIZER(struct cmd_subportstats_result
, stats_string
,
212 cmdline_parse_token_string_t cmd_subportstats_port_string
=
213 TOKEN_STRING_INITIALIZER(struct cmd_subportstats_result
, port_string
,
215 cmdline_parse_token_string_t cmd_subportstats_subport_string
=
216 TOKEN_STRING_INITIALIZER(struct cmd_subportstats_result
, subport_string
,
218 cmdline_parse_token_num_t cmd_subportstats_subport_number
=
219 TOKEN_NUM_INITIALIZER(struct cmd_subportstats_result
, subport_number
,
221 cmdline_parse_token_num_t cmd_subportstats_port_number
=
222 TOKEN_NUM_INITIALIZER(struct cmd_subportstats_result
, port_number
,
225 cmdline_parse_inst_t cmd_subportstats
= {
226 .f
= cmd_subportstats_parsed
,
228 .help_str
= "Show subport stats.",
230 (void *)&cmd_subportstats_stats_string
,
231 (void *)&cmd_subportstats_port_string
,
232 (void *)&cmd_subportstats_port_number
,
233 (void *)&cmd_subportstats_subport_string
,
234 (void *)&cmd_subportstats_subport_number
,
239 /* *** SHOW PIPE STATS *** */
240 struct cmd_pipestats_result
{
241 cmdline_fixed_string_t stats_string
;
242 cmdline_fixed_string_t port_string
;
244 cmdline_fixed_string_t subport_string
;
245 uint32_t subport_number
;
246 cmdline_fixed_string_t pipe_string
;
247 uint32_t pipe_number
;
250 static void cmd_pipestats_parsed(void *parsed_result
,
251 __attribute__((unused
)) struct cmdline
*cl
,
252 __attribute__((unused
)) void *data
)
254 struct cmd_pipestats_result
*res
= parsed_result
;
256 if (pipe_stat(res
->port_number
, res
->subport_number
, res
->pipe_number
) < 0)
257 printf ("\nStats not available for these parameters. Check that both the port and subport are correct.\n\n");
260 cmdline_parse_token_string_t cmd_pipestats_stats_string
=
261 TOKEN_STRING_INITIALIZER(struct cmd_pipestats_result
, stats_string
,
263 cmdline_parse_token_string_t cmd_pipestats_port_string
=
264 TOKEN_STRING_INITIALIZER(struct cmd_pipestats_result
, port_string
,
266 cmdline_parse_token_num_t cmd_pipestats_port_number
=
267 TOKEN_NUM_INITIALIZER(struct cmd_pipestats_result
, port_number
,
269 cmdline_parse_token_string_t cmd_pipestats_subport_string
=
270 TOKEN_STRING_INITIALIZER(struct cmd_pipestats_result
, subport_string
,
272 cmdline_parse_token_num_t cmd_pipestats_subport_number
=
273 TOKEN_NUM_INITIALIZER(struct cmd_pipestats_result
, subport_number
,
275 cmdline_parse_token_string_t cmd_pipestats_pipe_string
=
276 TOKEN_STRING_INITIALIZER(struct cmd_pipestats_result
, pipe_string
,
278 cmdline_parse_token_num_t cmd_pipestats_pipe_number
=
279 TOKEN_NUM_INITIALIZER(struct cmd_pipestats_result
, pipe_number
,
282 cmdline_parse_inst_t cmd_pipestats
= {
283 .f
= cmd_pipestats_parsed
,
285 .help_str
= "Show pipe stats.",
287 (void *)&cmd_pipestats_stats_string
,
288 (void *)&cmd_pipestats_port_string
,
289 (void *)&cmd_pipestats_port_number
,
290 (void *)&cmd_pipestats_subport_string
,
291 (void *)&cmd_pipestats_subport_number
,
292 (void *)&cmd_pipestats_pipe_string
,
293 (void *)&cmd_pipestats_pipe_number
,
298 /* *** SHOW AVERAGE QUEUE SIZE (QUEUE) *** */
299 struct cmd_avg_q_result
{
300 cmdline_fixed_string_t qavg_string
;
301 cmdline_fixed_string_t port_string
;
303 cmdline_fixed_string_t subport_string
;
304 uint32_t subport_number
;
305 cmdline_fixed_string_t pipe_string
;
306 uint32_t pipe_number
;
307 cmdline_fixed_string_t tc_string
;
309 cmdline_fixed_string_t q_string
;
313 static void cmd_avg_q_parsed(void *parsed_result
,
314 __attribute__((unused
)) struct cmdline
*cl
,
315 __attribute__((unused
)) void *data
)
317 struct cmd_avg_q_result
*res
= parsed_result
;
319 if (qavg_q(res
->port_number
, res
->subport_number
, res
->pipe_number
, res
->tc_number
, res
->q_number
) < 0)
320 printf ("\nStats not available for these parameters. Check that both the port and subport are correct.\n\n");
323 cmdline_parse_token_string_t cmd_avg_q_qavg_string
=
324 TOKEN_STRING_INITIALIZER(struct cmd_avg_q_result
, qavg_string
,
326 cmdline_parse_token_string_t cmd_avg_q_port_string
=
327 TOKEN_STRING_INITIALIZER(struct cmd_avg_q_result
, port_string
,
329 cmdline_parse_token_num_t cmd_avg_q_port_number
=
330 TOKEN_NUM_INITIALIZER(struct cmd_avg_q_result
, port_number
,
332 cmdline_parse_token_string_t cmd_avg_q_subport_string
=
333 TOKEN_STRING_INITIALIZER(struct cmd_avg_q_result
, subport_string
,
335 cmdline_parse_token_num_t cmd_avg_q_subport_number
=
336 TOKEN_NUM_INITIALIZER(struct cmd_avg_q_result
, subport_number
,
338 cmdline_parse_token_string_t cmd_avg_q_pipe_string
=
339 TOKEN_STRING_INITIALIZER(struct cmd_avg_q_result
, pipe_string
,
341 cmdline_parse_token_num_t cmd_avg_q_pipe_number
=
342 TOKEN_NUM_INITIALIZER(struct cmd_avg_q_result
, pipe_number
,
344 cmdline_parse_token_string_t cmd_avg_q_tc_string
=
345 TOKEN_STRING_INITIALIZER(struct cmd_avg_q_result
, tc_string
,
347 cmdline_parse_token_num_t cmd_avg_q_tc_number
=
348 TOKEN_NUM_INITIALIZER(struct cmd_avg_q_result
, tc_number
,
350 cmdline_parse_token_string_t cmd_avg_q_q_string
=
351 TOKEN_STRING_INITIALIZER(struct cmd_avg_q_result
, q_string
,
353 cmdline_parse_token_num_t cmd_avg_q_q_number
=
354 TOKEN_NUM_INITIALIZER(struct cmd_avg_q_result
, q_number
,
357 cmdline_parse_inst_t cmd_avg_q
= {
358 .f
= cmd_avg_q_parsed
,
360 .help_str
= "Show pipe stats.",
362 (void *)&cmd_avg_q_qavg_string
,
363 (void *)&cmd_avg_q_port_string
,
364 (void *)&cmd_avg_q_port_number
,
365 (void *)&cmd_avg_q_subport_string
,
366 (void *)&cmd_avg_q_subport_number
,
367 (void *)&cmd_avg_q_pipe_string
,
368 (void *)&cmd_avg_q_pipe_number
,
369 (void *)&cmd_avg_q_tc_string
,
370 (void *)&cmd_avg_q_tc_number
,
371 (void *)&cmd_avg_q_q_string
,
372 (void *)&cmd_avg_q_q_number
,
377 /* *** SHOW AVERAGE QUEUE SIZE (tc/pipe) *** */
378 struct cmd_avg_tcpipe_result
{
379 cmdline_fixed_string_t qavg_string
;
380 cmdline_fixed_string_t port_string
;
382 cmdline_fixed_string_t subport_string
;
383 uint32_t subport_number
;
384 cmdline_fixed_string_t pipe_string
;
385 uint32_t pipe_number
;
386 cmdline_fixed_string_t tc_string
;
390 static void cmd_avg_tcpipe_parsed(void *parsed_result
,
391 __attribute__((unused
)) struct cmdline
*cl
,
392 __attribute__((unused
)) void *data
)
394 struct cmd_avg_tcpipe_result
*res
= parsed_result
;
396 if (qavg_tcpipe(res
->port_number
, res
->subport_number
, res
->pipe_number
, res
->tc_number
) < 0)
397 printf ("\nStats not available for these parameters. Check that both the port and subport are correct.\n\n");
400 cmdline_parse_token_string_t cmd_avg_tcpipe_qavg_string
=
401 TOKEN_STRING_INITIALIZER(struct cmd_avg_tcpipe_result
, qavg_string
,
403 cmdline_parse_token_string_t cmd_avg_tcpipe_port_string
=
404 TOKEN_STRING_INITIALIZER(struct cmd_avg_tcpipe_result
, port_string
,
406 cmdline_parse_token_num_t cmd_avg_tcpipe_port_number
=
407 TOKEN_NUM_INITIALIZER(struct cmd_avg_tcpipe_result
, port_number
,
409 cmdline_parse_token_string_t cmd_avg_tcpipe_subport_string
=
410 TOKEN_STRING_INITIALIZER(struct cmd_avg_tcpipe_result
, subport_string
,
412 cmdline_parse_token_num_t cmd_avg_tcpipe_subport_number
=
413 TOKEN_NUM_INITIALIZER(struct cmd_avg_tcpipe_result
, subport_number
,
415 cmdline_parse_token_string_t cmd_avg_tcpipe_pipe_string
=
416 TOKEN_STRING_INITIALIZER(struct cmd_avg_tcpipe_result
, pipe_string
,
418 cmdline_parse_token_num_t cmd_avg_tcpipe_pipe_number
=
419 TOKEN_NUM_INITIALIZER(struct cmd_avg_tcpipe_result
, pipe_number
,
421 cmdline_parse_token_string_t cmd_avg_tcpipe_tc_string
=
422 TOKEN_STRING_INITIALIZER(struct cmd_avg_tcpipe_result
, tc_string
,
424 cmdline_parse_token_num_t cmd_avg_tcpipe_tc_number
=
425 TOKEN_NUM_INITIALIZER(struct cmd_avg_tcpipe_result
, tc_number
,
428 cmdline_parse_inst_t cmd_avg_tcpipe
= {
429 .f
= cmd_avg_tcpipe_parsed
,
431 .help_str
= "Show pipe stats.",
433 (void *)&cmd_avg_tcpipe_qavg_string
,
434 (void *)&cmd_avg_tcpipe_port_string
,
435 (void *)&cmd_avg_tcpipe_port_number
,
436 (void *)&cmd_avg_tcpipe_subport_string
,
437 (void *)&cmd_avg_tcpipe_subport_number
,
438 (void *)&cmd_avg_tcpipe_pipe_string
,
439 (void *)&cmd_avg_tcpipe_pipe_number
,
440 (void *)&cmd_avg_tcpipe_tc_string
,
441 (void *)&cmd_avg_tcpipe_tc_number
,
446 /* *** SHOW AVERAGE QUEUE SIZE (pipe) *** */
447 struct cmd_avg_pipe_result
{
448 cmdline_fixed_string_t qavg_string
;
449 cmdline_fixed_string_t port_string
;
451 cmdline_fixed_string_t subport_string
;
452 uint32_t subport_number
;
453 cmdline_fixed_string_t pipe_string
;
454 uint32_t pipe_number
;
457 static void cmd_avg_pipe_parsed(void *parsed_result
,
458 __attribute__((unused
)) struct cmdline
*cl
,
459 __attribute__((unused
)) void *data
)
461 struct cmd_avg_pipe_result
*res
= parsed_result
;
463 if (qavg_pipe(res
->port_number
, res
->subport_number
, res
->pipe_number
) < 0)
464 printf ("\nStats not available for these parameters. Check that both the port and subport are correct.\n\n");
467 cmdline_parse_token_string_t cmd_avg_pipe_qavg_string
=
468 TOKEN_STRING_INITIALIZER(struct cmd_avg_pipe_result
, qavg_string
,
470 cmdline_parse_token_string_t cmd_avg_pipe_port_string
=
471 TOKEN_STRING_INITIALIZER(struct cmd_avg_pipe_result
, port_string
,
473 cmdline_parse_token_num_t cmd_avg_pipe_port_number
=
474 TOKEN_NUM_INITIALIZER(struct cmd_avg_pipe_result
, port_number
,
476 cmdline_parse_token_string_t cmd_avg_pipe_subport_string
=
477 TOKEN_STRING_INITIALIZER(struct cmd_avg_pipe_result
, subport_string
,
479 cmdline_parse_token_num_t cmd_avg_pipe_subport_number
=
480 TOKEN_NUM_INITIALIZER(struct cmd_avg_pipe_result
, subport_number
,
482 cmdline_parse_token_string_t cmd_avg_pipe_pipe_string
=
483 TOKEN_STRING_INITIALIZER(struct cmd_avg_pipe_result
, pipe_string
,
485 cmdline_parse_token_num_t cmd_avg_pipe_pipe_number
=
486 TOKEN_NUM_INITIALIZER(struct cmd_avg_pipe_result
, pipe_number
,
489 cmdline_parse_inst_t cmd_avg_pipe
= {
490 .f
= cmd_avg_pipe_parsed
,
492 .help_str
= "Show pipe stats.",
494 (void *)&cmd_avg_pipe_qavg_string
,
495 (void *)&cmd_avg_pipe_port_string
,
496 (void *)&cmd_avg_pipe_port_number
,
497 (void *)&cmd_avg_pipe_subport_string
,
498 (void *)&cmd_avg_pipe_subport_number
,
499 (void *)&cmd_avg_pipe_pipe_string
,
500 (void *)&cmd_avg_pipe_pipe_number
,
505 /* *** SHOW AVERAGE QUEUE SIZE (tc/subport) *** */
506 struct cmd_avg_tcsubport_result
{
507 cmdline_fixed_string_t qavg_string
;
508 cmdline_fixed_string_t port_string
;
510 cmdline_fixed_string_t subport_string
;
511 uint32_t subport_number
;
512 cmdline_fixed_string_t tc_string
;
516 static void cmd_avg_tcsubport_parsed(void *parsed_result
,
517 __attribute__((unused
)) struct cmdline
*cl
,
518 __attribute__((unused
)) void *data
)
520 struct cmd_avg_tcsubport_result
*res
= parsed_result
;
522 if (qavg_tcsubport(res
->port_number
, res
->subport_number
, res
->tc_number
) < 0)
523 printf ("\nStats not available for these parameters. Check that both the port and subport are correct.\n\n");
526 cmdline_parse_token_string_t cmd_avg_tcsubport_qavg_string
=
527 TOKEN_STRING_INITIALIZER(struct cmd_avg_tcsubport_result
, qavg_string
,
529 cmdline_parse_token_string_t cmd_avg_tcsubport_port_string
=
530 TOKEN_STRING_INITIALIZER(struct cmd_avg_tcsubport_result
, port_string
,
532 cmdline_parse_token_num_t cmd_avg_tcsubport_port_number
=
533 TOKEN_NUM_INITIALIZER(struct cmd_avg_tcsubport_result
, port_number
,
535 cmdline_parse_token_string_t cmd_avg_tcsubport_subport_string
=
536 TOKEN_STRING_INITIALIZER(struct cmd_avg_tcsubport_result
, subport_string
,
538 cmdline_parse_token_num_t cmd_avg_tcsubport_subport_number
=
539 TOKEN_NUM_INITIALIZER(struct cmd_avg_tcsubport_result
, subport_number
,
541 cmdline_parse_token_string_t cmd_avg_tcsubport_tc_string
=
542 TOKEN_STRING_INITIALIZER(struct cmd_avg_tcsubport_result
, tc_string
,
544 cmdline_parse_token_num_t cmd_avg_tcsubport_tc_number
=
545 TOKEN_NUM_INITIALIZER(struct cmd_avg_tcsubport_result
, tc_number
,
548 cmdline_parse_inst_t cmd_avg_tcsubport
= {
549 .f
= cmd_avg_tcsubport_parsed
,
551 .help_str
= "Show pipe stats.",
553 (void *)&cmd_avg_tcsubport_qavg_string
,
554 (void *)&cmd_avg_tcsubport_port_string
,
555 (void *)&cmd_avg_tcsubport_port_number
,
556 (void *)&cmd_avg_tcsubport_subport_string
,
557 (void *)&cmd_avg_tcsubport_subport_number
,
558 (void *)&cmd_avg_tcsubport_tc_string
,
559 (void *)&cmd_avg_tcsubport_tc_number
,
564 /* *** SHOW AVERAGE QUEUE SIZE (subport) *** */
565 struct cmd_avg_subport_result
{
566 cmdline_fixed_string_t qavg_string
;
567 cmdline_fixed_string_t port_string
;
569 cmdline_fixed_string_t subport_string
;
570 uint32_t subport_number
;
573 static void cmd_avg_subport_parsed(void *parsed_result
,
574 __attribute__((unused
)) struct cmdline
*cl
,
575 __attribute__((unused
)) void *data
)
577 struct cmd_avg_subport_result
*res
= parsed_result
;
579 if (qavg_subport(res
->port_number
, res
->subport_number
) < 0)
580 printf ("\nStats not available for these parameters. Check that both the port and subport are correct.\n\n");
583 cmdline_parse_token_string_t cmd_avg_subport_qavg_string
=
584 TOKEN_STRING_INITIALIZER(struct cmd_avg_subport_result
, qavg_string
,
586 cmdline_parse_token_string_t cmd_avg_subport_port_string
=
587 TOKEN_STRING_INITIALIZER(struct cmd_avg_subport_result
, port_string
,
589 cmdline_parse_token_num_t cmd_avg_subport_port_number
=
590 TOKEN_NUM_INITIALIZER(struct cmd_avg_subport_result
, port_number
,
592 cmdline_parse_token_string_t cmd_avg_subport_subport_string
=
593 TOKEN_STRING_INITIALIZER(struct cmd_avg_subport_result
, subport_string
,
595 cmdline_parse_token_num_t cmd_avg_subport_subport_number
=
596 TOKEN_NUM_INITIALIZER(struct cmd_avg_subport_result
, subport_number
,
599 cmdline_parse_inst_t cmd_avg_subport
= {
600 .f
= cmd_avg_subport_parsed
,
602 .help_str
= "Show pipe stats.",
604 (void *)&cmd_avg_subport_qavg_string
,
605 (void *)&cmd_avg_subport_port_string
,
606 (void *)&cmd_avg_subport_port_number
,
607 (void *)&cmd_avg_subport_subport_string
,
608 (void *)&cmd_avg_subport_subport_number
,
613 /* ******************************************************************************** */
615 /* list of instructions */
616 cmdline_parse_ctx_t main_ctx
[] = {
617 (cmdline_parse_inst_t
*)&cmd_help
,
618 (cmdline_parse_inst_t
*)&cmd_setqavg
,
619 (cmdline_parse_inst_t
*)&cmd_appstats
,
620 (cmdline_parse_inst_t
*)&cmd_subportstats
,
621 (cmdline_parse_inst_t
*)&cmd_pipestats
,
622 (cmdline_parse_inst_t
*)&cmd_avg_q
,
623 (cmdline_parse_inst_t
*)&cmd_avg_tcpipe
,
624 (cmdline_parse_inst_t
*)&cmd_avg_pipe
,
625 (cmdline_parse_inst_t
*)&cmd_avg_tcsubport
,
626 (cmdline_parse_inst_t
*)&cmd_avg_subport
,
627 (cmdline_parse_inst_t
*)&cmd_quit
,
631 /* prompt function, called from main on MASTER lcore */
637 cl
= cmdline_stdin_new(main_ctx
, "qos_sched> ");
641 cmdline_interact(cl
);
642 cmdline_stdin_exit(cl
);