4 * Copyright(c) 2010-2012 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.
45 #include <net/socket.h>
47 #include <netinet/in.h>
49 #include <sys/queue.h>
51 #include <rte_common.h>
52 #include <rte_byteorder.h>
54 #include <rte_debug.h>
55 #include <rte_cycles.h>
56 #include <rte_memory.h>
57 #include <rte_memzone.h>
58 #include <rte_launch.h>
59 #include <rte_tailq.h>
61 #include <rte_per_lcore.h>
62 #include <rte_lcore.h>
63 #include <rte_atomic.h>
64 #include <rte_branch_prediction.h>
66 #include <rte_mempool.h>
67 #include <rte_interrupts.h>
69 #include <rte_ether.h>
70 #include <rte_ethdev.h>
71 #include <rte_string_fns.h>
73 #include <cmdline_rdline.h>
74 #include <cmdline_parse.h>
75 #include <cmdline_parse_num.h>
76 #include <cmdline_parse_string.h>
77 #include <cmdline_parse_ipaddr.h>
78 #include <cmdline_parse_etheraddr.h>
79 #include <cmdline_socket.h>
85 struct cmd_help_result {
86 cmdline_fixed_string_t help;
89 static void cmd_help_parsed(__attribute__((unused)) void *parsed_result,
91 __attribute__((unused)) void *data)
98 "This commandline can be used to configure forwarding\n"
101 "Display informations:\n"
102 "---------------------\n"
103 "- show port info|stats|fdir|stat_qmap X|all\n"
104 " Diplays information or stats or stats queue mapping on port X, or all\n"
105 "- clear port stats X|all\n"
106 " Clear stats for port X, or all\n"
107 "- show config rxtx|cores|fwd\n"
108 " Displays the given configuration\n"
109 "- read reg port_id reg_off\n"
110 " Displays value of a port register\n"
111 "- read regfield port_id reg_off bit_x bit_y\n"
112 " Displays value of a port register bit field\n"
113 "- read regbit port_id reg_off bit_x\n"
114 " Displays value of a port register bit\n"
115 "- read rxd port_id queue_id rxd_id\n"
116 " Displays a RX descriptor of a port RX queue\n"
117 "- read txd port_id queue_id txd_id\n"
118 " Displays a TX descriptor of a port TX queue\n"
123 "Modifications are taken into account once "
124 "forwarding is restarted.\n"
126 " Set forwarding to default configuration\n"
127 "- set nbport|nbcore|burst|verbose X\n"
128 " Set number of ports, number of cores, number "
129 "of packets per burst,\n or verbose level to X\n"
130 "- set txpkts x[,y]*\n"
131 " Set the length of each segment of TXONLY packets\n"
132 "- set coremask|portmask X\n"
133 " Set the hexadecimal mask of forwarding cores / "
135 "- set corelist|portlist x[,y]*\n"
136 " Set the list of forwarding cores / forwarding "
138 "- vlan set strip|filter|qinq on/off port_id\n"
139 " Set the VLAN strip, filter, QinQ(extended) on a port"
140 "- rx_vlan add/rm vlan_id|all port_id\n"
141 " Set the VLAN filter table, add/remove vlan_id, or all "
142 "identifiers, to/from the set of VLAN Identifiers\n"
143 "filtered by port_id\n"
144 "- rx_vlan set tpid value port_id\n"
145 " Set Outer VLAN TPID for Packet Filtering on a port \n"
146 "- tx_vlan set vlan_id port_id\n"
147 " Set hardware insertion of VLAN ID in packets sent on a port\n"
148 "- tx_vlan reset port_id\n"
149 " Disable hardware insertion of a VLAN header in "
150 "packets sent on port_id\n"
151 "- tx_checksum set mask port_id\n"
152 " Enable hardware insertion of checksum offload with "
153 "the 4-bit mask (0~0xf)\n in packets sent on port_id\n"
154 " Please check the NIC datasheet for HW limits\n"
155 " bit 0 - insert ip checksum offload if set \n"
156 " bit 1 - insert udp checksum offload if set \n"
157 " bit 2 - insert tcp checksum offload if set\n"
158 " bit 3 - insert sctp checksum offload if set\n"
159 #ifdef RTE_LIBRTE_IEEE1588
160 "- set fwd io|mac|rxonly|txonly|csum|ieee1588\n"
161 " Set IO, MAC, RXONLY, TXONLY, CSUM or IEEE1588 "
162 "packet forwarding mode\n"
164 "- set fwd io|mac|rxonly|txonly|csum\n"
165 " Set IO, MAC, RXONLY, CSUM or TXONLY packet "
168 "- mac_addr add|remove X <xx:xx:xx:xx:xx:xx>\n"
169 " Add/Remove the MAC address <xx:xx:xx:xx:xx:xx> on port X\n"
170 "- set promisc|allmulti [all|X] on|off\n"
171 " Set/unset promisc|allmulti mode on port X, or all\n"
172 "- set flow_ctrl rx on|off tx on|off high_water low_water "
173 "pause_time send_xon port_id \n"
174 " Set the link flow control parameter on the port \n"
175 "- write reg port_id reg_off value\n"
176 " Set value of a port register\n"
177 "- write regfield port_id reg_off bit_x bit_y value\n"
178 " Set bit field value of a port register\n"
179 "- write regbit port_id reg_off bit_x value\n"
180 " Set bit value of a port register\n"
181 "- set stat_qmap tx|rx port_id queue_id qmapping\n"
182 " Set statistics mapping (qmapping 0..15) for tx|rx queue_id on port_id\n"
183 " e.g., 'set stat_qmap rx 0 2 5' sets rx queue 2 on port 0 to mapping 5\n"
186 "Control forwarding:\n"
187 "-------------------\n"
189 " Start packet forwarding with current config\n"
191 " Start packet forwarding with current config"
192 " after sending one burst\n of packets\n"
194 " Stop packet forwarding, and displays accumulated"
198 "Flow director mode:\n"
199 "-------------------\n"
200 "- add_signature_filter port_id ip|udp|tcp|sctp src\n"
201 " ip_src_address port_src dst ip_dst_address port_dst\n"
202 " flexbytes flexbytes_values vlan vlan_id queue queue_id\n"
203 "- upd_signature_filter port_id ip|udp|tcp|sctp src \n"
204 " ip_src_address port_src dst ip_dst_address port_dst\n"
205 " flexbytes flexbytes_values vlan vlan_id queue queue_id\n"
206 "- rm_signature_filter port_id ip|udp|tcp|sctp src\n"
207 " ip_src_address port_src dst ip_dst_address port_dst\n"
208 " flexbytes flexbytes_values vlan vlan_id\n"
209 "- add_perfect_filter port_id ip|udp|tcp|sctp src\n"
210 " ip_src_address port_src dst ip_dst_address port_dst\n"
211 " flexbytes flexbytes_values vlan vlan_id queue \n"
212 " queue_id soft soft_id\n"
213 "- upd_perfect_filter port_id ip|udp|tcp|sctp src\n"
214 " ip_src_address port_src dst ip_dst_address port_dst\n"
215 " flexbytes flexbytes_values vlan vlan_id queue queue_id\n"
216 "- rm_perfect_filter port_id ip|udp|tcp|sctp src\n"
217 " ip_src_address port_src dst ip_dst_address port_dst\n"
218 " flexbytes flexbytes_values vlan vlan_id soft soft_id\n"
219 "- set_masks_filter port_id only_ip_flow 0|1 src_mask\n"
220 " ip_src_mask port_src_mask dst_mask ip_dst_mask\n"
221 " port_dst_mask flexbytes 0|1 vlan_id 0|1 vlan_prio 0|1\n"
222 "- set_ipv6_masks_filter port_id only_ip_flow 0|1 src_mask\n"
223 " ip_src_mask port_src_mask dst_mask ip_dst_mask\n"
224 " port_dst_mask flexbytes 0|1 vlan_id 0|1\n"
225 " vlan_prio 0|1 compare_dst 0|1\n"
231 " Quit to prompt in linux, and reboot on baremetal\n"
235 cmdline_parse_token_string_t cmd_help_help =
236 TOKEN_STRING_INITIALIZER(struct cmd_help_result, help, "help");
238 cmdline_parse_inst_t cmd_help = {
239 .f = cmd_help_parsed,
241 .help_str = "show help",
243 (void *)&cmd_help_help,
249 struct cmd_stop_result {
250 cmdline_fixed_string_t stop;
253 static void cmd_stop_parsed(__attribute__((unused)) void *parsed_result,
254 __attribute__((unused)) struct cmdline *cl,
255 __attribute__((unused)) void *data)
257 stop_packet_forwarding();
260 cmdline_parse_token_string_t cmd_stop_stop =
261 TOKEN_STRING_INITIALIZER(struct cmd_stop_result, stop, "stop");
263 cmdline_parse_inst_t cmd_stop = {
264 .f = cmd_stop_parsed,
266 .help_str = "stop - stop packet forwarding",
268 (void *)&cmd_stop_stop,
273 /* *** SET CORELIST and PORTLIST CONFIGURATION *** */
276 parse_item_list(char* str, const char* item_name, unsigned int max_items,
277 unsigned int *parsed_items, int check_unique_values)
279 unsigned int nb_item;
287 * First parse all items in the list and store their value.
292 for (i = 0; i < strnlen(str, STR_TOKEN_SIZE); i++) {
294 if ((c >= '0') && (c <= '9')) {
295 value = (unsigned int) (value * 10 + (c - '0'));
300 printf("character %c is not a decimal digit\n", c);
304 printf("No valid value before comma\n");
307 if (nb_item < max_items) {
308 parsed_items[nb_item] = value;
314 if (nb_item >= max_items) {
315 printf("Number of %s = %u > %u (maximum items)\n",
316 item_name, nb_item + 1, max_items);
319 parsed_items[nb_item++] = value;
320 if (! check_unique_values)
324 * Then, check that all values in the list are differents.
325 * No optimization here...
327 for (i = 0; i < nb_item; i++) {
328 for (j = i + 1; j < nb_item; j++) {
329 if (parsed_items[j] == parsed_items[i]) {
330 printf("duplicated %s %u at index %u and %u\n",
331 item_name, parsed_items[i], i, j);
339 struct cmd_set_list_result {
340 cmdline_fixed_string_t cmd_keyword;
341 cmdline_fixed_string_t list_name;
342 cmdline_fixed_string_t list_of_items;
345 static void cmd_set_list_parsed(void *parsed_result,
346 __attribute__((unused)) struct cmdline *cl,
347 __attribute__((unused)) void *data)
349 struct cmd_set_list_result *res;
351 unsigned int lcorelist[RTE_MAX_LCORE];
352 unsigned int portlist[RTE_MAX_ETHPORTS];
354 unsigned int nb_item;
357 if (!strcmp(res->list_name, "corelist")) {
358 nb_item = parse_item_list(res->list_of_items, "core",
360 parsed_items.lcorelist, 1);
362 set_fwd_lcores_list(parsed_items.lcorelist, nb_item);
365 if (!strcmp(res->list_name, "portlist")) {
366 nb_item = parse_item_list(res->list_of_items, "port",
368 parsed_items.portlist, 1);
370 set_fwd_ports_list(parsed_items.portlist, nb_item);
374 cmdline_parse_token_string_t cmd_set_list_keyword =
375 TOKEN_STRING_INITIALIZER(struct cmd_set_list_result, cmd_keyword,
377 cmdline_parse_token_string_t cmd_set_list_name =
378 TOKEN_STRING_INITIALIZER(struct cmd_set_list_result, list_name,
379 "corelist#portlist");
380 cmdline_parse_token_string_t cmd_set_list_of_items =
381 TOKEN_STRING_INITIALIZER(struct cmd_set_list_result, list_of_items,
384 cmdline_parse_inst_t cmd_set_fwd_list = {
385 .f = cmd_set_list_parsed,
387 .help_str = "set corelist|portlist x[,y]*",
389 (void *)&cmd_set_list_keyword,
390 (void *)&cmd_set_list_name,
391 (void *)&cmd_set_list_of_items,
396 /* *** SET COREMASK and PORTMASK CONFIGURATION *** */
398 struct cmd_setmask_result {
399 cmdline_fixed_string_t set;
400 cmdline_fixed_string_t mask;
404 static void cmd_set_mask_parsed(void *parsed_result,
405 __attribute__((unused)) struct cmdline *cl,
406 __attribute__((unused)) void *data)
408 struct cmd_setmask_result *res = parsed_result;
410 if (!strcmp(res->mask, "coremask"))
411 set_fwd_lcores_mask(res->hexavalue);
412 else if (!strcmp(res->mask, "portmask"))
413 set_fwd_ports_mask(res->hexavalue);
416 cmdline_parse_token_string_t cmd_setmask_set =
417 TOKEN_STRING_INITIALIZER(struct cmd_setmask_result, set, "set");
418 cmdline_parse_token_string_t cmd_setmask_mask =
419 TOKEN_STRING_INITIALIZER(struct cmd_setmask_result, mask,
420 "coremask#portmask");
421 cmdline_parse_token_num_t cmd_setmask_value =
422 TOKEN_NUM_INITIALIZER(struct cmd_setmask_result, hexavalue, UINT64);
424 cmdline_parse_inst_t cmd_set_fwd_mask = {
425 .f = cmd_set_mask_parsed,
427 .help_str = "set coremask|portmask hexadecimal value",
429 (void *)&cmd_setmask_set,
430 (void *)&cmd_setmask_mask,
431 (void *)&cmd_setmask_value,
437 * SET NBPORT, NBCORE, PACKET BURST, and VERBOSE LEVEL CONFIGURATION
439 struct cmd_set_result {
440 cmdline_fixed_string_t set;
441 cmdline_fixed_string_t what;
445 static void cmd_set_parsed(void *parsed_result,
446 __attribute__((unused)) struct cmdline *cl,
447 __attribute__((unused)) void *data)
449 struct cmd_set_result *res = parsed_result;
450 if (!strcmp(res->what, "nbport"))
451 set_fwd_ports_number(res->value);
452 else if (!strcmp(res->what, "nbcore"))
453 set_fwd_lcores_number(res->value);
454 else if (!strcmp(res->what, "burst"))
455 set_nb_pkt_per_burst(res->value);
456 else if (!strcmp(res->what, "verbose"))
457 set_verbose_level(res->value);
460 cmdline_parse_token_string_t cmd_set_set =
461 TOKEN_STRING_INITIALIZER(struct cmd_set_result, set, "set");
462 cmdline_parse_token_string_t cmd_set_what =
463 TOKEN_STRING_INITIALIZER(struct cmd_set_result, what,
464 "nbport#nbcore#burst#verbose");
465 cmdline_parse_token_num_t cmd_set_value =
466 TOKEN_NUM_INITIALIZER(struct cmd_set_result, value, UINT16);
468 cmdline_parse_inst_t cmd_set_numbers = {
471 .help_str = "set nbport|nbcore|burst|verbose value",
473 (void *)&cmd_set_set,
474 (void *)&cmd_set_what,
475 (void *)&cmd_set_value,
480 /* *** SET SEGMENT LENGTHS OF TXONLY PACKETS *** */
482 struct cmd_set_txpkts_result {
483 cmdline_fixed_string_t cmd_keyword;
484 cmdline_fixed_string_t txpkts;
485 cmdline_fixed_string_t seg_lengths;
489 cmd_set_txpkts_parsed(void *parsed_result,
490 __attribute__((unused)) struct cmdline *cl,
491 __attribute__((unused)) void *data)
493 struct cmd_set_txpkts_result *res;
494 unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT];
495 unsigned int nb_segs;
498 nb_segs = parse_item_list(res->seg_lengths, "segment lengths",
499 RTE_MAX_SEGS_PER_PKT, seg_lengths, 0);
501 set_tx_pkt_segments(seg_lengths, nb_segs);
504 cmdline_parse_token_string_t cmd_set_txpkts_keyword =
505 TOKEN_STRING_INITIALIZER(struct cmd_set_txpkts_result,
507 cmdline_parse_token_string_t cmd_set_txpkts_name =
508 TOKEN_STRING_INITIALIZER(struct cmd_set_txpkts_result,
510 cmdline_parse_token_string_t cmd_set_txpkts_lengths =
511 TOKEN_STRING_INITIALIZER(struct cmd_set_txpkts_result,
514 cmdline_parse_inst_t cmd_set_txpkts = {
515 .f = cmd_set_txpkts_parsed,
517 .help_str = "set txpkts x[,y]*",
519 (void *)&cmd_set_txpkts_keyword,
520 (void *)&cmd_set_txpkts_name,
521 (void *)&cmd_set_txpkts_lengths,
526 /* *** ADD/REMOVE ALL VLAN IDENTIFIERS TO/FROM A PORT VLAN RX FILTER *** */
527 struct cmd_rx_vlan_filter_all_result {
528 cmdline_fixed_string_t rx_vlan;
529 cmdline_fixed_string_t what;
530 cmdline_fixed_string_t all;
535 cmd_rx_vlan_filter_all_parsed(void *parsed_result,
536 __attribute__((unused)) struct cmdline *cl,
537 __attribute__((unused)) void *data)
539 struct cmd_rx_vlan_filter_all_result *res = parsed_result;
541 if (!strcmp(res->what, "add"))
542 rx_vlan_all_filter_set(res->port_id, 1);
544 rx_vlan_all_filter_set(res->port_id, 0);
547 cmdline_parse_token_string_t cmd_rx_vlan_filter_all_rx_vlan =
548 TOKEN_STRING_INITIALIZER(struct cmd_rx_vlan_filter_all_result,
550 cmdline_parse_token_string_t cmd_rx_vlan_filter_all_what =
551 TOKEN_STRING_INITIALIZER(struct cmd_rx_vlan_filter_all_result,
553 cmdline_parse_token_string_t cmd_rx_vlan_filter_all_all =
554 TOKEN_STRING_INITIALIZER(struct cmd_rx_vlan_filter_all_result,
556 cmdline_parse_token_num_t cmd_rx_vlan_filter_all_portid =
557 TOKEN_NUM_INITIALIZER(struct cmd_rx_vlan_filter_all_result,
560 cmdline_parse_inst_t cmd_rx_vlan_filter_all = {
561 .f = cmd_rx_vlan_filter_all_parsed,
563 .help_str = "add/remove all identifiers to/from the set of VLAN "
564 "Identifiers filtered by a port",
566 (void *)&cmd_rx_vlan_filter_all_rx_vlan,
567 (void *)&cmd_rx_vlan_filter_all_what,
568 (void *)&cmd_rx_vlan_filter_all_all,
569 (void *)&cmd_rx_vlan_filter_all_portid,
574 /* *** VLAN OFFLOAD SET ON A PORT *** */
575 struct cmd_vlan_offload_result {
576 cmdline_fixed_string_t vlan;
577 cmdline_fixed_string_t set;
578 cmdline_fixed_string_t what;
579 cmdline_fixed_string_t on;
580 cmdline_fixed_string_t port_id;
584 cmd_vlan_offload_parsed(void *parsed_result,
585 __attribute__((unused)) struct cmdline *cl,
586 __attribute__((unused)) void *data)
589 struct cmd_vlan_offload_result *res = parsed_result;
592 portid_t port_id = 0;
596 len = strnlen(str, STR_TOKEN_SIZE);
598 /* Get port_id first */
606 tmp = strtoul(str, NULL, 0);
607 /* If port_id greater that what portid_t can represent, return */
610 port_id = (portid_t)tmp;
612 if (!strcmp(res->on, "on"))
617 if (!strcmp(res->what, "strip"))
618 rx_vlan_strip_set(port_id, on);
619 else if(!strcmp(res->what, "stripq")){
620 uint16_t queue_id = 0;
622 /* No queue_id, return */
625 tmp = strtoul(str + i + 1, NULL, 0);
626 /* If queue_id greater that what 16-bits can represent, return */
630 queue_id = (uint16_t)tmp;
631 rx_vlan_strip_set_on_queue(port_id, queue_id, on);
633 else if (!strcmp(res->what, "filter"))
634 rx_vlan_filter_set(port_id, on);
636 vlan_extend_set(port_id, on);
641 cmdline_parse_token_string_t cmd_vlan_offload_vlan =
642 TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result,
644 cmdline_parse_token_string_t cmd_vlan_offload_set =
645 TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result,
647 cmdline_parse_token_string_t cmd_vlan_offload_what =
648 TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result,
649 what, "strip#filter#qinq#stripq");
650 cmdline_parse_token_string_t cmd_vlan_offload_on =
651 TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result,
653 cmdline_parse_token_string_t cmd_vlan_offload_portid =
654 TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result,
657 cmdline_parse_inst_t cmd_vlan_offload = {
658 .f = cmd_vlan_offload_parsed,
660 .help_str = "set strip|filter|qinq|stripq on|off port_id[,queue_id], filter/strip for rx side"
661 " qinq(extended) for both rx/tx sides ",
663 (void *)&cmd_vlan_offload_vlan,
664 (void *)&cmd_vlan_offload_set,
665 (void *)&cmd_vlan_offload_what,
666 (void *)&cmd_vlan_offload_on,
667 (void *)&cmd_vlan_offload_portid,
672 /* *** VLAN TPID SET ON A PORT *** */
673 struct cmd_vlan_tpid_result {
674 cmdline_fixed_string_t vlan;
675 cmdline_fixed_string_t set;
676 cmdline_fixed_string_t what;
682 cmd_vlan_tpid_parsed(void *parsed_result,
683 __attribute__((unused)) struct cmdline *cl,
684 __attribute__((unused)) void *data)
686 struct cmd_vlan_tpid_result *res = parsed_result;
687 vlan_tpid_set(res->port_id, res->tp_id);
691 cmdline_parse_token_string_t cmd_vlan_tpid_vlan =
692 TOKEN_STRING_INITIALIZER(struct cmd_vlan_tpid_result,
694 cmdline_parse_token_string_t cmd_vlan_tpid_set =
695 TOKEN_STRING_INITIALIZER(struct cmd_vlan_tpid_result,
697 cmdline_parse_token_string_t cmd_vlan_tpid_what =
698 TOKEN_STRING_INITIALIZER(struct cmd_vlan_tpid_result,
700 cmdline_parse_token_num_t cmd_vlan_tpid_tpid =
701 TOKEN_NUM_INITIALIZER(struct cmd_vlan_tpid_result,
703 cmdline_parse_token_num_t cmd_vlan_tpid_portid =
704 TOKEN_NUM_INITIALIZER(struct cmd_vlan_tpid_result,
707 cmdline_parse_inst_t cmd_vlan_tpid = {
708 .f = cmd_vlan_tpid_parsed,
710 .help_str = "set tpid tp_id port_id, set the Outer VLAN Ether type",
712 (void *)&cmd_vlan_tpid_vlan,
713 (void *)&cmd_vlan_tpid_set,
714 (void *)&cmd_vlan_tpid_what,
715 (void *)&cmd_vlan_tpid_tpid,
716 (void *)&cmd_vlan_tpid_portid,
721 /* *** ADD/REMOVE A VLAN IDENTIFIER TO/FROM A PORT VLAN RX FILTER *** */
722 struct cmd_rx_vlan_filter_result {
723 cmdline_fixed_string_t rx_vlan;
724 cmdline_fixed_string_t what;
730 cmd_rx_vlan_filter_parsed(void *parsed_result,
731 __attribute__((unused)) struct cmdline *cl,
732 __attribute__((unused)) void *data)
734 struct cmd_rx_vlan_filter_result *res = parsed_result;
736 if (!strcmp(res->what, "add"))
737 rx_vft_set(res->port_id, res->vlan_id, 1);
739 rx_vft_set(res->port_id, res->vlan_id, 0);
742 cmdline_parse_token_string_t cmd_rx_vlan_filter_rx_vlan =
743 TOKEN_STRING_INITIALIZER(struct cmd_rx_vlan_filter_result,
745 cmdline_parse_token_string_t cmd_rx_vlan_filter_what =
746 TOKEN_STRING_INITIALIZER(struct cmd_rx_vlan_filter_result,
748 cmdline_parse_token_num_t cmd_rx_vlan_filter_vlanid =
749 TOKEN_NUM_INITIALIZER(struct cmd_rx_vlan_filter_result,
751 cmdline_parse_token_num_t cmd_rx_vlan_filter_portid =
752 TOKEN_NUM_INITIALIZER(struct cmd_rx_vlan_filter_result,
755 cmdline_parse_inst_t cmd_rx_vlan_filter = {
756 .f = cmd_rx_vlan_filter_parsed,
758 .help_str = "add/remove a VLAN identifier to/from the set of VLAN "
759 "Identifiers filtered by a port",
761 (void *)&cmd_rx_vlan_filter_rx_vlan,
762 (void *)&cmd_rx_vlan_filter_what,
763 (void *)&cmd_rx_vlan_filter_vlanid,
764 (void *)&cmd_rx_vlan_filter_portid,
769 /* *** ENABLE HARDWARE INSERTION OF VLAN HEADER IN TX PACKETS *** */
770 struct cmd_tx_vlan_set_result {
771 cmdline_fixed_string_t tx_vlan;
772 cmdline_fixed_string_t set;
778 cmd_tx_vlan_set_parsed(void *parsed_result,
779 __attribute__((unused)) struct cmdline *cl,
780 __attribute__((unused)) void *data)
782 struct cmd_tx_vlan_set_result *res = parsed_result;
783 tx_vlan_set(res->port_id, res->vlan_id);
786 cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan =
787 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_set_result,
789 cmdline_parse_token_string_t cmd_tx_vlan_set_set =
790 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_set_result,
792 cmdline_parse_token_num_t cmd_tx_vlan_set_vlanid =
793 TOKEN_NUM_INITIALIZER(struct cmd_tx_vlan_set_result,
795 cmdline_parse_token_num_t cmd_tx_vlan_set_portid =
796 TOKEN_NUM_INITIALIZER(struct cmd_tx_vlan_set_result,
799 cmdline_parse_inst_t cmd_tx_vlan_set = {
800 .f = cmd_tx_vlan_set_parsed,
802 .help_str = "enable hardware insertion of a VLAN header with a given "
803 "TAG Identifier in packets sent on a port",
805 (void *)&cmd_tx_vlan_set_tx_vlan,
806 (void *)&cmd_tx_vlan_set_set,
807 (void *)&cmd_tx_vlan_set_vlanid,
808 (void *)&cmd_tx_vlan_set_portid,
813 /* *** DISABLE HARDWARE INSERTION OF VLAN HEADER IN TX PACKETS *** */
814 struct cmd_tx_vlan_reset_result {
815 cmdline_fixed_string_t tx_vlan;
816 cmdline_fixed_string_t reset;
821 cmd_tx_vlan_reset_parsed(void *parsed_result,
822 __attribute__((unused)) struct cmdline *cl,
823 __attribute__((unused)) void *data)
825 struct cmd_tx_vlan_reset_result *res = parsed_result;
827 tx_vlan_reset(res->port_id);
830 cmdline_parse_token_string_t cmd_tx_vlan_reset_tx_vlan =
831 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_reset_result,
833 cmdline_parse_token_string_t cmd_tx_vlan_reset_reset =
834 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_reset_result,
836 cmdline_parse_token_num_t cmd_tx_vlan_reset_portid =
837 TOKEN_NUM_INITIALIZER(struct cmd_tx_vlan_reset_result,
840 cmdline_parse_inst_t cmd_tx_vlan_reset = {
841 .f = cmd_tx_vlan_reset_parsed,
843 .help_str = "disable hardware insertion of a VLAN header in packets "
846 (void *)&cmd_tx_vlan_reset_tx_vlan,
847 (void *)&cmd_tx_vlan_reset_reset,
848 (void *)&cmd_tx_vlan_reset_portid,
854 /* *** ENABLE HARDWARE INSERTION OF CHECKSUM IN TX PACKETS *** */
855 struct cmd_tx_cksum_set_result {
856 cmdline_fixed_string_t tx_cksum;
857 cmdline_fixed_string_t set;
863 cmd_tx_cksum_set_parsed(void *parsed_result,
864 __attribute__((unused)) struct cmdline *cl,
865 __attribute__((unused)) void *data)
867 struct cmd_tx_cksum_set_result *res = parsed_result;
869 tx_cksum_set(res->port_id, res->cksum_mask);
872 cmdline_parse_token_string_t cmd_tx_cksum_set_tx_cksum =
873 TOKEN_STRING_INITIALIZER(struct cmd_tx_cksum_set_result,
874 tx_cksum, "tx_checksum");
875 cmdline_parse_token_string_t cmd_tx_cksum_set_set =
876 TOKEN_STRING_INITIALIZER(struct cmd_tx_cksum_set_result,
878 cmdline_parse_token_num_t cmd_tx_cksum_set_cksum_mask =
879 TOKEN_NUM_INITIALIZER(struct cmd_tx_cksum_set_result,
881 cmdline_parse_token_num_t cmd_tx_cksum_set_portid =
882 TOKEN_NUM_INITIALIZER(struct cmd_tx_cksum_set_result,
885 cmdline_parse_inst_t cmd_tx_cksum_set = {
886 .f = cmd_tx_cksum_set_parsed,
888 .help_str = "enable hardware insertion of L3/L4checksum with a given "
889 "mask in packets sent on a port, the bit mapping is given as, Bit 0 for ip"
890 "Bit 1 for UDP, Bit 2 for TCP, Bit 3 for SCTP",
892 (void *)&cmd_tx_cksum_set_tx_cksum,
893 (void *)&cmd_tx_cksum_set_set,
894 (void *)&cmd_tx_cksum_set_cksum_mask,
895 (void *)&cmd_tx_cksum_set_portid,
900 /* *** SET FORWARDING MODE *** */
901 struct cmd_set_fwd_mode_result {
902 cmdline_fixed_string_t set;
903 cmdline_fixed_string_t fwd;
904 cmdline_fixed_string_t mode;
907 static void cmd_set_fwd_mode_parsed(void *parsed_result,
908 __attribute__((unused)) struct cmdline *cl,
909 __attribute__((unused)) void *data)
911 struct cmd_set_fwd_mode_result *res = parsed_result;
913 set_pkt_forwarding_mode(res->mode);
916 cmdline_parse_token_string_t cmd_setfwd_set =
917 TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_mode_result, set, "set");
918 cmdline_parse_token_string_t cmd_setfwd_fwd =
919 TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_mode_result, fwd, "fwd");
920 cmdline_parse_token_string_t cmd_setfwd_mode =
921 TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_mode_result, mode,
922 #ifdef RTE_LIBRTE_IEEE1588
923 "io#mac#rxonly#txonly#csum#ieee1588");
925 "io#mac#rxonly#txonly#csum");
928 cmdline_parse_inst_t cmd_set_fwd_mode = {
929 .f = cmd_set_fwd_mode_parsed,
931 #ifdef RTE_LIBRTE_IEEE1588
932 .help_str = "set fwd io|mac|rxonly|txonly|csum|ieee1588 - set IO, MAC,"
933 " RXONLY, TXONLY, CSUM or IEEE1588 packet forwarding mode",
935 .help_str = "set fwd io|mac|rxonly|txonly|csum - set IO, MAC,"
936 " RXONLY, CSUM or TXONLY packet forwarding mode",
939 (void *)&cmd_setfwd_set,
940 (void *)&cmd_setfwd_fwd,
941 (void *)&cmd_setfwd_mode,
946 /* *** SET PROMISC MODE *** */
947 struct cmd_set_promisc_mode_result {
948 cmdline_fixed_string_t set;
949 cmdline_fixed_string_t promisc;
950 cmdline_fixed_string_t port_all; /* valid if "allports" argument == 1 */
951 uint8_t port_num; /* valid if "allports" argument == 0 */
952 cmdline_fixed_string_t mode;
955 static void cmd_set_promisc_mode_parsed(void *parsed_result,
956 __attribute__((unused)) struct cmdline *cl,
959 struct cmd_set_promisc_mode_result *res = parsed_result;
963 if (!strcmp(res->mode, "on"))
970 for (i = 0; i < nb_ports; i++) {
972 rte_eth_promiscuous_enable(i);
974 rte_eth_promiscuous_disable(i);
979 rte_eth_promiscuous_enable(res->port_num);
981 rte_eth_promiscuous_disable(res->port_num);
985 cmdline_parse_token_string_t cmd_setpromisc_set =
986 TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result, set, "set");
987 cmdline_parse_token_string_t cmd_setpromisc_promisc =
988 TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result, promisc,
990 cmdline_parse_token_string_t cmd_setpromisc_portall =
991 TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result, port_all,
993 cmdline_parse_token_num_t cmd_setpromisc_portnum =
994 TOKEN_NUM_INITIALIZER(struct cmd_set_promisc_mode_result, port_num,
996 cmdline_parse_token_string_t cmd_setpromisc_mode =
997 TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result, mode,
1000 cmdline_parse_inst_t cmd_set_promisc_mode_all = {
1001 .f = cmd_set_promisc_mode_parsed,
1003 .help_str = "set promisc all on|off: set promisc mode for all ports",
1005 (void *)&cmd_setpromisc_set,
1006 (void *)&cmd_setpromisc_promisc,
1007 (void *)&cmd_setpromisc_portall,
1008 (void *)&cmd_setpromisc_mode,
1013 cmdline_parse_inst_t cmd_set_promisc_mode_one = {
1014 .f = cmd_set_promisc_mode_parsed,
1016 .help_str = "set promisc X on|off: set promisc mode on port X",
1018 (void *)&cmd_setpromisc_set,
1019 (void *)&cmd_setpromisc_promisc,
1020 (void *)&cmd_setpromisc_portnum,
1021 (void *)&cmd_setpromisc_mode,
1026 /* *** SET ALLMULTI MODE *** */
1027 struct cmd_set_allmulti_mode_result {
1028 cmdline_fixed_string_t set;
1029 cmdline_fixed_string_t allmulti;
1030 cmdline_fixed_string_t port_all; /* valid if "allports" argument == 1 */
1031 uint8_t port_num; /* valid if "allports" argument == 0 */
1032 cmdline_fixed_string_t mode;
1035 static void cmd_set_allmulti_mode_parsed(void *parsed_result,
1036 __attribute__((unused)) struct cmdline *cl,
1039 struct cmd_set_allmulti_mode_result *res = parsed_result;
1043 if (!strcmp(res->mode, "on"))
1050 for (i = 0; i < nb_ports; i++) {
1052 rte_eth_allmulticast_enable(i);
1054 rte_eth_allmulticast_disable(i);
1059 rte_eth_allmulticast_enable(res->port_num);
1061 rte_eth_allmulticast_disable(res->port_num);
1065 cmdline_parse_token_string_t cmd_setallmulti_set =
1066 TOKEN_STRING_INITIALIZER(struct cmd_set_allmulti_mode_result, set, "set");
1067 cmdline_parse_token_string_t cmd_setallmulti_allmulti =
1068 TOKEN_STRING_INITIALIZER(struct cmd_set_allmulti_mode_result, allmulti,
1070 cmdline_parse_token_string_t cmd_setallmulti_portall =
1071 TOKEN_STRING_INITIALIZER(struct cmd_set_allmulti_mode_result, port_all,
1073 cmdline_parse_token_num_t cmd_setallmulti_portnum =
1074 TOKEN_NUM_INITIALIZER(struct cmd_set_allmulti_mode_result, port_num,
1076 cmdline_parse_token_string_t cmd_setallmulti_mode =
1077 TOKEN_STRING_INITIALIZER(struct cmd_set_allmulti_mode_result, mode,
1080 cmdline_parse_inst_t cmd_set_allmulti_mode_all = {
1081 .f = cmd_set_allmulti_mode_parsed,
1083 .help_str = "set allmulti all on|off: set allmulti mode for all ports",
1085 (void *)&cmd_setallmulti_set,
1086 (void *)&cmd_setallmulti_allmulti,
1087 (void *)&cmd_setallmulti_portall,
1088 (void *)&cmd_setallmulti_mode,
1093 cmdline_parse_inst_t cmd_set_allmulti_mode_one = {
1094 .f = cmd_set_allmulti_mode_parsed,
1096 .help_str = "set allmulti X on|off: set allmulti mode on port X",
1098 (void *)&cmd_setallmulti_set,
1099 (void *)&cmd_setallmulti_allmulti,
1100 (void *)&cmd_setallmulti_portnum,
1101 (void *)&cmd_setallmulti_mode,
1106 /* *** ADD/REMOVE A PKT FILTER *** */
1107 struct cmd_pkt_filter_result {
1108 cmdline_fixed_string_t pkt_filter;
1110 cmdline_fixed_string_t protocol;
1111 cmdline_fixed_string_t src;
1112 cmdline_ipaddr_t ip_src;
1114 cmdline_fixed_string_t dst;
1115 cmdline_ipaddr_t ip_dst;
1117 cmdline_fixed_string_t flexbytes;
1118 uint16_t flexbytes_value;
1119 cmdline_fixed_string_t vlan;
1121 cmdline_fixed_string_t queue;
1123 cmdline_fixed_string_t soft;
1128 cmd_pkt_filter_parsed(void *parsed_result,
1129 __attribute__((unused)) struct cmdline *cl,
1130 __attribute__((unused)) void *data)
1132 struct rte_fdir_filter fdir_filter;
1133 struct cmd_pkt_filter_result *res = parsed_result;
1135 memset(&fdir_filter, 0, sizeof(struct rte_fdir_filter));
1137 if (res->ip_src.family == AF_INET)
1138 fdir_filter.ip_src.ipv4_addr = res->ip_src.addr.ipv4.s_addr;
1140 memcpy(&(fdir_filter.ip_src.ipv6_addr),
1141 &(res->ip_src.addr.ipv6),
1142 sizeof(struct in6_addr));
1144 if (res->ip_dst.family == AF_INET)
1145 fdir_filter.ip_dst.ipv4_addr = res->ip_dst.addr.ipv4.s_addr;
1147 memcpy(&(fdir_filter.ip_dst.ipv6_addr),
1148 &(res->ip_dst.addr.ipv6),
1149 sizeof(struct in6_addr));
1151 fdir_filter.port_dst = rte_cpu_to_be_16(res->port_dst);
1152 fdir_filter.port_src = rte_cpu_to_be_16(res->port_src);
1154 if (!strcmp(res->protocol, "udp"))
1155 fdir_filter.l4type = RTE_FDIR_L4TYPE_UDP;
1156 else if (!strcmp(res->protocol, "tcp"))
1157 fdir_filter.l4type = RTE_FDIR_L4TYPE_TCP;
1158 else if (!strcmp(res->protocol, "sctp"))
1159 fdir_filter.l4type = RTE_FDIR_L4TYPE_SCTP;
1160 else /* default only IP */
1161 fdir_filter.l4type = RTE_FDIR_L4TYPE_NONE;
1163 if (res->ip_dst.family == AF_INET6)
1164 fdir_filter.iptype = RTE_FDIR_IPTYPE_IPV6;
1166 fdir_filter.iptype = RTE_FDIR_IPTYPE_IPV4;
1168 fdir_filter.vlan_id = rte_cpu_to_be_16(res->vlan_id);
1169 fdir_filter.flex_bytes = rte_cpu_to_be_16(res->flexbytes_value);
1171 if (!strcmp(res->pkt_filter, "add_signature_filter"))
1172 fdir_add_signature_filter(res->port_id, res->queue_id,
1174 else if (!strcmp(res->pkt_filter, "upd_signature_filter"))
1175 fdir_update_signature_filter(res->port_id, res->queue_id,
1177 else if (!strcmp(res->pkt_filter, "rm_signature_filter"))
1178 fdir_remove_signature_filter(res->port_id, &fdir_filter);
1179 else if (!strcmp(res->pkt_filter, "add_perfect_filter"))
1180 fdir_add_perfect_filter(res->port_id, res->soft_id,
1182 (uint8_t) (res->queue_id < 0),
1184 else if (!strcmp(res->pkt_filter, "upd_perfect_filter"))
1185 fdir_update_perfect_filter(res->port_id, res->soft_id,
1187 (uint8_t) (res->queue_id < 0),
1189 else if (!strcmp(res->pkt_filter, "rm_perfect_filter"))
1190 fdir_remove_perfect_filter(res->port_id, res->soft_id,
1196 cmdline_parse_token_num_t cmd_pkt_filter_port_id =
1197 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_result,
1199 cmdline_parse_token_string_t cmd_pkt_filter_protocol =
1200 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1201 protocol, "ip#tcp#udp#sctp");
1202 cmdline_parse_token_string_t cmd_pkt_filter_src =
1203 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1205 cmdline_parse_token_ipaddr_t cmd_pkt_filter_ip_src =
1206 TOKEN_IPADDR_INITIALIZER(struct cmd_pkt_filter_result,
1208 cmdline_parse_token_num_t cmd_pkt_filter_port_src =
1209 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_result,
1211 cmdline_parse_token_string_t cmd_pkt_filter_dst =
1212 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1214 cmdline_parse_token_ipaddr_t cmd_pkt_filter_ip_dst =
1215 TOKEN_IPADDR_INITIALIZER(struct cmd_pkt_filter_result,
1217 cmdline_parse_token_num_t cmd_pkt_filter_port_dst =
1218 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_result,
1220 cmdline_parse_token_string_t cmd_pkt_filter_flexbytes =
1221 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1222 flexbytes, "flexbytes");
1223 cmdline_parse_token_num_t cmd_pkt_filter_flexbytes_value =
1224 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_result,
1225 flexbytes_value, UINT16);
1226 cmdline_parse_token_string_t cmd_pkt_filter_vlan =
1227 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1229 cmdline_parse_token_num_t cmd_pkt_filter_vlan_id =
1230 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_result,
1232 cmdline_parse_token_string_t cmd_pkt_filter_queue =
1233 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1235 cmdline_parse_token_num_t cmd_pkt_filter_queue_id =
1236 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_result,
1238 cmdline_parse_token_string_t cmd_pkt_filter_soft =
1239 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1241 cmdline_parse_token_num_t cmd_pkt_filter_soft_id =
1242 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_result,
1246 cmdline_parse_token_string_t cmd_pkt_filter_add_signature_filter =
1247 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1248 pkt_filter, "add_signature_filter");
1249 cmdline_parse_inst_t cmd_add_signature_filter = {
1250 .f = cmd_pkt_filter_parsed,
1252 .help_str = "add a signature filter",
1254 (void *)&cmd_pkt_filter_add_signature_filter,
1255 (void *)&cmd_pkt_filter_port_id,
1256 (void *)&cmd_pkt_filter_protocol,
1257 (void *)&cmd_pkt_filter_src,
1258 (void *)&cmd_pkt_filter_ip_src,
1259 (void *)&cmd_pkt_filter_port_src,
1260 (void *)&cmd_pkt_filter_dst,
1261 (void *)&cmd_pkt_filter_ip_dst,
1262 (void *)&cmd_pkt_filter_port_dst,
1263 (void *)&cmd_pkt_filter_flexbytes,
1264 (void *)&cmd_pkt_filter_flexbytes_value,
1265 (void *)&cmd_pkt_filter_vlan,
1266 (void *)&cmd_pkt_filter_vlan_id,
1267 (void *)&cmd_pkt_filter_queue,
1268 (void *)&cmd_pkt_filter_queue_id,
1274 cmdline_parse_token_string_t cmd_pkt_filter_upd_signature_filter =
1275 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1276 pkt_filter, "upd_signature_filter");
1277 cmdline_parse_inst_t cmd_upd_signature_filter = {
1278 .f = cmd_pkt_filter_parsed,
1280 .help_str = "update a signature filter",
1282 (void *)&cmd_pkt_filter_upd_signature_filter,
1283 (void *)&cmd_pkt_filter_port_id,
1284 (void *)&cmd_pkt_filter_protocol,
1285 (void *)&cmd_pkt_filter_src,
1286 (void *)&cmd_pkt_filter_ip_src,
1287 (void *)&cmd_pkt_filter_port_src,
1288 (void *)&cmd_pkt_filter_dst,
1289 (void *)&cmd_pkt_filter_ip_dst,
1290 (void *)&cmd_pkt_filter_port_dst,
1291 (void *)&cmd_pkt_filter_flexbytes,
1292 (void *)&cmd_pkt_filter_flexbytes_value,
1293 (void *)&cmd_pkt_filter_vlan,
1294 (void *)&cmd_pkt_filter_vlan_id,
1295 (void *)&cmd_pkt_filter_queue,
1296 (void *)&cmd_pkt_filter_queue_id,
1302 cmdline_parse_token_string_t cmd_pkt_filter_rm_signature_filter =
1303 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1304 pkt_filter, "rm_signature_filter");
1305 cmdline_parse_inst_t cmd_rm_signature_filter = {
1306 .f = cmd_pkt_filter_parsed,
1308 .help_str = "remove a signature filter",
1310 (void *)&cmd_pkt_filter_rm_signature_filter,
1311 (void *)&cmd_pkt_filter_port_id,
1312 (void *)&cmd_pkt_filter_protocol,
1313 (void *)&cmd_pkt_filter_src,
1314 (void *)&cmd_pkt_filter_ip_src,
1315 (void *)&cmd_pkt_filter_port_src,
1316 (void *)&cmd_pkt_filter_dst,
1317 (void *)&cmd_pkt_filter_ip_dst,
1318 (void *)&cmd_pkt_filter_port_dst,
1319 (void *)&cmd_pkt_filter_flexbytes,
1320 (void *)&cmd_pkt_filter_flexbytes_value,
1321 (void *)&cmd_pkt_filter_vlan,
1322 (void *)&cmd_pkt_filter_vlan_id,
1328 cmdline_parse_token_string_t cmd_pkt_filter_add_perfect_filter =
1329 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1330 pkt_filter, "add_perfect_filter");
1331 cmdline_parse_inst_t cmd_add_perfect_filter = {
1332 .f = cmd_pkt_filter_parsed,
1334 .help_str = "add a perfect filter",
1336 (void *)&cmd_pkt_filter_add_perfect_filter,
1337 (void *)&cmd_pkt_filter_port_id,
1338 (void *)&cmd_pkt_filter_protocol,
1339 (void *)&cmd_pkt_filter_src,
1340 (void *)&cmd_pkt_filter_ip_src,
1341 (void *)&cmd_pkt_filter_port_src,
1342 (void *)&cmd_pkt_filter_dst,
1343 (void *)&cmd_pkt_filter_ip_dst,
1344 (void *)&cmd_pkt_filter_port_dst,
1345 (void *)&cmd_pkt_filter_flexbytes,
1346 (void *)&cmd_pkt_filter_flexbytes_value,
1347 (void *)&cmd_pkt_filter_vlan,
1348 (void *)&cmd_pkt_filter_vlan_id,
1349 (void *)&cmd_pkt_filter_queue,
1350 (void *)&cmd_pkt_filter_queue_id,
1351 (void *)&cmd_pkt_filter_soft,
1352 (void *)&cmd_pkt_filter_soft_id,
1358 cmdline_parse_token_string_t cmd_pkt_filter_upd_perfect_filter =
1359 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1360 pkt_filter, "upd_perfect_filter");
1361 cmdline_parse_inst_t cmd_upd_perfect_filter = {
1362 .f = cmd_pkt_filter_parsed,
1364 .help_str = "update a perfect filter",
1366 (void *)&cmd_pkt_filter_upd_perfect_filter,
1367 (void *)&cmd_pkt_filter_port_id,
1368 (void *)&cmd_pkt_filter_protocol,
1369 (void *)&cmd_pkt_filter_src,
1370 (void *)&cmd_pkt_filter_ip_src,
1371 (void *)&cmd_pkt_filter_port_src,
1372 (void *)&cmd_pkt_filter_dst,
1373 (void *)&cmd_pkt_filter_ip_dst,
1374 (void *)&cmd_pkt_filter_port_dst,
1375 (void *)&cmd_pkt_filter_flexbytes,
1376 (void *)&cmd_pkt_filter_flexbytes_value,
1377 (void *)&cmd_pkt_filter_vlan,
1378 (void *)&cmd_pkt_filter_vlan_id,
1379 (void *)&cmd_pkt_filter_queue,
1380 (void *)&cmd_pkt_filter_queue_id,
1381 (void *)&cmd_pkt_filter_soft,
1382 (void *)&cmd_pkt_filter_soft_id,
1388 cmdline_parse_token_string_t cmd_pkt_filter_rm_perfect_filter =
1389 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_result,
1390 pkt_filter, "rm_perfect_filter");
1391 cmdline_parse_inst_t cmd_rm_perfect_filter = {
1392 .f = cmd_pkt_filter_parsed,
1394 .help_str = "remove a perfect filter",
1396 (void *)&cmd_pkt_filter_rm_perfect_filter,
1397 (void *)&cmd_pkt_filter_port_id,
1398 (void *)&cmd_pkt_filter_protocol,
1399 (void *)&cmd_pkt_filter_src,
1400 (void *)&cmd_pkt_filter_ip_src,
1401 (void *)&cmd_pkt_filter_port_src,
1402 (void *)&cmd_pkt_filter_dst,
1403 (void *)&cmd_pkt_filter_ip_dst,
1404 (void *)&cmd_pkt_filter_port_dst,
1405 (void *)&cmd_pkt_filter_flexbytes,
1406 (void *)&cmd_pkt_filter_flexbytes_value,
1407 (void *)&cmd_pkt_filter_vlan,
1408 (void *)&cmd_pkt_filter_vlan_id,
1409 (void *)&cmd_pkt_filter_soft,
1410 (void *)&cmd_pkt_filter_soft_id,
1415 /* *** SETUP MASKS FILTER *** */
1416 struct cmd_pkt_filter_masks_result {
1417 cmdline_fixed_string_t filter_mask;
1419 cmdline_fixed_string_t src_mask;
1420 uint32_t ip_src_mask;
1421 uint16_t ipv6_src_mask;
1422 uint16_t port_src_mask;
1423 cmdline_fixed_string_t dst_mask;
1424 uint32_t ip_dst_mask;
1425 uint16_t ipv6_dst_mask;
1426 uint16_t port_dst_mask;
1427 cmdline_fixed_string_t flexbytes;
1428 uint8_t flexbytes_value;
1429 cmdline_fixed_string_t vlan_id;
1430 uint8_t vlan_id_value;
1431 cmdline_fixed_string_t vlan_prio;
1432 uint8_t vlan_prio_value;
1433 cmdline_fixed_string_t only_ip_flow;
1434 uint8_t only_ip_flow_value;
1435 cmdline_fixed_string_t comp_ipv6_dst;
1436 uint8_t comp_ipv6_dst_value;
1440 cmd_pkt_filter_masks_parsed(void *parsed_result,
1441 __attribute__((unused)) struct cmdline *cl,
1442 __attribute__((unused)) void *data)
1444 struct rte_fdir_masks fdir_masks;
1445 struct cmd_pkt_filter_masks_result *res = parsed_result;
1447 memset(&fdir_masks, 0, sizeof(struct rte_fdir_masks));
1449 fdir_masks.only_ip_flow = res->only_ip_flow_value;
1450 fdir_masks.vlan_id = res->vlan_id_value;
1451 fdir_masks.vlan_prio = res->vlan_prio_value;
1452 fdir_masks.dst_ipv4_mask = res->ip_dst_mask;
1453 fdir_masks.src_ipv4_mask = res->ip_src_mask;
1454 fdir_masks.src_port_mask = res->port_src_mask;
1455 fdir_masks.dst_port_mask = res->port_dst_mask;
1456 fdir_masks.flexbytes = res->flexbytes_value;
1458 fdir_set_masks(res->port_id, &fdir_masks);
1461 cmdline_parse_token_string_t cmd_pkt_filter_masks_filter_mask =
1462 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_masks_result,
1463 filter_mask, "set_masks_filter");
1464 cmdline_parse_token_num_t cmd_pkt_filter_masks_port_id =
1465 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
1467 cmdline_parse_token_string_t cmd_pkt_filter_masks_only_ip_flow =
1468 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_masks_result,
1469 only_ip_flow, "only_ip_flow");
1470 cmdline_parse_token_num_t cmd_pkt_filter_masks_only_ip_flow_value =
1471 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
1472 only_ip_flow_value, UINT8);
1473 cmdline_parse_token_string_t cmd_pkt_filter_masks_src_mask =
1474 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_masks_result,
1475 src_mask, "src_mask");
1476 cmdline_parse_token_num_t cmd_pkt_filter_masks_ip_src_mask =
1477 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
1478 ip_src_mask, UINT32);
1479 cmdline_parse_token_num_t cmd_pkt_filter_masks_port_src_mask =
1480 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
1481 port_src_mask, UINT16);
1482 cmdline_parse_token_string_t cmd_pkt_filter_masks_dst_mask =
1483 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_masks_result,
1484 dst_mask, "dst_mask");
1485 cmdline_parse_token_num_t cmd_pkt_filter_masks_ip_dst_mask =
1486 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
1487 ip_dst_mask, UINT32);
1488 cmdline_parse_token_num_t cmd_pkt_filter_masks_port_dst_mask =
1489 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
1490 port_dst_mask, UINT16);
1491 cmdline_parse_token_string_t cmd_pkt_filter_masks_flexbytes =
1492 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_masks_result,
1493 flexbytes, "flexbytes");
1494 cmdline_parse_token_num_t cmd_pkt_filter_masks_flexbytes_value =
1495 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
1496 flexbytes_value, UINT8);
1497 cmdline_parse_token_string_t cmd_pkt_filter_masks_vlan_id =
1498 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_masks_result,
1499 vlan_id, "vlan_id");
1500 cmdline_parse_token_num_t cmd_pkt_filter_masks_vlan_id_value =
1501 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
1502 vlan_id_value, UINT8);
1503 cmdline_parse_token_string_t cmd_pkt_filter_masks_vlan_prio =
1504 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_masks_result,
1505 vlan_prio, "vlan_prio");
1506 cmdline_parse_token_num_t cmd_pkt_filter_masks_vlan_prio_value =
1507 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
1508 vlan_prio_value, UINT8);
1510 cmdline_parse_inst_t cmd_set_masks_filter = {
1511 .f = cmd_pkt_filter_masks_parsed,
1513 .help_str = "setup masks filter",
1515 (void *)&cmd_pkt_filter_masks_filter_mask,
1516 (void *)&cmd_pkt_filter_masks_port_id,
1517 (void *)&cmd_pkt_filter_masks_only_ip_flow,
1518 (void *)&cmd_pkt_filter_masks_only_ip_flow_value,
1519 (void *)&cmd_pkt_filter_masks_src_mask,
1520 (void *)&cmd_pkt_filter_masks_ip_src_mask,
1521 (void *)&cmd_pkt_filter_masks_port_src_mask,
1522 (void *)&cmd_pkt_filter_masks_dst_mask,
1523 (void *)&cmd_pkt_filter_masks_ip_dst_mask,
1524 (void *)&cmd_pkt_filter_masks_port_dst_mask,
1525 (void *)&cmd_pkt_filter_masks_flexbytes,
1526 (void *)&cmd_pkt_filter_masks_flexbytes_value,
1527 (void *)&cmd_pkt_filter_masks_vlan_id,
1528 (void *)&cmd_pkt_filter_masks_vlan_id_value,
1529 (void *)&cmd_pkt_filter_masks_vlan_prio,
1530 (void *)&cmd_pkt_filter_masks_vlan_prio_value,
1536 cmd_pkt_filter_masks_ipv6_parsed(void *parsed_result,
1537 __attribute__((unused)) struct cmdline *cl,
1538 __attribute__((unused)) void *data)
1540 struct rte_fdir_masks fdir_masks;
1541 struct cmd_pkt_filter_masks_result *res = parsed_result;
1543 memset(&fdir_masks, 0, sizeof(struct rte_fdir_masks));
1545 fdir_masks.set_ipv6_mask = 1;
1546 fdir_masks.only_ip_flow = res->only_ip_flow_value;
1547 fdir_masks.vlan_id = res->vlan_id_value;
1548 fdir_masks.vlan_prio = res->vlan_prio_value;
1549 fdir_masks.dst_ipv6_mask = res->ipv6_dst_mask;
1550 fdir_masks.src_ipv6_mask = res->ipv6_src_mask;
1551 fdir_masks.src_port_mask = res->port_src_mask;
1552 fdir_masks.dst_port_mask = res->port_dst_mask;
1553 fdir_masks.flexbytes = res->flexbytes_value;
1554 fdir_masks.comp_ipv6_dst = res->comp_ipv6_dst_value;
1556 fdir_set_masks(res->port_id, &fdir_masks);
1559 cmdline_parse_token_string_t cmd_pkt_filter_masks_filter_mask_ipv6 =
1560 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_masks_result,
1561 filter_mask, "set_ipv6_masks_filter");
1562 cmdline_parse_token_num_t cmd_pkt_filter_masks_src_mask_ipv6_value =
1563 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
1564 ipv6_src_mask, UINT16);
1565 cmdline_parse_token_num_t cmd_pkt_filter_masks_dst_mask_ipv6_value =
1566 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
1567 ipv6_dst_mask, UINT16);
1569 cmdline_parse_token_string_t cmd_pkt_filter_masks_comp_ipv6_dst =
1570 TOKEN_STRING_INITIALIZER(struct cmd_pkt_filter_masks_result,
1571 comp_ipv6_dst, "compare_dst");
1572 cmdline_parse_token_num_t cmd_pkt_filter_masks_comp_ipv6_dst_value =
1573 TOKEN_NUM_INITIALIZER(struct cmd_pkt_filter_masks_result,
1574 comp_ipv6_dst_value, UINT8);
1576 cmdline_parse_inst_t cmd_set_ipv6_masks_filter = {
1577 .f = cmd_pkt_filter_masks_ipv6_parsed,
1579 .help_str = "setup ipv6 masks filter",
1581 (void *)&cmd_pkt_filter_masks_filter_mask_ipv6,
1582 (void *)&cmd_pkt_filter_masks_port_id,
1583 (void *)&cmd_pkt_filter_masks_only_ip_flow,
1584 (void *)&cmd_pkt_filter_masks_only_ip_flow_value,
1585 (void *)&cmd_pkt_filter_masks_src_mask,
1586 (void *)&cmd_pkt_filter_masks_src_mask_ipv6_value,
1587 (void *)&cmd_pkt_filter_masks_port_src_mask,
1588 (void *)&cmd_pkt_filter_masks_dst_mask,
1589 (void *)&cmd_pkt_filter_masks_dst_mask_ipv6_value,
1590 (void *)&cmd_pkt_filter_masks_port_dst_mask,
1591 (void *)&cmd_pkt_filter_masks_flexbytes,
1592 (void *)&cmd_pkt_filter_masks_flexbytes_value,
1593 (void *)&cmd_pkt_filter_masks_vlan_id,
1594 (void *)&cmd_pkt_filter_masks_vlan_id_value,
1595 (void *)&cmd_pkt_filter_masks_vlan_prio,
1596 (void *)&cmd_pkt_filter_masks_vlan_prio_value,
1597 (void *)&cmd_pkt_filter_masks_comp_ipv6_dst,
1598 (void *)&cmd_pkt_filter_masks_comp_ipv6_dst_value,
1603 /* *** SETUP ETHERNET LINK FLOW CONTROL *** */
1604 struct cmd_link_flow_ctrl_set_result {
1605 cmdline_fixed_string_t set;
1606 cmdline_fixed_string_t flow_ctrl;
1607 cmdline_fixed_string_t rx;
1608 cmdline_fixed_string_t rx_lfc_mode;
1609 cmdline_fixed_string_t tx;
1610 cmdline_fixed_string_t tx_lfc_mode;
1611 uint32_t high_water;
1613 uint16_t pause_time;
1619 cmd_link_flow_ctrl_set_parsed(void *parsed_result,
1620 __attribute__((unused)) struct cmdline *cl,
1621 __attribute__((unused)) void *data)
1623 struct cmd_link_flow_ctrl_set_result *res = parsed_result;
1624 struct rte_eth_fc_conf fc_conf;
1625 int rx_fc_enable, tx_fc_enable;
1629 * Rx on/off, flow control is enabled/disabled on RX side. This can indicate
1630 * the RTE_FC_TX_PAUSE, Transmit pause frame at the Rx side.
1631 * Tx on/off, flow control is enabled/disabled on TX side. This can indicate
1632 * the RTE_FC_RX_PAUSE, Respond to the pause frame at the Tx side.
1634 static enum rte_eth_fc_mode rx_tx_onoff_2_lfc_mode[2][2] = {
1635 {RTE_FC_NONE, RTE_FC_RX_PAUSE}, {RTE_FC_TX_PAUSE, RTE_FC_FULL}
1638 rx_fc_enable = (!strcmp(res->rx_lfc_mode, "on")) ? 1 : 0;
1639 tx_fc_enable = (!strcmp(res->tx_lfc_mode, "on")) ? 1 : 0;
1641 fc_conf.mode = rx_tx_onoff_2_lfc_mode[rx_fc_enable][tx_fc_enable];
1642 fc_conf.high_water = res->high_water;
1643 fc_conf.low_water = res->low_water;
1644 fc_conf.pause_time = res->pause_time;
1645 fc_conf.send_xon = res->send_xon;
1647 ret = rte_eth_dev_flow_ctrl_set(res->port_id, &fc_conf);
1649 printf("bad flow contrl parameter, return code = %d \n", ret);
1652 cmdline_parse_token_string_t cmd_lfc_set_set =
1653 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
1655 cmdline_parse_token_string_t cmd_lfc_set_flow_ctrl =
1656 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
1657 flow_ctrl, "flow_ctrl");
1658 cmdline_parse_token_string_t cmd_lfc_set_rx =
1659 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
1661 cmdline_parse_token_string_t cmd_lfc_set_rx_mode =
1662 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
1663 rx_lfc_mode, "on#off");
1664 cmdline_parse_token_string_t cmd_lfc_set_tx =
1665 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
1667 cmdline_parse_token_string_t cmd_lfc_set_tx_mode =
1668 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
1669 tx_lfc_mode, "on#off");
1670 cmdline_parse_token_num_t cmd_lfc_set_high_water =
1671 TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
1672 high_water, UINT32);
1673 cmdline_parse_token_num_t cmd_lfc_set_low_water =
1674 TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
1676 cmdline_parse_token_num_t cmd_lfc_set_pause_time =
1677 TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
1678 pause_time, UINT16);
1679 cmdline_parse_token_num_t cmd_lfc_set_send_xon =
1680 TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
1682 cmdline_parse_token_num_t cmd_lfc_set_portid =
1683 TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_set_result,
1686 cmdline_parse_inst_t cmd_link_flow_control_set = {
1687 .f = cmd_link_flow_ctrl_set_parsed,
1689 .help_str = "Configure the Ethernet link flow control...",
1691 (void *)&cmd_lfc_set_set,
1692 (void *)&cmd_lfc_set_flow_ctrl,
1693 (void *)&cmd_lfc_set_rx,
1694 (void *)&cmd_lfc_set_rx_mode,
1695 (void *)&cmd_lfc_set_tx,
1696 (void *)&cmd_lfc_set_tx_mode,
1697 (void *)&cmd_lfc_set_high_water,
1698 (void *)&cmd_lfc_set_low_water,
1699 (void *)&cmd_lfc_set_pause_time,
1700 (void *)&cmd_lfc_set_send_xon,
1701 (void *)&cmd_lfc_set_portid,
1706 /* *** RESET CONFIGURATION *** */
1707 struct cmd_reset_result {
1708 cmdline_fixed_string_t reset;
1709 cmdline_fixed_string_t def;
1712 static void cmd_reset_parsed(__attribute__((unused)) void *parsed_result,
1714 __attribute__((unused)) void *data)
1716 cmdline_printf(cl, "Reset to default forwarding configuration...\n");
1717 set_def_fwd_config();
1720 cmdline_parse_token_string_t cmd_reset_set =
1721 TOKEN_STRING_INITIALIZER(struct cmd_reset_result, reset, "set");
1722 cmdline_parse_token_string_t cmd_reset_def =
1723 TOKEN_STRING_INITIALIZER(struct cmd_reset_result, def,
1726 cmdline_parse_inst_t cmd_reset = {
1727 .f = cmd_reset_parsed,
1729 .help_str = "set default: reset default forwarding configuration",
1731 (void *)&cmd_reset_set,
1732 (void *)&cmd_reset_def,
1737 /* *** START FORWARDING *** */
1738 struct cmd_start_result {
1739 cmdline_fixed_string_t start;
1742 cmdline_parse_token_string_t cmd_start_start =
1743 TOKEN_STRING_INITIALIZER(struct cmd_start_result, start, "start");
1745 static void cmd_start_parsed(__attribute__((unused)) void *parsed_result,
1746 __attribute__((unused)) struct cmdline *cl,
1747 __attribute__((unused)) void *data)
1749 start_packet_forwarding(0);
1752 cmdline_parse_inst_t cmd_start = {
1753 .f = cmd_start_parsed,
1755 .help_str = "start packet forwarding",
1757 (void *)&cmd_start_start,
1762 /* *** START FORWARDING WITH ONE TX BURST FIRST *** */
1763 struct cmd_start_tx_first_result {
1764 cmdline_fixed_string_t start;
1765 cmdline_fixed_string_t tx_first;
1769 cmd_start_tx_first_parsed(__attribute__((unused)) void *parsed_result,
1770 __attribute__((unused)) struct cmdline *cl,
1771 __attribute__((unused)) void *data)
1773 start_packet_forwarding(1);
1776 cmdline_parse_token_string_t cmd_start_tx_first_start =
1777 TOKEN_STRING_INITIALIZER(struct cmd_start_tx_first_result, start,
1779 cmdline_parse_token_string_t cmd_start_tx_first_tx_first =
1780 TOKEN_STRING_INITIALIZER(struct cmd_start_tx_first_result,
1781 tx_first, "tx_first");
1783 cmdline_parse_inst_t cmd_start_tx_first = {
1784 .f = cmd_start_tx_first_parsed,
1786 .help_str = "start packet forwarding, after sending 1 burst of packets",
1788 (void *)&cmd_start_tx_first_start,
1789 (void *)&cmd_start_tx_first_tx_first,
1794 /* *** SHOW CFG *** */
1795 struct cmd_showcfg_result {
1796 cmdline_fixed_string_t show;
1797 cmdline_fixed_string_t cfg;
1798 cmdline_fixed_string_t what;
1801 static void cmd_showcfg_parsed(void *parsed_result,
1802 __attribute__((unused)) struct cmdline *cl,
1803 __attribute__((unused)) void *data)
1805 struct cmd_showcfg_result *res = parsed_result;
1806 if (!strcmp(res->what, "rxtx"))
1807 rxtx_config_display();
1808 else if (!strcmp(res->what, "cores"))
1809 fwd_lcores_config_display();
1810 else if (!strcmp(res->what, "fwd"))
1811 fwd_config_display();
1814 cmdline_parse_token_string_t cmd_showcfg_show =
1815 TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, show, "show");
1816 cmdline_parse_token_string_t cmd_showcfg_port =
1817 TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");
1818 cmdline_parse_token_string_t cmd_showcfg_what =
1819 TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what,
1822 cmdline_parse_inst_t cmd_showcfg = {
1823 .f = cmd_showcfg_parsed,
1825 .help_str = "show config rxtx|cores|fwd",
1827 (void *)&cmd_showcfg_show,
1828 (void *)&cmd_showcfg_port,
1829 (void *)&cmd_showcfg_what,
1834 /* *** SHOW ALL PORT INFO *** */
1835 struct cmd_showportall_result {
1836 cmdline_fixed_string_t show;
1837 cmdline_fixed_string_t port;
1838 cmdline_fixed_string_t what;
1839 cmdline_fixed_string_t all;
1842 static void cmd_showportall_parsed(void *parsed_result,
1843 __attribute__((unused)) struct cmdline *cl,
1844 __attribute__((unused)) void *data)
1848 struct cmd_showportall_result *res = parsed_result;
1849 if (!strcmp(res->show, "clear")) {
1850 if (!strcmp(res->what, "stats"))
1851 for (i = 0; i < nb_ports; i++)
1853 } else if (!strcmp(res->what, "info"))
1854 for (i = 0; i < nb_ports; i++)
1855 port_infos_display(i);
1856 else if (!strcmp(res->what, "stats"))
1857 for (i = 0; i < nb_ports; i++)
1858 nic_stats_display(i);
1859 else if (!strcmp(res->what, "fdir"))
1860 for (i = 0; i < nb_ports; i++)
1862 else if (!strcmp(res->what, "stat_qmap"))
1863 for (i = 0; i < nb_ports; i++)
1864 nic_stats_mapping_display(i);
1867 cmdline_parse_token_string_t cmd_showportall_show =
1868 TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, show,
1870 cmdline_parse_token_string_t cmd_showportall_port =
1871 TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, port, "port");
1872 cmdline_parse_token_string_t cmd_showportall_what =
1873 TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, what,
1874 "info#stats#fdir#stat_qmap");
1875 cmdline_parse_token_string_t cmd_showportall_all =
1876 TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, all, "all");
1877 cmdline_parse_inst_t cmd_showportall = {
1878 .f = cmd_showportall_parsed,
1880 .help_str = "show|clear port info|stats|fdir|stat_qmap all",
1882 (void *)&cmd_showportall_show,
1883 (void *)&cmd_showportall_port,
1884 (void *)&cmd_showportall_what,
1885 (void *)&cmd_showportall_all,
1890 /* *** SHOW PORT INFO *** */
1891 struct cmd_showport_result {
1892 cmdline_fixed_string_t show;
1893 cmdline_fixed_string_t port;
1894 cmdline_fixed_string_t what;
1898 static void cmd_showport_parsed(void *parsed_result,
1899 __attribute__((unused)) struct cmdline *cl,
1900 __attribute__((unused)) void *data)
1902 struct cmd_showport_result *res = parsed_result;
1903 if (!strcmp(res->show, "clear")) {
1904 if (!strcmp(res->what, "stats"))
1905 nic_stats_clear(res->portnum);
1906 } else if (!strcmp(res->what, "info"))
1907 port_infos_display(res->portnum);
1908 else if (!strcmp(res->what, "stats"))
1909 nic_stats_display(res->portnum);
1910 else if (!strcmp(res->what, "fdir"))
1911 fdir_get_infos(res->portnum);
1912 else if (!strcmp(res->what, "stat_qmap"))
1913 nic_stats_mapping_display(res->portnum);
1916 cmdline_parse_token_string_t cmd_showport_show =
1917 TOKEN_STRING_INITIALIZER(struct cmd_showport_result, show,
1919 cmdline_parse_token_string_t cmd_showport_port =
1920 TOKEN_STRING_INITIALIZER(struct cmd_showport_result, port, "port");
1921 cmdline_parse_token_string_t cmd_showport_what =
1922 TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what,
1923 "info#stats#fdir#stat_qmap");
1924 cmdline_parse_token_num_t cmd_showport_portnum =
1925 TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, INT32);
1927 cmdline_parse_inst_t cmd_showport = {
1928 .f = cmd_showport_parsed,
1930 .help_str = "show|clear port info|stats|fdir|stat_qmap X (X = port number)",
1932 (void *)&cmd_showport_show,
1933 (void *)&cmd_showport_port,
1934 (void *)&cmd_showport_what,
1935 (void *)&cmd_showport_portnum,
1940 /* *** READ PORT REGISTER *** */
1941 struct cmd_read_reg_result {
1942 cmdline_fixed_string_t read;
1943 cmdline_fixed_string_t reg;
1949 cmd_read_reg_parsed(void *parsed_result,
1950 __attribute__((unused)) struct cmdline *cl,
1951 __attribute__((unused)) void *data)
1953 struct cmd_read_reg_result *res = parsed_result;
1954 port_reg_display(res->port_id, res->reg_off);
1957 cmdline_parse_token_string_t cmd_read_reg_read =
1958 TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, read, "read");
1959 cmdline_parse_token_string_t cmd_read_reg_reg =
1960 TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result, reg, "reg");
1961 cmdline_parse_token_num_t cmd_read_reg_port_id =
1962 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, port_id, UINT8);
1963 cmdline_parse_token_num_t cmd_read_reg_reg_off =
1964 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result, reg_off, UINT32);
1966 cmdline_parse_inst_t cmd_read_reg = {
1967 .f = cmd_read_reg_parsed,
1969 .help_str = "read reg port_id reg_off",
1971 (void *)&cmd_read_reg_read,
1972 (void *)&cmd_read_reg_reg,
1973 (void *)&cmd_read_reg_port_id,
1974 (void *)&cmd_read_reg_reg_off,
1979 /* *** READ PORT REGISTER BIT FIELD *** */
1980 struct cmd_read_reg_bit_field_result {
1981 cmdline_fixed_string_t read;
1982 cmdline_fixed_string_t regfield;
1990 cmd_read_reg_bit_field_parsed(void *parsed_result,
1991 __attribute__((unused)) struct cmdline *cl,
1992 __attribute__((unused)) void *data)
1994 struct cmd_read_reg_bit_field_result *res = parsed_result;
1995 port_reg_bit_field_display(res->port_id, res->reg_off,
1996 res->bit1_pos, res->bit2_pos);
1999 cmdline_parse_token_string_t cmd_read_reg_bit_field_read =
2000 TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result, read,
2002 cmdline_parse_token_string_t cmd_read_reg_bit_field_regfield =
2003 TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result,
2004 regfield, "regfield");
2005 cmdline_parse_token_num_t cmd_read_reg_bit_field_port_id =
2006 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, port_id,
2008 cmdline_parse_token_num_t cmd_read_reg_bit_field_reg_off =
2009 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, reg_off,
2011 cmdline_parse_token_num_t cmd_read_reg_bit_field_bit1_pos =
2012 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit1_pos,
2014 cmdline_parse_token_num_t cmd_read_reg_bit_field_bit2_pos =
2015 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result, bit2_pos,
2018 cmdline_parse_inst_t cmd_read_reg_bit_field = {
2019 .f = cmd_read_reg_bit_field_parsed,
2021 .help_str = "read regfield port_id reg_off bit_x bit_y "
2022 "(read register bit field between bit_x and bit_y included)",
2024 (void *)&cmd_read_reg_bit_field_read,
2025 (void *)&cmd_read_reg_bit_field_regfield,
2026 (void *)&cmd_read_reg_bit_field_port_id,
2027 (void *)&cmd_read_reg_bit_field_reg_off,
2028 (void *)&cmd_read_reg_bit_field_bit1_pos,
2029 (void *)&cmd_read_reg_bit_field_bit2_pos,
2034 /* *** READ PORT REGISTER BIT *** */
2035 struct cmd_read_reg_bit_result {
2036 cmdline_fixed_string_t read;
2037 cmdline_fixed_string_t regbit;
2044 cmd_read_reg_bit_parsed(void *parsed_result,
2045 __attribute__((unused)) struct cmdline *cl,
2046 __attribute__((unused)) void *data)
2048 struct cmd_read_reg_bit_result *res = parsed_result;
2049 port_reg_bit_display(res->port_id, res->reg_off, res->bit_pos);
2052 cmdline_parse_token_string_t cmd_read_reg_bit_read =
2053 TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result, read, "read");
2054 cmdline_parse_token_string_t cmd_read_reg_bit_regbit =
2055 TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result,
2057 cmdline_parse_token_num_t cmd_read_reg_bit_port_id =
2058 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, port_id, UINT8);
2059 cmdline_parse_token_num_t cmd_read_reg_bit_reg_off =
2060 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, reg_off, UINT32);
2061 cmdline_parse_token_num_t cmd_read_reg_bit_bit_pos =
2062 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result, bit_pos, UINT8);
2064 cmdline_parse_inst_t cmd_read_reg_bit = {
2065 .f = cmd_read_reg_bit_parsed,
2067 .help_str = "read regbit port_id reg_off bit_x (0 <= bit_x <= 31)",
2069 (void *)&cmd_read_reg_bit_read,
2070 (void *)&cmd_read_reg_bit_regbit,
2071 (void *)&cmd_read_reg_bit_port_id,
2072 (void *)&cmd_read_reg_bit_reg_off,
2073 (void *)&cmd_read_reg_bit_bit_pos,
2078 /* *** WRITE PORT REGISTER *** */
2079 struct cmd_write_reg_result {
2080 cmdline_fixed_string_t write;
2081 cmdline_fixed_string_t reg;
2088 cmd_write_reg_parsed(void *parsed_result,
2089 __attribute__((unused)) struct cmdline *cl,
2090 __attribute__((unused)) void *data)
2092 struct cmd_write_reg_result *res = parsed_result;
2093 port_reg_set(res->port_id, res->reg_off, res->value);
2096 cmdline_parse_token_string_t cmd_write_reg_write =
2097 TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, write, "write");
2098 cmdline_parse_token_string_t cmd_write_reg_reg =
2099 TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result, reg, "reg");
2100 cmdline_parse_token_num_t cmd_write_reg_port_id =
2101 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, port_id, UINT8);
2102 cmdline_parse_token_num_t cmd_write_reg_reg_off =
2103 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, reg_off, UINT32);
2104 cmdline_parse_token_num_t cmd_write_reg_value =
2105 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result, value, UINT32);
2107 cmdline_parse_inst_t cmd_write_reg = {
2108 .f = cmd_write_reg_parsed,
2110 .help_str = "write reg port_id reg_off reg_value",
2112 (void *)&cmd_write_reg_write,
2113 (void *)&cmd_write_reg_reg,
2114 (void *)&cmd_write_reg_port_id,
2115 (void *)&cmd_write_reg_reg_off,
2116 (void *)&cmd_write_reg_value,
2121 /* *** WRITE PORT REGISTER BIT FIELD *** */
2122 struct cmd_write_reg_bit_field_result {
2123 cmdline_fixed_string_t write;
2124 cmdline_fixed_string_t regfield;
2133 cmd_write_reg_bit_field_parsed(void *parsed_result,
2134 __attribute__((unused)) struct cmdline *cl,
2135 __attribute__((unused)) void *data)
2137 struct cmd_write_reg_bit_field_result *res = parsed_result;
2138 port_reg_bit_field_set(res->port_id, res->reg_off,
2139 res->bit1_pos, res->bit2_pos, res->value);
2142 cmdline_parse_token_string_t cmd_write_reg_bit_field_write =
2143 TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result, write,
2145 cmdline_parse_token_string_t cmd_write_reg_bit_field_regfield =
2146 TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result,
2147 regfield, "regfield");
2148 cmdline_parse_token_num_t cmd_write_reg_bit_field_port_id =
2149 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, port_id,
2151 cmdline_parse_token_num_t cmd_write_reg_bit_field_reg_off =
2152 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, reg_off,
2154 cmdline_parse_token_num_t cmd_write_reg_bit_field_bit1_pos =
2155 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit1_pos,
2157 cmdline_parse_token_num_t cmd_write_reg_bit_field_bit2_pos =
2158 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, bit2_pos,
2160 cmdline_parse_token_num_t cmd_write_reg_bit_field_value =
2161 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result, value,
2164 cmdline_parse_inst_t cmd_write_reg_bit_field = {
2165 .f = cmd_write_reg_bit_field_parsed,
2167 .help_str = "write regfield port_id reg_off bit_x bit_y reg_value"
2168 "(set register bit field between bit_x and bit_y included)",
2170 (void *)&cmd_write_reg_bit_field_write,
2171 (void *)&cmd_write_reg_bit_field_regfield,
2172 (void *)&cmd_write_reg_bit_field_port_id,
2173 (void *)&cmd_write_reg_bit_field_reg_off,
2174 (void *)&cmd_write_reg_bit_field_bit1_pos,
2175 (void *)&cmd_write_reg_bit_field_bit2_pos,
2176 (void *)&cmd_write_reg_bit_field_value,
2181 /* *** WRITE PORT REGISTER BIT *** */
2182 struct cmd_write_reg_bit_result {
2183 cmdline_fixed_string_t write;
2184 cmdline_fixed_string_t regbit;
2192 cmd_write_reg_bit_parsed(void *parsed_result,
2193 __attribute__((unused)) struct cmdline *cl,
2194 __attribute__((unused)) void *data)
2196 struct cmd_write_reg_bit_result *res = parsed_result;
2197 port_reg_bit_set(res->port_id, res->reg_off, res->bit_pos, res->value);
2200 cmdline_parse_token_string_t cmd_write_reg_bit_write =
2201 TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result, write,
2203 cmdline_parse_token_string_t cmd_write_reg_bit_regbit =
2204 TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result,
2206 cmdline_parse_token_num_t cmd_write_reg_bit_port_id =
2207 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, port_id, UINT8);
2208 cmdline_parse_token_num_t cmd_write_reg_bit_reg_off =
2209 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, reg_off, UINT32);
2210 cmdline_parse_token_num_t cmd_write_reg_bit_bit_pos =
2211 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, bit_pos, UINT8);
2212 cmdline_parse_token_num_t cmd_write_reg_bit_value =
2213 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result, value, UINT8);
2215 cmdline_parse_inst_t cmd_write_reg_bit = {
2216 .f = cmd_write_reg_bit_parsed,
2218 .help_str = "write regbit port_id reg_off bit_x 0/1 (0 <= bit_x <= 31)",
2220 (void *)&cmd_write_reg_bit_write,
2221 (void *)&cmd_write_reg_bit_regbit,
2222 (void *)&cmd_write_reg_bit_port_id,
2223 (void *)&cmd_write_reg_bit_reg_off,
2224 (void *)&cmd_write_reg_bit_bit_pos,
2225 (void *)&cmd_write_reg_bit_value,
2230 /* *** READ A RING DESCRIPTOR OF A PORT RX/TX QUEUE *** */
2231 struct cmd_read_rxd_txd_result {
2232 cmdline_fixed_string_t read;
2233 cmdline_fixed_string_t rxd_txd;
2240 cmd_read_rxd_txd_parsed(void *parsed_result,
2241 __attribute__((unused)) struct cmdline *cl,
2242 __attribute__((unused)) void *data)
2244 struct cmd_read_rxd_txd_result *res = parsed_result;
2246 if (!strcmp(res->rxd_txd, "rxd"))
2247 rx_ring_desc_display(res->port_id, res->queue_id, res->desc_id);
2248 else if (!strcmp(res->rxd_txd, "txd"))
2249 tx_ring_desc_display(res->port_id, res->queue_id, res->desc_id);
2252 cmdline_parse_token_string_t cmd_read_rxd_txd_read =
2253 TOKEN_STRING_INITIALIZER(struct cmd_read_rxd_txd_result, read, "read");
2254 cmdline_parse_token_string_t cmd_read_rxd_txd_rxd_txd =
2255 TOKEN_STRING_INITIALIZER(struct cmd_read_rxd_txd_result, rxd_txd,
2257 cmdline_parse_token_num_t cmd_read_rxd_txd_port_id =
2258 TOKEN_NUM_INITIALIZER(struct cmd_read_rxd_txd_result, port_id, UINT8);
2259 cmdline_parse_token_num_t cmd_read_rxd_txd_queue_id =
2260 TOKEN_NUM_INITIALIZER(struct cmd_read_rxd_txd_result, queue_id, UINT16);
2261 cmdline_parse_token_num_t cmd_read_rxd_txd_desc_id =
2262 TOKEN_NUM_INITIALIZER(struct cmd_read_rxd_txd_result, desc_id, UINT16);
2264 cmdline_parse_inst_t cmd_read_rxd_txd = {
2265 .f = cmd_read_rxd_txd_parsed,
2267 .help_str = "read rxd|txd port_id queue_id rxd_id",
2269 (void *)&cmd_read_rxd_txd_read,
2270 (void *)&cmd_read_rxd_txd_rxd_txd,
2271 (void *)&cmd_read_rxd_txd_port_id,
2272 (void *)&cmd_read_rxd_txd_queue_id,
2273 (void *)&cmd_read_rxd_txd_desc_id,
2279 struct cmd_quit_result {
2280 cmdline_fixed_string_t quit;
2283 static void cmd_quit_parsed(__attribute__((unused)) void *parsed_result,
2285 __attribute__((unused)) void *data)
2291 cmdline_parse_token_string_t cmd_quit_quit =
2292 TOKEN_STRING_INITIALIZER(struct cmd_quit_result, quit, "quit");
2294 cmdline_parse_inst_t cmd_quit = {
2295 .f = cmd_quit_parsed,
2297 .help_str = "exit application",
2299 (void *)&cmd_quit_quit,
2304 /* *** ADD/REMOVE MAC ADDRESS FROM A PORT *** */
2305 struct cmd_mac_addr_result {
2306 cmdline_fixed_string_t mac_addr_cmd;
2307 cmdline_fixed_string_t what;
2309 struct ether_addr address;
2312 static void cmd_mac_addr_parsed(void *parsed_result,
2313 __attribute__((unused)) struct cmdline *cl,
2314 __attribute__((unused)) void *data)
2316 struct cmd_mac_addr_result *res = parsed_result;
2319 if (strcmp(res->what, "add") == 0)
2320 ret = rte_eth_dev_mac_addr_add(res->port_num, &res->address, 0);
2322 ret = rte_eth_dev_mac_addr_remove(res->port_num, &res->address);
2324 /* check the return value and print it if is < 0 */
2326 printf("mac_addr_cmd error: (%s)\n", strerror(-ret));
2330 cmdline_parse_token_string_t cmd_mac_addr_cmd =
2331 TOKEN_STRING_INITIALIZER(struct cmd_mac_addr_result, mac_addr_cmd,
2333 cmdline_parse_token_string_t cmd_mac_addr_what =
2334 TOKEN_STRING_INITIALIZER(struct cmd_mac_addr_result, what,
2336 cmdline_parse_token_num_t cmd_mac_addr_portnum =
2337 TOKEN_NUM_INITIALIZER(struct cmd_mac_addr_result, port_num, UINT8);
2338 cmdline_parse_token_string_t cmd_mac_addr_addr =
2339 TOKEN_ETHERADDR_INITIALIZER(struct cmd_mac_addr_result, address);
2341 cmdline_parse_inst_t cmd_mac_addr = {
2342 .f = cmd_mac_addr_parsed,
2344 .help_str = "mac_addr add|remove X <address>: "
2345 "add/remove MAC address on port X",
2347 (void *)&cmd_mac_addr_cmd,
2348 (void *)&cmd_mac_addr_what,
2349 (void *)&cmd_mac_addr_portnum,
2350 (void *)&cmd_mac_addr_addr,
2356 /* *** CONFIGURE QUEUE STATS COUNTER MAPPINGS *** */
2357 struct cmd_set_qmap_result {
2358 cmdline_fixed_string_t set;
2359 cmdline_fixed_string_t qmap;
2360 cmdline_fixed_string_t what;
2367 cmd_set_qmap_parsed(void *parsed_result,
2368 __attribute__((unused)) struct cmdline *cl,
2369 __attribute__((unused)) void *data)
2371 struct cmd_set_qmap_result *res = parsed_result;
2372 int is_rx = (strcmp(res->what, "tx") == 0) ? 0 : 1;
2374 set_qmap(res->port_id, (uint8_t)is_rx, res->queue_id, res->map_value);
2377 cmdline_parse_token_string_t cmd_setqmap_set =
2378 TOKEN_STRING_INITIALIZER(struct cmd_set_qmap_result,
2380 cmdline_parse_token_string_t cmd_setqmap_qmap =
2381 TOKEN_STRING_INITIALIZER(struct cmd_set_qmap_result,
2383 cmdline_parse_token_string_t cmd_setqmap_what =
2384 TOKEN_STRING_INITIALIZER(struct cmd_set_qmap_result,
2386 cmdline_parse_token_num_t cmd_setqmap_portid =
2387 TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result,
2389 cmdline_parse_token_num_t cmd_setqmap_queueid =
2390 TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result,
2392 cmdline_parse_token_num_t cmd_setqmap_mapvalue =
2393 TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result,
2396 cmdline_parse_inst_t cmd_set_qmap = {
2397 .f = cmd_set_qmap_parsed,
2399 .help_str = "Set statistics mapping value on tx|rx queue_id of port_id",
2401 (void *)&cmd_setqmap_set,
2402 (void *)&cmd_setqmap_qmap,
2403 (void *)&cmd_setqmap_what,
2404 (void *)&cmd_setqmap_portid,
2405 (void *)&cmd_setqmap_queueid,
2406 (void *)&cmd_setqmap_mapvalue,
2411 /* ******************************************************************************** */
2413 /* list of instructions */
2414 cmdline_parse_ctx_t main_ctx[] = {
2415 (cmdline_parse_inst_t *)&cmd_help,
2416 (cmdline_parse_inst_t *)&cmd_quit,
2417 (cmdline_parse_inst_t *)&cmd_showport,
2418 (cmdline_parse_inst_t *)&cmd_showportall,
2419 (cmdline_parse_inst_t *)&cmd_showcfg,
2420 (cmdline_parse_inst_t *)&cmd_start,
2421 (cmdline_parse_inst_t *)&cmd_start_tx_first,
2422 (cmdline_parse_inst_t *)&cmd_reset,
2423 (cmdline_parse_inst_t *)&cmd_set_numbers,
2424 (cmdline_parse_inst_t *)&cmd_set_txpkts,
2425 (cmdline_parse_inst_t *)&cmd_set_fwd_list,
2426 (cmdline_parse_inst_t *)&cmd_set_fwd_mask,
2427 (cmdline_parse_inst_t *)&cmd_set_fwd_mode,
2428 (cmdline_parse_inst_t *)&cmd_set_promisc_mode_one,
2429 (cmdline_parse_inst_t *)&cmd_set_promisc_mode_all,
2430 (cmdline_parse_inst_t *)&cmd_set_allmulti_mode_one,
2431 (cmdline_parse_inst_t *)&cmd_set_allmulti_mode_all,
2432 (cmdline_parse_inst_t *)&cmd_vlan_offload,
2433 (cmdline_parse_inst_t *)&cmd_vlan_tpid,
2434 (cmdline_parse_inst_t *)&cmd_rx_vlan_filter_all,
2435 (cmdline_parse_inst_t *)&cmd_rx_vlan_filter,
2436 (cmdline_parse_inst_t *)&cmd_tx_vlan_set,
2437 (cmdline_parse_inst_t *)&cmd_tx_vlan_reset,
2438 (cmdline_parse_inst_t *)&cmd_tx_cksum_set,
2439 (cmdline_parse_inst_t *)&cmd_link_flow_control_set,
2440 (cmdline_parse_inst_t *)&cmd_read_reg,
2441 (cmdline_parse_inst_t *)&cmd_read_reg_bit_field,
2442 (cmdline_parse_inst_t *)&cmd_read_reg_bit,
2443 (cmdline_parse_inst_t *)&cmd_write_reg,
2444 (cmdline_parse_inst_t *)&cmd_write_reg_bit_field,
2445 (cmdline_parse_inst_t *)&cmd_write_reg_bit,
2446 (cmdline_parse_inst_t *)&cmd_read_rxd_txd,
2447 (cmdline_parse_inst_t *)&cmd_add_signature_filter,
2448 (cmdline_parse_inst_t *)&cmd_upd_signature_filter,
2449 (cmdline_parse_inst_t *)&cmd_rm_signature_filter,
2450 (cmdline_parse_inst_t *)&cmd_add_perfect_filter,
2451 (cmdline_parse_inst_t *)&cmd_upd_perfect_filter,
2452 (cmdline_parse_inst_t *)&cmd_rm_perfect_filter,
2453 (cmdline_parse_inst_t *)&cmd_set_masks_filter,
2454 (cmdline_parse_inst_t *)&cmd_set_ipv6_masks_filter,
2455 (cmdline_parse_inst_t *)&cmd_stop,
2456 (cmdline_parse_inst_t *)&cmd_mac_addr,
2457 (cmdline_parse_inst_t *)&cmd_set_qmap,
2461 /* prompt function, called from main on MASTER lcore */
2467 cl = cmdline_stdin_new(main_ctx, "testpmd> ");
2471 cmdline_interact(cl);
2472 cmdline_stdin_exit(cl);