1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2016 Intel Corporation.
3 * Copyright(c) 2014 6WIND S.A.
16 #include <net/socket.h>
18 #include <sys/socket.h>
21 #include <netinet/in.h>
23 #include <sys/queue.h>
25 #include <rte_common.h>
26 #include <rte_byteorder.h>
28 #include <rte_debug.h>
29 #include <rte_cycles.h>
30 #include <rte_memory.h>
31 #include <rte_memzone.h>
32 #include <rte_malloc.h>
33 #include <rte_launch.h>
35 #include <rte_per_lcore.h>
36 #include <rte_lcore.h>
37 #include <rte_atomic.h>
38 #include <rte_branch_prediction.h>
40 #include <rte_mempool.h>
41 #include <rte_interrupts.h>
43 #include <rte_ether.h>
44 #include <rte_ethdev.h>
45 #include <rte_string_fns.h>
46 #include <rte_devargs.h>
50 #include <cmdline_rdline.h>
51 #include <cmdline_parse.h>
52 #include <cmdline_parse_num.h>
53 #include <cmdline_parse_string.h>
54 #include <cmdline_parse_ipaddr.h>
55 #include <cmdline_parse_etheraddr.h>
56 #include <cmdline_socket.h>
58 #ifdef RTE_LIBRTE_PMD_BOND
59 #include <rte_eth_bond.h>
60 #include <rte_eth_bond_8023ad.h>
62 #if defined RTE_LIBRTE_DPAA_BUS && defined RTE_LIBRTE_DPAA_PMD
63 #include <rte_pmd_dpaa.h>
65 #ifdef RTE_LIBRTE_IXGBE_PMD
66 #include <rte_pmd_ixgbe.h>
68 #ifdef RTE_LIBRTE_I40E_PMD
69 #include <rte_pmd_i40e.h>
71 #ifdef RTE_LIBRTE_BNXT_PMD
72 #include <rte_pmd_bnxt.h>
75 #include "cmdline_mtr.h"
76 #include "cmdline_tm.h"
79 static struct cmdline
*testpmd_cl
;
81 static void cmd_reconfig_device_queue(portid_t id
, uint8_t dev
, uint8_t queue
);
83 /* *** Help command with introduction. *** */
84 struct cmd_help_brief_result
{
85 cmdline_fixed_string_t help
;
88 static void cmd_help_brief_parsed(__attribute__((unused
)) void *parsed_result
,
90 __attribute__((unused
)) void *data
)
95 "Help is available for the following sections:\n\n"
96 " help control : Start and stop forwarding.\n"
97 " help display : Displaying port, stats and config "
99 " help config : Configuration information.\n"
100 " help ports : Configuring ports.\n"
101 " help registers : Reading and setting port registers.\n"
102 " help filters : Filters configuration help.\n"
103 " help traffic_management : Traffic Management commmands.\n"
104 " help all : All of the above sections.\n\n"
109 cmdline_parse_token_string_t cmd_help_brief_help
=
110 TOKEN_STRING_INITIALIZER(struct cmd_help_brief_result
, help
, "help");
112 cmdline_parse_inst_t cmd_help_brief
= {
113 .f
= cmd_help_brief_parsed
,
115 .help_str
= "help: Show help",
117 (void *)&cmd_help_brief_help
,
122 /* *** Help command with help sections. *** */
123 struct cmd_help_long_result
{
124 cmdline_fixed_string_t help
;
125 cmdline_fixed_string_t section
;
128 static void cmd_help_long_parsed(void *parsed_result
,
130 __attribute__((unused
)) void *data
)
133 struct cmd_help_long_result
*res
= parsed_result
;
135 if (!strcmp(res
->section
, "all"))
138 if (show_all
|| !strcmp(res
->section
, "control")) {
143 "Control forwarding:\n"
144 "-------------------\n\n"
147 " Start packet forwarding with current configuration.\n\n"
150 " Start packet forwarding with current config"
151 " after sending one burst of packets.\n\n"
154 " Stop packet forwarding, and display accumulated"
158 " Quit to prompt.\n\n"
162 if (show_all
|| !strcmp(res
->section
, "display")) {
170 "show port (info|stats|summary|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)\n"
171 " Display information for port_id, or all.\n\n"
173 "show port X rss reta (size) (mask0,mask1,...)\n"
174 " Display the rss redirection table entry indicated"
175 " by masks on port X. size is used to indicate the"
176 " hardware supported reta size\n\n"
178 "show port (port_id) rss-hash [key]\n"
179 " Display the RSS hash functions and RSS hash key of port\n\n"
181 "clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all)\n"
182 " Clear information for port_id, or all.\n\n"
184 "show (rxq|txq) info (port_id) (queue_id)\n"
185 " Display information for configured RX/TX queue.\n\n"
187 "show config (rxtx|cores|fwd|txpkts)\n"
188 " Display the given configuration.\n\n"
190 "read rxd (port_id) (queue_id) (rxd_id)\n"
191 " Display an RX descriptor of a port RX queue.\n\n"
193 "read txd (port_id) (queue_id) (txd_id)\n"
194 " Display a TX descriptor of a port TX queue.\n\n"
196 "ddp get list (port_id)\n"
197 " Get ddp profile info list\n\n"
199 "ddp get info (profile_path)\n"
200 " Get ddp profile information.\n\n"
202 "show vf stats (port_id) (vf_id)\n"
203 " Display a VF's statistics.\n\n"
205 "clear vf stats (port_id) (vf_id)\n"
206 " Reset a VF's statistics.\n\n"
208 "show port (port_id) pctype mapping\n"
209 " Get flow ptype to pctype mapping on a port\n\n"
211 "show port meter stats (port_id) (meter_id) (clear)\n"
212 " Get meter stats on a port\n\n"
214 "show fwd stats all\n"
215 " Display statistics for all fwd engines.\n\n"
217 "clear fwd stats all\n"
218 " Clear statistics for all fwd engines.\n\n"
220 "show port (port_id) rx_offload capabilities\n"
221 " List all per queue and per port Rx offloading"
222 " capabilities of a port\n\n"
224 "show port (port_id) rx_offload configuration\n"
225 " List port level and all queue level"
226 " Rx offloading configuration\n\n"
228 "show port (port_id) tx_offload capabilities\n"
229 " List all per queue and per port"
230 " Tx offloading capabilities of a port\n\n"
232 "show port (port_id) tx_offload configuration\n"
233 " List port level and all queue level"
234 " Tx offloading configuration\n\n"
236 "show port (port_id) tx_metadata\n"
237 " Show Tx metadata value set"
238 " for a specific port\n\n"
242 if (show_all
|| !strcmp(res
->section
, "config")) {
248 "Configuration changes only become active when"
249 " forwarding is started/restarted.\n\n"
252 " Reset forwarding to the default configuration.\n\n"
254 "set verbose (level)\n"
255 " Set the debug verbosity level X.\n\n"
257 "set log global|(type) (level)\n"
258 " Set the log level.\n\n"
261 " Set number of ports.\n\n"
264 " Set number of cores.\n\n"
266 "set coremask (mask)\n"
267 " Set the forwarding cores hexadecimal mask.\n\n"
269 "set portmask (mask)\n"
270 " Set the forwarding ports hexadecimal mask.\n\n"
273 " Set number of packets per burst.\n\n"
275 "set burst tx delay (microseconds) retry (num)\n"
276 " Set the transmit delay time and number of retries,"
277 " effective when retry is enabled.\n\n"
279 "set txpkts (x[,y]*)\n"
280 " Set the length of each segment of TXONLY"
281 " and optionally CSUM packets.\n\n"
283 "set txsplit (off|on|rand)\n"
284 " Set the split policy for the TX packets."
285 " Right now only applicable for CSUM and TXONLY"
288 "set corelist (x[,y]*)\n"
289 " Set the list of forwarding cores.\n\n"
291 "set portlist (x[,y]*)\n"
292 " Set the list of forwarding ports.\n\n"
294 "set port setup on (iterator|event)\n"
295 " Select how attached port is retrieved for setup.\n\n"
297 "set tx loopback (port_id) (on|off)\n"
298 " Enable or disable tx loopback.\n\n"
300 "set all queues drop (port_id) (on|off)\n"
301 " Set drop enable bit for all queues.\n\n"
303 "set vf split drop (port_id) (vf_id) (on|off)\n"
304 " Set split drop enable bit for a VF from the PF.\n\n"
306 "set vf mac antispoof (port_id) (vf_id) (on|off).\n"
307 " Set MAC antispoof for a VF from the PF.\n\n"
309 "set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)\n"
310 " Enable MACsec offload.\n\n"
312 "set macsec offload (port_id) off\n"
313 " Disable MACsec offload.\n\n"
315 "set macsec sc (tx|rx) (port_id) (mac) (pi)\n"
316 " Configure MACsec secure connection (SC).\n\n"
318 "set macsec sa (tx|rx) (port_id) (idx) (an) (pn) (key)\n"
319 " Configure MACsec secure association (SA).\n\n"
321 "set vf broadcast (port_id) (vf_id) (on|off)\n"
322 " Set VF broadcast for a VF from the PF.\n\n"
324 "vlan set strip (on|off) (port_id)\n"
325 " Set the VLAN strip on a port.\n\n"
327 "vlan set stripq (on|off) (port_id,queue_id)\n"
328 " Set the VLAN strip for a queue on a port.\n\n"
330 "set vf vlan stripq (port_id) (vf_id) (on|off)\n"
331 " Set the VLAN strip for all queues in a pool for a VF from the PF.\n\n"
333 "set vf vlan insert (port_id) (vf_id) (vlan_id)\n"
334 " Set VLAN insert for a VF from the PF.\n\n"
336 "set vf vlan antispoof (port_id) (vf_id) (on|off)\n"
337 " Set VLAN antispoof for a VF from the PF.\n\n"
339 "set vf vlan tag (port_id) (vf_id) (on|off)\n"
340 " Set VLAN tag for a VF from the PF.\n\n"
342 "set vf tx max-bandwidth (port_id) (vf_id) (bandwidth)\n"
343 " Set a VF's max bandwidth(Mbps).\n\n"
345 "set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...)\n"
346 " Set all TCs' min bandwidth(%%) on a VF.\n\n"
348 "set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (bandwidth)\n"
349 " Set a TC's max bandwidth(Mbps) on a VF.\n\n"
351 "set tx strict-link-priority (port_id) (tc_bitmap)\n"
352 " Set some TCs' strict link priority mode on a physical port.\n\n"
354 "set tc tx min-bandwidth (port_id) (bw1, bw2, ...)\n"
355 " Set all TCs' min bandwidth(%%) for all PF and VFs.\n\n"
357 "vlan set filter (on|off) (port_id)\n"
358 " Set the VLAN filter on a port.\n\n"
360 "vlan set qinq (on|off) (port_id)\n"
361 " Set the VLAN QinQ (extended queue in queue)"
364 "vlan set (inner|outer) tpid (value) (port_id)\n"
365 " Set the VLAN TPID for Packet Filtering on"
368 "rx_vlan add (vlan_id|all) (port_id)\n"
369 " Add a vlan_id, or all identifiers, to the set"
370 " of VLAN identifiers filtered by port_id.\n\n"
372 "rx_vlan rm (vlan_id|all) (port_id)\n"
373 " Remove a vlan_id, or all identifiers, from the set"
374 " of VLAN identifiers filtered by port_id.\n\n"
376 "rx_vlan add (vlan_id) port (port_id) vf (vf_mask)\n"
377 " Add a vlan_id, to the set of VLAN identifiers"
378 "filtered for VF(s) from port_id.\n\n"
380 "rx_vlan rm (vlan_id) port (port_id) vf (vf_mask)\n"
381 " Remove a vlan_id, to the set of VLAN identifiers"
382 "filtered for VF(s) from port_id.\n\n"
384 "tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) "
385 "(inner_vlan) (vxlan|nvgre|ipingre|vxlan-gpe) (imac-ivlan|imac-ivlan-tenid|"
386 "imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)\n"
387 " add a tunnel filter of a port.\n\n"
389 "tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) "
390 "(inner_vlan) (vxlan|nvgre|ipingre|vxlan-gpe) (imac-ivlan|imac-ivlan-tenid|"
391 "imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)\n"
392 " remove a tunnel filter of a port.\n\n"
394 "rx_vxlan_port add (udp_port) (port_id)\n"
395 " Add an UDP port for VXLAN packet filter on a port\n\n"
397 "rx_vxlan_port rm (udp_port) (port_id)\n"
398 " Remove an UDP port for VXLAN packet filter on a port\n\n"
400 "tx_vlan set (port_id) vlan_id[, vlan_id_outer]\n"
401 " Set hardware insertion of VLAN IDs (single or double VLAN "
402 "depends on the number of VLAN IDs) in packets sent on a port.\n\n"
404 "tx_vlan set pvid port_id vlan_id (on|off)\n"
405 " Set port based TX VLAN insertion.\n\n"
407 "tx_vlan reset (port_id)\n"
408 " Disable hardware insertion of a VLAN header in"
409 " packets sent on a port.\n\n"
411 "csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id)\n"
412 " Select hardware or software calculation of the"
413 " checksum when transmitting a packet using the"
414 " csum forward engine.\n"
415 " ip|udp|tcp|sctp always concern the inner layer.\n"
416 " outer-ip concerns the outer IP layer in"
417 " outer-udp concerns the outer UDP layer in"
418 " case the packet is recognized as a tunnel packet by"
419 " the forward engine (vxlan, gre and ipip are supported)\n"
420 " Please check the NIC datasheet for HW limits.\n\n"
422 "csum parse-tunnel (on|off) (tx_port_id)\n"
423 " If disabled, treat tunnel packets as non-tunneled"
424 " packets (treat inner headers as payload). The port\n"
425 " argument is the port used for TX in csum forward"
428 "csum show (port_id)\n"
429 " Display tx checksum offload configuration\n\n"
431 "tso set (segsize) (portid)\n"
432 " Enable TCP Segmentation Offload in csum forward"
434 " Please check the NIC datasheet for HW limits.\n\n"
437 " Display the status of TCP Segmentation Offload.\n\n"
439 "set port (port_id) gro on|off\n"
440 " Enable or disable Generic Receive Offload in"
441 " csum forwarding engine.\n\n"
443 "show port (port_id) gro\n"
444 " Display GRO configuration.\n\n"
446 "set gro flush (cycles)\n"
447 " Set the cycle to flush GROed packets from"
448 " reassembly tables.\n\n"
450 "set port (port_id) gso (on|off)"
451 " Enable or disable Generic Segmentation Offload in"
452 " csum forwarding engine.\n\n"
454 "set gso segsz (length)\n"
455 " Set max packet length for output GSO segments,"
456 " including packet header and payload.\n\n"
458 "show port (port_id) gso\n"
459 " Show GSO configuration.\n\n"
462 " Set packet forwarding mode.\n\n"
464 "mac_addr add (port_id) (XX:XX:XX:XX:XX:XX)\n"
465 " Add a MAC address on port_id.\n\n"
467 "mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)\n"
468 " Remove a MAC address from port_id.\n\n"
470 "mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)\n"
471 " Set the default MAC address for port_id.\n\n"
473 "mac_addr add port (port_id) vf (vf_id) (mac_address)\n"
474 " Add a MAC address for a VF on the port.\n\n"
476 "set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)\n"
477 " Set the MAC address for a VF from the PF.\n\n"
479 "set eth-peer (port_id) (peer_addr)\n"
480 " set the peer address for certain port.\n\n"
482 "set port (port_id) uta (mac_address|all) (on|off)\n"
483 " Add/Remove a or all unicast hash filter(s)"
486 "set promisc (port_id|all) (on|off)\n"
487 " Set the promiscuous mode on port_id, or all.\n\n"
489 "set allmulti (port_id|all) (on|off)\n"
490 " Set the allmulti mode on port_id, or all.\n\n"
492 "set vf promisc (port_id) (vf_id) (on|off)\n"
493 " Set unicast promiscuous mode for a VF from the PF.\n\n"
495 "set vf allmulti (port_id) (vf_id) (on|off)\n"
496 " Set multicast promiscuous mode for a VF from the PF.\n\n"
498 "set flow_ctrl rx (on|off) tx (on|off) (high_water)"
499 " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd"
500 " (on|off) autoneg (on|off) (port_id)\n"
501 "set flow_ctrl rx (on|off) (portid)\n"
502 "set flow_ctrl tx (on|off) (portid)\n"
503 "set flow_ctrl high_water (high_water) (portid)\n"
504 "set flow_ctrl low_water (low_water) (portid)\n"
505 "set flow_ctrl pause_time (pause_time) (portid)\n"
506 "set flow_ctrl send_xon (send_xon) (portid)\n"
507 "set flow_ctrl mac_ctrl_frame_fwd (on|off) (portid)\n"
508 "set flow_ctrl autoneg (on|off) (port_id)\n"
509 " Set the link flow control parameter on a port.\n\n"
511 "set pfc_ctrl rx (on|off) tx (on|off) (high_water)"
512 " (low_water) (pause_time) (priority) (port_id)\n"
513 " Set the priority flow control parameter on a"
516 "set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping)\n"
517 " Set statistics mapping (qmapping 0..15) for RX/TX"
519 " e.g., 'set stat_qmap rx 0 2 5' sets rx queue 2"
520 " on port 0 to mapping 5.\n\n"
522 "set xstats-hide-zero on|off\n"
523 " Set the option to hide the zero values"
524 " for xstats display.\n"
526 "set port (port_id) vf (vf_id) rx|tx on|off\n"
527 " Enable/Disable a VF receive/tranmit from a port\n\n"
529 "set port (port_id) vf (vf_id) (mac_addr)"
530 " (exact-mac#exact-mac-vlan#hashmac|hashmac-vlan) on|off\n"
531 " Add/Remove unicast or multicast MAC addr filter"
534 "set port (port_id) vf (vf_id) rxmode (AUPE|ROPE|BAM"
536 " AUPE:accepts untagged VLAN;"
537 "ROPE:accept unicast hash\n\n"
538 " BAM:accepts broadcast packets;"
539 "MPE:accepts all multicast packets\n\n"
540 " Enable/Disable a VF receive mode of a port\n\n"
542 "set port (port_id) queue (queue_id) rate (rate_num)\n"
543 " Set rate limit for a queue of a port\n\n"
545 "set port (port_id) vf (vf_id) rate (rate_num) "
546 "queue_mask (queue_mask_value)\n"
547 " Set rate limit for queues in VF of a port\n\n"
549 "set port (port_id) mirror-rule (rule_id)"
550 " (pool-mirror-up|pool-mirror-down|vlan-mirror)"
551 " (poolmask|vlanid[,vlanid]*) dst-pool (pool_id) (on|off)\n"
552 " Set pool or vlan type mirror rule on a port.\n"
553 " e.g., 'set port 0 mirror-rule 0 vlan-mirror 0,1"
554 " dst-pool 0 on' enable mirror traffic with vlan 0,1"
557 "set port (port_id) mirror-rule (rule_id)"
558 " (uplink-mirror|downlink-mirror) dst-pool"
559 " (pool_id) (on|off)\n"
560 " Set uplink or downlink type mirror rule on a port.\n"
561 " e.g., 'set port 0 mirror-rule 0 uplink-mirror dst-pool"
562 " 0 on' enable mirror income traffic to pool 0.\n\n"
564 "reset port (port_id) mirror-rule (rule_id)\n"
565 " Reset a mirror rule.\n\n"
567 "set flush_rx (on|off)\n"
568 " Flush (default) or don't flush RX streams before"
569 " forwarding. Mainly used with PCAP drivers.\n\n"
571 "set bypass mode (normal|bypass|isolate) (port_id)\n"
572 " Set the bypass mode for the lowest port on bypass enabled"
575 "set bypass event (timeout|os_on|os_off|power_on|power_off) "
576 "mode (normal|bypass|isolate) (port_id)\n"
577 " Set the event required to initiate specified bypass mode for"
578 " the lowest port on a bypass enabled NIC where:\n"
579 " timeout = enable bypass after watchdog timeout.\n"
580 " os_on = enable bypass when OS/board is powered on.\n"
581 " os_off = enable bypass when OS/board is powered off.\n"
582 " power_on = enable bypass when power supply is turned on.\n"
583 " power_off = enable bypass when power supply is turned off."
586 "set bypass timeout (0|1.5|2|3|4|8|16|32)\n"
587 " Set the bypass watchdog timeout to 'n' seconds"
588 " where 0 = instant.\n\n"
590 "show bypass config (port_id)\n"
591 " Show the bypass configuration for a bypass enabled NIC"
592 " using the lowest port on the NIC.\n\n"
594 #ifdef RTE_LIBRTE_PMD_BOND
595 "create bonded device (mode) (socket)\n"
596 " Create a new bonded device with specific bonding mode and socket.\n\n"
598 "add bonding slave (slave_id) (port_id)\n"
599 " Add a slave device to a bonded device.\n\n"
601 "remove bonding slave (slave_id) (port_id)\n"
602 " Remove a slave device from a bonded device.\n\n"
604 "set bonding mode (value) (port_id)\n"
605 " Set the bonding mode on a bonded device.\n\n"
607 "set bonding primary (slave_id) (port_id)\n"
608 " Set the primary slave for a bonded device.\n\n"
610 "show bonding config (port_id)\n"
611 " Show the bonding config for port_id.\n\n"
613 "set bonding mac_addr (port_id) (address)\n"
614 " Set the MAC address of a bonded device.\n\n"
616 "set bonding mode IEEE802.3AD aggregator policy (port_id) (agg_name)"
617 " Set Aggregation mode for IEEE802.3AD (mode 4)"
619 "set bonding xmit_balance_policy (port_id) (l2|l23|l34)\n"
620 " Set the transmit balance policy for bonded device running in balance mode.\n\n"
622 "set bonding mon_period (port_id) (value)\n"
623 " Set the bonding link status monitoring polling period in ms.\n\n"
625 "set bonding lacp dedicated_queues <port_id> (enable|disable)\n"
626 " Enable/disable dedicated queues for LACP control traffic.\n\n"
629 "set link-up port (port_id)\n"
630 " Set link up for a port.\n\n"
632 "set link-down port (port_id)\n"
633 " Set link down for a port.\n\n"
635 "E-tag set insertion on port-tag-id (value)"
636 " port (port_id) vf (vf_id)\n"
637 " Enable E-tag insertion for a VF on a port\n\n"
639 "E-tag set insertion off port (port_id) vf (vf_id)\n"
640 " Disable E-tag insertion for a VF on a port\n\n"
642 "E-tag set stripping (on|off) port (port_id)\n"
643 " Enable/disable E-tag stripping on a port\n\n"
645 "E-tag set forwarding (on|off) port (port_id)\n"
646 " Enable/disable E-tag based forwarding"
649 "E-tag set filter add e-tag-id (value) dst-pool"
650 " (pool_id) port (port_id)\n"
651 " Add an E-tag forwarding filter on a port\n\n"
653 "E-tag set filter del e-tag-id (value) port (port_id)\n"
654 " Delete an E-tag forwarding filter on a port\n\n"
656 "ddp add (port_id) (profile_path[,backup_profile_path])\n"
657 " Load a profile package on a port\n\n"
659 "ddp del (port_id) (backup_profile_path)\n"
660 " Delete a profile package from a port\n\n"
662 "ptype mapping get (port_id) (valid_only)\n"
663 " Get ptype mapping on a port\n\n"
665 "ptype mapping replace (port_id) (target) (mask) (pky_type)\n"
666 " Replace target with the pkt_type in ptype mapping\n\n"
668 "ptype mapping reset (port_id)\n"
669 " Reset ptype mapping on a port\n\n"
671 "ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
672 " Update a ptype mapping item on a port\n\n"
674 "set port (port_id) queue-region region_id (value) "
675 "queue_start_index (value) queue_num (value)\n"
676 " Set a queue region on a port\n\n"
678 "set port (port_id) queue-region region_id (value) "
680 " Set a flowtype region index on a port\n\n"
682 "set port (port_id) queue-region UP (value) region_id (value)\n"
683 " Set the mapping of User Priority to "
684 "queue region on a port\n\n"
686 "set port (port_id) queue-region flush (on|off)\n"
687 " flush all queue region related configuration\n\n"
689 "show port meter cap (port_id)\n"
690 " Show port meter capability information\n\n"
692 "add port meter profile srtcm_rfc2697 (port_id) (profile_id) (cir) (cbs) (ebs)\n"
693 " meter profile add - srtcm rfc 2697\n\n"
695 "add port meter profile trtcm_rfc2698 (port_id) (profile_id) (cir) (pir) (cbs) (pbs)\n"
696 " meter profile add - trtcm rfc 2698\n\n"
698 "add port meter profile trtcm_rfc4115 (port_id) (profile_id) (cir) (eir) (cbs) (ebs)\n"
699 " meter profile add - trtcm rfc 4115\n\n"
701 "del port meter profile (port_id) (profile_id)\n"
702 " meter profile delete\n\n"
704 "create port meter (port_id) (mtr_id) (profile_id) (meter_enable)\n"
705 "(g_action) (y_action) (r_action) (stats_mask) (shared)\n"
706 "(use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\n"
707 "(dscp_tbl_entry63)]\n"
710 "enable port meter (port_id) (mtr_id)\n"
713 "disable port meter (port_id) (mtr_id)\n"
716 "del port meter (port_id) (mtr_id)\n"
719 "set port meter profile (port_id) (mtr_id) (profile_id)\n"
720 " meter update meter profile\n\n"
722 "set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0)\n"
723 "(dscp_tbl_entry1)...(dscp_tbl_entry63)]\n"
724 " update meter dscp table entries\n\n"
726 "set port meter policer action (port_id) (mtr_id) (action_mask)\n"
727 "(action0) [(action1) (action2)]\n"
728 " meter update policer action\n\n"
730 "set port meter stats mask (port_id) (mtr_id) (stats_mask)\n"
731 " meter update stats\n\n"
733 "show port (port_id) queue-region\n"
734 " show all queue region related configuration info\n\n"
736 "vxlan ip-version (ipv4|ipv6) vni (vni) udp-src"
737 " (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst"
738 " (ip-dst) eth-src (eth-src) eth-dst (eth-dst)\n"
739 " Configure the VXLAN encapsulation for flows.\n\n"
741 "vxlan-with-vlan ip-version (ipv4|ipv6) vni (vni)"
742 " udp-src (udp-src) udp-dst (udp-dst) ip-src (ip-src)"
743 " ip-dst (ip-dst) vlan-tci (vlan-tci) eth-src (eth-src)"
744 " eth-dst (eth-dst)\n"
745 " Configure the VXLAN encapsulation for flows.\n\n"
747 "vxlan-tos-ttl ip-version (ipv4|ipv6) vni (vni) udp-src"
748 " (udp-src) udp-dst (udp-dst) ip-tos (ip-tos) ip-ttl (ip-ttl)"
749 " ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src)"
750 " eth-dst (eth-dst)\n"
751 " Configure the VXLAN encapsulation for flows.\n\n"
753 "nvgre ip-version (ipv4|ipv6) tni (tni) ip-src"
754 " (ip-src) ip-dst (ip-dst) eth-src (eth-src) eth-dst"
756 " Configure the NVGRE encapsulation for flows.\n\n"
758 "nvgre-with-vlan ip-version (ipv4|ipv6) tni (tni)"
759 " ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci)"
760 " eth-src (eth-src) eth-dst (eth-dst)\n"
761 " Configure the NVGRE encapsulation for flows.\n\n"
763 , list_pkt_forwarding_modes()
767 if (show_all
|| !strcmp(res
->section
, "ports")) {
773 "----------------\n\n"
775 "port start (port_id|all)\n"
776 " Start all ports or port_id.\n\n"
778 "port stop (port_id|all)\n"
779 " Stop all ports or port_id.\n\n"
781 "port close (port_id|all)\n"
782 " Close all ports or port_id.\n\n"
784 "port attach (ident)\n"
785 " Attach physical or virtual dev by pci address or virtual device name\n\n"
787 "port detach (port_id)\n"
788 " Detach physical or virtual dev by port_id\n\n"
790 "port config (port_id|all)"
791 " speed (10|100|1000|10000|25000|40000|50000|100000|auto)"
792 " duplex (half|full|auto)\n"
793 " Set speed and duplex for all ports or port_id\n\n"
795 "port config (port_id|all) loopback (mode)\n"
796 " Set loopback mode for all ports or port_id\n\n"
798 "port config all (rxq|txq|rxd|txd) (value)\n"
799 " Set number for rxq/txq/rxd/txd.\n\n"
801 "port config all max-pkt-len (value)\n"
802 " Set the max packet length.\n\n"
804 "port config all (crc-strip|scatter|rx-cksum|rx-timestamp|hw-vlan|hw-vlan-filter|"
805 "hw-vlan-strip|hw-vlan-extend|drop-en)"
807 " Set crc-strip/scatter/rx-checksum/hardware-vlan/drop_en"
810 "port config all rss (all|default|ip|tcp|udp|sctp|"
811 "ether|port|vxlan|geneve|nvgre|vxlan-gpe|none|<flowtype_id>)\n"
812 " Set the RSS mode.\n\n"
814 "port config port-id rss reta (hash,queue)[,(hash,queue)]\n"
815 " Set the RSS redirection table.\n\n"
817 "port config (port_id) dcb vt (on|off) (traffic_class)"
819 " Set the DCB mode.\n\n"
821 "port config all burst (value)\n"
822 " Set the number of packets per burst.\n\n"
824 "port config all (txpt|txht|txwt|rxpt|rxht|rxwt)"
826 " Set the ring prefetch/host/writeback threshold"
827 " for tx/rx queue.\n\n"
829 "port config all (txfreet|txrst|rxfreet) (value)\n"
830 " Set free threshold for rx/tx, or set"
831 " tx rs bit threshold.\n\n"
832 "port config mtu X value\n"
833 " Set the MTU of port X to a given value\n\n"
835 "port config (port_id) (rxq|txq) (queue_id) ring_size (value)\n"
836 " Set a rx/tx queue's ring size configuration, the new"
837 " value will take effect after command that (re-)start the port"
838 " or command that setup the specific queue\n\n"
840 "port (port_id) (rxq|txq) (queue_id) (start|stop)\n"
841 " Start/stop a rx/tx queue of port X. Only take effect"
842 " when port X is started\n\n"
844 "port (port_id) (rxq|txq) (queue_id) deferred_start (on|off)\n"
845 " Switch on/off a deferred start of port X rx/tx queue. Only"
846 " take effect when port X is stopped.\n\n"
848 "port (port_id) (rxq|txq) (queue_id) setup\n"
849 " Setup a rx/tx queue of port X.\n\n"
851 "port config (port_id|all) l2-tunnel E-tag ether-type"
853 " Set the value of E-tag ether-type.\n\n"
855 "port config (port_id|all) l2-tunnel E-tag"
856 " (enable|disable)\n"
857 " Enable/disable the E-tag support.\n\n"
859 "port config (port_id) pctype mapping reset\n"
860 " Reset flow type to pctype mapping on a port\n\n"
862 "port config (port_id) pctype mapping update"
863 " (pctype_id_0[,pctype_id_1]*) (flow_type_id)\n"
864 " Update a flow type to pctype mapping item on a port\n\n"
866 "port config (port_id) pctype (pctype_id) hash_inset|"
867 "fdir_inset|fdir_flx_inset get|set|clear field\n"
869 " Configure RSS|FDIR|FDIR_FLX input set for some pctype\n\n"
871 "port config (port_id) pctype (pctype_id) hash_inset|"
872 "fdir_inset|fdir_flx_inset clear all"
873 " Clear RSS|FDIR|FDIR_FLX input set completely for some pctype\n\n"
875 "port config (port_id) udp_tunnel_port add|rm vxlan|geneve (udp_port)\n\n"
876 " Add/remove UDP tunnel port for tunneling offload\n\n"
878 "port config <port_id> rx_offload vlan_strip|"
879 "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|"
880 "outer_ipv4_cksum|macsec_strip|header_split|"
881 "vlan_filter|vlan_extend|jumbo_frame|crc_strip|"
882 "scatter|timestamp|security|keep_crc on|off\n"
883 " Enable or disable a per port Rx offloading"
884 " on all Rx queues of a port\n\n"
886 "port (port_id) rxq (queue_id) rx_offload vlan_strip|"
887 "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|"
888 "outer_ipv4_cksum|macsec_strip|header_split|"
889 "vlan_filter|vlan_extend|jumbo_frame|crc_strip|"
890 "scatter|timestamp|security|keep_crc on|off\n"
891 " Enable or disable a per queue Rx offloading"
892 " only on a specific Rx queue\n\n"
894 "port config (port_id) tx_offload vlan_insert|"
895 "ipv4_cksum|udp_cksum|tcp_cksum|sctp_cksum|tcp_tso|"
896 "udp_tso|outer_ipv4_cksum|qinq_insert|vxlan_tnl_tso|"
897 "gre_tnl_tso|ipip_tnl_tso|geneve_tnl_tso|"
898 "macsec_insert|mt_lockfree|multi_segs|mbuf_fast_free|"
899 "security|match_metadata on|off\n"
900 " Enable or disable a per port Tx offloading"
901 " on all Tx queues of a port\n\n"
903 "port (port_id) txq (queue_id) tx_offload vlan_insert|"
904 "ipv4_cksum|udp_cksum|tcp_cksum|sctp_cksum|tcp_tso|"
905 "udp_tso|outer_ipv4_cksum|qinq_insert|vxlan_tnl_tso|"
906 "gre_tnl_tso|ipip_tnl_tso|geneve_tnl_tso|macsec_insert"
907 "|mt_lockfree|multi_segs|mbuf_fast_free|security"
909 " Enable or disable a per queue Tx offloading"
910 " only on a specific Tx queue\n\n"
912 "bpf-load rx|tx (port) (queue) (J|M|B) (file_name)\n"
913 " Load an eBPF program as a callback"
914 " for particular RX/TX queue\n\n"
916 "bpf-unload rx|tx (port) (queue)\n"
917 " Unload previously loaded eBPF program"
918 " for particular RX/TX queue\n\n"
920 "port config (port_id) tx_metadata (value)\n"
921 " Set Tx metadata value per port. Testpmd will add this value"
922 " to any Tx packet sent from this port\n\n"
926 if (show_all
|| !strcmp(res
->section
, "registers")) {
934 "read reg (port_id) (address)\n"
935 " Display value of a port register.\n\n"
937 "read regfield (port_id) (address) (bit_x) (bit_y)\n"
938 " Display a port register bit field.\n\n"
940 "read regbit (port_id) (address) (bit_x)\n"
941 " Display a single port register bit.\n\n"
943 "write reg (port_id) (address) (value)\n"
944 " Set value of a port register.\n\n"
946 "write regfield (port_id) (address) (bit_x) (bit_y)"
948 " Set bit field of a port register.\n\n"
950 "write regbit (port_id) (address) (bit_x) (value)\n"
951 " Set single bit value of a port register.\n\n"
954 if (show_all
|| !strcmp(res
->section
, "filters")) {
962 "ethertype_filter (port_id) (add|del)"
963 " (mac_addr|mac_ignr) (mac_address) ethertype"
964 " (ether_type) (drop|fwd) queue (queue_id)\n"
965 " Add/Del an ethertype filter.\n\n"
967 "2tuple_filter (port_id) (add|del)"
968 " dst_port (dst_port_value) protocol (protocol_value)"
969 " mask (mask_value) tcp_flags (tcp_flags_value)"
970 " priority (prio_value) queue (queue_id)\n"
971 " Add/Del a 2tuple filter.\n\n"
973 "5tuple_filter (port_id) (add|del)"
974 " dst_ip (dst_address) src_ip (src_address)"
975 " dst_port (dst_port_value) src_port (src_port_value)"
976 " protocol (protocol_value)"
977 " mask (mask_value) tcp_flags (tcp_flags_value)"
978 " priority (prio_value) queue (queue_id)\n"
979 " Add/Del a 5tuple filter.\n\n"
981 "syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)"
982 " Add/Del syn filter.\n\n"
984 "flex_filter (port_id) (add|del) len (len_value)"
985 " bytes (bytes_value) mask (mask_value)"
986 " priority (prio_value) queue (queue_id)\n"
987 " Add/Del a flex filter.\n\n"
989 "flow_director_filter (port_id) mode IP (add|del|update)"
990 " flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)"
991 " src (src_ip_address) dst (dst_ip_address)"
992 " tos (tos_value) proto (proto_value) ttl (ttl_value)"
993 " vlan (vlan_value) flexbytes (flexbytes_value)"
994 " (drop|fwd) pf|vf(vf_id) queue (queue_id)"
995 " fd_id (fd_id_value)\n"
996 " Add/Del an IP type flow director filter.\n\n"
998 "flow_director_filter (port_id) mode IP (add|del|update)"
999 " flow (ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp)"
1000 " src (src_ip_address) (src_port)"
1001 " dst (dst_ip_address) (dst_port)"
1002 " tos (tos_value) ttl (ttl_value)"
1003 " vlan (vlan_value) flexbytes (flexbytes_value)"
1004 " (drop|fwd) pf|vf(vf_id) queue (queue_id)"
1005 " fd_id (fd_id_value)\n"
1006 " Add/Del an UDP/TCP type flow director filter.\n\n"
1008 "flow_director_filter (port_id) mode IP (add|del|update)"
1009 " flow (ipv4-sctp|ipv6-sctp)"
1010 " src (src_ip_address) (src_port)"
1011 " dst (dst_ip_address) (dst_port)"
1012 " tag (verification_tag) "
1013 " tos (tos_value) ttl (ttl_value)"
1014 " vlan (vlan_value)"
1015 " flexbytes (flexbytes_value) (drop|fwd)"
1016 " pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n"
1017 " Add/Del a SCTP type flow director filter.\n\n"
1019 "flow_director_filter (port_id) mode IP (add|del|update)"
1020 " flow l2_payload ether (ethertype)"
1021 " flexbytes (flexbytes_value) (drop|fwd)"
1022 " pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n"
1023 " Add/Del a l2 payload type flow director filter.\n\n"
1025 "flow_director_filter (port_id) mode MAC-VLAN (add|del|update)"
1026 " mac (mac_address) vlan (vlan_value)"
1027 " flexbytes (flexbytes_value) (drop|fwd)"
1028 " queue (queue_id) fd_id (fd_id_value)\n"
1029 " Add/Del a MAC-VLAN flow director filter.\n\n"
1031 "flow_director_filter (port_id) mode Tunnel (add|del|update)"
1032 " mac (mac_address) vlan (vlan_value)"
1033 " tunnel (NVGRE|VxLAN) tunnel-id (tunnel_id_value)"
1034 " flexbytes (flexbytes_value) (drop|fwd)"
1035 " queue (queue_id) fd_id (fd_id_value)\n"
1036 " Add/Del a Tunnel flow director filter.\n\n"
1038 "flow_director_filter (port_id) mode raw (add|del|update)"
1039 " flow (flow_id) (drop|fwd) queue (queue_id)"
1040 " fd_id (fd_id_value) packet (packet file name)\n"
1041 " Add/Del a raw type flow director filter.\n\n"
1043 "flush_flow_director (port_id)\n"
1044 " Flush all flow director entries of a device.\n\n"
1046 "flow_director_mask (port_id) mode IP vlan (vlan_value)"
1047 " src_mask (ipv4_src) (ipv6_src) (src_port)"
1048 " dst_mask (ipv4_dst) (ipv6_dst) (dst_port)\n"
1049 " Set flow director IP mask.\n\n"
1051 "flow_director_mask (port_id) mode MAC-VLAN"
1052 " vlan (vlan_value)\n"
1053 " Set flow director MAC-VLAN mask.\n\n"
1055 "flow_director_mask (port_id) mode Tunnel"
1056 " vlan (vlan_value) mac (mac_value)"
1057 " tunnel-type (tunnel_type_value)"
1058 " tunnel-id (tunnel_id_value)\n"
1059 " Set flow director Tunnel mask.\n\n"
1061 "flow_director_flex_mask (port_id)"
1062 " flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|"
1063 "ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|l2_payload|all)"
1065 " Configure mask of flex payload.\n\n"
1067 "flow_director_flex_payload (port_id)"
1068 " (raw|l2|l3|l4) (config)\n"
1069 " Configure flex payload selection.\n\n"
1071 "get_sym_hash_ena_per_port (port_id)\n"
1072 " get symmetric hash enable configuration per port.\n\n"
1074 "set_sym_hash_ena_per_port (port_id) (enable|disable)\n"
1075 " set symmetric hash enable configuration per port"
1076 " to enable or disable.\n\n"
1078 "get_hash_global_config (port_id)\n"
1079 " Get the global configurations of hash filters.\n\n"
1081 "set_hash_global_config (port_id) (toeplitz|simple_xor|default)"
1082 " (ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|"
1083 "ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload)"
1084 " (enable|disable)\n"
1085 " Set the global configurations of hash filters.\n\n"
1087 "set_hash_input_set (port_id) (ipv4|ipv4-frag|"
1088 "ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|"
1089 "ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|"
1090 "l2_payload|<flowtype_id>) (ovlan|ivlan|src-ipv4|dst-ipv4|"
1091 "src-ipv6|dst-ipv6|ipv4-tos|ipv4-proto|ipv6-tc|"
1092 "ipv6-next-header|udp-src-port|udp-dst-port|"
1093 "tcp-src-port|tcp-dst-port|sctp-src-port|"
1094 "sctp-dst-port|sctp-veri-tag|udp-key|gre-key|fld-1st|"
1095 "fld-2nd|fld-3rd|fld-4th|fld-5th|fld-6th|fld-7th|"
1096 "fld-8th|none) (select|add)\n"
1097 " Set the input set for hash.\n\n"
1099 "set_fdir_input_set (port_id) "
1100 "(ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
1101 "ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|"
1102 "l2_payload) (ivlan|ethertype|src-ipv4|dst-ipv4|src-ipv6|"
1103 "dst-ipv6|ipv4-tos|ipv4-proto|ipv4-ttl|ipv6-tc|"
1104 "ipv6-next-header|ipv6-hop-limits|udp-src-port|"
1105 "udp-dst-port|tcp-src-port|tcp-dst-port|"
1106 "sctp-src-port|sctp-dst-port|sctp-veri-tag|none)"
1108 " Set the input set for FDir.\n\n"
1110 "flow validate {port_id}"
1111 " [group {group_id}] [priority {level}]"
1112 " [ingress] [egress]"
1113 " pattern {item} [/ {item} [...]] / end"
1114 " actions {action} [/ {action} [...]] / end\n"
1115 " Check whether a flow rule can be created.\n\n"
1117 "flow create {port_id}"
1118 " [group {group_id}] [priority {level}]"
1119 " [ingress] [egress]"
1120 " pattern {item} [/ {item} [...]] / end"
1121 " actions {action} [/ {action} [...]] / end\n"
1122 " Create a flow rule.\n\n"
1124 "flow destroy {port_id} rule {rule_id} [...]\n"
1125 " Destroy specific flow rules.\n\n"
1127 "flow flush {port_id}\n"
1128 " Destroy all flow rules.\n\n"
1130 "flow query {port_id} {rule_id} {action}\n"
1131 " Query an existing flow rule.\n\n"
1133 "flow list {port_id} [group {group_id}] [...]\n"
1134 " List existing flow rules sorted by priority,"
1135 " filtered by group identifiers.\n\n"
1137 "flow isolate {port_id} {boolean}\n"
1138 " Restrict ingress traffic to the defined"
1143 if (show_all
|| !strcmp(res
->section
, "traffic_management")) {
1147 "Traffic Management:\n"
1149 "show port tm cap (port_id)\n"
1150 " Display the port TM capability.\n\n"
1152 "show port tm level cap (port_id) (level_id)\n"
1153 " Display the port TM hierarchical level capability.\n\n"
1155 "show port tm node cap (port_id) (node_id)\n"
1156 " Display the port TM node capability.\n\n"
1158 "show port tm node type (port_id) (node_id)\n"
1159 " Display the port TM node type.\n\n"
1161 "show port tm node stats (port_id) (node_id) (clear)\n"
1162 " Display the port TM node stats.\n\n"
1164 #if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED
1165 "set port tm hierarchy default (port_id)\n"
1166 " Set default traffic Management hierarchy on a port\n\n"
1169 "add port tm node shaper profile (port_id) (shaper_profile_id)"
1170 " (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size)"
1171 " (packet_length_adjust)\n"
1172 " Add port tm node private shaper profile.\n\n"
1174 "del port tm node shaper profile (port_id) (shaper_profile_id)\n"
1175 " Delete port tm node private shaper profile.\n\n"
1177 "add port tm node shared shaper (port_id) (shared_shaper_id)"
1178 " (shaper_profile_id)\n"
1179 " Add/update port tm node shared shaper.\n\n"
1181 "del port tm node shared shaper (port_id) (shared_shaper_id)\n"
1182 " Delete port tm node shared shaper.\n\n"
1184 "set port tm node shaper profile (port_id) (node_id)"
1185 " (shaper_profile_id)\n"
1186 " Set port tm node shaper profile.\n\n"
1188 "add port tm node wred profile (port_id) (wred_profile_id)"
1189 " (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g)"
1190 " (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y)"
1191 " (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)\n"
1192 " Add port tm node wred profile.\n\n"
1194 "del port tm node wred profile (port_id) (wred_profile_id)\n"
1195 " Delete port tm node wred profile.\n\n"
1197 "add port tm nonleaf node (port_id) (node_id) (parent_node_id)"
1198 " (priority) (weight) (level_id) (shaper_profile_id)"
1199 " (n_sp_priorities) (stats_mask) (n_shared_shapers)"
1200 " [(shared_shaper_id_0) (shared_shaper_id_1)...]\n"
1201 " Add port tm nonleaf node.\n\n"
1203 "add port tm leaf node (port_id) (node_id) (parent_node_id)"
1204 " (priority) (weight) (level_id) (shaper_profile_id)"
1205 " (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers)"
1206 " [(shared_shaper_id_0) (shared_shaper_id_1)...]\n"
1207 " Add port tm leaf node.\n\n"
1209 "del port tm node (port_id) (node_id)\n"
1210 " Delete port tm node.\n\n"
1212 "set port tm node parent (port_id) (node_id) (parent_node_id)"
1213 " (priority) (weight)\n"
1214 " Set port tm node parent.\n\n"
1216 "suspend port tm node (port_id) (node_id)"
1217 " Suspend tm node.\n\n"
1219 "resume port tm node (port_id) (node_id)"
1220 " Resume tm node.\n\n"
1222 "port tm hierarchy commit (port_id) (clean_on_fail)\n"
1223 " Commit tm hierarchy.\n\n"
1225 "set port tm mark ip_ecn (port) (green) (yellow)"
1227 " Enables/Disables the traffic management marking"
1228 " for IP ECN (Explicit Congestion Notification)"
1229 " packets on a given port\n\n"
1231 "set port tm mark ip_dscp (port) (green) (yellow)"
1233 " Enables/Disables the traffic management marking"
1234 " on the port for IP dscp packets\n\n"
1236 "set port tm mark vlan_dei (port) (green) (yellow)"
1238 " Enables/Disables the traffic management marking"
1239 " on the port for VLAN packets with DEI enabled\n\n"
1245 cmdline_parse_token_string_t cmd_help_long_help
=
1246 TOKEN_STRING_INITIALIZER(struct cmd_help_long_result
, help
, "help");
1248 cmdline_parse_token_string_t cmd_help_long_section
=
1249 TOKEN_STRING_INITIALIZER(struct cmd_help_long_result
, section
,
1250 "all#control#display#config#"
1251 "ports#registers#filters#traffic_management");
1253 cmdline_parse_inst_t cmd_help_long
= {
1254 .f
= cmd_help_long_parsed
,
1256 .help_str
= "help all|control|display|config|ports|register|"
1257 "filters|traffic_management: "
1260 (void *)&cmd_help_long_help
,
1261 (void *)&cmd_help_long_section
,
1267 /* *** start/stop/close all ports *** */
1268 struct cmd_operate_port_result
{
1269 cmdline_fixed_string_t keyword
;
1270 cmdline_fixed_string_t name
;
1271 cmdline_fixed_string_t value
;
1274 static void cmd_operate_port_parsed(void *parsed_result
,
1275 __attribute__((unused
)) struct cmdline
*cl
,
1276 __attribute__((unused
)) void *data
)
1278 struct cmd_operate_port_result
*res
= parsed_result
;
1280 if (!strcmp(res
->name
, "start"))
1281 start_port(RTE_PORT_ALL
);
1282 else if (!strcmp(res
->name
, "stop"))
1283 stop_port(RTE_PORT_ALL
);
1284 else if (!strcmp(res
->name
, "close"))
1285 close_port(RTE_PORT_ALL
);
1286 else if (!strcmp(res
->name
, "reset"))
1287 reset_port(RTE_PORT_ALL
);
1289 printf("Unknown parameter\n");
1292 cmdline_parse_token_string_t cmd_operate_port_all_cmd
=
1293 TOKEN_STRING_INITIALIZER(struct cmd_operate_port_result
, keyword
,
1295 cmdline_parse_token_string_t cmd_operate_port_all_port
=
1296 TOKEN_STRING_INITIALIZER(struct cmd_operate_port_result
, name
,
1297 "start#stop#close#reset");
1298 cmdline_parse_token_string_t cmd_operate_port_all_all
=
1299 TOKEN_STRING_INITIALIZER(struct cmd_operate_port_result
, value
, "all");
1301 cmdline_parse_inst_t cmd_operate_port
= {
1302 .f
= cmd_operate_port_parsed
,
1304 .help_str
= "port start|stop|close all: Start/Stop/Close/Reset all ports",
1306 (void *)&cmd_operate_port_all_cmd
,
1307 (void *)&cmd_operate_port_all_port
,
1308 (void *)&cmd_operate_port_all_all
,
1313 /* *** start/stop/close specific port *** */
1314 struct cmd_operate_specific_port_result
{
1315 cmdline_fixed_string_t keyword
;
1316 cmdline_fixed_string_t name
;
1320 static void cmd_operate_specific_port_parsed(void *parsed_result
,
1321 __attribute__((unused
)) struct cmdline
*cl
,
1322 __attribute__((unused
)) void *data
)
1324 struct cmd_operate_specific_port_result
*res
= parsed_result
;
1326 if (!strcmp(res
->name
, "start"))
1327 start_port(res
->value
);
1328 else if (!strcmp(res
->name
, "stop"))
1329 stop_port(res
->value
);
1330 else if (!strcmp(res
->name
, "close"))
1331 close_port(res
->value
);
1332 else if (!strcmp(res
->name
, "reset"))
1333 reset_port(res
->value
);
1335 printf("Unknown parameter\n");
1338 cmdline_parse_token_string_t cmd_operate_specific_port_cmd
=
1339 TOKEN_STRING_INITIALIZER(struct cmd_operate_specific_port_result
,
1341 cmdline_parse_token_string_t cmd_operate_specific_port_port
=
1342 TOKEN_STRING_INITIALIZER(struct cmd_operate_specific_port_result
,
1343 name
, "start#stop#close#reset");
1344 cmdline_parse_token_num_t cmd_operate_specific_port_id
=
1345 TOKEN_NUM_INITIALIZER(struct cmd_operate_specific_port_result
,
1348 cmdline_parse_inst_t cmd_operate_specific_port
= {
1349 .f
= cmd_operate_specific_port_parsed
,
1351 .help_str
= "port start|stop|close <port_id>: Start/Stop/Close/Reset port_id",
1353 (void *)&cmd_operate_specific_port_cmd
,
1354 (void *)&cmd_operate_specific_port_port
,
1355 (void *)&cmd_operate_specific_port_id
,
1360 /* *** enable port setup (after attach) via iterator or event *** */
1361 struct cmd_set_port_setup_on_result
{
1362 cmdline_fixed_string_t set
;
1363 cmdline_fixed_string_t port
;
1364 cmdline_fixed_string_t setup
;
1365 cmdline_fixed_string_t on
;
1366 cmdline_fixed_string_t mode
;
1369 static void cmd_set_port_setup_on_parsed(void *parsed_result
,
1370 __attribute__((unused
)) struct cmdline
*cl
,
1371 __attribute__((unused
)) void *data
)
1373 struct cmd_set_port_setup_on_result
*res
= parsed_result
;
1375 if (strcmp(res
->mode
, "event") == 0)
1376 setup_on_probe_event
= true;
1377 else if (strcmp(res
->mode
, "iterator") == 0)
1378 setup_on_probe_event
= false;
1380 printf("Unknown mode\n");
1383 cmdline_parse_token_string_t cmd_set_port_setup_on_set
=
1384 TOKEN_STRING_INITIALIZER(struct cmd_set_port_setup_on_result
,
1386 cmdline_parse_token_string_t cmd_set_port_setup_on_port
=
1387 TOKEN_STRING_INITIALIZER(struct cmd_set_port_setup_on_result
,
1389 cmdline_parse_token_string_t cmd_set_port_setup_on_setup
=
1390 TOKEN_STRING_INITIALIZER(struct cmd_set_port_setup_on_result
,
1392 cmdline_parse_token_string_t cmd_set_port_setup_on_on
=
1393 TOKEN_STRING_INITIALIZER(struct cmd_set_port_setup_on_result
,
1395 cmdline_parse_token_string_t cmd_set_port_setup_on_mode
=
1396 TOKEN_STRING_INITIALIZER(struct cmd_set_port_setup_on_result
,
1397 mode
, "iterator#event");
1399 cmdline_parse_inst_t cmd_set_port_setup_on
= {
1400 .f
= cmd_set_port_setup_on_parsed
,
1402 .help_str
= "set port setup on iterator|event",
1404 (void *)&cmd_set_port_setup_on_set
,
1405 (void *)&cmd_set_port_setup_on_port
,
1406 (void *)&cmd_set_port_setup_on_setup
,
1407 (void *)&cmd_set_port_setup_on_on
,
1408 (void *)&cmd_set_port_setup_on_mode
,
1413 /* *** attach a specified port *** */
1414 struct cmd_operate_attach_port_result
{
1415 cmdline_fixed_string_t port
;
1416 cmdline_fixed_string_t keyword
;
1417 cmdline_fixed_string_t identifier
;
1420 static void cmd_operate_attach_port_parsed(void *parsed_result
,
1421 __attribute__((unused
)) struct cmdline
*cl
,
1422 __attribute__((unused
)) void *data
)
1424 struct cmd_operate_attach_port_result
*res
= parsed_result
;
1426 if (!strcmp(res
->keyword
, "attach"))
1427 attach_port(res
->identifier
);
1429 printf("Unknown parameter\n");
1432 cmdline_parse_token_string_t cmd_operate_attach_port_port
=
1433 TOKEN_STRING_INITIALIZER(struct cmd_operate_attach_port_result
,
1435 cmdline_parse_token_string_t cmd_operate_attach_port_keyword
=
1436 TOKEN_STRING_INITIALIZER(struct cmd_operate_attach_port_result
,
1438 cmdline_parse_token_string_t cmd_operate_attach_port_identifier
=
1439 TOKEN_STRING_INITIALIZER(struct cmd_operate_attach_port_result
,
1442 cmdline_parse_inst_t cmd_operate_attach_port
= {
1443 .f
= cmd_operate_attach_port_parsed
,
1445 .help_str
= "port attach <identifier>: "
1446 "(identifier: pci address or virtual dev name)",
1448 (void *)&cmd_operate_attach_port_port
,
1449 (void *)&cmd_operate_attach_port_keyword
,
1450 (void *)&cmd_operate_attach_port_identifier
,
1455 /* *** detach a specified port *** */
1456 struct cmd_operate_detach_port_result
{
1457 cmdline_fixed_string_t port
;
1458 cmdline_fixed_string_t keyword
;
1462 static void cmd_operate_detach_port_parsed(void *parsed_result
,
1463 __attribute__((unused
)) struct cmdline
*cl
,
1464 __attribute__((unused
)) void *data
)
1466 struct cmd_operate_detach_port_result
*res
= parsed_result
;
1468 if (!strcmp(res
->keyword
, "detach"))
1469 detach_port_device(res
->port_id
);
1471 printf("Unknown parameter\n");
1474 cmdline_parse_token_string_t cmd_operate_detach_port_port
=
1475 TOKEN_STRING_INITIALIZER(struct cmd_operate_detach_port_result
,
1477 cmdline_parse_token_string_t cmd_operate_detach_port_keyword
=
1478 TOKEN_STRING_INITIALIZER(struct cmd_operate_detach_port_result
,
1480 cmdline_parse_token_num_t cmd_operate_detach_port_port_id
=
1481 TOKEN_NUM_INITIALIZER(struct cmd_operate_detach_port_result
,
1484 cmdline_parse_inst_t cmd_operate_detach_port
= {
1485 .f
= cmd_operate_detach_port_parsed
,
1487 .help_str
= "port detach <port_id>",
1489 (void *)&cmd_operate_detach_port_port
,
1490 (void *)&cmd_operate_detach_port_keyword
,
1491 (void *)&cmd_operate_detach_port_port_id
,
1496 /* *** configure speed for all ports *** */
1497 struct cmd_config_speed_all
{
1498 cmdline_fixed_string_t port
;
1499 cmdline_fixed_string_t keyword
;
1500 cmdline_fixed_string_t all
;
1501 cmdline_fixed_string_t item1
;
1502 cmdline_fixed_string_t item2
;
1503 cmdline_fixed_string_t value1
;
1504 cmdline_fixed_string_t value2
;
1508 parse_and_check_speed_duplex(char *speedstr
, char *duplexstr
, uint32_t *speed
)
1513 if (!strcmp(duplexstr
, "half")) {
1514 duplex
= ETH_LINK_HALF_DUPLEX
;
1515 } else if (!strcmp(duplexstr
, "full")) {
1516 duplex
= ETH_LINK_FULL_DUPLEX
;
1517 } else if (!strcmp(duplexstr
, "auto")) {
1518 duplex
= ETH_LINK_FULL_DUPLEX
;
1520 printf("Unknown duplex parameter\n");
1524 if (!strcmp(speedstr
, "10")) {
1525 *speed
= (duplex
== ETH_LINK_HALF_DUPLEX
) ?
1526 ETH_LINK_SPEED_10M_HD
: ETH_LINK_SPEED_10M
;
1527 } else if (!strcmp(speedstr
, "100")) {
1528 *speed
= (duplex
== ETH_LINK_HALF_DUPLEX
) ?
1529 ETH_LINK_SPEED_100M_HD
: ETH_LINK_SPEED_100M
;
1531 if (duplex
!= ETH_LINK_FULL_DUPLEX
) {
1532 printf("Invalid speed/duplex parameters\n");
1535 if (!strcmp(speedstr
, "1000")) {
1536 *speed
= ETH_LINK_SPEED_1G
;
1537 } else if (!strcmp(speedstr
, "10000")) {
1538 *speed
= ETH_LINK_SPEED_10G
;
1539 } else if (!strcmp(speedstr
, "25000")) {
1540 *speed
= ETH_LINK_SPEED_25G
;
1541 } else if (!strcmp(speedstr
, "40000")) {
1542 *speed
= ETH_LINK_SPEED_40G
;
1543 } else if (!strcmp(speedstr
, "50000")) {
1544 *speed
= ETH_LINK_SPEED_50G
;
1545 } else if (!strcmp(speedstr
, "100000")) {
1546 *speed
= ETH_LINK_SPEED_100G
;
1547 } else if (!strcmp(speedstr
, "auto")) {
1548 *speed
= ETH_LINK_SPEED_AUTONEG
;
1550 printf("Unknown speed parameter\n");
1559 cmd_config_speed_all_parsed(void *parsed_result
,
1560 __attribute__((unused
)) struct cmdline
*cl
,
1561 __attribute__((unused
)) void *data
)
1563 struct cmd_config_speed_all
*res
= parsed_result
;
1564 uint32_t link_speed
;
1567 if (!all_ports_stopped()) {
1568 printf("Please stop all ports first\n");
1572 if (parse_and_check_speed_duplex(res
->value1
, res
->value2
,
1576 RTE_ETH_FOREACH_DEV(pid
) {
1577 ports
[pid
].dev_conf
.link_speeds
= link_speed
;
1580 cmd_reconfig_device_queue(RTE_PORT_ALL
, 1, 1);
1583 cmdline_parse_token_string_t cmd_config_speed_all_port
=
1584 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all
, port
, "port");
1585 cmdline_parse_token_string_t cmd_config_speed_all_keyword
=
1586 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all
, keyword
,
1588 cmdline_parse_token_string_t cmd_config_speed_all_all
=
1589 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all
, all
, "all");
1590 cmdline_parse_token_string_t cmd_config_speed_all_item1
=
1591 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all
, item1
, "speed");
1592 cmdline_parse_token_string_t cmd_config_speed_all_value1
=
1593 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all
, value1
,
1594 "10#100#1000#10000#25000#40000#50000#100000#auto");
1595 cmdline_parse_token_string_t cmd_config_speed_all_item2
=
1596 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all
, item2
, "duplex");
1597 cmdline_parse_token_string_t cmd_config_speed_all_value2
=
1598 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all
, value2
,
1601 cmdline_parse_inst_t cmd_config_speed_all
= {
1602 .f
= cmd_config_speed_all_parsed
,
1604 .help_str
= "port config all speed "
1605 "10|100|1000|10000|25000|40000|50000|100000|auto duplex "
1608 (void *)&cmd_config_speed_all_port
,
1609 (void *)&cmd_config_speed_all_keyword
,
1610 (void *)&cmd_config_speed_all_all
,
1611 (void *)&cmd_config_speed_all_item1
,
1612 (void *)&cmd_config_speed_all_value1
,
1613 (void *)&cmd_config_speed_all_item2
,
1614 (void *)&cmd_config_speed_all_value2
,
1619 /* *** configure speed for specific port *** */
1620 struct cmd_config_speed_specific
{
1621 cmdline_fixed_string_t port
;
1622 cmdline_fixed_string_t keyword
;
1624 cmdline_fixed_string_t item1
;
1625 cmdline_fixed_string_t item2
;
1626 cmdline_fixed_string_t value1
;
1627 cmdline_fixed_string_t value2
;
1631 cmd_config_speed_specific_parsed(void *parsed_result
,
1632 __attribute__((unused
)) struct cmdline
*cl
,
1633 __attribute__((unused
)) void *data
)
1635 struct cmd_config_speed_specific
*res
= parsed_result
;
1636 uint32_t link_speed
;
1638 if (!all_ports_stopped()) {
1639 printf("Please stop all ports first\n");
1643 if (port_id_is_invalid(res
->id
, ENABLED_WARN
))
1646 if (parse_and_check_speed_duplex(res
->value1
, res
->value2
,
1650 ports
[res
->id
].dev_conf
.link_speeds
= link_speed
;
1652 cmd_reconfig_device_queue(RTE_PORT_ALL
, 1, 1);
1656 cmdline_parse_token_string_t cmd_config_speed_specific_port
=
1657 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific
, port
,
1659 cmdline_parse_token_string_t cmd_config_speed_specific_keyword
=
1660 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific
, keyword
,
1662 cmdline_parse_token_num_t cmd_config_speed_specific_id
=
1663 TOKEN_NUM_INITIALIZER(struct cmd_config_speed_specific
, id
, UINT16
);
1664 cmdline_parse_token_string_t cmd_config_speed_specific_item1
=
1665 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific
, item1
,
1667 cmdline_parse_token_string_t cmd_config_speed_specific_value1
=
1668 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific
, value1
,
1669 "10#100#1000#10000#25000#40000#50000#100000#auto");
1670 cmdline_parse_token_string_t cmd_config_speed_specific_item2
=
1671 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific
, item2
,
1673 cmdline_parse_token_string_t cmd_config_speed_specific_value2
=
1674 TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific
, value2
,
1677 cmdline_parse_inst_t cmd_config_speed_specific
= {
1678 .f
= cmd_config_speed_specific_parsed
,
1680 .help_str
= "port config <port_id> speed "
1681 "10|100|1000|10000|25000|40000|50000|100000|auto duplex "
1684 (void *)&cmd_config_speed_specific_port
,
1685 (void *)&cmd_config_speed_specific_keyword
,
1686 (void *)&cmd_config_speed_specific_id
,
1687 (void *)&cmd_config_speed_specific_item1
,
1688 (void *)&cmd_config_speed_specific_value1
,
1689 (void *)&cmd_config_speed_specific_item2
,
1690 (void *)&cmd_config_speed_specific_value2
,
1695 /* *** configure loopback for all ports *** */
1696 struct cmd_config_loopback_all
{
1697 cmdline_fixed_string_t port
;
1698 cmdline_fixed_string_t keyword
;
1699 cmdline_fixed_string_t all
;
1700 cmdline_fixed_string_t item
;
1705 cmd_config_loopback_all_parsed(void *parsed_result
,
1706 __attribute__((unused
)) struct cmdline
*cl
,
1707 __attribute__((unused
)) void *data
)
1709 struct cmd_config_loopback_all
*res
= parsed_result
;
1712 if (!all_ports_stopped()) {
1713 printf("Please stop all ports first\n");
1717 RTE_ETH_FOREACH_DEV(pid
) {
1718 ports
[pid
].dev_conf
.lpbk_mode
= res
->mode
;
1721 cmd_reconfig_device_queue(RTE_PORT_ALL
, 1, 1);
1724 cmdline_parse_token_string_t cmd_config_loopback_all_port
=
1725 TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_all
, port
, "port");
1726 cmdline_parse_token_string_t cmd_config_loopback_all_keyword
=
1727 TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_all
, keyword
,
1729 cmdline_parse_token_string_t cmd_config_loopback_all_all
=
1730 TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_all
, all
, "all");
1731 cmdline_parse_token_string_t cmd_config_loopback_all_item
=
1732 TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_all
, item
,
1734 cmdline_parse_token_num_t cmd_config_loopback_all_mode
=
1735 TOKEN_NUM_INITIALIZER(struct cmd_config_loopback_all
, mode
, UINT32
);
1737 cmdline_parse_inst_t cmd_config_loopback_all
= {
1738 .f
= cmd_config_loopback_all_parsed
,
1740 .help_str
= "port config all loopback <mode>",
1742 (void *)&cmd_config_loopback_all_port
,
1743 (void *)&cmd_config_loopback_all_keyword
,
1744 (void *)&cmd_config_loopback_all_all
,
1745 (void *)&cmd_config_loopback_all_item
,
1746 (void *)&cmd_config_loopback_all_mode
,
1751 /* *** configure loopback for specific port *** */
1752 struct cmd_config_loopback_specific
{
1753 cmdline_fixed_string_t port
;
1754 cmdline_fixed_string_t keyword
;
1756 cmdline_fixed_string_t item
;
1761 cmd_config_loopback_specific_parsed(void *parsed_result
,
1762 __attribute__((unused
)) struct cmdline
*cl
,
1763 __attribute__((unused
)) void *data
)
1765 struct cmd_config_loopback_specific
*res
= parsed_result
;
1767 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
1770 if (!port_is_stopped(res
->port_id
)) {
1771 printf("Please stop port %u first\n", res
->port_id
);
1775 ports
[res
->port_id
].dev_conf
.lpbk_mode
= res
->mode
;
1777 cmd_reconfig_device_queue(res
->port_id
, 1, 1);
1781 cmdline_parse_token_string_t cmd_config_loopback_specific_port
=
1782 TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_specific
, port
,
1784 cmdline_parse_token_string_t cmd_config_loopback_specific_keyword
=
1785 TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_specific
, keyword
,
1787 cmdline_parse_token_num_t cmd_config_loopback_specific_id
=
1788 TOKEN_NUM_INITIALIZER(struct cmd_config_loopback_specific
, port_id
,
1790 cmdline_parse_token_string_t cmd_config_loopback_specific_item
=
1791 TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_specific
, item
,
1793 cmdline_parse_token_num_t cmd_config_loopback_specific_mode
=
1794 TOKEN_NUM_INITIALIZER(struct cmd_config_loopback_specific
, mode
,
1797 cmdline_parse_inst_t cmd_config_loopback_specific
= {
1798 .f
= cmd_config_loopback_specific_parsed
,
1800 .help_str
= "port config <port_id> loopback <mode>",
1802 (void *)&cmd_config_loopback_specific_port
,
1803 (void *)&cmd_config_loopback_specific_keyword
,
1804 (void *)&cmd_config_loopback_specific_id
,
1805 (void *)&cmd_config_loopback_specific_item
,
1806 (void *)&cmd_config_loopback_specific_mode
,
1811 /* *** configure txq/rxq, txd/rxd *** */
1812 struct cmd_config_rx_tx
{
1813 cmdline_fixed_string_t port
;
1814 cmdline_fixed_string_t keyword
;
1815 cmdline_fixed_string_t all
;
1816 cmdline_fixed_string_t name
;
1821 cmd_config_rx_tx_parsed(void *parsed_result
,
1822 __attribute__((unused
)) struct cmdline
*cl
,
1823 __attribute__((unused
)) void *data
)
1825 struct cmd_config_rx_tx
*res
= parsed_result
;
1827 if (!all_ports_stopped()) {
1828 printf("Please stop all ports first\n");
1831 if (!strcmp(res
->name
, "rxq")) {
1832 if (!res
->value
&& !nb_txq
) {
1833 printf("Warning: Either rx or tx queues should be non zero\n");
1836 if (check_nb_rxq(res
->value
) != 0)
1838 nb_rxq
= res
->value
;
1840 else if (!strcmp(res
->name
, "txq")) {
1841 if (!res
->value
&& !nb_rxq
) {
1842 printf("Warning: Either rx or tx queues should be non zero\n");
1845 if (check_nb_txq(res
->value
) != 0)
1847 nb_txq
= res
->value
;
1849 else if (!strcmp(res
->name
, "rxd")) {
1850 if (res
->value
<= 0 || res
->value
> RTE_TEST_RX_DESC_MAX
) {
1851 printf("rxd %d invalid - must be > 0 && <= %d\n",
1852 res
->value
, RTE_TEST_RX_DESC_MAX
);
1855 nb_rxd
= res
->value
;
1856 } else if (!strcmp(res
->name
, "txd")) {
1857 if (res
->value
<= 0 || res
->value
> RTE_TEST_TX_DESC_MAX
) {
1858 printf("txd %d invalid - must be > 0 && <= %d\n",
1859 res
->value
, RTE_TEST_TX_DESC_MAX
);
1862 nb_txd
= res
->value
;
1864 printf("Unknown parameter\n");
1872 cmd_reconfig_device_queue(RTE_PORT_ALL
, 1, 1);
1875 cmdline_parse_token_string_t cmd_config_rx_tx_port
=
1876 TOKEN_STRING_INITIALIZER(struct cmd_config_rx_tx
, port
, "port");
1877 cmdline_parse_token_string_t cmd_config_rx_tx_keyword
=
1878 TOKEN_STRING_INITIALIZER(struct cmd_config_rx_tx
, keyword
, "config");
1879 cmdline_parse_token_string_t cmd_config_rx_tx_all
=
1880 TOKEN_STRING_INITIALIZER(struct cmd_config_rx_tx
, all
, "all");
1881 cmdline_parse_token_string_t cmd_config_rx_tx_name
=
1882 TOKEN_STRING_INITIALIZER(struct cmd_config_rx_tx
, name
,
1884 cmdline_parse_token_num_t cmd_config_rx_tx_value
=
1885 TOKEN_NUM_INITIALIZER(struct cmd_config_rx_tx
, value
, UINT16
);
1887 cmdline_parse_inst_t cmd_config_rx_tx
= {
1888 .f
= cmd_config_rx_tx_parsed
,
1890 .help_str
= "port config all rxq|txq|rxd|txd <value>",
1892 (void *)&cmd_config_rx_tx_port
,
1893 (void *)&cmd_config_rx_tx_keyword
,
1894 (void *)&cmd_config_rx_tx_all
,
1895 (void *)&cmd_config_rx_tx_name
,
1896 (void *)&cmd_config_rx_tx_value
,
1901 /* *** config max packet length *** */
1902 struct cmd_config_max_pkt_len_result
{
1903 cmdline_fixed_string_t port
;
1904 cmdline_fixed_string_t keyword
;
1905 cmdline_fixed_string_t all
;
1906 cmdline_fixed_string_t name
;
1911 cmd_config_max_pkt_len_parsed(void *parsed_result
,
1912 __attribute__((unused
)) struct cmdline
*cl
,
1913 __attribute__((unused
)) void *data
)
1915 struct cmd_config_max_pkt_len_result
*res
= parsed_result
;
1918 if (!all_ports_stopped()) {
1919 printf("Please stop all ports first\n");
1923 RTE_ETH_FOREACH_DEV(pid
) {
1924 struct rte_port
*port
= &ports
[pid
];
1925 uint64_t rx_offloads
= port
->dev_conf
.rxmode
.offloads
;
1927 if (!strcmp(res
->name
, "max-pkt-len")) {
1928 if (res
->value
< ETHER_MIN_LEN
) {
1929 printf("max-pkt-len can not be less than %d\n",
1933 if (res
->value
== port
->dev_conf
.rxmode
.max_rx_pkt_len
)
1936 port
->dev_conf
.rxmode
.max_rx_pkt_len
= res
->value
;
1937 if (res
->value
> ETHER_MAX_LEN
)
1938 rx_offloads
|= DEV_RX_OFFLOAD_JUMBO_FRAME
;
1940 rx_offloads
&= ~DEV_RX_OFFLOAD_JUMBO_FRAME
;
1941 port
->dev_conf
.rxmode
.offloads
= rx_offloads
;
1943 printf("Unknown parameter\n");
1950 cmd_reconfig_device_queue(RTE_PORT_ALL
, 1, 1);
1953 cmdline_parse_token_string_t cmd_config_max_pkt_len_port
=
1954 TOKEN_STRING_INITIALIZER(struct cmd_config_max_pkt_len_result
, port
,
1956 cmdline_parse_token_string_t cmd_config_max_pkt_len_keyword
=
1957 TOKEN_STRING_INITIALIZER(struct cmd_config_max_pkt_len_result
, keyword
,
1959 cmdline_parse_token_string_t cmd_config_max_pkt_len_all
=
1960 TOKEN_STRING_INITIALIZER(struct cmd_config_max_pkt_len_result
, all
,
1962 cmdline_parse_token_string_t cmd_config_max_pkt_len_name
=
1963 TOKEN_STRING_INITIALIZER(struct cmd_config_max_pkt_len_result
, name
,
1965 cmdline_parse_token_num_t cmd_config_max_pkt_len_value
=
1966 TOKEN_NUM_INITIALIZER(struct cmd_config_max_pkt_len_result
, value
,
1969 cmdline_parse_inst_t cmd_config_max_pkt_len
= {
1970 .f
= cmd_config_max_pkt_len_parsed
,
1972 .help_str
= "port config all max-pkt-len <value>",
1974 (void *)&cmd_config_max_pkt_len_port
,
1975 (void *)&cmd_config_max_pkt_len_keyword
,
1976 (void *)&cmd_config_max_pkt_len_all
,
1977 (void *)&cmd_config_max_pkt_len_name
,
1978 (void *)&cmd_config_max_pkt_len_value
,
1983 /* *** configure port MTU *** */
1984 struct cmd_config_mtu_result
{
1985 cmdline_fixed_string_t port
;
1986 cmdline_fixed_string_t keyword
;
1987 cmdline_fixed_string_t mtu
;
1993 cmd_config_mtu_parsed(void *parsed_result
,
1994 __attribute__((unused
)) struct cmdline
*cl
,
1995 __attribute__((unused
)) void *data
)
1997 struct cmd_config_mtu_result
*res
= parsed_result
;
1999 if (res
->value
< ETHER_MIN_LEN
) {
2000 printf("mtu cannot be less than %d\n", ETHER_MIN_LEN
);
2003 port_mtu_set(res
->port_id
, res
->value
);
2006 cmdline_parse_token_string_t cmd_config_mtu_port
=
2007 TOKEN_STRING_INITIALIZER(struct cmd_config_mtu_result
, port
,
2009 cmdline_parse_token_string_t cmd_config_mtu_keyword
=
2010 TOKEN_STRING_INITIALIZER(struct cmd_config_mtu_result
, keyword
,
2012 cmdline_parse_token_string_t cmd_config_mtu_mtu
=
2013 TOKEN_STRING_INITIALIZER(struct cmd_config_mtu_result
, keyword
,
2015 cmdline_parse_token_num_t cmd_config_mtu_port_id
=
2016 TOKEN_NUM_INITIALIZER(struct cmd_config_mtu_result
, port_id
, UINT16
);
2017 cmdline_parse_token_num_t cmd_config_mtu_value
=
2018 TOKEN_NUM_INITIALIZER(struct cmd_config_mtu_result
, value
, UINT16
);
2020 cmdline_parse_inst_t cmd_config_mtu
= {
2021 .f
= cmd_config_mtu_parsed
,
2023 .help_str
= "port config mtu <port_id> <value>",
2025 (void *)&cmd_config_mtu_port
,
2026 (void *)&cmd_config_mtu_keyword
,
2027 (void *)&cmd_config_mtu_mtu
,
2028 (void *)&cmd_config_mtu_port_id
,
2029 (void *)&cmd_config_mtu_value
,
2034 /* *** configure rx mode *** */
2035 struct cmd_config_rx_mode_flag
{
2036 cmdline_fixed_string_t port
;
2037 cmdline_fixed_string_t keyword
;
2038 cmdline_fixed_string_t all
;
2039 cmdline_fixed_string_t name
;
2040 cmdline_fixed_string_t value
;
2044 cmd_config_rx_mode_flag_parsed(void *parsed_result
,
2045 __attribute__((unused
)) struct cmdline
*cl
,
2046 __attribute__((unused
)) void *data
)
2048 struct cmd_config_rx_mode_flag
*res
= parsed_result
;
2051 if (!all_ports_stopped()) {
2052 printf("Please stop all ports first\n");
2056 RTE_ETH_FOREACH_DEV(pid
) {
2057 struct rte_port
*port
;
2058 uint64_t rx_offloads
;
2061 rx_offloads
= port
->dev_conf
.rxmode
.offloads
;
2062 if (!strcmp(res
->name
, "crc-strip")) {
2063 if (!strcmp(res
->value
, "on")) {
2064 rx_offloads
&= ~DEV_RX_OFFLOAD_KEEP_CRC
;
2065 } else if (!strcmp(res
->value
, "off")) {
2066 rx_offloads
|= DEV_RX_OFFLOAD_KEEP_CRC
;
2068 printf("Unknown parameter\n");
2071 } else if (!strcmp(res
->name
, "scatter")) {
2072 if (!strcmp(res
->value
, "on")) {
2073 rx_offloads
|= DEV_RX_OFFLOAD_SCATTER
;
2074 } else if (!strcmp(res
->value
, "off")) {
2075 rx_offloads
&= ~DEV_RX_OFFLOAD_SCATTER
;
2077 printf("Unknown parameter\n");
2080 } else if (!strcmp(res
->name
, "rx-cksum")) {
2081 if (!strcmp(res
->value
, "on"))
2082 rx_offloads
|= DEV_RX_OFFLOAD_CHECKSUM
;
2083 else if (!strcmp(res
->value
, "off"))
2084 rx_offloads
&= ~DEV_RX_OFFLOAD_CHECKSUM
;
2086 printf("Unknown parameter\n");
2089 } else if (!strcmp(res
->name
, "rx-timestamp")) {
2090 if (!strcmp(res
->value
, "on"))
2091 rx_offloads
|= DEV_RX_OFFLOAD_TIMESTAMP
;
2092 else if (!strcmp(res
->value
, "off"))
2093 rx_offloads
&= ~DEV_RX_OFFLOAD_TIMESTAMP
;
2095 printf("Unknown parameter\n");
2098 } else if (!strcmp(res
->name
, "hw-vlan")) {
2099 if (!strcmp(res
->value
, "on")) {
2100 rx_offloads
|= (DEV_RX_OFFLOAD_VLAN_FILTER
|
2101 DEV_RX_OFFLOAD_VLAN_STRIP
);
2102 } else if (!strcmp(res
->value
, "off")) {
2103 rx_offloads
&= ~(DEV_RX_OFFLOAD_VLAN_FILTER
|
2104 DEV_RX_OFFLOAD_VLAN_STRIP
);
2106 printf("Unknown parameter\n");
2109 } else if (!strcmp(res
->name
, "hw-vlan-filter")) {
2110 if (!strcmp(res
->value
, "on"))
2111 rx_offloads
|= DEV_RX_OFFLOAD_VLAN_FILTER
;
2112 else if (!strcmp(res
->value
, "off"))
2113 rx_offloads
&= ~DEV_RX_OFFLOAD_VLAN_FILTER
;
2115 printf("Unknown parameter\n");
2118 } else if (!strcmp(res
->name
, "hw-vlan-strip")) {
2119 if (!strcmp(res
->value
, "on"))
2120 rx_offloads
|= DEV_RX_OFFLOAD_VLAN_STRIP
;
2121 else if (!strcmp(res
->value
, "off"))
2122 rx_offloads
&= ~DEV_RX_OFFLOAD_VLAN_STRIP
;
2124 printf("Unknown parameter\n");
2127 } else if (!strcmp(res
->name
, "hw-vlan-extend")) {
2128 if (!strcmp(res
->value
, "on"))
2129 rx_offloads
|= DEV_RX_OFFLOAD_VLAN_EXTEND
;
2130 else if (!strcmp(res
->value
, "off"))
2131 rx_offloads
&= ~DEV_RX_OFFLOAD_VLAN_EXTEND
;
2133 printf("Unknown parameter\n");
2136 } else if (!strcmp(res
->name
, "drop-en")) {
2137 if (!strcmp(res
->value
, "on"))
2139 else if (!strcmp(res
->value
, "off"))
2142 printf("Unknown parameter\n");
2146 printf("Unknown parameter\n");
2149 port
->dev_conf
.rxmode
.offloads
= rx_offloads
;
2154 cmd_reconfig_device_queue(RTE_PORT_ALL
, 1, 1);
2157 cmdline_parse_token_string_t cmd_config_rx_mode_flag_port
=
2158 TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag
, port
, "port");
2159 cmdline_parse_token_string_t cmd_config_rx_mode_flag_keyword
=
2160 TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag
, keyword
,
2162 cmdline_parse_token_string_t cmd_config_rx_mode_flag_all
=
2163 TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag
, all
, "all");
2164 cmdline_parse_token_string_t cmd_config_rx_mode_flag_name
=
2165 TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag
, name
,
2166 "crc-strip#scatter#rx-cksum#rx-timestamp#hw-vlan#"
2167 "hw-vlan-filter#hw-vlan-strip#hw-vlan-extend");
2168 cmdline_parse_token_string_t cmd_config_rx_mode_flag_value
=
2169 TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag
, value
,
2172 cmdline_parse_inst_t cmd_config_rx_mode_flag
= {
2173 .f
= cmd_config_rx_mode_flag_parsed
,
2175 .help_str
= "port config all crc-strip|scatter|rx-cksum|rx-timestamp|hw-vlan|"
2176 "hw-vlan-filter|hw-vlan-strip|hw-vlan-extend on|off",
2178 (void *)&cmd_config_rx_mode_flag_port
,
2179 (void *)&cmd_config_rx_mode_flag_keyword
,
2180 (void *)&cmd_config_rx_mode_flag_all
,
2181 (void *)&cmd_config_rx_mode_flag_name
,
2182 (void *)&cmd_config_rx_mode_flag_value
,
2187 /* *** configure rss *** */
2188 struct cmd_config_rss
{
2189 cmdline_fixed_string_t port
;
2190 cmdline_fixed_string_t keyword
;
2191 cmdline_fixed_string_t all
;
2192 cmdline_fixed_string_t name
;
2193 cmdline_fixed_string_t value
;
2197 cmd_config_rss_parsed(void *parsed_result
,
2198 __attribute__((unused
)) struct cmdline
*cl
,
2199 __attribute__((unused
)) void *data
)
2201 struct cmd_config_rss
*res
= parsed_result
;
2202 struct rte_eth_rss_conf rss_conf
= { .rss_key_len
= 0, };
2203 struct rte_eth_dev_info dev_info
= { .flow_type_rss_offloads
= 0, };
2204 int use_default
= 0;
2205 int all_updated
= 1;
2209 if (!strcmp(res
->value
, "all"))
2210 rss_conf
.rss_hf
= ETH_RSS_IP
| ETH_RSS_TCP
|
2211 ETH_RSS_UDP
| ETH_RSS_SCTP
|
2213 else if (!strcmp(res
->value
, "ip"))
2214 rss_conf
.rss_hf
= ETH_RSS_IP
;
2215 else if (!strcmp(res
->value
, "udp"))
2216 rss_conf
.rss_hf
= ETH_RSS_UDP
;
2217 else if (!strcmp(res
->value
, "tcp"))
2218 rss_conf
.rss_hf
= ETH_RSS_TCP
;
2219 else if (!strcmp(res
->value
, "sctp"))
2220 rss_conf
.rss_hf
= ETH_RSS_SCTP
;
2221 else if (!strcmp(res
->value
, "ether"))
2222 rss_conf
.rss_hf
= ETH_RSS_L2_PAYLOAD
;
2223 else if (!strcmp(res
->value
, "port"))
2224 rss_conf
.rss_hf
= ETH_RSS_PORT
;
2225 else if (!strcmp(res
->value
, "vxlan"))
2226 rss_conf
.rss_hf
= ETH_RSS_VXLAN
;
2227 else if (!strcmp(res
->value
, "geneve"))
2228 rss_conf
.rss_hf
= ETH_RSS_GENEVE
;
2229 else if (!strcmp(res
->value
, "nvgre"))
2230 rss_conf
.rss_hf
= ETH_RSS_NVGRE
;
2231 else if (!strcmp(res
->value
, "none"))
2232 rss_conf
.rss_hf
= 0;
2233 else if (!strcmp(res
->value
, "default"))
2235 else if (isdigit(res
->value
[0]) && atoi(res
->value
) > 0 &&
2236 atoi(res
->value
) < 64)
2237 rss_conf
.rss_hf
= 1ULL << atoi(res
->value
);
2239 printf("Unknown parameter\n");
2242 rss_conf
.rss_key
= NULL
;
2243 /* Update global configuration for RSS types. */
2244 RTE_ETH_FOREACH_DEV(i
) {
2245 struct rte_eth_rss_conf local_rss_conf
;
2247 rte_eth_dev_info_get(i
, &dev_info
);
2249 rss_conf
.rss_hf
= dev_info
.flow_type_rss_offloads
;
2251 local_rss_conf
= rss_conf
;
2252 local_rss_conf
.rss_hf
= rss_conf
.rss_hf
&
2253 dev_info
.flow_type_rss_offloads
;
2254 if (local_rss_conf
.rss_hf
!= rss_conf
.rss_hf
) {
2255 printf("Port %u modified RSS hash function based on hardware support,"
2256 "requested:%#"PRIx64
" configured:%#"PRIx64
"\n",
2257 i
, rss_conf
.rss_hf
, local_rss_conf
.rss_hf
);
2259 diag
= rte_eth_dev_rss_hash_update(i
, &local_rss_conf
);
2262 printf("Configuration of RSS hash at ethernet port %d "
2263 "failed with error (%d): %s.\n",
2264 i
, -diag
, strerror(-diag
));
2267 if (all_updated
&& !use_default
)
2268 rss_hf
= rss_conf
.rss_hf
;
2271 cmdline_parse_token_string_t cmd_config_rss_port
=
2272 TOKEN_STRING_INITIALIZER(struct cmd_config_rss
, port
, "port");
2273 cmdline_parse_token_string_t cmd_config_rss_keyword
=
2274 TOKEN_STRING_INITIALIZER(struct cmd_config_rss
, keyword
, "config");
2275 cmdline_parse_token_string_t cmd_config_rss_all
=
2276 TOKEN_STRING_INITIALIZER(struct cmd_config_rss
, all
, "all");
2277 cmdline_parse_token_string_t cmd_config_rss_name
=
2278 TOKEN_STRING_INITIALIZER(struct cmd_config_rss
, name
, "rss");
2279 cmdline_parse_token_string_t cmd_config_rss_value
=
2280 TOKEN_STRING_INITIALIZER(struct cmd_config_rss
, value
, NULL
);
2282 cmdline_parse_inst_t cmd_config_rss
= {
2283 .f
= cmd_config_rss_parsed
,
2285 .help_str
= "port config all rss "
2286 "all|default|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|none|<flowtype_id>",
2288 (void *)&cmd_config_rss_port
,
2289 (void *)&cmd_config_rss_keyword
,
2290 (void *)&cmd_config_rss_all
,
2291 (void *)&cmd_config_rss_name
,
2292 (void *)&cmd_config_rss_value
,
2297 /* *** configure rss hash key *** */
2298 struct cmd_config_rss_hash_key
{
2299 cmdline_fixed_string_t port
;
2300 cmdline_fixed_string_t config
;
2302 cmdline_fixed_string_t rss_hash_key
;
2303 cmdline_fixed_string_t rss_type
;
2304 cmdline_fixed_string_t key
;
2308 hexa_digit_to_value(char hexa_digit
)
2310 if ((hexa_digit
>= '0') && (hexa_digit
<= '9'))
2311 return (uint8_t) (hexa_digit
- '0');
2312 if ((hexa_digit
>= 'a') && (hexa_digit
<= 'f'))
2313 return (uint8_t) ((hexa_digit
- 'a') + 10);
2314 if ((hexa_digit
>= 'A') && (hexa_digit
<= 'F'))
2315 return (uint8_t) ((hexa_digit
- 'A') + 10);
2316 /* Invalid hexa digit */
2321 parse_and_check_key_hexa_digit(char *key
, int idx
)
2325 hexa_v
= hexa_digit_to_value(key
[idx
]);
2327 printf("invalid key: character %c at position %d is not a "
2328 "valid hexa digit\n", key
[idx
], idx
);
2333 cmd_config_rss_hash_key_parsed(void *parsed_result
,
2334 __attribute__((unused
)) struct cmdline
*cl
,
2335 __attribute__((unused
)) void *data
)
2337 struct cmd_config_rss_hash_key
*res
= parsed_result
;
2338 uint8_t hash_key
[RSS_HASH_KEY_LENGTH
];
2342 struct rte_eth_dev_info dev_info
;
2343 uint8_t hash_key_size
;
2346 memset(&dev_info
, 0, sizeof(dev_info
));
2347 rte_eth_dev_info_get(res
->port_id
, &dev_info
);
2348 if (dev_info
.hash_key_size
> 0 &&
2349 dev_info
.hash_key_size
<= sizeof(hash_key
))
2350 hash_key_size
= dev_info
.hash_key_size
;
2352 printf("dev_info did not provide a valid hash key size\n");
2355 /* Check the length of the RSS hash key */
2356 key_len
= strlen(res
->key
);
2357 if (key_len
!= (hash_key_size
* 2)) {
2358 printf("key length: %d invalid - key must be a string of %d"
2359 " hexa-decimal numbers\n",
2360 (int) key_len
, hash_key_size
* 2);
2363 /* Translate RSS hash key into binary representation */
2364 for (i
= 0; i
< hash_key_size
; i
++) {
2365 xdgt0
= parse_and_check_key_hexa_digit(res
->key
, (i
* 2));
2368 xdgt1
= parse_and_check_key_hexa_digit(res
->key
, (i
* 2) + 1);
2371 hash_key
[i
] = (uint8_t) ((xdgt0
* 16) + xdgt1
);
2373 port_rss_hash_key_update(res
->port_id
, res
->rss_type
, hash_key
,
2377 cmdline_parse_token_string_t cmd_config_rss_hash_key_port
=
2378 TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_key
, port
, "port");
2379 cmdline_parse_token_string_t cmd_config_rss_hash_key_config
=
2380 TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_key
, config
,
2382 cmdline_parse_token_num_t cmd_config_rss_hash_key_port_id
=
2383 TOKEN_NUM_INITIALIZER(struct cmd_config_rss_hash_key
, port_id
, UINT16
);
2384 cmdline_parse_token_string_t cmd_config_rss_hash_key_rss_hash_key
=
2385 TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_key
,
2386 rss_hash_key
, "rss-hash-key");
2387 cmdline_parse_token_string_t cmd_config_rss_hash_key_rss_type
=
2388 TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_key
, rss_type
,
2389 "ipv4#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
2390 "ipv4-other#ipv6#ipv6-frag#ipv6-tcp#ipv6-udp#"
2391 "ipv6-sctp#ipv6-other#l2-payload#ipv6-ex#"
2392 "ipv6-tcp-ex#ipv6-udp-ex");
2393 cmdline_parse_token_string_t cmd_config_rss_hash_key_value
=
2394 TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_key
, key
, NULL
);
2396 cmdline_parse_inst_t cmd_config_rss_hash_key
= {
2397 .f
= cmd_config_rss_hash_key_parsed
,
2399 .help_str
= "port config <port_id> rss-hash-key "
2400 "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
2401 "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|"
2402 "l2-payload|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex "
2403 "<string of hex digits (variable length, NIC dependent)>",
2405 (void *)&cmd_config_rss_hash_key_port
,
2406 (void *)&cmd_config_rss_hash_key_config
,
2407 (void *)&cmd_config_rss_hash_key_port_id
,
2408 (void *)&cmd_config_rss_hash_key_rss_hash_key
,
2409 (void *)&cmd_config_rss_hash_key_rss_type
,
2410 (void *)&cmd_config_rss_hash_key_value
,
2415 /* *** configure port rxq/txq ring size *** */
2416 struct cmd_config_rxtx_ring_size
{
2417 cmdline_fixed_string_t port
;
2418 cmdline_fixed_string_t config
;
2420 cmdline_fixed_string_t rxtxq
;
2422 cmdline_fixed_string_t rsize
;
2427 cmd_config_rxtx_ring_size_parsed(void *parsed_result
,
2428 __attribute__((unused
)) struct cmdline
*cl
,
2429 __attribute__((unused
)) void *data
)
2431 struct cmd_config_rxtx_ring_size
*res
= parsed_result
;
2432 struct rte_port
*port
;
2435 if (port_id_is_invalid(res
->portid
, ENABLED_WARN
))
2438 if (res
->portid
== (portid_t
)RTE_PORT_ALL
) {
2439 printf("Invalid port id\n");
2443 port
= &ports
[res
->portid
];
2445 if (!strcmp(res
->rxtxq
, "rxq"))
2447 else if (!strcmp(res
->rxtxq
, "txq"))
2450 printf("Unknown parameter\n");
2454 if (isrx
&& rx_queue_id_is_invalid(res
->qid
))
2456 else if (!isrx
&& tx_queue_id_is_invalid(res
->qid
))
2459 if (isrx
&& res
->size
!= 0 && res
->size
<= rx_free_thresh
) {
2460 printf("Invalid rx ring_size, must > rx_free_thresh: %d\n",
2466 port
->nb_rx_desc
[res
->qid
] = res
->size
;
2468 port
->nb_tx_desc
[res
->qid
] = res
->size
;
2470 cmd_reconfig_device_queue(res
->portid
, 0, 1);
2473 cmdline_parse_token_string_t cmd_config_rxtx_ring_size_port
=
2474 TOKEN_STRING_INITIALIZER(struct cmd_config_rxtx_ring_size
,
2476 cmdline_parse_token_string_t cmd_config_rxtx_ring_size_config
=
2477 TOKEN_STRING_INITIALIZER(struct cmd_config_rxtx_ring_size
,
2479 cmdline_parse_token_num_t cmd_config_rxtx_ring_size_portid
=
2480 TOKEN_NUM_INITIALIZER(struct cmd_config_rxtx_ring_size
,
2482 cmdline_parse_token_string_t cmd_config_rxtx_ring_size_rxtxq
=
2483 TOKEN_STRING_INITIALIZER(struct cmd_config_rxtx_ring_size
,
2485 cmdline_parse_token_num_t cmd_config_rxtx_ring_size_qid
=
2486 TOKEN_NUM_INITIALIZER(struct cmd_config_rxtx_ring_size
,
2488 cmdline_parse_token_string_t cmd_config_rxtx_ring_size_rsize
=
2489 TOKEN_STRING_INITIALIZER(struct cmd_config_rxtx_ring_size
,
2490 rsize
, "ring_size");
2491 cmdline_parse_token_num_t cmd_config_rxtx_ring_size_size
=
2492 TOKEN_NUM_INITIALIZER(struct cmd_config_rxtx_ring_size
,
2495 cmdline_parse_inst_t cmd_config_rxtx_ring_size
= {
2496 .f
= cmd_config_rxtx_ring_size_parsed
,
2498 .help_str
= "port config <port_id> rxq|txq <queue_id> ring_size <value>",
2500 (void *)&cmd_config_rxtx_ring_size_port
,
2501 (void *)&cmd_config_rxtx_ring_size_config
,
2502 (void *)&cmd_config_rxtx_ring_size_portid
,
2503 (void *)&cmd_config_rxtx_ring_size_rxtxq
,
2504 (void *)&cmd_config_rxtx_ring_size_qid
,
2505 (void *)&cmd_config_rxtx_ring_size_rsize
,
2506 (void *)&cmd_config_rxtx_ring_size_size
,
2511 /* *** configure port rxq/txq start/stop *** */
2512 struct cmd_config_rxtx_queue
{
2513 cmdline_fixed_string_t port
;
2515 cmdline_fixed_string_t rxtxq
;
2517 cmdline_fixed_string_t opname
;
2521 cmd_config_rxtx_queue_parsed(void *parsed_result
,
2522 __attribute__((unused
)) struct cmdline
*cl
,
2523 __attribute__((unused
)) void *data
)
2525 struct cmd_config_rxtx_queue
*res
= parsed_result
;
2530 if (test_done
== 0) {
2531 printf("Please stop forwarding first\n");
2535 if (port_id_is_invalid(res
->portid
, ENABLED_WARN
))
2538 if (port_is_started(res
->portid
) != 1) {
2539 printf("Please start port %u first\n", res
->portid
);
2543 if (!strcmp(res
->rxtxq
, "rxq"))
2545 else if (!strcmp(res
->rxtxq
, "txq"))
2548 printf("Unknown parameter\n");
2552 if (isrx
&& rx_queue_id_is_invalid(res
->qid
))
2554 else if (!isrx
&& tx_queue_id_is_invalid(res
->qid
))
2557 if (!strcmp(res
->opname
, "start"))
2559 else if (!strcmp(res
->opname
, "stop"))
2562 printf("Unknown parameter\n");
2566 if (isstart
&& isrx
)
2567 ret
= rte_eth_dev_rx_queue_start(res
->portid
, res
->qid
);
2568 else if (!isstart
&& isrx
)
2569 ret
= rte_eth_dev_rx_queue_stop(res
->portid
, res
->qid
);
2570 else if (isstart
&& !isrx
)
2571 ret
= rte_eth_dev_tx_queue_start(res
->portid
, res
->qid
);
2573 ret
= rte_eth_dev_tx_queue_stop(res
->portid
, res
->qid
);
2575 if (ret
== -ENOTSUP
)
2576 printf("Function not supported in PMD driver\n");
2579 cmdline_parse_token_string_t cmd_config_rxtx_queue_port
=
2580 TOKEN_STRING_INITIALIZER(struct cmd_config_rxtx_queue
, port
, "port");
2581 cmdline_parse_token_num_t cmd_config_rxtx_queue_portid
=
2582 TOKEN_NUM_INITIALIZER(struct cmd_config_rxtx_queue
, portid
, UINT16
);
2583 cmdline_parse_token_string_t cmd_config_rxtx_queue_rxtxq
=
2584 TOKEN_STRING_INITIALIZER(struct cmd_config_rxtx_queue
, rxtxq
, "rxq#txq");
2585 cmdline_parse_token_num_t cmd_config_rxtx_queue_qid
=
2586 TOKEN_NUM_INITIALIZER(struct cmd_config_rxtx_queue
, qid
, UINT16
);
2587 cmdline_parse_token_string_t cmd_config_rxtx_queue_opname
=
2588 TOKEN_STRING_INITIALIZER(struct cmd_config_rxtx_queue
, opname
,
2591 cmdline_parse_inst_t cmd_config_rxtx_queue
= {
2592 .f
= cmd_config_rxtx_queue_parsed
,
2594 .help_str
= "port <port_id> rxq|txq <queue_id> start|stop",
2596 (void *)&cmd_config_rxtx_queue_port
,
2597 (void *)&cmd_config_rxtx_queue_portid
,
2598 (void *)&cmd_config_rxtx_queue_rxtxq
,
2599 (void *)&cmd_config_rxtx_queue_qid
,
2600 (void *)&cmd_config_rxtx_queue_opname
,
2605 /* *** configure port rxq/txq deferred start on/off *** */
2606 struct cmd_config_deferred_start_rxtx_queue
{
2607 cmdline_fixed_string_t port
;
2609 cmdline_fixed_string_t rxtxq
;
2611 cmdline_fixed_string_t opname
;
2612 cmdline_fixed_string_t state
;
2616 cmd_config_deferred_start_rxtx_queue_parsed(void *parsed_result
,
2617 __attribute__((unused
)) struct cmdline
*cl
,
2618 __attribute__((unused
)) void *data
)
2620 struct cmd_config_deferred_start_rxtx_queue
*res
= parsed_result
;
2621 struct rte_port
*port
;
2624 uint8_t needreconfig
= 0;
2626 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
2629 if (port_is_started(res
->port_id
) != 0) {
2630 printf("Please stop port %u first\n", res
->port_id
);
2634 port
= &ports
[res
->port_id
];
2636 isrx
= !strcmp(res
->rxtxq
, "rxq");
2638 if (isrx
&& rx_queue_id_is_invalid(res
->qid
))
2640 else if (!isrx
&& tx_queue_id_is_invalid(res
->qid
))
2643 ison
= !strcmp(res
->state
, "on");
2645 if (isrx
&& port
->rx_conf
[res
->qid
].rx_deferred_start
!= ison
) {
2646 port
->rx_conf
[res
->qid
].rx_deferred_start
= ison
;
2648 } else if (!isrx
&& port
->tx_conf
[res
->qid
].tx_deferred_start
!= ison
) {
2649 port
->tx_conf
[res
->qid
].tx_deferred_start
= ison
;
2654 cmd_reconfig_device_queue(res
->port_id
, 0, 1);
2657 cmdline_parse_token_string_t cmd_config_deferred_start_rxtx_queue_port
=
2658 TOKEN_STRING_INITIALIZER(struct cmd_config_deferred_start_rxtx_queue
,
2660 cmdline_parse_token_num_t cmd_config_deferred_start_rxtx_queue_port_id
=
2661 TOKEN_NUM_INITIALIZER(struct cmd_config_deferred_start_rxtx_queue
,
2663 cmdline_parse_token_string_t cmd_config_deferred_start_rxtx_queue_rxtxq
=
2664 TOKEN_STRING_INITIALIZER(struct cmd_config_deferred_start_rxtx_queue
,
2666 cmdline_parse_token_num_t cmd_config_deferred_start_rxtx_queue_qid
=
2667 TOKEN_NUM_INITIALIZER(struct cmd_config_deferred_start_rxtx_queue
,
2669 cmdline_parse_token_string_t cmd_config_deferred_start_rxtx_queue_opname
=
2670 TOKEN_STRING_INITIALIZER(struct cmd_config_deferred_start_rxtx_queue
,
2671 opname
, "deferred_start");
2672 cmdline_parse_token_string_t cmd_config_deferred_start_rxtx_queue_state
=
2673 TOKEN_STRING_INITIALIZER(struct cmd_config_deferred_start_rxtx_queue
,
2676 cmdline_parse_inst_t cmd_config_deferred_start_rxtx_queue
= {
2677 .f
= cmd_config_deferred_start_rxtx_queue_parsed
,
2679 .help_str
= "port <port_id> rxq|txq <queue_id> deferred_start on|off",
2681 (void *)&cmd_config_deferred_start_rxtx_queue_port
,
2682 (void *)&cmd_config_deferred_start_rxtx_queue_port_id
,
2683 (void *)&cmd_config_deferred_start_rxtx_queue_rxtxq
,
2684 (void *)&cmd_config_deferred_start_rxtx_queue_qid
,
2685 (void *)&cmd_config_deferred_start_rxtx_queue_opname
,
2686 (void *)&cmd_config_deferred_start_rxtx_queue_state
,
2691 /* *** configure port rxq/txq setup *** */
2692 struct cmd_setup_rxtx_queue
{
2693 cmdline_fixed_string_t port
;
2695 cmdline_fixed_string_t rxtxq
;
2697 cmdline_fixed_string_t setup
;
2700 /* Common CLI fields for queue setup */
2701 cmdline_parse_token_string_t cmd_setup_rxtx_queue_port
=
2702 TOKEN_STRING_INITIALIZER(struct cmd_setup_rxtx_queue
, port
, "port");
2703 cmdline_parse_token_num_t cmd_setup_rxtx_queue_portid
=
2704 TOKEN_NUM_INITIALIZER(struct cmd_setup_rxtx_queue
, portid
, UINT16
);
2705 cmdline_parse_token_string_t cmd_setup_rxtx_queue_rxtxq
=
2706 TOKEN_STRING_INITIALIZER(struct cmd_setup_rxtx_queue
, rxtxq
, "rxq#txq");
2707 cmdline_parse_token_num_t cmd_setup_rxtx_queue_qid
=
2708 TOKEN_NUM_INITIALIZER(struct cmd_setup_rxtx_queue
, qid
, UINT16
);
2709 cmdline_parse_token_string_t cmd_setup_rxtx_queue_setup
=
2710 TOKEN_STRING_INITIALIZER(struct cmd_setup_rxtx_queue
, setup
, "setup");
2713 cmd_setup_rxtx_queue_parsed(
2714 void *parsed_result
,
2715 __attribute__((unused
)) struct cmdline
*cl
,
2716 __attribute__((unused
)) void *data
)
2718 struct cmd_setup_rxtx_queue
*res
= parsed_result
;
2719 struct rte_port
*port
;
2720 struct rte_mempool
*mp
;
2721 unsigned int socket_id
;
2725 if (port_id_is_invalid(res
->portid
, ENABLED_WARN
))
2728 if (res
->portid
== (portid_t
)RTE_PORT_ALL
) {
2729 printf("Invalid port id\n");
2733 if (!strcmp(res
->rxtxq
, "rxq"))
2735 else if (!strcmp(res
->rxtxq
, "txq"))
2738 printf("Unknown parameter\n");
2742 if (isrx
&& rx_queue_id_is_invalid(res
->qid
)) {
2743 printf("Invalid rx queue\n");
2745 } else if (!isrx
&& tx_queue_id_is_invalid(res
->qid
)) {
2746 printf("Invalid tx queue\n");
2750 port
= &ports
[res
->portid
];
2752 socket_id
= rxring_numa
[res
->portid
];
2753 if (!numa_support
|| socket_id
== NUMA_NO_CONFIG
)
2754 socket_id
= port
->socket_id
;
2756 mp
= mbuf_pool_find(socket_id
);
2758 printf("Failed to setup RX queue: "
2759 "No mempool allocation"
2760 " on the socket %d\n",
2761 rxring_numa
[res
->portid
]);
2764 ret
= rte_eth_rx_queue_setup(res
->portid
,
2766 port
->nb_rx_desc
[res
->qid
],
2768 &port
->rx_conf
[res
->qid
],
2771 printf("Failed to setup RX queue\n");
2773 socket_id
= txring_numa
[res
->portid
];
2774 if (!numa_support
|| socket_id
== NUMA_NO_CONFIG
)
2775 socket_id
= port
->socket_id
;
2777 ret
= rte_eth_tx_queue_setup(res
->portid
,
2779 port
->nb_tx_desc
[res
->qid
],
2781 &port
->tx_conf
[res
->qid
]);
2783 printf("Failed to setup TX queue\n");
2787 cmdline_parse_inst_t cmd_setup_rxtx_queue
= {
2788 .f
= cmd_setup_rxtx_queue_parsed
,
2790 .help_str
= "port <port_id> rxq|txq <queue_idx> setup",
2792 (void *)&cmd_setup_rxtx_queue_port
,
2793 (void *)&cmd_setup_rxtx_queue_portid
,
2794 (void *)&cmd_setup_rxtx_queue_rxtxq
,
2795 (void *)&cmd_setup_rxtx_queue_qid
,
2796 (void *)&cmd_setup_rxtx_queue_setup
,
2802 /* *** Configure RSS RETA *** */
2803 struct cmd_config_rss_reta
{
2804 cmdline_fixed_string_t port
;
2805 cmdline_fixed_string_t keyword
;
2807 cmdline_fixed_string_t name
;
2808 cmdline_fixed_string_t list_name
;
2809 cmdline_fixed_string_t list_of_items
;
2813 parse_reta_config(const char *str
,
2814 struct rte_eth_rss_reta_entry64
*reta_conf
,
2815 uint16_t nb_entries
)
2819 uint16_t hash_index
, idx
, shift
;
2822 const char *p
, *p0
= str
;
2829 unsigned long int_fld
[_NUM_FLD
];
2830 char *str_fld
[_NUM_FLD
];
2832 while ((p
= strchr(p0
,'(')) != NULL
) {
2834 if((p0
= strchr(p
,')')) == NULL
)
2838 if(size
>= sizeof(s
))
2841 snprintf(s
, sizeof(s
), "%.*s", size
, p
);
2842 if (rte_strsplit(s
, sizeof(s
), str_fld
, _NUM_FLD
, ',') != _NUM_FLD
)
2844 for (i
= 0; i
< _NUM_FLD
; i
++) {
2846 int_fld
[i
] = strtoul(str_fld
[i
], &end
, 0);
2847 if (errno
!= 0 || end
== str_fld
[i
] ||
2852 hash_index
= (uint16_t)int_fld
[FLD_HASH_INDEX
];
2853 nb_queue
= (uint16_t)int_fld
[FLD_QUEUE
];
2855 if (hash_index
>= nb_entries
) {
2856 printf("Invalid RETA hash index=%d\n", hash_index
);
2860 idx
= hash_index
/ RTE_RETA_GROUP_SIZE
;
2861 shift
= hash_index
% RTE_RETA_GROUP_SIZE
;
2862 reta_conf
[idx
].mask
|= (1ULL << shift
);
2863 reta_conf
[idx
].reta
[shift
] = nb_queue
;
2870 cmd_set_rss_reta_parsed(void *parsed_result
,
2871 __attribute__((unused
)) struct cmdline
*cl
,
2872 __attribute__((unused
)) void *data
)
2875 struct rte_eth_dev_info dev_info
;
2876 struct rte_eth_rss_reta_entry64 reta_conf
[8];
2877 struct cmd_config_rss_reta
*res
= parsed_result
;
2879 memset(&dev_info
, 0, sizeof(dev_info
));
2880 rte_eth_dev_info_get(res
->port_id
, &dev_info
);
2881 if (dev_info
.reta_size
== 0) {
2882 printf("Redirection table size is 0 which is "
2883 "invalid for RSS\n");
2886 printf("The reta size of port %d is %u\n",
2887 res
->port_id
, dev_info
.reta_size
);
2888 if (dev_info
.reta_size
> ETH_RSS_RETA_SIZE_512
) {
2889 printf("Currently do not support more than %u entries of "
2890 "redirection table\n", ETH_RSS_RETA_SIZE_512
);
2894 memset(reta_conf
, 0, sizeof(reta_conf
));
2895 if (!strcmp(res
->list_name
, "reta")) {
2896 if (parse_reta_config(res
->list_of_items
, reta_conf
,
2897 dev_info
.reta_size
)) {
2898 printf("Invalid RSS Redirection Table "
2899 "config entered\n");
2902 ret
= rte_eth_dev_rss_reta_update(res
->port_id
,
2903 reta_conf
, dev_info
.reta_size
);
2905 printf("Bad redirection table parameter, "
2906 "return code = %d \n", ret
);
2910 cmdline_parse_token_string_t cmd_config_rss_reta_port
=
2911 TOKEN_STRING_INITIALIZER(struct cmd_config_rss_reta
, port
, "port");
2912 cmdline_parse_token_string_t cmd_config_rss_reta_keyword
=
2913 TOKEN_STRING_INITIALIZER(struct cmd_config_rss_reta
, keyword
, "config");
2914 cmdline_parse_token_num_t cmd_config_rss_reta_port_id
=
2915 TOKEN_NUM_INITIALIZER(struct cmd_config_rss_reta
, port_id
, UINT16
);
2916 cmdline_parse_token_string_t cmd_config_rss_reta_name
=
2917 TOKEN_STRING_INITIALIZER(struct cmd_config_rss_reta
, name
, "rss");
2918 cmdline_parse_token_string_t cmd_config_rss_reta_list_name
=
2919 TOKEN_STRING_INITIALIZER(struct cmd_config_rss_reta
, list_name
, "reta");
2920 cmdline_parse_token_string_t cmd_config_rss_reta_list_of_items
=
2921 TOKEN_STRING_INITIALIZER(struct cmd_config_rss_reta
, list_of_items
,
2923 cmdline_parse_inst_t cmd_config_rss_reta
= {
2924 .f
= cmd_set_rss_reta_parsed
,
2926 .help_str
= "port config <port_id> rss reta <hash,queue[,hash,queue]*>",
2928 (void *)&cmd_config_rss_reta_port
,
2929 (void *)&cmd_config_rss_reta_keyword
,
2930 (void *)&cmd_config_rss_reta_port_id
,
2931 (void *)&cmd_config_rss_reta_name
,
2932 (void *)&cmd_config_rss_reta_list_name
,
2933 (void *)&cmd_config_rss_reta_list_of_items
,
2938 /* *** SHOW PORT RETA INFO *** */
2939 struct cmd_showport_reta
{
2940 cmdline_fixed_string_t show
;
2941 cmdline_fixed_string_t port
;
2943 cmdline_fixed_string_t rss
;
2944 cmdline_fixed_string_t reta
;
2946 cmdline_fixed_string_t list_of_items
;
2950 showport_parse_reta_config(struct rte_eth_rss_reta_entry64
*conf
,
2951 uint16_t nb_entries
,
2955 const char *p
, *p0
= str
;
2960 uint16_t num
= (nb_entries
+ RTE_RETA_GROUP_SIZE
- 1) /
2961 RTE_RETA_GROUP_SIZE
;
2964 p
= strchr(p0
, '(');
2968 p0
= strchr(p
, ')');
2972 if (size
>= sizeof(s
)) {
2973 printf("The string size exceeds the internal buffer size\n");
2976 snprintf(s
, sizeof(s
), "%.*s", size
, p
);
2977 ret
= rte_strsplit(s
, sizeof(s
), str_fld
, num
, ',');
2978 if (ret
<= 0 || ret
!= num
) {
2979 printf("The bits of masks do not match the number of "
2980 "reta entries: %u\n", num
);
2983 for (i
= 0; i
< ret
; i
++)
2984 conf
[i
].mask
= (uint64_t)strtoul(str_fld
[i
], &end
, 0);
2990 cmd_showport_reta_parsed(void *parsed_result
,
2991 __attribute__((unused
)) struct cmdline
*cl
,
2992 __attribute__((unused
)) void *data
)
2994 struct cmd_showport_reta
*res
= parsed_result
;
2995 struct rte_eth_rss_reta_entry64 reta_conf
[8];
2996 struct rte_eth_dev_info dev_info
;
2997 uint16_t max_reta_size
;
2999 memset(&dev_info
, 0, sizeof(dev_info
));
3000 rte_eth_dev_info_get(res
->port_id
, &dev_info
);
3001 max_reta_size
= RTE_MIN(dev_info
.reta_size
, ETH_RSS_RETA_SIZE_512
);
3002 if (res
->size
== 0 || res
->size
> max_reta_size
) {
3003 printf("Invalid redirection table size: %u (1-%u)\n",
3004 res
->size
, max_reta_size
);
3008 memset(reta_conf
, 0, sizeof(reta_conf
));
3009 if (showport_parse_reta_config(reta_conf
, res
->size
,
3010 res
->list_of_items
) < 0) {
3011 printf("Invalid string: %s for reta masks\n",
3012 res
->list_of_items
);
3015 port_rss_reta_info(res
->port_id
, reta_conf
, res
->size
);
3018 cmdline_parse_token_string_t cmd_showport_reta_show
=
3019 TOKEN_STRING_INITIALIZER(struct cmd_showport_reta
, show
, "show");
3020 cmdline_parse_token_string_t cmd_showport_reta_port
=
3021 TOKEN_STRING_INITIALIZER(struct cmd_showport_reta
, port
, "port");
3022 cmdline_parse_token_num_t cmd_showport_reta_port_id
=
3023 TOKEN_NUM_INITIALIZER(struct cmd_showport_reta
, port_id
, UINT16
);
3024 cmdline_parse_token_string_t cmd_showport_reta_rss
=
3025 TOKEN_STRING_INITIALIZER(struct cmd_showport_reta
, rss
, "rss");
3026 cmdline_parse_token_string_t cmd_showport_reta_reta
=
3027 TOKEN_STRING_INITIALIZER(struct cmd_showport_reta
, reta
, "reta");
3028 cmdline_parse_token_num_t cmd_showport_reta_size
=
3029 TOKEN_NUM_INITIALIZER(struct cmd_showport_reta
, size
, UINT16
);
3030 cmdline_parse_token_string_t cmd_showport_reta_list_of_items
=
3031 TOKEN_STRING_INITIALIZER(struct cmd_showport_reta
,
3032 list_of_items
, NULL
);
3034 cmdline_parse_inst_t cmd_showport_reta
= {
3035 .f
= cmd_showport_reta_parsed
,
3037 .help_str
= "show port <port_id> rss reta <size> <mask0[,mask1]*>",
3039 (void *)&cmd_showport_reta_show
,
3040 (void *)&cmd_showport_reta_port
,
3041 (void *)&cmd_showport_reta_port_id
,
3042 (void *)&cmd_showport_reta_rss
,
3043 (void *)&cmd_showport_reta_reta
,
3044 (void *)&cmd_showport_reta_size
,
3045 (void *)&cmd_showport_reta_list_of_items
,
3050 /* *** Show RSS hash configuration *** */
3051 struct cmd_showport_rss_hash
{
3052 cmdline_fixed_string_t show
;
3053 cmdline_fixed_string_t port
;
3055 cmdline_fixed_string_t rss_hash
;
3056 cmdline_fixed_string_t rss_type
;
3057 cmdline_fixed_string_t key
; /* optional argument */
3060 static void cmd_showport_rss_hash_parsed(void *parsed_result
,
3061 __attribute__((unused
)) struct cmdline
*cl
,
3064 struct cmd_showport_rss_hash
*res
= parsed_result
;
3066 port_rss_hash_conf_show(res
->port_id
, show_rss_key
!= NULL
);
3069 cmdline_parse_token_string_t cmd_showport_rss_hash_show
=
3070 TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash
, show
, "show");
3071 cmdline_parse_token_string_t cmd_showport_rss_hash_port
=
3072 TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash
, port
, "port");
3073 cmdline_parse_token_num_t cmd_showport_rss_hash_port_id
=
3074 TOKEN_NUM_INITIALIZER(struct cmd_showport_rss_hash
, port_id
, UINT16
);
3075 cmdline_parse_token_string_t cmd_showport_rss_hash_rss_hash
=
3076 TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash
, rss_hash
,
3078 cmdline_parse_token_string_t cmd_showport_rss_hash_rss_key
=
3079 TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash
, key
, "key");
3081 cmdline_parse_inst_t cmd_showport_rss_hash
= {
3082 .f
= cmd_showport_rss_hash_parsed
,
3084 .help_str
= "show port <port_id> rss-hash",
3086 (void *)&cmd_showport_rss_hash_show
,
3087 (void *)&cmd_showport_rss_hash_port
,
3088 (void *)&cmd_showport_rss_hash_port_id
,
3089 (void *)&cmd_showport_rss_hash_rss_hash
,
3094 cmdline_parse_inst_t cmd_showport_rss_hash_key
= {
3095 .f
= cmd_showport_rss_hash_parsed
,
3097 .help_str
= "show port <port_id> rss-hash key",
3099 (void *)&cmd_showport_rss_hash_show
,
3100 (void *)&cmd_showport_rss_hash_port
,
3101 (void *)&cmd_showport_rss_hash_port_id
,
3102 (void *)&cmd_showport_rss_hash_rss_hash
,
3103 (void *)&cmd_showport_rss_hash_rss_key
,
3108 /* *** Configure DCB *** */
3109 struct cmd_config_dcb
{
3110 cmdline_fixed_string_t port
;
3111 cmdline_fixed_string_t config
;
3113 cmdline_fixed_string_t dcb
;
3114 cmdline_fixed_string_t vt
;
3115 cmdline_fixed_string_t vt_en
;
3117 cmdline_fixed_string_t pfc
;
3118 cmdline_fixed_string_t pfc_en
;
3122 cmd_config_dcb_parsed(void *parsed_result
,
3123 __attribute__((unused
)) struct cmdline
*cl
,
3124 __attribute__((unused
)) void *data
)
3126 struct cmd_config_dcb
*res
= parsed_result
;
3127 portid_t port_id
= res
->port_id
;
3128 struct rte_port
*port
;
3132 port
= &ports
[port_id
];
3133 /** Check if the port is not started **/
3134 if (port
->port_status
!= RTE_PORT_STOPPED
) {
3135 printf("Please stop port %d first\n", port_id
);
3139 if ((res
->num_tcs
!= ETH_4_TCS
) && (res
->num_tcs
!= ETH_8_TCS
)) {
3140 printf("The invalid number of traffic class,"
3141 " only 4 or 8 allowed.\n");
3145 if (nb_fwd_lcores
< res
->num_tcs
) {
3146 printf("nb_cores shouldn't be less than number of TCs.\n");
3149 if (!strncmp(res
->pfc_en
, "on", 2))
3154 /* DCB in VT mode */
3155 if (!strncmp(res
->vt_en
, "on", 2))
3156 ret
= init_port_dcb_config(port_id
, DCB_VT_ENABLED
,
3157 (enum rte_eth_nb_tcs
)res
->num_tcs
,
3160 ret
= init_port_dcb_config(port_id
, DCB_ENABLED
,
3161 (enum rte_eth_nb_tcs
)res
->num_tcs
,
3166 printf("Cannot initialize network ports.\n");
3170 cmd_reconfig_device_queue(port_id
, 1, 1);
3173 cmdline_parse_token_string_t cmd_config_dcb_port
=
3174 TOKEN_STRING_INITIALIZER(struct cmd_config_dcb
, port
, "port");
3175 cmdline_parse_token_string_t cmd_config_dcb_config
=
3176 TOKEN_STRING_INITIALIZER(struct cmd_config_dcb
, config
, "config");
3177 cmdline_parse_token_num_t cmd_config_dcb_port_id
=
3178 TOKEN_NUM_INITIALIZER(struct cmd_config_dcb
, port_id
, UINT16
);
3179 cmdline_parse_token_string_t cmd_config_dcb_dcb
=
3180 TOKEN_STRING_INITIALIZER(struct cmd_config_dcb
, dcb
, "dcb");
3181 cmdline_parse_token_string_t cmd_config_dcb_vt
=
3182 TOKEN_STRING_INITIALIZER(struct cmd_config_dcb
, vt
, "vt");
3183 cmdline_parse_token_string_t cmd_config_dcb_vt_en
=
3184 TOKEN_STRING_INITIALIZER(struct cmd_config_dcb
, vt_en
, "on#off");
3185 cmdline_parse_token_num_t cmd_config_dcb_num_tcs
=
3186 TOKEN_NUM_INITIALIZER(struct cmd_config_dcb
, num_tcs
, UINT8
);
3187 cmdline_parse_token_string_t cmd_config_dcb_pfc
=
3188 TOKEN_STRING_INITIALIZER(struct cmd_config_dcb
, pfc
, "pfc");
3189 cmdline_parse_token_string_t cmd_config_dcb_pfc_en
=
3190 TOKEN_STRING_INITIALIZER(struct cmd_config_dcb
, pfc_en
, "on#off");
3192 cmdline_parse_inst_t cmd_config_dcb
= {
3193 .f
= cmd_config_dcb_parsed
,
3195 .help_str
= "port config <port-id> dcb vt on|off <num_tcs> pfc on|off",
3197 (void *)&cmd_config_dcb_port
,
3198 (void *)&cmd_config_dcb_config
,
3199 (void *)&cmd_config_dcb_port_id
,
3200 (void *)&cmd_config_dcb_dcb
,
3201 (void *)&cmd_config_dcb_vt
,
3202 (void *)&cmd_config_dcb_vt_en
,
3203 (void *)&cmd_config_dcb_num_tcs
,
3204 (void *)&cmd_config_dcb_pfc
,
3205 (void *)&cmd_config_dcb_pfc_en
,
3210 /* *** configure number of packets per burst *** */
3211 struct cmd_config_burst
{
3212 cmdline_fixed_string_t port
;
3213 cmdline_fixed_string_t keyword
;
3214 cmdline_fixed_string_t all
;
3215 cmdline_fixed_string_t name
;
3220 cmd_config_burst_parsed(void *parsed_result
,
3221 __attribute__((unused
)) struct cmdline
*cl
,
3222 __attribute__((unused
)) void *data
)
3224 struct cmd_config_burst
*res
= parsed_result
;
3225 struct rte_eth_dev_info dev_info
;
3226 uint16_t rec_nb_pkts
;
3228 if (!all_ports_stopped()) {
3229 printf("Please stop all ports first\n");
3233 if (!strcmp(res
->name
, "burst")) {
3234 if (res
->value
== 0) {
3235 /* If user gives a value of zero, query the PMD for
3236 * its recommended Rx burst size. Testpmd uses a single
3237 * size for all ports, so assume all ports are the same
3238 * NIC model and use the values from Port 0.
3240 rte_eth_dev_info_get(0, &dev_info
);
3241 rec_nb_pkts
= dev_info
.default_rxportconf
.burst_size
;
3243 if (rec_nb_pkts
== 0) {
3244 printf("PMD does not recommend a burst size.\n"
3245 "User provided value must be between"
3246 " 1 and %d\n", MAX_PKT_BURST
);
3248 } else if (rec_nb_pkts
> MAX_PKT_BURST
) {
3249 printf("PMD recommended burst size of %d"
3250 " exceeds maximum value of %d\n",
3251 rec_nb_pkts
, MAX_PKT_BURST
);
3254 printf("Using PMD-provided burst value of %d\n",
3256 nb_pkt_per_burst
= rec_nb_pkts
;
3257 } else if (res
->value
> MAX_PKT_BURST
) {
3258 printf("burst must be >= 1 && <= %d\n", MAX_PKT_BURST
);
3261 nb_pkt_per_burst
= res
->value
;
3263 printf("Unknown parameter\n");
3269 cmd_reconfig_device_queue(RTE_PORT_ALL
, 1, 1);
3272 cmdline_parse_token_string_t cmd_config_burst_port
=
3273 TOKEN_STRING_INITIALIZER(struct cmd_config_burst
, port
, "port");
3274 cmdline_parse_token_string_t cmd_config_burst_keyword
=
3275 TOKEN_STRING_INITIALIZER(struct cmd_config_burst
, keyword
, "config");
3276 cmdline_parse_token_string_t cmd_config_burst_all
=
3277 TOKEN_STRING_INITIALIZER(struct cmd_config_burst
, all
, "all");
3278 cmdline_parse_token_string_t cmd_config_burst_name
=
3279 TOKEN_STRING_INITIALIZER(struct cmd_config_burst
, name
, "burst");
3280 cmdline_parse_token_num_t cmd_config_burst_value
=
3281 TOKEN_NUM_INITIALIZER(struct cmd_config_burst
, value
, UINT16
);
3283 cmdline_parse_inst_t cmd_config_burst
= {
3284 .f
= cmd_config_burst_parsed
,
3286 .help_str
= "port config all burst <value>",
3288 (void *)&cmd_config_burst_port
,
3289 (void *)&cmd_config_burst_keyword
,
3290 (void *)&cmd_config_burst_all
,
3291 (void *)&cmd_config_burst_name
,
3292 (void *)&cmd_config_burst_value
,
3297 /* *** configure rx/tx queues *** */
3298 struct cmd_config_thresh
{
3299 cmdline_fixed_string_t port
;
3300 cmdline_fixed_string_t keyword
;
3301 cmdline_fixed_string_t all
;
3302 cmdline_fixed_string_t name
;
3307 cmd_config_thresh_parsed(void *parsed_result
,
3308 __attribute__((unused
)) struct cmdline
*cl
,
3309 __attribute__((unused
)) void *data
)
3311 struct cmd_config_thresh
*res
= parsed_result
;
3313 if (!all_ports_stopped()) {
3314 printf("Please stop all ports first\n");
3318 if (!strcmp(res
->name
, "txpt"))
3319 tx_pthresh
= res
->value
;
3320 else if(!strcmp(res
->name
, "txht"))
3321 tx_hthresh
= res
->value
;
3322 else if(!strcmp(res
->name
, "txwt"))
3323 tx_wthresh
= res
->value
;
3324 else if(!strcmp(res
->name
, "rxpt"))
3325 rx_pthresh
= res
->value
;
3326 else if(!strcmp(res
->name
, "rxht"))
3327 rx_hthresh
= res
->value
;
3328 else if(!strcmp(res
->name
, "rxwt"))
3329 rx_wthresh
= res
->value
;
3331 printf("Unknown parameter\n");
3337 cmd_reconfig_device_queue(RTE_PORT_ALL
, 1, 1);
3340 cmdline_parse_token_string_t cmd_config_thresh_port
=
3341 TOKEN_STRING_INITIALIZER(struct cmd_config_thresh
, port
, "port");
3342 cmdline_parse_token_string_t cmd_config_thresh_keyword
=
3343 TOKEN_STRING_INITIALIZER(struct cmd_config_thresh
, keyword
, "config");
3344 cmdline_parse_token_string_t cmd_config_thresh_all
=
3345 TOKEN_STRING_INITIALIZER(struct cmd_config_thresh
, all
, "all");
3346 cmdline_parse_token_string_t cmd_config_thresh_name
=
3347 TOKEN_STRING_INITIALIZER(struct cmd_config_thresh
, name
,
3348 "txpt#txht#txwt#rxpt#rxht#rxwt");
3349 cmdline_parse_token_num_t cmd_config_thresh_value
=
3350 TOKEN_NUM_INITIALIZER(struct cmd_config_thresh
, value
, UINT8
);
3352 cmdline_parse_inst_t cmd_config_thresh
= {
3353 .f
= cmd_config_thresh_parsed
,
3355 .help_str
= "port config all txpt|txht|txwt|rxpt|rxht|rxwt <value>",
3357 (void *)&cmd_config_thresh_port
,
3358 (void *)&cmd_config_thresh_keyword
,
3359 (void *)&cmd_config_thresh_all
,
3360 (void *)&cmd_config_thresh_name
,
3361 (void *)&cmd_config_thresh_value
,
3366 /* *** configure free/rs threshold *** */
3367 struct cmd_config_threshold
{
3368 cmdline_fixed_string_t port
;
3369 cmdline_fixed_string_t keyword
;
3370 cmdline_fixed_string_t all
;
3371 cmdline_fixed_string_t name
;
3376 cmd_config_threshold_parsed(void *parsed_result
,
3377 __attribute__((unused
)) struct cmdline
*cl
,
3378 __attribute__((unused
)) void *data
)
3380 struct cmd_config_threshold
*res
= parsed_result
;
3382 if (!all_ports_stopped()) {
3383 printf("Please stop all ports first\n");
3387 if (!strcmp(res
->name
, "txfreet"))
3388 tx_free_thresh
= res
->value
;
3389 else if (!strcmp(res
->name
, "txrst"))
3390 tx_rs_thresh
= res
->value
;
3391 else if (!strcmp(res
->name
, "rxfreet"))
3392 rx_free_thresh
= res
->value
;
3394 printf("Unknown parameter\n");
3400 cmd_reconfig_device_queue(RTE_PORT_ALL
, 1, 1);
3403 cmdline_parse_token_string_t cmd_config_threshold_port
=
3404 TOKEN_STRING_INITIALIZER(struct cmd_config_threshold
, port
, "port");
3405 cmdline_parse_token_string_t cmd_config_threshold_keyword
=
3406 TOKEN_STRING_INITIALIZER(struct cmd_config_threshold
, keyword
,
3408 cmdline_parse_token_string_t cmd_config_threshold_all
=
3409 TOKEN_STRING_INITIALIZER(struct cmd_config_threshold
, all
, "all");
3410 cmdline_parse_token_string_t cmd_config_threshold_name
=
3411 TOKEN_STRING_INITIALIZER(struct cmd_config_threshold
, name
,
3412 "txfreet#txrst#rxfreet");
3413 cmdline_parse_token_num_t cmd_config_threshold_value
=
3414 TOKEN_NUM_INITIALIZER(struct cmd_config_threshold
, value
, UINT16
);
3416 cmdline_parse_inst_t cmd_config_threshold
= {
3417 .f
= cmd_config_threshold_parsed
,
3419 .help_str
= "port config all txfreet|txrst|rxfreet <value>",
3421 (void *)&cmd_config_threshold_port
,
3422 (void *)&cmd_config_threshold_keyword
,
3423 (void *)&cmd_config_threshold_all
,
3424 (void *)&cmd_config_threshold_name
,
3425 (void *)&cmd_config_threshold_value
,
3431 struct cmd_stop_result
{
3432 cmdline_fixed_string_t stop
;
3435 static void cmd_stop_parsed(__attribute__((unused
)) void *parsed_result
,
3436 __attribute__((unused
)) struct cmdline
*cl
,
3437 __attribute__((unused
)) void *data
)
3439 stop_packet_forwarding();
3442 cmdline_parse_token_string_t cmd_stop_stop
=
3443 TOKEN_STRING_INITIALIZER(struct cmd_stop_result
, stop
, "stop");
3445 cmdline_parse_inst_t cmd_stop
= {
3446 .f
= cmd_stop_parsed
,
3448 .help_str
= "stop: Stop packet forwarding",
3450 (void *)&cmd_stop_stop
,
3455 /* *** SET CORELIST and PORTLIST CONFIGURATION *** */
3458 parse_item_list(char* str
, const char* item_name
, unsigned int max_items
,
3459 unsigned int *parsed_items
, int check_unique_values
)
3461 unsigned int nb_item
;
3469 * First parse all items in the list and store their value.
3474 for (i
= 0; i
< strnlen(str
, STR_TOKEN_SIZE
); i
++) {
3476 if ((c
>= '0') && (c
<= '9')) {
3477 value
= (unsigned int) (value
* 10 + (c
- '0'));
3482 printf("character %c is not a decimal digit\n", c
);
3486 printf("No valid value before comma\n");
3489 if (nb_item
< max_items
) {
3490 parsed_items
[nb_item
] = value
;
3496 if (nb_item
>= max_items
) {
3497 printf("Number of %s = %u > %u (maximum items)\n",
3498 item_name
, nb_item
+ 1, max_items
);
3501 parsed_items
[nb_item
++] = value
;
3502 if (! check_unique_values
)
3506 * Then, check that all values in the list are differents.
3507 * No optimization here...
3509 for (i
= 0; i
< nb_item
; i
++) {
3510 for (j
= i
+ 1; j
< nb_item
; j
++) {
3511 if (parsed_items
[j
] == parsed_items
[i
]) {
3512 printf("duplicated %s %u at index %u and %u\n",
3513 item_name
, parsed_items
[i
], i
, j
);
3521 struct cmd_set_list_result
{
3522 cmdline_fixed_string_t cmd_keyword
;
3523 cmdline_fixed_string_t list_name
;
3524 cmdline_fixed_string_t list_of_items
;
3527 static void cmd_set_list_parsed(void *parsed_result
,
3528 __attribute__((unused
)) struct cmdline
*cl
,
3529 __attribute__((unused
)) void *data
)
3531 struct cmd_set_list_result
*res
;
3533 unsigned int lcorelist
[RTE_MAX_LCORE
];
3534 unsigned int portlist
[RTE_MAX_ETHPORTS
];
3536 unsigned int nb_item
;
3538 if (test_done
== 0) {
3539 printf("Please stop forwarding first\n");
3543 res
= parsed_result
;
3544 if (!strcmp(res
->list_name
, "corelist")) {
3545 nb_item
= parse_item_list(res
->list_of_items
, "core",
3547 parsed_items
.lcorelist
, 1);
3549 set_fwd_lcores_list(parsed_items
.lcorelist
, nb_item
);
3554 if (!strcmp(res
->list_name
, "portlist")) {
3555 nb_item
= parse_item_list(res
->list_of_items
, "port",
3557 parsed_items
.portlist
, 1);
3559 set_fwd_ports_list(parsed_items
.portlist
, nb_item
);
3565 cmdline_parse_token_string_t cmd_set_list_keyword
=
3566 TOKEN_STRING_INITIALIZER(struct cmd_set_list_result
, cmd_keyword
,
3568 cmdline_parse_token_string_t cmd_set_list_name
=
3569 TOKEN_STRING_INITIALIZER(struct cmd_set_list_result
, list_name
,
3570 "corelist#portlist");
3571 cmdline_parse_token_string_t cmd_set_list_of_items
=
3572 TOKEN_STRING_INITIALIZER(struct cmd_set_list_result
, list_of_items
,
3575 cmdline_parse_inst_t cmd_set_fwd_list
= {
3576 .f
= cmd_set_list_parsed
,
3578 .help_str
= "set corelist|portlist <list0[,list1]*>",
3580 (void *)&cmd_set_list_keyword
,
3581 (void *)&cmd_set_list_name
,
3582 (void *)&cmd_set_list_of_items
,
3587 /* *** SET COREMASK and PORTMASK CONFIGURATION *** */
3589 struct cmd_setmask_result
{
3590 cmdline_fixed_string_t set
;
3591 cmdline_fixed_string_t mask
;
3595 static void cmd_set_mask_parsed(void *parsed_result
,
3596 __attribute__((unused
)) struct cmdline
*cl
,
3597 __attribute__((unused
)) void *data
)
3599 struct cmd_setmask_result
*res
= parsed_result
;
3601 if (test_done
== 0) {
3602 printf("Please stop forwarding first\n");
3605 if (!strcmp(res
->mask
, "coremask")) {
3606 set_fwd_lcores_mask(res
->hexavalue
);
3608 } else if (!strcmp(res
->mask
, "portmask")) {
3609 set_fwd_ports_mask(res
->hexavalue
);
3614 cmdline_parse_token_string_t cmd_setmask_set
=
3615 TOKEN_STRING_INITIALIZER(struct cmd_setmask_result
, set
, "set");
3616 cmdline_parse_token_string_t cmd_setmask_mask
=
3617 TOKEN_STRING_INITIALIZER(struct cmd_setmask_result
, mask
,
3618 "coremask#portmask");
3619 cmdline_parse_token_num_t cmd_setmask_value
=
3620 TOKEN_NUM_INITIALIZER(struct cmd_setmask_result
, hexavalue
, UINT64
);
3622 cmdline_parse_inst_t cmd_set_fwd_mask
= {
3623 .f
= cmd_set_mask_parsed
,
3625 .help_str
= "set coremask|portmask <hexadecimal value>",
3627 (void *)&cmd_setmask_set
,
3628 (void *)&cmd_setmask_mask
,
3629 (void *)&cmd_setmask_value
,
3635 * SET NBPORT, NBCORE, PACKET BURST, and VERBOSE LEVEL CONFIGURATION
3637 struct cmd_set_result
{
3638 cmdline_fixed_string_t set
;
3639 cmdline_fixed_string_t what
;
3643 static void cmd_set_parsed(void *parsed_result
,
3644 __attribute__((unused
)) struct cmdline
*cl
,
3645 __attribute__((unused
)) void *data
)
3647 struct cmd_set_result
*res
= parsed_result
;
3648 if (!strcmp(res
->what
, "nbport")) {
3649 set_fwd_ports_number(res
->value
);
3651 } else if (!strcmp(res
->what
, "nbcore")) {
3652 set_fwd_lcores_number(res
->value
);
3654 } else if (!strcmp(res
->what
, "burst"))
3655 set_nb_pkt_per_burst(res
->value
);
3656 else if (!strcmp(res
->what
, "verbose"))
3657 set_verbose_level(res
->value
);
3660 cmdline_parse_token_string_t cmd_set_set
=
3661 TOKEN_STRING_INITIALIZER(struct cmd_set_result
, set
, "set");
3662 cmdline_parse_token_string_t cmd_set_what
=
3663 TOKEN_STRING_INITIALIZER(struct cmd_set_result
, what
,
3664 "nbport#nbcore#burst#verbose");
3665 cmdline_parse_token_num_t cmd_set_value
=
3666 TOKEN_NUM_INITIALIZER(struct cmd_set_result
, value
, UINT16
);
3668 cmdline_parse_inst_t cmd_set_numbers
= {
3669 .f
= cmd_set_parsed
,
3671 .help_str
= "set nbport|nbcore|burst|verbose <value>",
3673 (void *)&cmd_set_set
,
3674 (void *)&cmd_set_what
,
3675 (void *)&cmd_set_value
,
3680 /* *** SET LOG LEVEL CONFIGURATION *** */
3682 struct cmd_set_log_result
{
3683 cmdline_fixed_string_t set
;
3684 cmdline_fixed_string_t log
;
3685 cmdline_fixed_string_t type
;
3690 cmd_set_log_parsed(void *parsed_result
,
3691 __attribute__((unused
)) struct cmdline
*cl
,
3692 __attribute__((unused
)) void *data
)
3694 struct cmd_set_log_result
*res
;
3697 res
= parsed_result
;
3698 if (!strcmp(res
->type
, "global"))
3699 rte_log_set_global_level(res
->level
);
3701 ret
= rte_log_set_level_regexp(res
->type
, res
->level
);
3703 printf("Unable to set log level\n");
3707 cmdline_parse_token_string_t cmd_set_log_set
=
3708 TOKEN_STRING_INITIALIZER(struct cmd_set_log_result
, set
, "set");
3709 cmdline_parse_token_string_t cmd_set_log_log
=
3710 TOKEN_STRING_INITIALIZER(struct cmd_set_log_result
, log
, "log");
3711 cmdline_parse_token_string_t cmd_set_log_type
=
3712 TOKEN_STRING_INITIALIZER(struct cmd_set_log_result
, type
, NULL
);
3713 cmdline_parse_token_num_t cmd_set_log_level
=
3714 TOKEN_NUM_INITIALIZER(struct cmd_set_log_result
, level
, UINT32
);
3716 cmdline_parse_inst_t cmd_set_log
= {
3717 .f
= cmd_set_log_parsed
,
3719 .help_str
= "set log global|<type> <level>",
3721 (void *)&cmd_set_log_set
,
3722 (void *)&cmd_set_log_log
,
3723 (void *)&cmd_set_log_type
,
3724 (void *)&cmd_set_log_level
,
3729 /* *** SET SEGMENT LENGTHS OF TXONLY PACKETS *** */
3731 struct cmd_set_txpkts_result
{
3732 cmdline_fixed_string_t cmd_keyword
;
3733 cmdline_fixed_string_t txpkts
;
3734 cmdline_fixed_string_t seg_lengths
;
3738 cmd_set_txpkts_parsed(void *parsed_result
,
3739 __attribute__((unused
)) struct cmdline
*cl
,
3740 __attribute__((unused
)) void *data
)
3742 struct cmd_set_txpkts_result
*res
;
3743 unsigned seg_lengths
[RTE_MAX_SEGS_PER_PKT
];
3744 unsigned int nb_segs
;
3746 res
= parsed_result
;
3747 nb_segs
= parse_item_list(res
->seg_lengths
, "segment lengths",
3748 RTE_MAX_SEGS_PER_PKT
, seg_lengths
, 0);
3750 set_tx_pkt_segments(seg_lengths
, nb_segs
);
3753 cmdline_parse_token_string_t cmd_set_txpkts_keyword
=
3754 TOKEN_STRING_INITIALIZER(struct cmd_set_txpkts_result
,
3755 cmd_keyword
, "set");
3756 cmdline_parse_token_string_t cmd_set_txpkts_name
=
3757 TOKEN_STRING_INITIALIZER(struct cmd_set_txpkts_result
,
3759 cmdline_parse_token_string_t cmd_set_txpkts_lengths
=
3760 TOKEN_STRING_INITIALIZER(struct cmd_set_txpkts_result
,
3763 cmdline_parse_inst_t cmd_set_txpkts
= {
3764 .f
= cmd_set_txpkts_parsed
,
3766 .help_str
= "set txpkts <len0[,len1]*>",
3768 (void *)&cmd_set_txpkts_keyword
,
3769 (void *)&cmd_set_txpkts_name
,
3770 (void *)&cmd_set_txpkts_lengths
,
3775 /* *** SET COPY AND SPLIT POLICY ON TX PACKETS *** */
3777 struct cmd_set_txsplit_result
{
3778 cmdline_fixed_string_t cmd_keyword
;
3779 cmdline_fixed_string_t txsplit
;
3780 cmdline_fixed_string_t mode
;
3784 cmd_set_txsplit_parsed(void *parsed_result
,
3785 __attribute__((unused
)) struct cmdline
*cl
,
3786 __attribute__((unused
)) void *data
)
3788 struct cmd_set_txsplit_result
*res
;
3790 res
= parsed_result
;
3791 set_tx_pkt_split(res
->mode
);
3794 cmdline_parse_token_string_t cmd_set_txsplit_keyword
=
3795 TOKEN_STRING_INITIALIZER(struct cmd_set_txsplit_result
,
3796 cmd_keyword
, "set");
3797 cmdline_parse_token_string_t cmd_set_txsplit_name
=
3798 TOKEN_STRING_INITIALIZER(struct cmd_set_txsplit_result
,
3799 txsplit
, "txsplit");
3800 cmdline_parse_token_string_t cmd_set_txsplit_mode
=
3801 TOKEN_STRING_INITIALIZER(struct cmd_set_txsplit_result
,
3804 cmdline_parse_inst_t cmd_set_txsplit
= {
3805 .f
= cmd_set_txsplit_parsed
,
3807 .help_str
= "set txsplit on|off|rand",
3809 (void *)&cmd_set_txsplit_keyword
,
3810 (void *)&cmd_set_txsplit_name
,
3811 (void *)&cmd_set_txsplit_mode
,
3816 /* *** ADD/REMOVE ALL VLAN IDENTIFIERS TO/FROM A PORT VLAN RX FILTER *** */
3817 struct cmd_rx_vlan_filter_all_result
{
3818 cmdline_fixed_string_t rx_vlan
;
3819 cmdline_fixed_string_t what
;
3820 cmdline_fixed_string_t all
;
3825 cmd_rx_vlan_filter_all_parsed(void *parsed_result
,
3826 __attribute__((unused
)) struct cmdline
*cl
,
3827 __attribute__((unused
)) void *data
)
3829 struct cmd_rx_vlan_filter_all_result
*res
= parsed_result
;
3831 if (!strcmp(res
->what
, "add"))
3832 rx_vlan_all_filter_set(res
->port_id
, 1);
3834 rx_vlan_all_filter_set(res
->port_id
, 0);
3837 cmdline_parse_token_string_t cmd_rx_vlan_filter_all_rx_vlan
=
3838 TOKEN_STRING_INITIALIZER(struct cmd_rx_vlan_filter_all_result
,
3839 rx_vlan
, "rx_vlan");
3840 cmdline_parse_token_string_t cmd_rx_vlan_filter_all_what
=
3841 TOKEN_STRING_INITIALIZER(struct cmd_rx_vlan_filter_all_result
,
3843 cmdline_parse_token_string_t cmd_rx_vlan_filter_all_all
=
3844 TOKEN_STRING_INITIALIZER(struct cmd_rx_vlan_filter_all_result
,
3846 cmdline_parse_token_num_t cmd_rx_vlan_filter_all_portid
=
3847 TOKEN_NUM_INITIALIZER(struct cmd_rx_vlan_filter_all_result
,
3850 cmdline_parse_inst_t cmd_rx_vlan_filter_all
= {
3851 .f
= cmd_rx_vlan_filter_all_parsed
,
3853 .help_str
= "rx_vlan add|rm all <port_id>: "
3854 "Add/Remove all identifiers to/from the set of VLAN "
3855 "identifiers filtered by a port",
3857 (void *)&cmd_rx_vlan_filter_all_rx_vlan
,
3858 (void *)&cmd_rx_vlan_filter_all_what
,
3859 (void *)&cmd_rx_vlan_filter_all_all
,
3860 (void *)&cmd_rx_vlan_filter_all_portid
,
3865 /* *** VLAN OFFLOAD SET ON A PORT *** */
3866 struct cmd_vlan_offload_result
{
3867 cmdline_fixed_string_t vlan
;
3868 cmdline_fixed_string_t set
;
3869 cmdline_fixed_string_t vlan_type
;
3870 cmdline_fixed_string_t what
;
3871 cmdline_fixed_string_t on
;
3872 cmdline_fixed_string_t port_id
;
3876 cmd_vlan_offload_parsed(void *parsed_result
,
3877 __attribute__((unused
)) struct cmdline
*cl
,
3878 __attribute__((unused
)) void *data
)
3881 struct cmd_vlan_offload_result
*res
= parsed_result
;
3884 portid_t port_id
= 0;
3888 len
= strnlen(str
, STR_TOKEN_SIZE
);
3890 /* Get port_id first */
3898 tmp
= strtoul(str
, NULL
, 0);
3899 /* If port_id greater that what portid_t can represent, return */
3900 if(tmp
>= RTE_MAX_ETHPORTS
)
3902 port_id
= (portid_t
)tmp
;
3904 if (!strcmp(res
->on
, "on"))
3909 if (!strcmp(res
->what
, "strip"))
3910 rx_vlan_strip_set(port_id
, on
);
3911 else if(!strcmp(res
->what
, "stripq")){
3912 uint16_t queue_id
= 0;
3914 /* No queue_id, return */
3916 printf("must specify (port,queue_id)\n");
3919 tmp
= strtoul(str
+ i
+ 1, NULL
, 0);
3920 /* If queue_id greater that what 16-bits can represent, return */
3924 queue_id
= (uint16_t)tmp
;
3925 rx_vlan_strip_set_on_queue(port_id
, queue_id
, on
);
3927 else if (!strcmp(res
->what
, "filter"))
3928 rx_vlan_filter_set(port_id
, on
);
3930 vlan_extend_set(port_id
, on
);
3935 cmdline_parse_token_string_t cmd_vlan_offload_vlan
=
3936 TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result
,
3938 cmdline_parse_token_string_t cmd_vlan_offload_set
=
3939 TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result
,
3941 cmdline_parse_token_string_t cmd_vlan_offload_what
=
3942 TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result
,
3943 what
, "strip#filter#qinq#stripq");
3944 cmdline_parse_token_string_t cmd_vlan_offload_on
=
3945 TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result
,
3947 cmdline_parse_token_string_t cmd_vlan_offload_portid
=
3948 TOKEN_STRING_INITIALIZER(struct cmd_vlan_offload_result
,
3951 cmdline_parse_inst_t cmd_vlan_offload
= {
3952 .f
= cmd_vlan_offload_parsed
,
3954 .help_str
= "vlan set strip|filter|qinq|stripq on|off "
3955 "<port_id[,queue_id]>: "
3956 "Filter/Strip for rx side qinq(extended) for both rx/tx sides",
3958 (void *)&cmd_vlan_offload_vlan
,
3959 (void *)&cmd_vlan_offload_set
,
3960 (void *)&cmd_vlan_offload_what
,
3961 (void *)&cmd_vlan_offload_on
,
3962 (void *)&cmd_vlan_offload_portid
,
3967 /* *** VLAN TPID SET ON A PORT *** */
3968 struct cmd_vlan_tpid_result
{
3969 cmdline_fixed_string_t vlan
;
3970 cmdline_fixed_string_t set
;
3971 cmdline_fixed_string_t vlan_type
;
3972 cmdline_fixed_string_t what
;
3978 cmd_vlan_tpid_parsed(void *parsed_result
,
3979 __attribute__((unused
)) struct cmdline
*cl
,
3980 __attribute__((unused
)) void *data
)
3982 struct cmd_vlan_tpid_result
*res
= parsed_result
;
3983 enum rte_vlan_type vlan_type
;
3985 if (!strcmp(res
->vlan_type
, "inner"))
3986 vlan_type
= ETH_VLAN_TYPE_INNER
;
3987 else if (!strcmp(res
->vlan_type
, "outer"))
3988 vlan_type
= ETH_VLAN_TYPE_OUTER
;
3990 printf("Unknown vlan type\n");
3993 vlan_tpid_set(res
->port_id
, vlan_type
, res
->tp_id
);
3996 cmdline_parse_token_string_t cmd_vlan_tpid_vlan
=
3997 TOKEN_STRING_INITIALIZER(struct cmd_vlan_tpid_result
,
3999 cmdline_parse_token_string_t cmd_vlan_tpid_set
=
4000 TOKEN_STRING_INITIALIZER(struct cmd_vlan_tpid_result
,
4002 cmdline_parse_token_string_t cmd_vlan_type
=
4003 TOKEN_STRING_INITIALIZER(struct cmd_vlan_tpid_result
,
4004 vlan_type
, "inner#outer");
4005 cmdline_parse_token_string_t cmd_vlan_tpid_what
=
4006 TOKEN_STRING_INITIALIZER(struct cmd_vlan_tpid_result
,
4008 cmdline_parse_token_num_t cmd_vlan_tpid_tpid
=
4009 TOKEN_NUM_INITIALIZER(struct cmd_vlan_tpid_result
,
4011 cmdline_parse_token_num_t cmd_vlan_tpid_portid
=
4012 TOKEN_NUM_INITIALIZER(struct cmd_vlan_tpid_result
,
4015 cmdline_parse_inst_t cmd_vlan_tpid
= {
4016 .f
= cmd_vlan_tpid_parsed
,
4018 .help_str
= "vlan set inner|outer tpid <tp_id> <port_id>: "
4019 "Set the VLAN Ether type",
4021 (void *)&cmd_vlan_tpid_vlan
,
4022 (void *)&cmd_vlan_tpid_set
,
4023 (void *)&cmd_vlan_type
,
4024 (void *)&cmd_vlan_tpid_what
,
4025 (void *)&cmd_vlan_tpid_tpid
,
4026 (void *)&cmd_vlan_tpid_portid
,
4031 /* *** ADD/REMOVE A VLAN IDENTIFIER TO/FROM A PORT VLAN RX FILTER *** */
4032 struct cmd_rx_vlan_filter_result
{
4033 cmdline_fixed_string_t rx_vlan
;
4034 cmdline_fixed_string_t what
;
4040 cmd_rx_vlan_filter_parsed(void *parsed_result
,
4041 __attribute__((unused
)) struct cmdline
*cl
,
4042 __attribute__((unused
)) void *data
)
4044 struct cmd_rx_vlan_filter_result
*res
= parsed_result
;
4046 if (!strcmp(res
->what
, "add"))
4047 rx_vft_set(res
->port_id
, res
->vlan_id
, 1);
4049 rx_vft_set(res
->port_id
, res
->vlan_id
, 0);
4052 cmdline_parse_token_string_t cmd_rx_vlan_filter_rx_vlan
=
4053 TOKEN_STRING_INITIALIZER(struct cmd_rx_vlan_filter_result
,
4054 rx_vlan
, "rx_vlan");
4055 cmdline_parse_token_string_t cmd_rx_vlan_filter_what
=
4056 TOKEN_STRING_INITIALIZER(struct cmd_rx_vlan_filter_result
,
4058 cmdline_parse_token_num_t cmd_rx_vlan_filter_vlanid
=
4059 TOKEN_NUM_INITIALIZER(struct cmd_rx_vlan_filter_result
,
4061 cmdline_parse_token_num_t cmd_rx_vlan_filter_portid
=
4062 TOKEN_NUM_INITIALIZER(struct cmd_rx_vlan_filter_result
,
4065 cmdline_parse_inst_t cmd_rx_vlan_filter
= {
4066 .f
= cmd_rx_vlan_filter_parsed
,
4068 .help_str
= "rx_vlan add|rm <vlan_id> <port_id>: "
4069 "Add/Remove a VLAN identifier to/from the set of VLAN "
4070 "identifiers filtered by a port",
4072 (void *)&cmd_rx_vlan_filter_rx_vlan
,
4073 (void *)&cmd_rx_vlan_filter_what
,
4074 (void *)&cmd_rx_vlan_filter_vlanid
,
4075 (void *)&cmd_rx_vlan_filter_portid
,
4080 /* *** ENABLE HARDWARE INSERTION OF VLAN HEADER IN TX PACKETS *** */
4081 struct cmd_tx_vlan_set_result
{
4082 cmdline_fixed_string_t tx_vlan
;
4083 cmdline_fixed_string_t set
;
4089 cmd_tx_vlan_set_parsed(void *parsed_result
,
4090 __attribute__((unused
)) struct cmdline
*cl
,
4091 __attribute__((unused
)) void *data
)
4093 struct cmd_tx_vlan_set_result
*res
= parsed_result
;
4095 if (!port_is_stopped(res
->port_id
)) {
4096 printf("Please stop port %d first\n", res
->port_id
);
4100 tx_vlan_set(res
->port_id
, res
->vlan_id
);
4102 cmd_reconfig_device_queue(res
->port_id
, 1, 1);
4105 cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan
=
4106 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_set_result
,
4107 tx_vlan
, "tx_vlan");
4108 cmdline_parse_token_string_t cmd_tx_vlan_set_set
=
4109 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_set_result
,
4111 cmdline_parse_token_num_t cmd_tx_vlan_set_portid
=
4112 TOKEN_NUM_INITIALIZER(struct cmd_tx_vlan_set_result
,
4114 cmdline_parse_token_num_t cmd_tx_vlan_set_vlanid
=
4115 TOKEN_NUM_INITIALIZER(struct cmd_tx_vlan_set_result
,
4118 cmdline_parse_inst_t cmd_tx_vlan_set
= {
4119 .f
= cmd_tx_vlan_set_parsed
,
4121 .help_str
= "tx_vlan set <port_id> <vlan_id>: "
4122 "Enable hardware insertion of a single VLAN header "
4123 "with a given TAG Identifier in packets sent on a port",
4125 (void *)&cmd_tx_vlan_set_tx_vlan
,
4126 (void *)&cmd_tx_vlan_set_set
,
4127 (void *)&cmd_tx_vlan_set_portid
,
4128 (void *)&cmd_tx_vlan_set_vlanid
,
4133 /* *** ENABLE HARDWARE INSERTION OF Double VLAN HEADER IN TX PACKETS *** */
4134 struct cmd_tx_vlan_set_qinq_result
{
4135 cmdline_fixed_string_t tx_vlan
;
4136 cmdline_fixed_string_t set
;
4139 uint16_t vlan_id_outer
;
4143 cmd_tx_vlan_set_qinq_parsed(void *parsed_result
,
4144 __attribute__((unused
)) struct cmdline
*cl
,
4145 __attribute__((unused
)) void *data
)
4147 struct cmd_tx_vlan_set_qinq_result
*res
= parsed_result
;
4149 if (!port_is_stopped(res
->port_id
)) {
4150 printf("Please stop port %d first\n", res
->port_id
);
4154 tx_qinq_set(res
->port_id
, res
->vlan_id
, res
->vlan_id_outer
);
4156 cmd_reconfig_device_queue(res
->port_id
, 1, 1);
4159 cmdline_parse_token_string_t cmd_tx_vlan_set_qinq_tx_vlan
=
4160 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_set_qinq_result
,
4161 tx_vlan
, "tx_vlan");
4162 cmdline_parse_token_string_t cmd_tx_vlan_set_qinq_set
=
4163 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_set_qinq_result
,
4165 cmdline_parse_token_num_t cmd_tx_vlan_set_qinq_portid
=
4166 TOKEN_NUM_INITIALIZER(struct cmd_tx_vlan_set_qinq_result
,
4168 cmdline_parse_token_num_t cmd_tx_vlan_set_qinq_vlanid
=
4169 TOKEN_NUM_INITIALIZER(struct cmd_tx_vlan_set_qinq_result
,
4171 cmdline_parse_token_num_t cmd_tx_vlan_set_qinq_vlanid_outer
=
4172 TOKEN_NUM_INITIALIZER(struct cmd_tx_vlan_set_qinq_result
,
4173 vlan_id_outer
, UINT16
);
4175 cmdline_parse_inst_t cmd_tx_vlan_set_qinq
= {
4176 .f
= cmd_tx_vlan_set_qinq_parsed
,
4178 .help_str
= "tx_vlan set <port_id> <vlan_id> <outer_vlan_id>: "
4179 "Enable hardware insertion of double VLAN header "
4180 "with given TAG Identifiers in packets sent on a port",
4182 (void *)&cmd_tx_vlan_set_qinq_tx_vlan
,
4183 (void *)&cmd_tx_vlan_set_qinq_set
,
4184 (void *)&cmd_tx_vlan_set_qinq_portid
,
4185 (void *)&cmd_tx_vlan_set_qinq_vlanid
,
4186 (void *)&cmd_tx_vlan_set_qinq_vlanid_outer
,
4191 /* *** ENABLE/DISABLE PORT BASED TX VLAN INSERTION *** */
4192 struct cmd_tx_vlan_set_pvid_result
{
4193 cmdline_fixed_string_t tx_vlan
;
4194 cmdline_fixed_string_t set
;
4195 cmdline_fixed_string_t pvid
;
4198 cmdline_fixed_string_t mode
;
4202 cmd_tx_vlan_set_pvid_parsed(void *parsed_result
,
4203 __attribute__((unused
)) struct cmdline
*cl
,
4204 __attribute__((unused
)) void *data
)
4206 struct cmd_tx_vlan_set_pvid_result
*res
= parsed_result
;
4208 if (strcmp(res
->mode
, "on") == 0)
4209 tx_vlan_pvid_set(res
->port_id
, res
->vlan_id
, 1);
4211 tx_vlan_pvid_set(res
->port_id
, res
->vlan_id
, 0);
4214 cmdline_parse_token_string_t cmd_tx_vlan_set_pvid_tx_vlan
=
4215 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_set_pvid_result
,
4216 tx_vlan
, "tx_vlan");
4217 cmdline_parse_token_string_t cmd_tx_vlan_set_pvid_set
=
4218 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_set_pvid_result
,
4220 cmdline_parse_token_string_t cmd_tx_vlan_set_pvid_pvid
=
4221 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_set_pvid_result
,
4223 cmdline_parse_token_num_t cmd_tx_vlan_set_pvid_port_id
=
4224 TOKEN_NUM_INITIALIZER(struct cmd_tx_vlan_set_pvid_result
,
4226 cmdline_parse_token_num_t cmd_tx_vlan_set_pvid_vlan_id
=
4227 TOKEN_NUM_INITIALIZER(struct cmd_tx_vlan_set_pvid_result
,
4229 cmdline_parse_token_string_t cmd_tx_vlan_set_pvid_mode
=
4230 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_set_pvid_result
,
4233 cmdline_parse_inst_t cmd_tx_vlan_set_pvid
= {
4234 .f
= cmd_tx_vlan_set_pvid_parsed
,
4236 .help_str
= "tx_vlan set pvid <port_id> <vlan_id> on|off",
4238 (void *)&cmd_tx_vlan_set_pvid_tx_vlan
,
4239 (void *)&cmd_tx_vlan_set_pvid_set
,
4240 (void *)&cmd_tx_vlan_set_pvid_pvid
,
4241 (void *)&cmd_tx_vlan_set_pvid_port_id
,
4242 (void *)&cmd_tx_vlan_set_pvid_vlan_id
,
4243 (void *)&cmd_tx_vlan_set_pvid_mode
,
4248 /* *** DISABLE HARDWARE INSERTION OF VLAN HEADER IN TX PACKETS *** */
4249 struct cmd_tx_vlan_reset_result
{
4250 cmdline_fixed_string_t tx_vlan
;
4251 cmdline_fixed_string_t reset
;
4256 cmd_tx_vlan_reset_parsed(void *parsed_result
,
4257 __attribute__((unused
)) struct cmdline
*cl
,
4258 __attribute__((unused
)) void *data
)
4260 struct cmd_tx_vlan_reset_result
*res
= parsed_result
;
4262 if (!port_is_stopped(res
->port_id
)) {
4263 printf("Please stop port %d first\n", res
->port_id
);
4267 tx_vlan_reset(res
->port_id
);
4269 cmd_reconfig_device_queue(res
->port_id
, 1, 1);
4272 cmdline_parse_token_string_t cmd_tx_vlan_reset_tx_vlan
=
4273 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_reset_result
,
4274 tx_vlan
, "tx_vlan");
4275 cmdline_parse_token_string_t cmd_tx_vlan_reset_reset
=
4276 TOKEN_STRING_INITIALIZER(struct cmd_tx_vlan_reset_result
,
4278 cmdline_parse_token_num_t cmd_tx_vlan_reset_portid
=
4279 TOKEN_NUM_INITIALIZER(struct cmd_tx_vlan_reset_result
,
4282 cmdline_parse_inst_t cmd_tx_vlan_reset
= {
4283 .f
= cmd_tx_vlan_reset_parsed
,
4285 .help_str
= "tx_vlan reset <port_id>: Disable hardware insertion of a "
4286 "VLAN header in packets sent on a port",
4288 (void *)&cmd_tx_vlan_reset_tx_vlan
,
4289 (void *)&cmd_tx_vlan_reset_reset
,
4290 (void *)&cmd_tx_vlan_reset_portid
,
4296 /* *** ENABLE HARDWARE INSERTION OF CHECKSUM IN TX PACKETS *** */
4297 struct cmd_csum_result
{
4298 cmdline_fixed_string_t csum
;
4299 cmdline_fixed_string_t mode
;
4300 cmdline_fixed_string_t proto
;
4301 cmdline_fixed_string_t hwsw
;
4306 csum_show(int port_id
)
4308 struct rte_eth_dev_info dev_info
;
4309 uint64_t tx_offloads
;
4311 tx_offloads
= ports
[port_id
].dev_conf
.txmode
.offloads
;
4312 printf("Parse tunnel is %s\n",
4313 (ports
[port_id
].parse_tunnel
) ? "on" : "off");
4314 printf("IP checksum offload is %s\n",
4315 (tx_offloads
& DEV_TX_OFFLOAD_IPV4_CKSUM
) ? "hw" : "sw");
4316 printf("UDP checksum offload is %s\n",
4317 (tx_offloads
& DEV_TX_OFFLOAD_UDP_CKSUM
) ? "hw" : "sw");
4318 printf("TCP checksum offload is %s\n",
4319 (tx_offloads
& DEV_TX_OFFLOAD_TCP_CKSUM
) ? "hw" : "sw");
4320 printf("SCTP checksum offload is %s\n",
4321 (tx_offloads
& DEV_TX_OFFLOAD_SCTP_CKSUM
) ? "hw" : "sw");
4322 printf("Outer-Ip checksum offload is %s\n",
4323 (tx_offloads
& DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM
) ? "hw" : "sw");
4324 printf("Outer-Udp checksum offload is %s\n",
4325 (tx_offloads
& DEV_TX_OFFLOAD_OUTER_UDP_CKSUM
) ? "hw" : "sw");
4327 /* display warnings if configuration is not supported by the NIC */
4328 rte_eth_dev_info_get(port_id
, &dev_info
);
4329 if ((tx_offloads
& DEV_TX_OFFLOAD_IPV4_CKSUM
) &&
4330 (dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_IPV4_CKSUM
) == 0) {
4331 printf("Warning: hardware IP checksum enabled but not "
4332 "supported by port %d\n", port_id
);
4334 if ((tx_offloads
& DEV_TX_OFFLOAD_UDP_CKSUM
) &&
4335 (dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_UDP_CKSUM
) == 0) {
4336 printf("Warning: hardware UDP checksum enabled but not "
4337 "supported by port %d\n", port_id
);
4339 if ((tx_offloads
& DEV_TX_OFFLOAD_TCP_CKSUM
) &&
4340 (dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_TCP_CKSUM
) == 0) {
4341 printf("Warning: hardware TCP checksum enabled but not "
4342 "supported by port %d\n", port_id
);
4344 if ((tx_offloads
& DEV_TX_OFFLOAD_SCTP_CKSUM
) &&
4345 (dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_SCTP_CKSUM
) == 0) {
4346 printf("Warning: hardware SCTP checksum enabled but not "
4347 "supported by port %d\n", port_id
);
4349 if ((tx_offloads
& DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM
) &&
4350 (dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM
) == 0) {
4351 printf("Warning: hardware outer IP checksum enabled but not "
4352 "supported by port %d\n", port_id
);
4354 if ((tx_offloads
& DEV_TX_OFFLOAD_OUTER_UDP_CKSUM
) &&
4355 (dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_OUTER_UDP_CKSUM
)
4357 printf("Warning: hardware outer UDP checksum enabled but not "
4358 "supported by port %d\n", port_id
);
4363 cmd_csum_parsed(void *parsed_result
,
4364 __attribute__((unused
)) struct cmdline
*cl
,
4365 __attribute__((unused
)) void *data
)
4367 struct cmd_csum_result
*res
= parsed_result
;
4369 uint64_t csum_offloads
= 0;
4370 struct rte_eth_dev_info dev_info
;
4372 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
)) {
4373 printf("invalid port %d\n", res
->port_id
);
4376 if (!port_is_stopped(res
->port_id
)) {
4377 printf("Please stop port %d first\n", res
->port_id
);
4381 rte_eth_dev_info_get(res
->port_id
, &dev_info
);
4382 if (!strcmp(res
->mode
, "set")) {
4384 if (!strcmp(res
->hwsw
, "hw"))
4387 if (!strcmp(res
->proto
, "ip")) {
4388 if (hw
== 0 || (dev_info
.tx_offload_capa
&
4389 DEV_TX_OFFLOAD_IPV4_CKSUM
)) {
4390 csum_offloads
|= DEV_TX_OFFLOAD_IPV4_CKSUM
;
4392 printf("IP checksum offload is not supported "
4393 "by port %u\n", res
->port_id
);
4395 } else if (!strcmp(res
->proto
, "udp")) {
4396 if (hw
== 0 || (dev_info
.tx_offload_capa
&
4397 DEV_TX_OFFLOAD_UDP_CKSUM
)) {
4398 csum_offloads
|= DEV_TX_OFFLOAD_UDP_CKSUM
;
4400 printf("UDP checksum offload is not supported "
4401 "by port %u\n", res
->port_id
);
4403 } else if (!strcmp(res
->proto
, "tcp")) {
4404 if (hw
== 0 || (dev_info
.tx_offload_capa
&
4405 DEV_TX_OFFLOAD_TCP_CKSUM
)) {
4406 csum_offloads
|= DEV_TX_OFFLOAD_TCP_CKSUM
;
4408 printf("TCP checksum offload is not supported "
4409 "by port %u\n", res
->port_id
);
4411 } else if (!strcmp(res
->proto
, "sctp")) {
4412 if (hw
== 0 || (dev_info
.tx_offload_capa
&
4413 DEV_TX_OFFLOAD_SCTP_CKSUM
)) {
4414 csum_offloads
|= DEV_TX_OFFLOAD_SCTP_CKSUM
;
4416 printf("SCTP checksum offload is not supported "
4417 "by port %u\n", res
->port_id
);
4419 } else if (!strcmp(res
->proto
, "outer-ip")) {
4420 if (hw
== 0 || (dev_info
.tx_offload_capa
&
4421 DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM
)) {
4423 DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM
;
4425 printf("Outer IP checksum offload is not "
4426 "supported by port %u\n", res
->port_id
);
4428 } else if (!strcmp(res
->proto
, "outer-udp")) {
4429 if (hw
== 0 || (dev_info
.tx_offload_capa
&
4430 DEV_TX_OFFLOAD_OUTER_UDP_CKSUM
)) {
4432 DEV_TX_OFFLOAD_OUTER_UDP_CKSUM
;
4434 printf("Outer UDP checksum offload is not "
4435 "supported by port %u\n", res
->port_id
);
4440 ports
[res
->port_id
].dev_conf
.txmode
.offloads
|=
4443 ports
[res
->port_id
].dev_conf
.txmode
.offloads
&=
4447 csum_show(res
->port_id
);
4449 cmd_reconfig_device_queue(res
->port_id
, 1, 1);
4452 cmdline_parse_token_string_t cmd_csum_csum
=
4453 TOKEN_STRING_INITIALIZER(struct cmd_csum_result
,
4455 cmdline_parse_token_string_t cmd_csum_mode
=
4456 TOKEN_STRING_INITIALIZER(struct cmd_csum_result
,
4458 cmdline_parse_token_string_t cmd_csum_proto
=
4459 TOKEN_STRING_INITIALIZER(struct cmd_csum_result
,
4460 proto
, "ip#tcp#udp#sctp#outer-ip#outer-udp");
4461 cmdline_parse_token_string_t cmd_csum_hwsw
=
4462 TOKEN_STRING_INITIALIZER(struct cmd_csum_result
,
4464 cmdline_parse_token_num_t cmd_csum_portid
=
4465 TOKEN_NUM_INITIALIZER(struct cmd_csum_result
,
4468 cmdline_parse_inst_t cmd_csum_set
= {
4469 .f
= cmd_csum_parsed
,
4471 .help_str
= "csum set ip|tcp|udp|sctp|outer-ip|outer-udp hw|sw <port_id>: "
4472 "Enable/Disable hardware calculation of L3/L4 checksum when "
4473 "using csum forward engine",
4475 (void *)&cmd_csum_csum
,
4476 (void *)&cmd_csum_mode
,
4477 (void *)&cmd_csum_proto
,
4478 (void *)&cmd_csum_hwsw
,
4479 (void *)&cmd_csum_portid
,
4484 cmdline_parse_token_string_t cmd_csum_mode_show
=
4485 TOKEN_STRING_INITIALIZER(struct cmd_csum_result
,
4488 cmdline_parse_inst_t cmd_csum_show
= {
4489 .f
= cmd_csum_parsed
,
4491 .help_str
= "csum show <port_id>: Show checksum offload configuration",
4493 (void *)&cmd_csum_csum
,
4494 (void *)&cmd_csum_mode_show
,
4495 (void *)&cmd_csum_portid
,
4500 /* Enable/disable tunnel parsing */
4501 struct cmd_csum_tunnel_result
{
4502 cmdline_fixed_string_t csum
;
4503 cmdline_fixed_string_t parse
;
4504 cmdline_fixed_string_t onoff
;
4509 cmd_csum_tunnel_parsed(void *parsed_result
,
4510 __attribute__((unused
)) struct cmdline
*cl
,
4511 __attribute__((unused
)) void *data
)
4513 struct cmd_csum_tunnel_result
*res
= parsed_result
;
4515 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
4518 if (!strcmp(res
->onoff
, "on"))
4519 ports
[res
->port_id
].parse_tunnel
= 1;
4521 ports
[res
->port_id
].parse_tunnel
= 0;
4523 csum_show(res
->port_id
);
4526 cmdline_parse_token_string_t cmd_csum_tunnel_csum
=
4527 TOKEN_STRING_INITIALIZER(struct cmd_csum_tunnel_result
,
4529 cmdline_parse_token_string_t cmd_csum_tunnel_parse
=
4530 TOKEN_STRING_INITIALIZER(struct cmd_csum_tunnel_result
,
4531 parse
, "parse-tunnel");
4532 cmdline_parse_token_string_t cmd_csum_tunnel_onoff
=
4533 TOKEN_STRING_INITIALIZER(struct cmd_csum_tunnel_result
,
4535 cmdline_parse_token_num_t cmd_csum_tunnel_portid
=
4536 TOKEN_NUM_INITIALIZER(struct cmd_csum_tunnel_result
,
4539 cmdline_parse_inst_t cmd_csum_tunnel
= {
4540 .f
= cmd_csum_tunnel_parsed
,
4542 .help_str
= "csum parse-tunnel on|off <port_id>: "
4543 "Enable/Disable parsing of tunnels for csum engine",
4545 (void *)&cmd_csum_tunnel_csum
,
4546 (void *)&cmd_csum_tunnel_parse
,
4547 (void *)&cmd_csum_tunnel_onoff
,
4548 (void *)&cmd_csum_tunnel_portid
,
4553 /* *** ENABLE HARDWARE SEGMENTATION IN TX NON-TUNNELED PACKETS *** */
4554 struct cmd_tso_set_result
{
4555 cmdline_fixed_string_t tso
;
4556 cmdline_fixed_string_t mode
;
4562 cmd_tso_set_parsed(void *parsed_result
,
4563 __attribute__((unused
)) struct cmdline
*cl
,
4564 __attribute__((unused
)) void *data
)
4566 struct cmd_tso_set_result
*res
= parsed_result
;
4567 struct rte_eth_dev_info dev_info
;
4569 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
4571 if (!port_is_stopped(res
->port_id
)) {
4572 printf("Please stop port %d first\n", res
->port_id
);
4576 if (!strcmp(res
->mode
, "set"))
4577 ports
[res
->port_id
].tso_segsz
= res
->tso_segsz
;
4579 rte_eth_dev_info_get(res
->port_id
, &dev_info
);
4580 if ((ports
[res
->port_id
].tso_segsz
!= 0) &&
4581 (dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_TCP_TSO
) == 0) {
4582 printf("Error: TSO is not supported by port %d\n",
4587 if (ports
[res
->port_id
].tso_segsz
== 0) {
4588 ports
[res
->port_id
].dev_conf
.txmode
.offloads
&=
4589 ~DEV_TX_OFFLOAD_TCP_TSO
;
4590 printf("TSO for non-tunneled packets is disabled\n");
4592 ports
[res
->port_id
].dev_conf
.txmode
.offloads
|=
4593 DEV_TX_OFFLOAD_TCP_TSO
;
4594 printf("TSO segment size for non-tunneled packets is %d\n",
4595 ports
[res
->port_id
].tso_segsz
);
4598 /* display warnings if configuration is not supported by the NIC */
4599 rte_eth_dev_info_get(res
->port_id
, &dev_info
);
4600 if ((ports
[res
->port_id
].tso_segsz
!= 0) &&
4601 (dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_TCP_TSO
) == 0) {
4602 printf("Warning: TSO enabled but not "
4603 "supported by port %d\n", res
->port_id
);
4606 cmd_reconfig_device_queue(res
->port_id
, 1, 1);
4609 cmdline_parse_token_string_t cmd_tso_set_tso
=
4610 TOKEN_STRING_INITIALIZER(struct cmd_tso_set_result
,
4612 cmdline_parse_token_string_t cmd_tso_set_mode
=
4613 TOKEN_STRING_INITIALIZER(struct cmd_tso_set_result
,
4615 cmdline_parse_token_num_t cmd_tso_set_tso_segsz
=
4616 TOKEN_NUM_INITIALIZER(struct cmd_tso_set_result
,
4618 cmdline_parse_token_num_t cmd_tso_set_portid
=
4619 TOKEN_NUM_INITIALIZER(struct cmd_tso_set_result
,
4622 cmdline_parse_inst_t cmd_tso_set
= {
4623 .f
= cmd_tso_set_parsed
,
4625 .help_str
= "tso set <tso_segsz> <port_id>: "
4626 "Set TSO segment size of non-tunneled packets for csum engine "
4629 (void *)&cmd_tso_set_tso
,
4630 (void *)&cmd_tso_set_mode
,
4631 (void *)&cmd_tso_set_tso_segsz
,
4632 (void *)&cmd_tso_set_portid
,
4637 cmdline_parse_token_string_t cmd_tso_show_mode
=
4638 TOKEN_STRING_INITIALIZER(struct cmd_tso_set_result
,
4642 cmdline_parse_inst_t cmd_tso_show
= {
4643 .f
= cmd_tso_set_parsed
,
4645 .help_str
= "tso show <port_id>: "
4646 "Show TSO segment size of non-tunneled packets for csum engine",
4648 (void *)&cmd_tso_set_tso
,
4649 (void *)&cmd_tso_show_mode
,
4650 (void *)&cmd_tso_set_portid
,
4655 /* *** ENABLE HARDWARE SEGMENTATION IN TX TUNNELED PACKETS *** */
4656 struct cmd_tunnel_tso_set_result
{
4657 cmdline_fixed_string_t tso
;
4658 cmdline_fixed_string_t mode
;
4663 static struct rte_eth_dev_info
4664 check_tunnel_tso_nic_support(portid_t port_id
)
4666 struct rte_eth_dev_info dev_info
;
4668 rte_eth_dev_info_get(port_id
, &dev_info
);
4669 if (!(dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_VXLAN_TNL_TSO
))
4670 printf("Warning: VXLAN TUNNEL TSO not supported therefore "
4671 "not enabled for port %d\n", port_id
);
4672 if (!(dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_GRE_TNL_TSO
))
4673 printf("Warning: GRE TUNNEL TSO not supported therefore "
4674 "not enabled for port %d\n", port_id
);
4675 if (!(dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_IPIP_TNL_TSO
))
4676 printf("Warning: IPIP TUNNEL TSO not supported therefore "
4677 "not enabled for port %d\n", port_id
);
4678 if (!(dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_GENEVE_TNL_TSO
))
4679 printf("Warning: GENEVE TUNNEL TSO not supported therefore "
4680 "not enabled for port %d\n", port_id
);
4681 if (!(dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_IP_TNL_TSO
))
4682 printf("Warning: IP TUNNEL TSO not supported therefore "
4683 "not enabled for port %d\n", port_id
);
4684 if (!(dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_UDP_TNL_TSO
))
4685 printf("Warning: UDP TUNNEL TSO not supported therefore "
4686 "not enabled for port %d\n", port_id
);
4691 cmd_tunnel_tso_set_parsed(void *parsed_result
,
4692 __attribute__((unused
)) struct cmdline
*cl
,
4693 __attribute__((unused
)) void *data
)
4695 struct cmd_tunnel_tso_set_result
*res
= parsed_result
;
4696 struct rte_eth_dev_info dev_info
;
4698 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
4700 if (!port_is_stopped(res
->port_id
)) {
4701 printf("Please stop port %d first\n", res
->port_id
);
4705 if (!strcmp(res
->mode
, "set"))
4706 ports
[res
->port_id
].tunnel_tso_segsz
= res
->tso_segsz
;
4708 dev_info
= check_tunnel_tso_nic_support(res
->port_id
);
4709 if (ports
[res
->port_id
].tunnel_tso_segsz
== 0) {
4710 ports
[res
->port_id
].dev_conf
.txmode
.offloads
&=
4711 ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO
|
4712 DEV_TX_OFFLOAD_GRE_TNL_TSO
|
4713 DEV_TX_OFFLOAD_IPIP_TNL_TSO
|
4714 DEV_TX_OFFLOAD_GENEVE_TNL_TSO
|
4715 DEV_TX_OFFLOAD_IP_TNL_TSO
|
4716 DEV_TX_OFFLOAD_UDP_TNL_TSO
);
4717 printf("TSO for tunneled packets is disabled\n");
4719 uint64_t tso_offloads
= (DEV_TX_OFFLOAD_VXLAN_TNL_TSO
|
4720 DEV_TX_OFFLOAD_GRE_TNL_TSO
|
4721 DEV_TX_OFFLOAD_IPIP_TNL_TSO
|
4722 DEV_TX_OFFLOAD_GENEVE_TNL_TSO
|
4723 DEV_TX_OFFLOAD_IP_TNL_TSO
|
4724 DEV_TX_OFFLOAD_UDP_TNL_TSO
);
4726 ports
[res
->port_id
].dev_conf
.txmode
.offloads
|=
4727 (tso_offloads
& dev_info
.tx_offload_capa
);
4728 printf("TSO segment size for tunneled packets is %d\n",
4729 ports
[res
->port_id
].tunnel_tso_segsz
);
4731 /* Below conditions are needed to make it work:
4732 * (1) tunnel TSO is supported by the NIC;
4733 * (2) "csum parse_tunnel" must be set so that tunneled pkts
4735 * (3) for tunneled pkts with outer L3 of IPv4,
4736 * "csum set outer-ip" must be set to hw, because after tso,
4737 * total_len of outer IP header is changed, and the checksum
4738 * of outer IP header calculated by sw should be wrong; that
4739 * is not necessary for IPv6 tunneled pkts because there's no
4740 * checksum in IP header anymore.
4743 if (!ports
[res
->port_id
].parse_tunnel
)
4744 printf("Warning: csum parse_tunnel must be set "
4745 "so that tunneled packets are recognized\n");
4746 if (!(ports
[res
->port_id
].dev_conf
.txmode
.offloads
&
4747 DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM
))
4748 printf("Warning: csum set outer-ip must be set to hw "
4749 "if outer L3 is IPv4; not necessary for IPv6\n");
4752 cmd_reconfig_device_queue(res
->port_id
, 1, 1);
4755 cmdline_parse_token_string_t cmd_tunnel_tso_set_tso
=
4756 TOKEN_STRING_INITIALIZER(struct cmd_tunnel_tso_set_result
,
4758 cmdline_parse_token_string_t cmd_tunnel_tso_set_mode
=
4759 TOKEN_STRING_INITIALIZER(struct cmd_tunnel_tso_set_result
,
4761 cmdline_parse_token_num_t cmd_tunnel_tso_set_tso_segsz
=
4762 TOKEN_NUM_INITIALIZER(struct cmd_tunnel_tso_set_result
,
4764 cmdline_parse_token_num_t cmd_tunnel_tso_set_portid
=
4765 TOKEN_NUM_INITIALIZER(struct cmd_tunnel_tso_set_result
,
4768 cmdline_parse_inst_t cmd_tunnel_tso_set
= {
4769 .f
= cmd_tunnel_tso_set_parsed
,
4771 .help_str
= "tunnel_tso set <tso_segsz> <port_id>: "
4772 "Set TSO segment size of tunneled packets for csum engine "
4775 (void *)&cmd_tunnel_tso_set_tso
,
4776 (void *)&cmd_tunnel_tso_set_mode
,
4777 (void *)&cmd_tunnel_tso_set_tso_segsz
,
4778 (void *)&cmd_tunnel_tso_set_portid
,
4783 cmdline_parse_token_string_t cmd_tunnel_tso_show_mode
=
4784 TOKEN_STRING_INITIALIZER(struct cmd_tunnel_tso_set_result
,
4788 cmdline_parse_inst_t cmd_tunnel_tso_show
= {
4789 .f
= cmd_tunnel_tso_set_parsed
,
4791 .help_str
= "tunnel_tso show <port_id> "
4792 "Show TSO segment size of tunneled packets for csum engine",
4794 (void *)&cmd_tunnel_tso_set_tso
,
4795 (void *)&cmd_tunnel_tso_show_mode
,
4796 (void *)&cmd_tunnel_tso_set_portid
,
4801 /* *** SET GRO FOR A PORT *** */
4802 struct cmd_gro_enable_result
{
4803 cmdline_fixed_string_t cmd_set
;
4804 cmdline_fixed_string_t cmd_port
;
4805 cmdline_fixed_string_t cmd_keyword
;
4806 cmdline_fixed_string_t cmd_onoff
;
4811 cmd_gro_enable_parsed(void *parsed_result
,
4812 __attribute__((unused
)) struct cmdline
*cl
,
4813 __attribute__((unused
)) void *data
)
4815 struct cmd_gro_enable_result
*res
;
4817 res
= parsed_result
;
4818 if (!strcmp(res
->cmd_keyword
, "gro"))
4819 setup_gro(res
->cmd_onoff
, res
->cmd_pid
);
4822 cmdline_parse_token_string_t cmd_gro_enable_set
=
4823 TOKEN_STRING_INITIALIZER(struct cmd_gro_enable_result
,
4825 cmdline_parse_token_string_t cmd_gro_enable_port
=
4826 TOKEN_STRING_INITIALIZER(struct cmd_gro_enable_result
,
4827 cmd_keyword
, "port");
4828 cmdline_parse_token_num_t cmd_gro_enable_pid
=
4829 TOKEN_NUM_INITIALIZER(struct cmd_gro_enable_result
,
4831 cmdline_parse_token_string_t cmd_gro_enable_keyword
=
4832 TOKEN_STRING_INITIALIZER(struct cmd_gro_enable_result
,
4833 cmd_keyword
, "gro");
4834 cmdline_parse_token_string_t cmd_gro_enable_onoff
=
4835 TOKEN_STRING_INITIALIZER(struct cmd_gro_enable_result
,
4836 cmd_onoff
, "on#off");
4838 cmdline_parse_inst_t cmd_gro_enable
= {
4839 .f
= cmd_gro_enable_parsed
,
4841 .help_str
= "set port <port_id> gro on|off",
4843 (void *)&cmd_gro_enable_set
,
4844 (void *)&cmd_gro_enable_port
,
4845 (void *)&cmd_gro_enable_pid
,
4846 (void *)&cmd_gro_enable_keyword
,
4847 (void *)&cmd_gro_enable_onoff
,
4852 /* *** DISPLAY GRO CONFIGURATION *** */
4853 struct cmd_gro_show_result
{
4854 cmdline_fixed_string_t cmd_show
;
4855 cmdline_fixed_string_t cmd_port
;
4856 cmdline_fixed_string_t cmd_keyword
;
4861 cmd_gro_show_parsed(void *parsed_result
,
4862 __attribute__((unused
)) struct cmdline
*cl
,
4863 __attribute__((unused
)) void *data
)
4865 struct cmd_gro_show_result
*res
;
4867 res
= parsed_result
;
4868 if (!strcmp(res
->cmd_keyword
, "gro"))
4869 show_gro(res
->cmd_pid
);
4872 cmdline_parse_token_string_t cmd_gro_show_show
=
4873 TOKEN_STRING_INITIALIZER(struct cmd_gro_show_result
,
4875 cmdline_parse_token_string_t cmd_gro_show_port
=
4876 TOKEN_STRING_INITIALIZER(struct cmd_gro_show_result
,
4878 cmdline_parse_token_num_t cmd_gro_show_pid
=
4879 TOKEN_NUM_INITIALIZER(struct cmd_gro_show_result
,
4881 cmdline_parse_token_string_t cmd_gro_show_keyword
=
4882 TOKEN_STRING_INITIALIZER(struct cmd_gro_show_result
,
4883 cmd_keyword
, "gro");
4885 cmdline_parse_inst_t cmd_gro_show
= {
4886 .f
= cmd_gro_show_parsed
,
4888 .help_str
= "show port <port_id> gro",
4890 (void *)&cmd_gro_show_show
,
4891 (void *)&cmd_gro_show_port
,
4892 (void *)&cmd_gro_show_pid
,
4893 (void *)&cmd_gro_show_keyword
,
4898 /* *** SET FLUSH CYCLES FOR GRO *** */
4899 struct cmd_gro_flush_result
{
4900 cmdline_fixed_string_t cmd_set
;
4901 cmdline_fixed_string_t cmd_keyword
;
4902 cmdline_fixed_string_t cmd_flush
;
4907 cmd_gro_flush_parsed(void *parsed_result
,
4908 __attribute__((unused
)) struct cmdline
*cl
,
4909 __attribute__((unused
)) void *data
)
4911 struct cmd_gro_flush_result
*res
;
4913 res
= parsed_result
;
4914 if ((!strcmp(res
->cmd_keyword
, "gro")) &&
4915 (!strcmp(res
->cmd_flush
, "flush")))
4916 setup_gro_flush_cycles(res
->cmd_cycles
);
4919 cmdline_parse_token_string_t cmd_gro_flush_set
=
4920 TOKEN_STRING_INITIALIZER(struct cmd_gro_flush_result
,
4922 cmdline_parse_token_string_t cmd_gro_flush_keyword
=
4923 TOKEN_STRING_INITIALIZER(struct cmd_gro_flush_result
,
4924 cmd_keyword
, "gro");
4925 cmdline_parse_token_string_t cmd_gro_flush_flush
=
4926 TOKEN_STRING_INITIALIZER(struct cmd_gro_flush_result
,
4927 cmd_flush
, "flush");
4928 cmdline_parse_token_num_t cmd_gro_flush_cycles
=
4929 TOKEN_NUM_INITIALIZER(struct cmd_gro_flush_result
,
4932 cmdline_parse_inst_t cmd_gro_flush
= {
4933 .f
= cmd_gro_flush_parsed
,
4935 .help_str
= "set gro flush <cycles>",
4937 (void *)&cmd_gro_flush_set
,
4938 (void *)&cmd_gro_flush_keyword
,
4939 (void *)&cmd_gro_flush_flush
,
4940 (void *)&cmd_gro_flush_cycles
,
4945 /* *** ENABLE/DISABLE GSO *** */
4946 struct cmd_gso_enable_result
{
4947 cmdline_fixed_string_t cmd_set
;
4948 cmdline_fixed_string_t cmd_port
;
4949 cmdline_fixed_string_t cmd_keyword
;
4950 cmdline_fixed_string_t cmd_mode
;
4955 cmd_gso_enable_parsed(void *parsed_result
,
4956 __attribute__((unused
)) struct cmdline
*cl
,
4957 __attribute__((unused
)) void *data
)
4959 struct cmd_gso_enable_result
*res
;
4961 res
= parsed_result
;
4962 if (!strcmp(res
->cmd_keyword
, "gso"))
4963 setup_gso(res
->cmd_mode
, res
->cmd_pid
);
4966 cmdline_parse_token_string_t cmd_gso_enable_set
=
4967 TOKEN_STRING_INITIALIZER(struct cmd_gso_enable_result
,
4969 cmdline_parse_token_string_t cmd_gso_enable_port
=
4970 TOKEN_STRING_INITIALIZER(struct cmd_gso_enable_result
,
4972 cmdline_parse_token_string_t cmd_gso_enable_keyword
=
4973 TOKEN_STRING_INITIALIZER(struct cmd_gso_enable_result
,
4974 cmd_keyword
, "gso");
4975 cmdline_parse_token_string_t cmd_gso_enable_mode
=
4976 TOKEN_STRING_INITIALIZER(struct cmd_gso_enable_result
,
4977 cmd_mode
, "on#off");
4978 cmdline_parse_token_num_t cmd_gso_enable_pid
=
4979 TOKEN_NUM_INITIALIZER(struct cmd_gso_enable_result
,
4982 cmdline_parse_inst_t cmd_gso_enable
= {
4983 .f
= cmd_gso_enable_parsed
,
4985 .help_str
= "set port <port_id> gso on|off",
4987 (void *)&cmd_gso_enable_set
,
4988 (void *)&cmd_gso_enable_port
,
4989 (void *)&cmd_gso_enable_pid
,
4990 (void *)&cmd_gso_enable_keyword
,
4991 (void *)&cmd_gso_enable_mode
,
4996 /* *** SET MAX PACKET LENGTH FOR GSO SEGMENTS *** */
4997 struct cmd_gso_size_result
{
4998 cmdline_fixed_string_t cmd_set
;
4999 cmdline_fixed_string_t cmd_keyword
;
5000 cmdline_fixed_string_t cmd_segsz
;
5005 cmd_gso_size_parsed(void *parsed_result
,
5006 __attribute__((unused
)) struct cmdline
*cl
,
5007 __attribute__((unused
)) void *data
)
5009 struct cmd_gso_size_result
*res
= parsed_result
;
5011 if (test_done
== 0) {
5012 printf("Before setting GSO segsz, please first"
5013 " stop fowarding\n");
5017 if (!strcmp(res
->cmd_keyword
, "gso") &&
5018 !strcmp(res
->cmd_segsz
, "segsz")) {
5019 if (res
->cmd_size
< RTE_GSO_SEG_SIZE_MIN
)
5020 printf("gso_size should be larger than %zu."
5021 " Please input a legal value\n",
5022 RTE_GSO_SEG_SIZE_MIN
);
5024 gso_max_segment_size
= res
->cmd_size
;
5028 cmdline_parse_token_string_t cmd_gso_size_set
=
5029 TOKEN_STRING_INITIALIZER(struct cmd_gso_size_result
,
5031 cmdline_parse_token_string_t cmd_gso_size_keyword
=
5032 TOKEN_STRING_INITIALIZER(struct cmd_gso_size_result
,
5033 cmd_keyword
, "gso");
5034 cmdline_parse_token_string_t cmd_gso_size_segsz
=
5035 TOKEN_STRING_INITIALIZER(struct cmd_gso_size_result
,
5036 cmd_segsz
, "segsz");
5037 cmdline_parse_token_num_t cmd_gso_size_size
=
5038 TOKEN_NUM_INITIALIZER(struct cmd_gso_size_result
,
5041 cmdline_parse_inst_t cmd_gso_size
= {
5042 .f
= cmd_gso_size_parsed
,
5044 .help_str
= "set gso segsz <length>",
5046 (void *)&cmd_gso_size_set
,
5047 (void *)&cmd_gso_size_keyword
,
5048 (void *)&cmd_gso_size_segsz
,
5049 (void *)&cmd_gso_size_size
,
5054 /* *** SHOW GSO CONFIGURATION *** */
5055 struct cmd_gso_show_result
{
5056 cmdline_fixed_string_t cmd_show
;
5057 cmdline_fixed_string_t cmd_port
;
5058 cmdline_fixed_string_t cmd_keyword
;
5063 cmd_gso_show_parsed(void *parsed_result
,
5064 __attribute__((unused
)) struct cmdline
*cl
,
5065 __attribute__((unused
)) void *data
)
5067 struct cmd_gso_show_result
*res
= parsed_result
;
5069 if (!rte_eth_dev_is_valid_port(res
->cmd_pid
)) {
5070 printf("invalid port id %u\n", res
->cmd_pid
);
5073 if (!strcmp(res
->cmd_keyword
, "gso")) {
5074 if (gso_ports
[res
->cmd_pid
].enable
) {
5075 printf("Max GSO'd packet size: %uB\n"
5076 "Supported GSO types: TCP/IPv4, "
5077 "UDP/IPv4, VxLAN with inner "
5078 "TCP/IPv4 packet, GRE with inner "
5079 "TCP/IPv4 packet\n",
5080 gso_max_segment_size
);
5082 printf("GSO is not enabled on Port %u\n", res
->cmd_pid
);
5086 cmdline_parse_token_string_t cmd_gso_show_show
=
5087 TOKEN_STRING_INITIALIZER(struct cmd_gso_show_result
,
5089 cmdline_parse_token_string_t cmd_gso_show_port
=
5090 TOKEN_STRING_INITIALIZER(struct cmd_gso_show_result
,
5092 cmdline_parse_token_string_t cmd_gso_show_keyword
=
5093 TOKEN_STRING_INITIALIZER(struct cmd_gso_show_result
,
5094 cmd_keyword
, "gso");
5095 cmdline_parse_token_num_t cmd_gso_show_pid
=
5096 TOKEN_NUM_INITIALIZER(struct cmd_gso_show_result
,
5099 cmdline_parse_inst_t cmd_gso_show
= {
5100 .f
= cmd_gso_show_parsed
,
5102 .help_str
= "show port <port_id> gso",
5104 (void *)&cmd_gso_show_show
,
5105 (void *)&cmd_gso_show_port
,
5106 (void *)&cmd_gso_show_pid
,
5107 (void *)&cmd_gso_show_keyword
,
5112 /* *** ENABLE/DISABLE FLUSH ON RX STREAMS *** */
5113 struct cmd_set_flush_rx
{
5114 cmdline_fixed_string_t set
;
5115 cmdline_fixed_string_t flush_rx
;
5116 cmdline_fixed_string_t mode
;
5120 cmd_set_flush_rx_parsed(void *parsed_result
,
5121 __attribute__((unused
)) struct cmdline
*cl
,
5122 __attribute__((unused
)) void *data
)
5124 struct cmd_set_flush_rx
*res
= parsed_result
;
5125 no_flush_rx
= (uint8_t)((strcmp(res
->mode
, "on") == 0) ? 0 : 1);
5128 cmdline_parse_token_string_t cmd_setflushrx_set
=
5129 TOKEN_STRING_INITIALIZER(struct cmd_set_flush_rx
,
5131 cmdline_parse_token_string_t cmd_setflushrx_flush_rx
=
5132 TOKEN_STRING_INITIALIZER(struct cmd_set_flush_rx
,
5133 flush_rx
, "flush_rx");
5134 cmdline_parse_token_string_t cmd_setflushrx_mode
=
5135 TOKEN_STRING_INITIALIZER(struct cmd_set_flush_rx
,
5139 cmdline_parse_inst_t cmd_set_flush_rx
= {
5140 .f
= cmd_set_flush_rx_parsed
,
5141 .help_str
= "set flush_rx on|off: Enable/Disable flush on rx streams",
5144 (void *)&cmd_setflushrx_set
,
5145 (void *)&cmd_setflushrx_flush_rx
,
5146 (void *)&cmd_setflushrx_mode
,
5151 /* *** ENABLE/DISABLE LINK STATUS CHECK *** */
5152 struct cmd_set_link_check
{
5153 cmdline_fixed_string_t set
;
5154 cmdline_fixed_string_t link_check
;
5155 cmdline_fixed_string_t mode
;
5159 cmd_set_link_check_parsed(void *parsed_result
,
5160 __attribute__((unused
)) struct cmdline
*cl
,
5161 __attribute__((unused
)) void *data
)
5163 struct cmd_set_link_check
*res
= parsed_result
;
5164 no_link_check
= (uint8_t)((strcmp(res
->mode
, "on") == 0) ? 0 : 1);
5167 cmdline_parse_token_string_t cmd_setlinkcheck_set
=
5168 TOKEN_STRING_INITIALIZER(struct cmd_set_link_check
,
5170 cmdline_parse_token_string_t cmd_setlinkcheck_link_check
=
5171 TOKEN_STRING_INITIALIZER(struct cmd_set_link_check
,
5172 link_check
, "link_check");
5173 cmdline_parse_token_string_t cmd_setlinkcheck_mode
=
5174 TOKEN_STRING_INITIALIZER(struct cmd_set_link_check
,
5178 cmdline_parse_inst_t cmd_set_link_check
= {
5179 .f
= cmd_set_link_check_parsed
,
5180 .help_str
= "set link_check on|off: Enable/Disable link status check "
5181 "when starting/stopping a port",
5184 (void *)&cmd_setlinkcheck_set
,
5185 (void *)&cmd_setlinkcheck_link_check
,
5186 (void *)&cmd_setlinkcheck_mode
,
5191 /* *** SET NIC BYPASS MODE *** */
5192 struct cmd_set_bypass_mode_result
{
5193 cmdline_fixed_string_t set
;
5194 cmdline_fixed_string_t bypass
;
5195 cmdline_fixed_string_t mode
;
5196 cmdline_fixed_string_t value
;
5201 cmd_set_bypass_mode_parsed(void *parsed_result
,
5202 __attribute__((unused
)) struct cmdline
*cl
,
5203 __attribute__((unused
)) void *data
)
5205 struct cmd_set_bypass_mode_result
*res
= parsed_result
;
5206 portid_t port_id
= res
->port_id
;
5207 int32_t rc
= -EINVAL
;
5209 #if defined RTE_LIBRTE_IXGBE_PMD && defined RTE_LIBRTE_IXGBE_BYPASS
5210 uint32_t bypass_mode
= RTE_PMD_IXGBE_BYPASS_MODE_NORMAL
;
5212 if (!strcmp(res
->value
, "bypass"))
5213 bypass_mode
= RTE_PMD_IXGBE_BYPASS_MODE_BYPASS
;
5214 else if (!strcmp(res
->value
, "isolate"))
5215 bypass_mode
= RTE_PMD_IXGBE_BYPASS_MODE_ISOLATE
;
5217 bypass_mode
= RTE_PMD_IXGBE_BYPASS_MODE_NORMAL
;
5219 /* Set the bypass mode for the relevant port. */
5220 rc
= rte_pmd_ixgbe_bypass_state_set(port_id
, &bypass_mode
);
5223 printf("\t Failed to set bypass mode for port = %d.\n", port_id
);
5226 cmdline_parse_token_string_t cmd_setbypass_mode_set
=
5227 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_mode_result
,
5229 cmdline_parse_token_string_t cmd_setbypass_mode_bypass
=
5230 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_mode_result
,
5232 cmdline_parse_token_string_t cmd_setbypass_mode_mode
=
5233 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_mode_result
,
5235 cmdline_parse_token_string_t cmd_setbypass_mode_value
=
5236 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_mode_result
,
5237 value
, "normal#bypass#isolate");
5238 cmdline_parse_token_num_t cmd_setbypass_mode_port
=
5239 TOKEN_NUM_INITIALIZER(struct cmd_set_bypass_mode_result
,
5242 cmdline_parse_inst_t cmd_set_bypass_mode
= {
5243 .f
= cmd_set_bypass_mode_parsed
,
5244 .help_str
= "set bypass mode normal|bypass|isolate <port_id>: "
5245 "Set the NIC bypass mode for port_id",
5248 (void *)&cmd_setbypass_mode_set
,
5249 (void *)&cmd_setbypass_mode_bypass
,
5250 (void *)&cmd_setbypass_mode_mode
,
5251 (void *)&cmd_setbypass_mode_value
,
5252 (void *)&cmd_setbypass_mode_port
,
5257 /* *** SET NIC BYPASS EVENT *** */
5258 struct cmd_set_bypass_event_result
{
5259 cmdline_fixed_string_t set
;
5260 cmdline_fixed_string_t bypass
;
5261 cmdline_fixed_string_t event
;
5262 cmdline_fixed_string_t event_value
;
5263 cmdline_fixed_string_t mode
;
5264 cmdline_fixed_string_t mode_value
;
5269 cmd_set_bypass_event_parsed(void *parsed_result
,
5270 __attribute__((unused
)) struct cmdline
*cl
,
5271 __attribute__((unused
)) void *data
)
5273 int32_t rc
= -EINVAL
;
5274 struct cmd_set_bypass_event_result
*res
= parsed_result
;
5275 portid_t port_id
= res
->port_id
;
5277 #if defined RTE_LIBRTE_IXGBE_PMD && defined RTE_LIBRTE_IXGBE_BYPASS
5278 uint32_t bypass_event
= RTE_PMD_IXGBE_BYPASS_EVENT_NONE
;
5279 uint32_t bypass_mode
= RTE_PMD_IXGBE_BYPASS_MODE_NORMAL
;
5281 if (!strcmp(res
->event_value
, "timeout"))
5282 bypass_event
= RTE_PMD_IXGBE_BYPASS_EVENT_TIMEOUT
;
5283 else if (!strcmp(res
->event_value
, "os_on"))
5284 bypass_event
= RTE_PMD_IXGBE_BYPASS_EVENT_OS_ON
;
5285 else if (!strcmp(res
->event_value
, "os_off"))
5286 bypass_event
= RTE_PMD_IXGBE_BYPASS_EVENT_OS_OFF
;
5287 else if (!strcmp(res
->event_value
, "power_on"))
5288 bypass_event
= RTE_PMD_IXGBE_BYPASS_EVENT_POWER_ON
;
5289 else if (!strcmp(res
->event_value
, "power_off"))
5290 bypass_event
= RTE_PMD_IXGBE_BYPASS_EVENT_POWER_OFF
;
5292 bypass_event
= RTE_PMD_IXGBE_BYPASS_EVENT_NONE
;
5294 if (!strcmp(res
->mode_value
, "bypass"))
5295 bypass_mode
= RTE_PMD_IXGBE_BYPASS_MODE_BYPASS
;
5296 else if (!strcmp(res
->mode_value
, "isolate"))
5297 bypass_mode
= RTE_PMD_IXGBE_BYPASS_MODE_ISOLATE
;
5299 bypass_mode
= RTE_PMD_IXGBE_BYPASS_MODE_NORMAL
;
5301 /* Set the watchdog timeout. */
5302 if (bypass_event
== RTE_PMD_IXGBE_BYPASS_EVENT_TIMEOUT
) {
5305 if (RTE_PMD_IXGBE_BYPASS_TMT_VALID(bypass_timeout
)) {
5306 rc
= rte_pmd_ixgbe_bypass_wd_timeout_store(port_id
,
5310 printf("Failed to set timeout value %u "
5311 "for port %d, errto code: %d.\n",
5312 bypass_timeout
, port_id
, rc
);
5316 /* Set the bypass event to transition to bypass mode. */
5317 rc
= rte_pmd_ixgbe_bypass_event_store(port_id
, bypass_event
,
5322 printf("\t Failed to set bypass event for port = %d.\n",
5326 cmdline_parse_token_string_t cmd_setbypass_event_set
=
5327 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_event_result
,
5329 cmdline_parse_token_string_t cmd_setbypass_event_bypass
=
5330 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_event_result
,
5332 cmdline_parse_token_string_t cmd_setbypass_event_event
=
5333 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_event_result
,
5335 cmdline_parse_token_string_t cmd_setbypass_event_event_value
=
5336 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_event_result
,
5337 event_value
, "none#timeout#os_off#os_on#power_on#power_off");
5338 cmdline_parse_token_string_t cmd_setbypass_event_mode
=
5339 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_event_result
,
5341 cmdline_parse_token_string_t cmd_setbypass_event_mode_value
=
5342 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_event_result
,
5343 mode_value
, "normal#bypass#isolate");
5344 cmdline_parse_token_num_t cmd_setbypass_event_port
=
5345 TOKEN_NUM_INITIALIZER(struct cmd_set_bypass_event_result
,
5348 cmdline_parse_inst_t cmd_set_bypass_event
= {
5349 .f
= cmd_set_bypass_event_parsed
,
5350 .help_str
= "set bypass event none|timeout|os_on|os_off|power_on|"
5351 "power_off mode normal|bypass|isolate <port_id>: "
5352 "Set the NIC bypass event mode for port_id",
5355 (void *)&cmd_setbypass_event_set
,
5356 (void *)&cmd_setbypass_event_bypass
,
5357 (void *)&cmd_setbypass_event_event
,
5358 (void *)&cmd_setbypass_event_event_value
,
5359 (void *)&cmd_setbypass_event_mode
,
5360 (void *)&cmd_setbypass_event_mode_value
,
5361 (void *)&cmd_setbypass_event_port
,
5367 /* *** SET NIC BYPASS TIMEOUT *** */
5368 struct cmd_set_bypass_timeout_result
{
5369 cmdline_fixed_string_t set
;
5370 cmdline_fixed_string_t bypass
;
5371 cmdline_fixed_string_t timeout
;
5372 cmdline_fixed_string_t value
;
5376 cmd_set_bypass_timeout_parsed(void *parsed_result
,
5377 __attribute__((unused
)) struct cmdline
*cl
,
5378 __attribute__((unused
)) void *data
)
5380 __rte_unused
struct cmd_set_bypass_timeout_result
*res
= parsed_result
;
5382 #if defined RTE_LIBRTE_IXGBE_PMD && defined RTE_LIBRTE_IXGBE_BYPASS
5383 if (!strcmp(res
->value
, "1.5"))
5384 bypass_timeout
= RTE_PMD_IXGBE_BYPASS_TMT_1_5_SEC
;
5385 else if (!strcmp(res
->value
, "2"))
5386 bypass_timeout
= RTE_PMD_IXGBE_BYPASS_TMT_2_SEC
;
5387 else if (!strcmp(res
->value
, "3"))
5388 bypass_timeout
= RTE_PMD_IXGBE_BYPASS_TMT_3_SEC
;
5389 else if (!strcmp(res
->value
, "4"))
5390 bypass_timeout
= RTE_PMD_IXGBE_BYPASS_TMT_4_SEC
;
5391 else if (!strcmp(res
->value
, "8"))
5392 bypass_timeout
= RTE_PMD_IXGBE_BYPASS_TMT_8_SEC
;
5393 else if (!strcmp(res
->value
, "16"))
5394 bypass_timeout
= RTE_PMD_IXGBE_BYPASS_TMT_16_SEC
;
5395 else if (!strcmp(res
->value
, "32"))
5396 bypass_timeout
= RTE_PMD_IXGBE_BYPASS_TMT_32_SEC
;
5398 bypass_timeout
= RTE_PMD_IXGBE_BYPASS_TMT_OFF
;
5402 cmdline_parse_token_string_t cmd_setbypass_timeout_set
=
5403 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_timeout_result
,
5405 cmdline_parse_token_string_t cmd_setbypass_timeout_bypass
=
5406 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_timeout_result
,
5408 cmdline_parse_token_string_t cmd_setbypass_timeout_timeout
=
5409 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_timeout_result
,
5410 timeout
, "timeout");
5411 cmdline_parse_token_string_t cmd_setbypass_timeout_value
=
5412 TOKEN_STRING_INITIALIZER(struct cmd_set_bypass_timeout_result
,
5413 value
, "0#1.5#2#3#4#8#16#32");
5415 cmdline_parse_inst_t cmd_set_bypass_timeout
= {
5416 .f
= cmd_set_bypass_timeout_parsed
,
5417 .help_str
= "set bypass timeout 0|1.5|2|3|4|8|16|32: "
5418 "Set the NIC bypass watchdog timeout in seconds",
5421 (void *)&cmd_setbypass_timeout_set
,
5422 (void *)&cmd_setbypass_timeout_bypass
,
5423 (void *)&cmd_setbypass_timeout_timeout
,
5424 (void *)&cmd_setbypass_timeout_value
,
5429 /* *** SHOW NIC BYPASS MODE *** */
5430 struct cmd_show_bypass_config_result
{
5431 cmdline_fixed_string_t show
;
5432 cmdline_fixed_string_t bypass
;
5433 cmdline_fixed_string_t config
;
5438 cmd_show_bypass_config_parsed(void *parsed_result
,
5439 __attribute__((unused
)) struct cmdline
*cl
,
5440 __attribute__((unused
)) void *data
)
5442 struct cmd_show_bypass_config_result
*res
= parsed_result
;
5443 portid_t port_id
= res
->port_id
;
5445 #if defined RTE_LIBRTE_IXGBE_PMD && defined RTE_LIBRTE_IXGBE_BYPASS
5446 uint32_t event_mode
;
5447 uint32_t bypass_mode
;
5448 uint32_t timeout
= bypass_timeout
;
5451 static const char * const timeouts
[RTE_PMD_IXGBE_BYPASS_TMT_NUM
] =
5452 {"off", "1.5", "2", "3", "4", "8", "16", "32"};
5453 static const char * const modes
[RTE_PMD_IXGBE_BYPASS_MODE_NUM
] =
5454 {"UNKNOWN", "normal", "bypass", "isolate"};
5455 static const char * const events
[RTE_PMD_IXGBE_BYPASS_EVENT_NUM
] = {
5462 int num_events
= (sizeof events
) / (sizeof events
[0]);
5464 /* Display the bypass mode.*/
5465 if (rte_pmd_ixgbe_bypass_state_show(port_id
, &bypass_mode
) != 0) {
5466 printf("\tFailed to get bypass mode for port = %d\n", port_id
);
5470 if (!RTE_PMD_IXGBE_BYPASS_MODE_VALID(bypass_mode
))
5471 bypass_mode
= RTE_PMD_IXGBE_BYPASS_MODE_NONE
;
5473 printf("\tbypass mode = %s\n", modes
[bypass_mode
]);
5476 /* Display the bypass timeout.*/
5477 if (!RTE_PMD_IXGBE_BYPASS_TMT_VALID(timeout
))
5478 timeout
= RTE_PMD_IXGBE_BYPASS_TMT_OFF
;
5480 printf("\tbypass timeout = %s\n", timeouts
[timeout
]);
5482 /* Display the bypass events and associated modes. */
5483 for (i
= RTE_PMD_IXGBE_BYPASS_EVENT_START
; i
< num_events
; i
++) {
5485 if (rte_pmd_ixgbe_bypass_event_show(port_id
, i
, &event_mode
)) {
5486 printf("\tFailed to get bypass mode for event = %s\n",
5489 if (!RTE_PMD_IXGBE_BYPASS_MODE_VALID(event_mode
))
5490 event_mode
= RTE_PMD_IXGBE_BYPASS_MODE_NONE
;
5492 printf("\tbypass event: %-16s = %s\n", events
[i
],
5498 printf("\tFailed to get bypass configuration for port = %d\n",
5502 cmdline_parse_token_string_t cmd_showbypass_config_show
=
5503 TOKEN_STRING_INITIALIZER(struct cmd_show_bypass_config_result
,
5505 cmdline_parse_token_string_t cmd_showbypass_config_bypass
=
5506 TOKEN_STRING_INITIALIZER(struct cmd_show_bypass_config_result
,
5508 cmdline_parse_token_string_t cmd_showbypass_config_config
=
5509 TOKEN_STRING_INITIALIZER(struct cmd_show_bypass_config_result
,
5511 cmdline_parse_token_num_t cmd_showbypass_config_port
=
5512 TOKEN_NUM_INITIALIZER(struct cmd_show_bypass_config_result
,
5515 cmdline_parse_inst_t cmd_show_bypass_config
= {
5516 .f
= cmd_show_bypass_config_parsed
,
5517 .help_str
= "show bypass config <port_id>: "
5518 "Show the NIC bypass config for port_id",
5521 (void *)&cmd_showbypass_config_show
,
5522 (void *)&cmd_showbypass_config_bypass
,
5523 (void *)&cmd_showbypass_config_config
,
5524 (void *)&cmd_showbypass_config_port
,
5529 #ifdef RTE_LIBRTE_PMD_BOND
5530 /* *** SET BONDING MODE *** */
5531 struct cmd_set_bonding_mode_result
{
5532 cmdline_fixed_string_t set
;
5533 cmdline_fixed_string_t bonding
;
5534 cmdline_fixed_string_t mode
;
5539 static void cmd_set_bonding_mode_parsed(void *parsed_result
,
5540 __attribute__((unused
)) struct cmdline
*cl
,
5541 __attribute__((unused
)) void *data
)
5543 struct cmd_set_bonding_mode_result
*res
= parsed_result
;
5544 portid_t port_id
= res
->port_id
;
5546 /* Set the bonding mode for the relevant port. */
5547 if (0 != rte_eth_bond_mode_set(port_id
, res
->value
))
5548 printf("\t Failed to set bonding mode for port = %d.\n", port_id
);
5551 cmdline_parse_token_string_t cmd_setbonding_mode_set
=
5552 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_mode_result
,
5554 cmdline_parse_token_string_t cmd_setbonding_mode_bonding
=
5555 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_mode_result
,
5556 bonding
, "bonding");
5557 cmdline_parse_token_string_t cmd_setbonding_mode_mode
=
5558 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_mode_result
,
5560 cmdline_parse_token_num_t cmd_setbonding_mode_value
=
5561 TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_mode_result
,
5563 cmdline_parse_token_num_t cmd_setbonding_mode_port
=
5564 TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_mode_result
,
5567 cmdline_parse_inst_t cmd_set_bonding_mode
= {
5568 .f
= cmd_set_bonding_mode_parsed
,
5569 .help_str
= "set bonding mode <mode_value> <port_id>: "
5570 "Set the bonding mode for port_id",
5573 (void *) &cmd_setbonding_mode_set
,
5574 (void *) &cmd_setbonding_mode_bonding
,
5575 (void *) &cmd_setbonding_mode_mode
,
5576 (void *) &cmd_setbonding_mode_value
,
5577 (void *) &cmd_setbonding_mode_port
,
5582 /* *** SET BONDING SLOW_QUEUE SW/HW *** */
5583 struct cmd_set_bonding_lacp_dedicated_queues_result
{
5584 cmdline_fixed_string_t set
;
5585 cmdline_fixed_string_t bonding
;
5586 cmdline_fixed_string_t lacp
;
5587 cmdline_fixed_string_t dedicated_queues
;
5589 cmdline_fixed_string_t mode
;
5592 static void cmd_set_bonding_lacp_dedicated_queues_parsed(void *parsed_result
,
5593 __attribute__((unused
)) struct cmdline
*cl
,
5594 __attribute__((unused
)) void *data
)
5596 struct cmd_set_bonding_lacp_dedicated_queues_result
*res
= parsed_result
;
5597 portid_t port_id
= res
->port_id
;
5598 struct rte_port
*port
;
5600 port
= &ports
[port_id
];
5602 /** Check if the port is not started **/
5603 if (port
->port_status
!= RTE_PORT_STOPPED
) {
5604 printf("Please stop port %d first\n", port_id
);
5608 if (!strcmp(res
->mode
, "enable")) {
5609 if (rte_eth_bond_8023ad_dedicated_queues_enable(port_id
) == 0)
5610 printf("Dedicate queues for LACP control packets"
5613 printf("Enabling dedicate queues for LACP control "
5614 "packets on port %d failed\n", port_id
);
5615 } else if (!strcmp(res
->mode
, "disable")) {
5616 if (rte_eth_bond_8023ad_dedicated_queues_disable(port_id
) == 0)
5617 printf("Dedicated queues for LACP control packets "
5620 printf("Disabling dedicated queues for LACP control "
5621 "traffic on port %d failed\n", port_id
);
5625 cmdline_parse_token_string_t cmd_setbonding_lacp_dedicated_queues_set
=
5626 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_lacp_dedicated_queues_result
,
5628 cmdline_parse_token_string_t cmd_setbonding_lacp_dedicated_queues_bonding
=
5629 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_lacp_dedicated_queues_result
,
5630 bonding
, "bonding");
5631 cmdline_parse_token_string_t cmd_setbonding_lacp_dedicated_queues_lacp
=
5632 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_lacp_dedicated_queues_result
,
5634 cmdline_parse_token_string_t cmd_setbonding_lacp_dedicated_queues_dedicated_queues
=
5635 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_lacp_dedicated_queues_result
,
5636 dedicated_queues
, "dedicated_queues");
5637 cmdline_parse_token_num_t cmd_setbonding_lacp_dedicated_queues_port_id
=
5638 TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_lacp_dedicated_queues_result
,
5640 cmdline_parse_token_string_t cmd_setbonding_lacp_dedicated_queues_mode
=
5641 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_lacp_dedicated_queues_result
,
5642 mode
, "enable#disable");
5644 cmdline_parse_inst_t cmd_set_lacp_dedicated_queues
= {
5645 .f
= cmd_set_bonding_lacp_dedicated_queues_parsed
,
5646 .help_str
= "set bonding lacp dedicated_queues <port_id> "
5648 "Enable/disable dedicated queues for LACP control traffic for port_id",
5651 (void *)&cmd_setbonding_lacp_dedicated_queues_set
,
5652 (void *)&cmd_setbonding_lacp_dedicated_queues_bonding
,
5653 (void *)&cmd_setbonding_lacp_dedicated_queues_lacp
,
5654 (void *)&cmd_setbonding_lacp_dedicated_queues_dedicated_queues
,
5655 (void *)&cmd_setbonding_lacp_dedicated_queues_port_id
,
5656 (void *)&cmd_setbonding_lacp_dedicated_queues_mode
,
5661 /* *** SET BALANCE XMIT POLICY *** */
5662 struct cmd_set_bonding_balance_xmit_policy_result
{
5663 cmdline_fixed_string_t set
;
5664 cmdline_fixed_string_t bonding
;
5665 cmdline_fixed_string_t balance_xmit_policy
;
5667 cmdline_fixed_string_t policy
;
5670 static void cmd_set_bonding_balance_xmit_policy_parsed(void *parsed_result
,
5671 __attribute__((unused
)) struct cmdline
*cl
,
5672 __attribute__((unused
)) void *data
)
5674 struct cmd_set_bonding_balance_xmit_policy_result
*res
= parsed_result
;
5675 portid_t port_id
= res
->port_id
;
5678 if (!strcmp(res
->policy
, "l2")) {
5679 policy
= BALANCE_XMIT_POLICY_LAYER2
;
5680 } else if (!strcmp(res
->policy
, "l23")) {
5681 policy
= BALANCE_XMIT_POLICY_LAYER23
;
5682 } else if (!strcmp(res
->policy
, "l34")) {
5683 policy
= BALANCE_XMIT_POLICY_LAYER34
;
5685 printf("\t Invalid xmit policy selection");
5689 /* Set the bonding mode for the relevant port. */
5690 if (0 != rte_eth_bond_xmit_policy_set(port_id
, policy
)) {
5691 printf("\t Failed to set bonding balance xmit policy for port = %d.\n",
5696 cmdline_parse_token_string_t cmd_setbonding_balance_xmit_policy_set
=
5697 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_balance_xmit_policy_result
,
5699 cmdline_parse_token_string_t cmd_setbonding_balance_xmit_policy_bonding
=
5700 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_balance_xmit_policy_result
,
5701 bonding
, "bonding");
5702 cmdline_parse_token_string_t cmd_setbonding_balance_xmit_policy_balance_xmit_policy
=
5703 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_balance_xmit_policy_result
,
5704 balance_xmit_policy
, "balance_xmit_policy");
5705 cmdline_parse_token_num_t cmd_setbonding_balance_xmit_policy_port
=
5706 TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_balance_xmit_policy_result
,
5708 cmdline_parse_token_string_t cmd_setbonding_balance_xmit_policy_policy
=
5709 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_balance_xmit_policy_result
,
5710 policy
, "l2#l23#l34");
5712 cmdline_parse_inst_t cmd_set_balance_xmit_policy
= {
5713 .f
= cmd_set_bonding_balance_xmit_policy_parsed
,
5714 .help_str
= "set bonding balance_xmit_policy <port_id> "
5716 "Set the bonding balance_xmit_policy for port_id",
5719 (void *)&cmd_setbonding_balance_xmit_policy_set
,
5720 (void *)&cmd_setbonding_balance_xmit_policy_bonding
,
5721 (void *)&cmd_setbonding_balance_xmit_policy_balance_xmit_policy
,
5722 (void *)&cmd_setbonding_balance_xmit_policy_port
,
5723 (void *)&cmd_setbonding_balance_xmit_policy_policy
,
5728 /* *** SHOW NIC BONDING CONFIGURATION *** */
5729 struct cmd_show_bonding_config_result
{
5730 cmdline_fixed_string_t show
;
5731 cmdline_fixed_string_t bonding
;
5732 cmdline_fixed_string_t config
;
5736 static void cmd_show_bonding_config_parsed(void *parsed_result
,
5737 __attribute__((unused
)) struct cmdline
*cl
,
5738 __attribute__((unused
)) void *data
)
5740 struct cmd_show_bonding_config_result
*res
= parsed_result
;
5741 int bonding_mode
, agg_mode
;
5742 portid_t slaves
[RTE_MAX_ETHPORTS
];
5743 int num_slaves
, num_active_slaves
;
5746 portid_t port_id
= res
->port_id
;
5748 /* Display the bonding mode.*/
5749 bonding_mode
= rte_eth_bond_mode_get(port_id
);
5750 if (bonding_mode
< 0) {
5751 printf("\tFailed to get bonding mode for port = %d\n", port_id
);
5754 printf("\tBonding mode: %d\n", bonding_mode
);
5756 if (bonding_mode
== BONDING_MODE_BALANCE
) {
5757 int balance_xmit_policy
;
5759 balance_xmit_policy
= rte_eth_bond_xmit_policy_get(port_id
);
5760 if (balance_xmit_policy
< 0) {
5761 printf("\tFailed to get balance xmit policy for port = %d\n",
5765 printf("\tBalance Xmit Policy: ");
5767 switch (balance_xmit_policy
) {
5768 case BALANCE_XMIT_POLICY_LAYER2
:
5769 printf("BALANCE_XMIT_POLICY_LAYER2");
5771 case BALANCE_XMIT_POLICY_LAYER23
:
5772 printf("BALANCE_XMIT_POLICY_LAYER23");
5774 case BALANCE_XMIT_POLICY_LAYER34
:
5775 printf("BALANCE_XMIT_POLICY_LAYER34");
5782 if (bonding_mode
== BONDING_MODE_8023AD
) {
5783 agg_mode
= rte_eth_bond_8023ad_agg_selection_get(port_id
);
5784 printf("\tIEEE802.3AD Aggregator Mode: ");
5787 printf("bandwidth");
5799 num_slaves
= rte_eth_bond_slaves_get(port_id
, slaves
, RTE_MAX_ETHPORTS
);
5801 if (num_slaves
< 0) {
5802 printf("\tFailed to get slave list for port = %d\n", port_id
);
5805 if (num_slaves
> 0) {
5806 printf("\tSlaves (%d): [", num_slaves
);
5807 for (i
= 0; i
< num_slaves
- 1; i
++)
5808 printf("%d ", slaves
[i
]);
5810 printf("%d]\n", slaves
[num_slaves
- 1]);
5812 printf("\tSlaves: []\n");
5816 num_active_slaves
= rte_eth_bond_active_slaves_get(port_id
, slaves
,
5819 if (num_active_slaves
< 0) {
5820 printf("\tFailed to get active slave list for port = %d\n", port_id
);
5823 if (num_active_slaves
> 0) {
5824 printf("\tActive Slaves (%d): [", num_active_slaves
);
5825 for (i
= 0; i
< num_active_slaves
- 1; i
++)
5826 printf("%d ", slaves
[i
]);
5828 printf("%d]\n", slaves
[num_active_slaves
- 1]);
5831 printf("\tActive Slaves: []\n");
5835 primary_id
= rte_eth_bond_primary_get(port_id
);
5836 if (primary_id
< 0) {
5837 printf("\tFailed to get primary slave for port = %d\n", port_id
);
5840 printf("\tPrimary: [%d]\n", primary_id
);
5844 cmdline_parse_token_string_t cmd_showbonding_config_show
=
5845 TOKEN_STRING_INITIALIZER(struct cmd_show_bonding_config_result
,
5847 cmdline_parse_token_string_t cmd_showbonding_config_bonding
=
5848 TOKEN_STRING_INITIALIZER(struct cmd_show_bonding_config_result
,
5849 bonding
, "bonding");
5850 cmdline_parse_token_string_t cmd_showbonding_config_config
=
5851 TOKEN_STRING_INITIALIZER(struct cmd_show_bonding_config_result
,
5853 cmdline_parse_token_num_t cmd_showbonding_config_port
=
5854 TOKEN_NUM_INITIALIZER(struct cmd_show_bonding_config_result
,
5857 cmdline_parse_inst_t cmd_show_bonding_config
= {
5858 .f
= cmd_show_bonding_config_parsed
,
5859 .help_str
= "show bonding config <port_id>: "
5860 "Show the bonding config for port_id",
5863 (void *)&cmd_showbonding_config_show
,
5864 (void *)&cmd_showbonding_config_bonding
,
5865 (void *)&cmd_showbonding_config_config
,
5866 (void *)&cmd_showbonding_config_port
,
5871 /* *** SET BONDING PRIMARY *** */
5872 struct cmd_set_bonding_primary_result
{
5873 cmdline_fixed_string_t set
;
5874 cmdline_fixed_string_t bonding
;
5875 cmdline_fixed_string_t primary
;
5880 static void cmd_set_bonding_primary_parsed(void *parsed_result
,
5881 __attribute__((unused
)) struct cmdline
*cl
,
5882 __attribute__((unused
)) void *data
)
5884 struct cmd_set_bonding_primary_result
*res
= parsed_result
;
5885 portid_t master_port_id
= res
->port_id
;
5886 portid_t slave_port_id
= res
->slave_id
;
5888 /* Set the primary slave for a bonded device. */
5889 if (0 != rte_eth_bond_primary_set(master_port_id
, slave_port_id
)) {
5890 printf("\t Failed to set primary slave for port = %d.\n",
5897 cmdline_parse_token_string_t cmd_setbonding_primary_set
=
5898 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_primary_result
,
5900 cmdline_parse_token_string_t cmd_setbonding_primary_bonding
=
5901 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_primary_result
,
5902 bonding
, "bonding");
5903 cmdline_parse_token_string_t cmd_setbonding_primary_primary
=
5904 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_primary_result
,
5905 primary
, "primary");
5906 cmdline_parse_token_num_t cmd_setbonding_primary_slave
=
5907 TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_primary_result
,
5909 cmdline_parse_token_num_t cmd_setbonding_primary_port
=
5910 TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_primary_result
,
5913 cmdline_parse_inst_t cmd_set_bonding_primary
= {
5914 .f
= cmd_set_bonding_primary_parsed
,
5915 .help_str
= "set bonding primary <slave_id> <port_id>: "
5916 "Set the primary slave for port_id",
5919 (void *)&cmd_setbonding_primary_set
,
5920 (void *)&cmd_setbonding_primary_bonding
,
5921 (void *)&cmd_setbonding_primary_primary
,
5922 (void *)&cmd_setbonding_primary_slave
,
5923 (void *)&cmd_setbonding_primary_port
,
5928 /* *** ADD SLAVE *** */
5929 struct cmd_add_bonding_slave_result
{
5930 cmdline_fixed_string_t add
;
5931 cmdline_fixed_string_t bonding
;
5932 cmdline_fixed_string_t slave
;
5937 static void cmd_add_bonding_slave_parsed(void *parsed_result
,
5938 __attribute__((unused
)) struct cmdline
*cl
,
5939 __attribute__((unused
)) void *data
)
5941 struct cmd_add_bonding_slave_result
*res
= parsed_result
;
5942 portid_t master_port_id
= res
->port_id
;
5943 portid_t slave_port_id
= res
->slave_id
;
5945 /* add the slave for a bonded device. */
5946 if (0 != rte_eth_bond_slave_add(master_port_id
, slave_port_id
)) {
5947 printf("\t Failed to add slave %d to master port = %d.\n",
5948 slave_port_id
, master_port_id
);
5952 set_port_slave_flag(slave_port_id
);
5955 cmdline_parse_token_string_t cmd_addbonding_slave_add
=
5956 TOKEN_STRING_INITIALIZER(struct cmd_add_bonding_slave_result
,
5958 cmdline_parse_token_string_t cmd_addbonding_slave_bonding
=
5959 TOKEN_STRING_INITIALIZER(struct cmd_add_bonding_slave_result
,
5960 bonding
, "bonding");
5961 cmdline_parse_token_string_t cmd_addbonding_slave_slave
=
5962 TOKEN_STRING_INITIALIZER(struct cmd_add_bonding_slave_result
,
5964 cmdline_parse_token_num_t cmd_addbonding_slave_slaveid
=
5965 TOKEN_NUM_INITIALIZER(struct cmd_add_bonding_slave_result
,
5967 cmdline_parse_token_num_t cmd_addbonding_slave_port
=
5968 TOKEN_NUM_INITIALIZER(struct cmd_add_bonding_slave_result
,
5971 cmdline_parse_inst_t cmd_add_bonding_slave
= {
5972 .f
= cmd_add_bonding_slave_parsed
,
5973 .help_str
= "add bonding slave <slave_id> <port_id>: "
5974 "Add a slave device to a bonded device",
5977 (void *)&cmd_addbonding_slave_add
,
5978 (void *)&cmd_addbonding_slave_bonding
,
5979 (void *)&cmd_addbonding_slave_slave
,
5980 (void *)&cmd_addbonding_slave_slaveid
,
5981 (void *)&cmd_addbonding_slave_port
,
5986 /* *** REMOVE SLAVE *** */
5987 struct cmd_remove_bonding_slave_result
{
5988 cmdline_fixed_string_t remove
;
5989 cmdline_fixed_string_t bonding
;
5990 cmdline_fixed_string_t slave
;
5995 static void cmd_remove_bonding_slave_parsed(void *parsed_result
,
5996 __attribute__((unused
)) struct cmdline
*cl
,
5997 __attribute__((unused
)) void *data
)
5999 struct cmd_remove_bonding_slave_result
*res
= parsed_result
;
6000 portid_t master_port_id
= res
->port_id
;
6001 portid_t slave_port_id
= res
->slave_id
;
6003 /* remove the slave from a bonded device. */
6004 if (0 != rte_eth_bond_slave_remove(master_port_id
, slave_port_id
)) {
6005 printf("\t Failed to remove slave %d from master port = %d.\n",
6006 slave_port_id
, master_port_id
);
6010 clear_port_slave_flag(slave_port_id
);
6013 cmdline_parse_token_string_t cmd_removebonding_slave_remove
=
6014 TOKEN_STRING_INITIALIZER(struct cmd_remove_bonding_slave_result
,
6016 cmdline_parse_token_string_t cmd_removebonding_slave_bonding
=
6017 TOKEN_STRING_INITIALIZER(struct cmd_remove_bonding_slave_result
,
6018 bonding
, "bonding");
6019 cmdline_parse_token_string_t cmd_removebonding_slave_slave
=
6020 TOKEN_STRING_INITIALIZER(struct cmd_remove_bonding_slave_result
,
6022 cmdline_parse_token_num_t cmd_removebonding_slave_slaveid
=
6023 TOKEN_NUM_INITIALIZER(struct cmd_remove_bonding_slave_result
,
6025 cmdline_parse_token_num_t cmd_removebonding_slave_port
=
6026 TOKEN_NUM_INITIALIZER(struct cmd_remove_bonding_slave_result
,
6029 cmdline_parse_inst_t cmd_remove_bonding_slave
= {
6030 .f
= cmd_remove_bonding_slave_parsed
,
6031 .help_str
= "remove bonding slave <slave_id> <port_id>: "
6032 "Remove a slave device from a bonded device",
6035 (void *)&cmd_removebonding_slave_remove
,
6036 (void *)&cmd_removebonding_slave_bonding
,
6037 (void *)&cmd_removebonding_slave_slave
,
6038 (void *)&cmd_removebonding_slave_slaveid
,
6039 (void *)&cmd_removebonding_slave_port
,
6044 /* *** CREATE BONDED DEVICE *** */
6045 struct cmd_create_bonded_device_result
{
6046 cmdline_fixed_string_t create
;
6047 cmdline_fixed_string_t bonded
;
6048 cmdline_fixed_string_t device
;
6053 static int bond_dev_num
= 0;
6055 static void cmd_create_bonded_device_parsed(void *parsed_result
,
6056 __attribute__((unused
)) struct cmdline
*cl
,
6057 __attribute__((unused
)) void *data
)
6059 struct cmd_create_bonded_device_result
*res
= parsed_result
;
6060 char ethdev_name
[RTE_ETH_NAME_MAX_LEN
];
6063 if (test_done
== 0) {
6064 printf("Please stop forwarding first\n");
6068 snprintf(ethdev_name
, RTE_ETH_NAME_MAX_LEN
, "net_bonding_testpmd_%d",
6071 /* Create a new bonded device. */
6072 port_id
= rte_eth_bond_create(ethdev_name
, res
->mode
, res
->socket
);
6074 printf("\t Failed to create bonded device.\n");
6077 printf("Created new bonded device %s on (port %d).\n", ethdev_name
,
6080 /* Update number of ports */
6081 nb_ports
= rte_eth_dev_count_avail();
6082 reconfig(port_id
, res
->socket
);
6083 rte_eth_promiscuous_enable(port_id
);
6084 ports
[port_id
].need_setup
= 0;
6085 ports
[port_id
].port_status
= RTE_PORT_STOPPED
;
6090 cmdline_parse_token_string_t cmd_createbonded_device_create
=
6091 TOKEN_STRING_INITIALIZER(struct cmd_create_bonded_device_result
,
6093 cmdline_parse_token_string_t cmd_createbonded_device_bonded
=
6094 TOKEN_STRING_INITIALIZER(struct cmd_create_bonded_device_result
,
6096 cmdline_parse_token_string_t cmd_createbonded_device_device
=
6097 TOKEN_STRING_INITIALIZER(struct cmd_create_bonded_device_result
,
6099 cmdline_parse_token_num_t cmd_createbonded_device_mode
=
6100 TOKEN_NUM_INITIALIZER(struct cmd_create_bonded_device_result
,
6102 cmdline_parse_token_num_t cmd_createbonded_device_socket
=
6103 TOKEN_NUM_INITIALIZER(struct cmd_create_bonded_device_result
,
6106 cmdline_parse_inst_t cmd_create_bonded_device
= {
6107 .f
= cmd_create_bonded_device_parsed
,
6108 .help_str
= "create bonded device <mode> <socket>: "
6109 "Create a new bonded device with specific bonding mode and socket",
6112 (void *)&cmd_createbonded_device_create
,
6113 (void *)&cmd_createbonded_device_bonded
,
6114 (void *)&cmd_createbonded_device_device
,
6115 (void *)&cmd_createbonded_device_mode
,
6116 (void *)&cmd_createbonded_device_socket
,
6121 /* *** SET MAC ADDRESS IN BONDED DEVICE *** */
6122 struct cmd_set_bond_mac_addr_result
{
6123 cmdline_fixed_string_t set
;
6124 cmdline_fixed_string_t bonding
;
6125 cmdline_fixed_string_t mac_addr
;
6127 struct ether_addr address
;
6130 static void cmd_set_bond_mac_addr_parsed(void *parsed_result
,
6131 __attribute__((unused
)) struct cmdline
*cl
,
6132 __attribute__((unused
)) void *data
)
6134 struct cmd_set_bond_mac_addr_result
*res
= parsed_result
;
6137 if (port_id_is_invalid(res
->port_num
, ENABLED_WARN
))
6140 ret
= rte_eth_bond_mac_address_set(res
->port_num
, &res
->address
);
6142 /* check the return value and print it if is < 0 */
6144 printf("set_bond_mac_addr error: (%s)\n", strerror(-ret
));
6147 cmdline_parse_token_string_t cmd_set_bond_mac_addr_set
=
6148 TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mac_addr_result
, set
, "set");
6149 cmdline_parse_token_string_t cmd_set_bond_mac_addr_bonding
=
6150 TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mac_addr_result
, bonding
,
6152 cmdline_parse_token_string_t cmd_set_bond_mac_addr_mac
=
6153 TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mac_addr_result
, mac_addr
,
6155 cmdline_parse_token_num_t cmd_set_bond_mac_addr_portnum
=
6156 TOKEN_NUM_INITIALIZER(struct cmd_set_bond_mac_addr_result
,
6158 cmdline_parse_token_etheraddr_t cmd_set_bond_mac_addr_addr
=
6159 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_bond_mac_addr_result
, address
);
6161 cmdline_parse_inst_t cmd_set_bond_mac_addr
= {
6162 .f
= cmd_set_bond_mac_addr_parsed
,
6164 .help_str
= "set bonding mac_addr <port_id> <mac_addr>",
6166 (void *)&cmd_set_bond_mac_addr_set
,
6167 (void *)&cmd_set_bond_mac_addr_bonding
,
6168 (void *)&cmd_set_bond_mac_addr_mac
,
6169 (void *)&cmd_set_bond_mac_addr_portnum
,
6170 (void *)&cmd_set_bond_mac_addr_addr
,
6176 /* *** SET LINK STATUS MONITORING POLLING PERIOD ON BONDED DEVICE *** */
6177 struct cmd_set_bond_mon_period_result
{
6178 cmdline_fixed_string_t set
;
6179 cmdline_fixed_string_t bonding
;
6180 cmdline_fixed_string_t mon_period
;
6185 static void cmd_set_bond_mon_period_parsed(void *parsed_result
,
6186 __attribute__((unused
)) struct cmdline
*cl
,
6187 __attribute__((unused
)) void *data
)
6189 struct cmd_set_bond_mon_period_result
*res
= parsed_result
;
6192 ret
= rte_eth_bond_link_monitoring_set(res
->port_num
, res
->period_ms
);
6194 /* check the return value and print it if is < 0 */
6196 printf("set_bond_mac_addr error: (%s)\n", strerror(-ret
));
6199 cmdline_parse_token_string_t cmd_set_bond_mon_period_set
=
6200 TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result
,
6202 cmdline_parse_token_string_t cmd_set_bond_mon_period_bonding
=
6203 TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result
,
6204 bonding
, "bonding");
6205 cmdline_parse_token_string_t cmd_set_bond_mon_period_mon_period
=
6206 TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result
,
6207 mon_period
, "mon_period");
6208 cmdline_parse_token_num_t cmd_set_bond_mon_period_portnum
=
6209 TOKEN_NUM_INITIALIZER(struct cmd_set_bond_mon_period_result
,
6211 cmdline_parse_token_num_t cmd_set_bond_mon_period_period_ms
=
6212 TOKEN_NUM_INITIALIZER(struct cmd_set_bond_mon_period_result
,
6215 cmdline_parse_inst_t cmd_set_bond_mon_period
= {
6216 .f
= cmd_set_bond_mon_period_parsed
,
6218 .help_str
= "set bonding mon_period <port_id> <period_ms>",
6220 (void *)&cmd_set_bond_mon_period_set
,
6221 (void *)&cmd_set_bond_mon_period_bonding
,
6222 (void *)&cmd_set_bond_mon_period_mon_period
,
6223 (void *)&cmd_set_bond_mon_period_portnum
,
6224 (void *)&cmd_set_bond_mon_period_period_ms
,
6231 struct cmd_set_bonding_agg_mode_policy_result
{
6232 cmdline_fixed_string_t set
;
6233 cmdline_fixed_string_t bonding
;
6234 cmdline_fixed_string_t agg_mode
;
6236 cmdline_fixed_string_t policy
;
6241 cmd_set_bonding_agg_mode(void *parsed_result
,
6242 __attribute__((unused
)) struct cmdline
*cl
,
6243 __attribute__((unused
)) void *data
)
6245 struct cmd_set_bonding_agg_mode_policy_result
*res
= parsed_result
;
6246 uint8_t policy
= AGG_BANDWIDTH
;
6248 if (!strcmp(res
->policy
, "bandwidth"))
6249 policy
= AGG_BANDWIDTH
;
6250 else if (!strcmp(res
->policy
, "stable"))
6251 policy
= AGG_STABLE
;
6252 else if (!strcmp(res
->policy
, "count"))
6255 rte_eth_bond_8023ad_agg_selection_set(res
->port_num
, policy
);
6259 cmdline_parse_token_string_t cmd_set_bonding_agg_mode_set
=
6260 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_agg_mode_policy_result
,
6262 cmdline_parse_token_string_t cmd_set_bonding_agg_mode_bonding
=
6263 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_agg_mode_policy_result
,
6264 bonding
, "bonding");
6266 cmdline_parse_token_string_t cmd_set_bonding_agg_mode_agg_mode
=
6267 TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_agg_mode_policy_result
,
6268 agg_mode
, "agg_mode");
6270 cmdline_parse_token_num_t cmd_set_bonding_agg_mode_portnum
=
6271 TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_agg_mode_policy_result
,
6274 cmdline_parse_token_string_t cmd_set_bonding_agg_mode_policy_string
=
6275 TOKEN_STRING_INITIALIZER(
6276 struct cmd_set_bonding_balance_xmit_policy_result
,
6277 policy
, "stable#bandwidth#count");
6279 cmdline_parse_inst_t cmd_set_bonding_agg_mode_policy
= {
6280 .f
= cmd_set_bonding_agg_mode
,
6282 .help_str
= "set bonding mode IEEE802.3AD aggregator policy <port_id> <agg_name>",
6284 (void *)&cmd_set_bonding_agg_mode_set
,
6285 (void *)&cmd_set_bonding_agg_mode_bonding
,
6286 (void *)&cmd_set_bonding_agg_mode_agg_mode
,
6287 (void *)&cmd_set_bonding_agg_mode_portnum
,
6288 (void *)&cmd_set_bonding_agg_mode_policy_string
,
6294 #endif /* RTE_LIBRTE_PMD_BOND */
6296 /* *** SET FORWARDING MODE *** */
6297 struct cmd_set_fwd_mode_result
{
6298 cmdline_fixed_string_t set
;
6299 cmdline_fixed_string_t fwd
;
6300 cmdline_fixed_string_t mode
;
6303 static void cmd_set_fwd_mode_parsed(void *parsed_result
,
6304 __attribute__((unused
)) struct cmdline
*cl
,
6305 __attribute__((unused
)) void *data
)
6307 struct cmd_set_fwd_mode_result
*res
= parsed_result
;
6310 set_pkt_forwarding_mode(res
->mode
);
6313 cmdline_parse_token_string_t cmd_setfwd_set
=
6314 TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_mode_result
, set
, "set");
6315 cmdline_parse_token_string_t cmd_setfwd_fwd
=
6316 TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_mode_result
, fwd
, "fwd");
6317 cmdline_parse_token_string_t cmd_setfwd_mode
=
6318 TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_mode_result
, mode
,
6319 "" /* defined at init */);
6321 cmdline_parse_inst_t cmd_set_fwd_mode
= {
6322 .f
= cmd_set_fwd_mode_parsed
,
6324 .help_str
= NULL
, /* defined at init */
6326 (void *)&cmd_setfwd_set
,
6327 (void *)&cmd_setfwd_fwd
,
6328 (void *)&cmd_setfwd_mode
,
6333 static void cmd_set_fwd_mode_init(void)
6336 static char token
[128];
6337 static char help
[256];
6338 cmdline_parse_token_string_t
*token_struct
;
6340 modes
= list_pkt_forwarding_modes();
6341 snprintf(help
, sizeof(help
), "set fwd %s: "
6342 "Set packet forwarding mode", modes
);
6343 cmd_set_fwd_mode
.help_str
= help
;
6345 /* string token separator is # */
6346 for (c
= token
; *modes
!= '\0'; modes
++)
6351 token_struct
= (cmdline_parse_token_string_t
*)cmd_set_fwd_mode
.tokens
[2];
6352 token_struct
->string_data
.str
= token
;
6355 /* *** SET RETRY FORWARDING MODE *** */
6356 struct cmd_set_fwd_retry_mode_result
{
6357 cmdline_fixed_string_t set
;
6358 cmdline_fixed_string_t fwd
;
6359 cmdline_fixed_string_t mode
;
6360 cmdline_fixed_string_t retry
;
6363 static void cmd_set_fwd_retry_mode_parsed(void *parsed_result
,
6364 __attribute__((unused
)) struct cmdline
*cl
,
6365 __attribute__((unused
)) void *data
)
6367 struct cmd_set_fwd_retry_mode_result
*res
= parsed_result
;
6370 set_pkt_forwarding_mode(res
->mode
);
6373 cmdline_parse_token_string_t cmd_setfwd_retry_set
=
6374 TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_retry_mode_result
,
6376 cmdline_parse_token_string_t cmd_setfwd_retry_fwd
=
6377 TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_retry_mode_result
,
6379 cmdline_parse_token_string_t cmd_setfwd_retry_mode
=
6380 TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_retry_mode_result
,
6382 "" /* defined at init */);
6383 cmdline_parse_token_string_t cmd_setfwd_retry_retry
=
6384 TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_retry_mode_result
,
6387 cmdline_parse_inst_t cmd_set_fwd_retry_mode
= {
6388 .f
= cmd_set_fwd_retry_mode_parsed
,
6390 .help_str
= NULL
, /* defined at init */
6392 (void *)&cmd_setfwd_retry_set
,
6393 (void *)&cmd_setfwd_retry_fwd
,
6394 (void *)&cmd_setfwd_retry_mode
,
6395 (void *)&cmd_setfwd_retry_retry
,
6400 static void cmd_set_fwd_retry_mode_init(void)
6403 static char token
[128];
6404 static char help
[256];
6405 cmdline_parse_token_string_t
*token_struct
;
6407 modes
= list_pkt_forwarding_retry_modes();
6408 snprintf(help
, sizeof(help
), "set fwd %s retry: "
6409 "Set packet forwarding mode with retry", modes
);
6410 cmd_set_fwd_retry_mode
.help_str
= help
;
6412 /* string token separator is # */
6413 for (c
= token
; *modes
!= '\0'; modes
++)
6418 token_struct
= (cmdline_parse_token_string_t
*)
6419 cmd_set_fwd_retry_mode
.tokens
[2];
6420 token_struct
->string_data
.str
= token
;
6423 /* *** SET BURST TX DELAY TIME RETRY NUMBER *** */
6424 struct cmd_set_burst_tx_retry_result
{
6425 cmdline_fixed_string_t set
;
6426 cmdline_fixed_string_t burst
;
6427 cmdline_fixed_string_t tx
;
6428 cmdline_fixed_string_t delay
;
6430 cmdline_fixed_string_t retry
;
6434 static void cmd_set_burst_tx_retry_parsed(void *parsed_result
,
6435 __attribute__((unused
)) struct cmdline
*cl
,
6436 __attribute__((unused
)) void *data
)
6438 struct cmd_set_burst_tx_retry_result
*res
= parsed_result
;
6440 if (!strcmp(res
->set
, "set") && !strcmp(res
->burst
, "burst")
6441 && !strcmp(res
->tx
, "tx")) {
6442 if (!strcmp(res
->delay
, "delay"))
6443 burst_tx_delay_time
= res
->time
;
6444 if (!strcmp(res
->retry
, "retry"))
6445 burst_tx_retry_num
= res
->retry_num
;
6450 cmdline_parse_token_string_t cmd_set_burst_tx_retry_set
=
6451 TOKEN_STRING_INITIALIZER(struct cmd_set_burst_tx_retry_result
, set
, "set");
6452 cmdline_parse_token_string_t cmd_set_burst_tx_retry_burst
=
6453 TOKEN_STRING_INITIALIZER(struct cmd_set_burst_tx_retry_result
, burst
,
6455 cmdline_parse_token_string_t cmd_set_burst_tx_retry_tx
=
6456 TOKEN_STRING_INITIALIZER(struct cmd_set_burst_tx_retry_result
, tx
, "tx");
6457 cmdline_parse_token_string_t cmd_set_burst_tx_retry_delay
=
6458 TOKEN_STRING_INITIALIZER(struct cmd_set_burst_tx_retry_result
, delay
, "delay");
6459 cmdline_parse_token_num_t cmd_set_burst_tx_retry_time
=
6460 TOKEN_NUM_INITIALIZER(struct cmd_set_burst_tx_retry_result
, time
, UINT32
);
6461 cmdline_parse_token_string_t cmd_set_burst_tx_retry_retry
=
6462 TOKEN_STRING_INITIALIZER(struct cmd_set_burst_tx_retry_result
, retry
, "retry");
6463 cmdline_parse_token_num_t cmd_set_burst_tx_retry_retry_num
=
6464 TOKEN_NUM_INITIALIZER(struct cmd_set_burst_tx_retry_result
, retry_num
, UINT32
);
6466 cmdline_parse_inst_t cmd_set_burst_tx_retry
= {
6467 .f
= cmd_set_burst_tx_retry_parsed
,
6468 .help_str
= "set burst tx delay <delay_usec> retry <num_retry>",
6470 (void *)&cmd_set_burst_tx_retry_set
,
6471 (void *)&cmd_set_burst_tx_retry_burst
,
6472 (void *)&cmd_set_burst_tx_retry_tx
,
6473 (void *)&cmd_set_burst_tx_retry_delay
,
6474 (void *)&cmd_set_burst_tx_retry_time
,
6475 (void *)&cmd_set_burst_tx_retry_retry
,
6476 (void *)&cmd_set_burst_tx_retry_retry_num
,
6481 /* *** SET PROMISC MODE *** */
6482 struct cmd_set_promisc_mode_result
{
6483 cmdline_fixed_string_t set
;
6484 cmdline_fixed_string_t promisc
;
6485 cmdline_fixed_string_t port_all
; /* valid if "allports" argument == 1 */
6486 uint16_t port_num
; /* valid if "allports" argument == 0 */
6487 cmdline_fixed_string_t mode
;
6490 static void cmd_set_promisc_mode_parsed(void *parsed_result
,
6491 __attribute__((unused
)) struct cmdline
*cl
,
6494 struct cmd_set_promisc_mode_result
*res
= parsed_result
;
6498 if (!strcmp(res
->mode
, "on"))
6505 RTE_ETH_FOREACH_DEV(i
) {
6507 rte_eth_promiscuous_enable(i
);
6509 rte_eth_promiscuous_disable(i
);
6514 rte_eth_promiscuous_enable(res
->port_num
);
6516 rte_eth_promiscuous_disable(res
->port_num
);
6520 cmdline_parse_token_string_t cmd_setpromisc_set
=
6521 TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result
, set
, "set");
6522 cmdline_parse_token_string_t cmd_setpromisc_promisc
=
6523 TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result
, promisc
,
6525 cmdline_parse_token_string_t cmd_setpromisc_portall
=
6526 TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result
, port_all
,
6528 cmdline_parse_token_num_t cmd_setpromisc_portnum
=
6529 TOKEN_NUM_INITIALIZER(struct cmd_set_promisc_mode_result
, port_num
,
6531 cmdline_parse_token_string_t cmd_setpromisc_mode
=
6532 TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result
, mode
,
6535 cmdline_parse_inst_t cmd_set_promisc_mode_all
= {
6536 .f
= cmd_set_promisc_mode_parsed
,
6538 .help_str
= "set promisc all on|off: Set promisc mode for all ports",
6540 (void *)&cmd_setpromisc_set
,
6541 (void *)&cmd_setpromisc_promisc
,
6542 (void *)&cmd_setpromisc_portall
,
6543 (void *)&cmd_setpromisc_mode
,
6548 cmdline_parse_inst_t cmd_set_promisc_mode_one
= {
6549 .f
= cmd_set_promisc_mode_parsed
,
6551 .help_str
= "set promisc <port_id> on|off: Set promisc mode on port_id",
6553 (void *)&cmd_setpromisc_set
,
6554 (void *)&cmd_setpromisc_promisc
,
6555 (void *)&cmd_setpromisc_portnum
,
6556 (void *)&cmd_setpromisc_mode
,
6561 /* *** SET ALLMULTI MODE *** */
6562 struct cmd_set_allmulti_mode_result
{
6563 cmdline_fixed_string_t set
;
6564 cmdline_fixed_string_t allmulti
;
6565 cmdline_fixed_string_t port_all
; /* valid if "allports" argument == 1 */
6566 uint16_t port_num
; /* valid if "allports" argument == 0 */
6567 cmdline_fixed_string_t mode
;
6570 static void cmd_set_allmulti_mode_parsed(void *parsed_result
,
6571 __attribute__((unused
)) struct cmdline
*cl
,
6574 struct cmd_set_allmulti_mode_result
*res
= parsed_result
;
6578 if (!strcmp(res
->mode
, "on"))
6585 RTE_ETH_FOREACH_DEV(i
) {
6587 rte_eth_allmulticast_enable(i
);
6589 rte_eth_allmulticast_disable(i
);
6594 rte_eth_allmulticast_enable(res
->port_num
);
6596 rte_eth_allmulticast_disable(res
->port_num
);
6600 cmdline_parse_token_string_t cmd_setallmulti_set
=
6601 TOKEN_STRING_INITIALIZER(struct cmd_set_allmulti_mode_result
, set
, "set");
6602 cmdline_parse_token_string_t cmd_setallmulti_allmulti
=
6603 TOKEN_STRING_INITIALIZER(struct cmd_set_allmulti_mode_result
, allmulti
,
6605 cmdline_parse_token_string_t cmd_setallmulti_portall
=
6606 TOKEN_STRING_INITIALIZER(struct cmd_set_allmulti_mode_result
, port_all
,
6608 cmdline_parse_token_num_t cmd_setallmulti_portnum
=
6609 TOKEN_NUM_INITIALIZER(struct cmd_set_allmulti_mode_result
, port_num
,
6611 cmdline_parse_token_string_t cmd_setallmulti_mode
=
6612 TOKEN_STRING_INITIALIZER(struct cmd_set_allmulti_mode_result
, mode
,
6615 cmdline_parse_inst_t cmd_set_allmulti_mode_all
= {
6616 .f
= cmd_set_allmulti_mode_parsed
,
6618 .help_str
= "set allmulti all on|off: Set allmulti mode for all ports",
6620 (void *)&cmd_setallmulti_set
,
6621 (void *)&cmd_setallmulti_allmulti
,
6622 (void *)&cmd_setallmulti_portall
,
6623 (void *)&cmd_setallmulti_mode
,
6628 cmdline_parse_inst_t cmd_set_allmulti_mode_one
= {
6629 .f
= cmd_set_allmulti_mode_parsed
,
6631 .help_str
= "set allmulti <port_id> on|off: "
6632 "Set allmulti mode on port_id",
6634 (void *)&cmd_setallmulti_set
,
6635 (void *)&cmd_setallmulti_allmulti
,
6636 (void *)&cmd_setallmulti_portnum
,
6637 (void *)&cmd_setallmulti_mode
,
6642 /* *** SETUP ETHERNET LINK FLOW CONTROL *** */
6643 struct cmd_link_flow_ctrl_set_result
{
6644 cmdline_fixed_string_t set
;
6645 cmdline_fixed_string_t flow_ctrl
;
6646 cmdline_fixed_string_t rx
;
6647 cmdline_fixed_string_t rx_lfc_mode
;
6648 cmdline_fixed_string_t tx
;
6649 cmdline_fixed_string_t tx_lfc_mode
;
6650 cmdline_fixed_string_t mac_ctrl_frame_fwd
;
6651 cmdline_fixed_string_t mac_ctrl_frame_fwd_mode
;
6652 cmdline_fixed_string_t autoneg_str
;
6653 cmdline_fixed_string_t autoneg
;
6654 cmdline_fixed_string_t hw_str
;
6655 uint32_t high_water
;
6656 cmdline_fixed_string_t lw_str
;
6658 cmdline_fixed_string_t pt_str
;
6659 uint16_t pause_time
;
6660 cmdline_fixed_string_t xon_str
;
6665 cmdline_parse_token_string_t cmd_lfc_set_set
=
6666 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6668 cmdline_parse_token_string_t cmd_lfc_set_flow_ctrl
=
6669 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6670 flow_ctrl
, "flow_ctrl");
6671 cmdline_parse_token_string_t cmd_lfc_set_rx
=
6672 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6674 cmdline_parse_token_string_t cmd_lfc_set_rx_mode
=
6675 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6676 rx_lfc_mode
, "on#off");
6677 cmdline_parse_token_string_t cmd_lfc_set_tx
=
6678 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6680 cmdline_parse_token_string_t cmd_lfc_set_tx_mode
=
6681 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6682 tx_lfc_mode
, "on#off");
6683 cmdline_parse_token_string_t cmd_lfc_set_high_water_str
=
6684 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6685 hw_str
, "high_water");
6686 cmdline_parse_token_num_t cmd_lfc_set_high_water
=
6687 TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6688 high_water
, UINT32
);
6689 cmdline_parse_token_string_t cmd_lfc_set_low_water_str
=
6690 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6691 lw_str
, "low_water");
6692 cmdline_parse_token_num_t cmd_lfc_set_low_water
=
6693 TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6695 cmdline_parse_token_string_t cmd_lfc_set_pause_time_str
=
6696 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6697 pt_str
, "pause_time");
6698 cmdline_parse_token_num_t cmd_lfc_set_pause_time
=
6699 TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6700 pause_time
, UINT16
);
6701 cmdline_parse_token_string_t cmd_lfc_set_send_xon_str
=
6702 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6703 xon_str
, "send_xon");
6704 cmdline_parse_token_num_t cmd_lfc_set_send_xon
=
6705 TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6707 cmdline_parse_token_string_t cmd_lfc_set_mac_ctrl_frame_fwd_mode
=
6708 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6709 mac_ctrl_frame_fwd
, "mac_ctrl_frame_fwd");
6710 cmdline_parse_token_string_t cmd_lfc_set_mac_ctrl_frame_fwd
=
6711 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6712 mac_ctrl_frame_fwd_mode
, "on#off");
6713 cmdline_parse_token_string_t cmd_lfc_set_autoneg_str
=
6714 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6715 autoneg_str
, "autoneg");
6716 cmdline_parse_token_string_t cmd_lfc_set_autoneg
=
6717 TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6719 cmdline_parse_token_num_t cmd_lfc_set_portid
=
6720 TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_set_result
,
6723 /* forward declaration */
6725 cmd_link_flow_ctrl_set_parsed(void *parsed_result
, struct cmdline
*cl
,
6728 cmdline_parse_inst_t cmd_link_flow_control_set
= {
6729 .f
= cmd_link_flow_ctrl_set_parsed
,
6731 .help_str
= "set flow_ctrl rx on|off tx on|off <high_water> "
6732 "<low_water> <pause_time> <send_xon> mac_ctrl_frame_fwd on|off "
6733 "autoneg on|off <port_id>: Configure the Ethernet flow control",
6735 (void *)&cmd_lfc_set_set
,
6736 (void *)&cmd_lfc_set_flow_ctrl
,
6737 (void *)&cmd_lfc_set_rx
,
6738 (void *)&cmd_lfc_set_rx_mode
,
6739 (void *)&cmd_lfc_set_tx
,
6740 (void *)&cmd_lfc_set_tx_mode
,
6741 (void *)&cmd_lfc_set_high_water
,
6742 (void *)&cmd_lfc_set_low_water
,
6743 (void *)&cmd_lfc_set_pause_time
,
6744 (void *)&cmd_lfc_set_send_xon
,
6745 (void *)&cmd_lfc_set_mac_ctrl_frame_fwd_mode
,
6746 (void *)&cmd_lfc_set_mac_ctrl_frame_fwd
,
6747 (void *)&cmd_lfc_set_autoneg_str
,
6748 (void *)&cmd_lfc_set_autoneg
,
6749 (void *)&cmd_lfc_set_portid
,
6754 cmdline_parse_inst_t cmd_link_flow_control_set_rx
= {
6755 .f
= cmd_link_flow_ctrl_set_parsed
,
6756 .data
= (void *)&cmd_link_flow_control_set_rx
,
6757 .help_str
= "set flow_ctrl rx on|off <port_id>: "
6758 "Change rx flow control parameter",
6760 (void *)&cmd_lfc_set_set
,
6761 (void *)&cmd_lfc_set_flow_ctrl
,
6762 (void *)&cmd_lfc_set_rx
,
6763 (void *)&cmd_lfc_set_rx_mode
,
6764 (void *)&cmd_lfc_set_portid
,
6769 cmdline_parse_inst_t cmd_link_flow_control_set_tx
= {
6770 .f
= cmd_link_flow_ctrl_set_parsed
,
6771 .data
= (void *)&cmd_link_flow_control_set_tx
,
6772 .help_str
= "set flow_ctrl tx on|off <port_id>: "
6773 "Change tx flow control parameter",
6775 (void *)&cmd_lfc_set_set
,
6776 (void *)&cmd_lfc_set_flow_ctrl
,
6777 (void *)&cmd_lfc_set_tx
,
6778 (void *)&cmd_lfc_set_tx_mode
,
6779 (void *)&cmd_lfc_set_portid
,
6784 cmdline_parse_inst_t cmd_link_flow_control_set_hw
= {
6785 .f
= cmd_link_flow_ctrl_set_parsed
,
6786 .data
= (void *)&cmd_link_flow_control_set_hw
,
6787 .help_str
= "set flow_ctrl high_water <value> <port_id>: "
6788 "Change high water flow control parameter",
6790 (void *)&cmd_lfc_set_set
,
6791 (void *)&cmd_lfc_set_flow_ctrl
,
6792 (void *)&cmd_lfc_set_high_water_str
,
6793 (void *)&cmd_lfc_set_high_water
,
6794 (void *)&cmd_lfc_set_portid
,
6799 cmdline_parse_inst_t cmd_link_flow_control_set_lw
= {
6800 .f
= cmd_link_flow_ctrl_set_parsed
,
6801 .data
= (void *)&cmd_link_flow_control_set_lw
,
6802 .help_str
= "set flow_ctrl low_water <value> <port_id>: "
6803 "Change low water flow control parameter",
6805 (void *)&cmd_lfc_set_set
,
6806 (void *)&cmd_lfc_set_flow_ctrl
,
6807 (void *)&cmd_lfc_set_low_water_str
,
6808 (void *)&cmd_lfc_set_low_water
,
6809 (void *)&cmd_lfc_set_portid
,
6814 cmdline_parse_inst_t cmd_link_flow_control_set_pt
= {
6815 .f
= cmd_link_flow_ctrl_set_parsed
,
6816 .data
= (void *)&cmd_link_flow_control_set_pt
,
6817 .help_str
= "set flow_ctrl pause_time <value> <port_id>: "
6818 "Change pause time flow control parameter",
6820 (void *)&cmd_lfc_set_set
,
6821 (void *)&cmd_lfc_set_flow_ctrl
,
6822 (void *)&cmd_lfc_set_pause_time_str
,
6823 (void *)&cmd_lfc_set_pause_time
,
6824 (void *)&cmd_lfc_set_portid
,
6829 cmdline_parse_inst_t cmd_link_flow_control_set_xon
= {
6830 .f
= cmd_link_flow_ctrl_set_parsed
,
6831 .data
= (void *)&cmd_link_flow_control_set_xon
,
6832 .help_str
= "set flow_ctrl send_xon <value> <port_id>: "
6833 "Change send_xon flow control parameter",
6835 (void *)&cmd_lfc_set_set
,
6836 (void *)&cmd_lfc_set_flow_ctrl
,
6837 (void *)&cmd_lfc_set_send_xon_str
,
6838 (void *)&cmd_lfc_set_send_xon
,
6839 (void *)&cmd_lfc_set_portid
,
6844 cmdline_parse_inst_t cmd_link_flow_control_set_macfwd
= {
6845 .f
= cmd_link_flow_ctrl_set_parsed
,
6846 .data
= (void *)&cmd_link_flow_control_set_macfwd
,
6847 .help_str
= "set flow_ctrl mac_ctrl_frame_fwd on|off <port_id>: "
6848 "Change mac ctrl fwd flow control parameter",
6850 (void *)&cmd_lfc_set_set
,
6851 (void *)&cmd_lfc_set_flow_ctrl
,
6852 (void *)&cmd_lfc_set_mac_ctrl_frame_fwd_mode
,
6853 (void *)&cmd_lfc_set_mac_ctrl_frame_fwd
,
6854 (void *)&cmd_lfc_set_portid
,
6859 cmdline_parse_inst_t cmd_link_flow_control_set_autoneg
= {
6860 .f
= cmd_link_flow_ctrl_set_parsed
,
6861 .data
= (void *)&cmd_link_flow_control_set_autoneg
,
6862 .help_str
= "set flow_ctrl autoneg on|off <port_id>: "
6863 "Change autoneg flow control parameter",
6865 (void *)&cmd_lfc_set_set
,
6866 (void *)&cmd_lfc_set_flow_ctrl
,
6867 (void *)&cmd_lfc_set_autoneg_str
,
6868 (void *)&cmd_lfc_set_autoneg
,
6869 (void *)&cmd_lfc_set_portid
,
6875 cmd_link_flow_ctrl_set_parsed(void *parsed_result
,
6876 __attribute__((unused
)) struct cmdline
*cl
,
6879 struct cmd_link_flow_ctrl_set_result
*res
= parsed_result
;
6880 cmdline_parse_inst_t
*cmd
= data
;
6881 struct rte_eth_fc_conf fc_conf
;
6887 * Rx on/off, flow control is enabled/disabled on RX side. This can indicate
6888 * the RTE_FC_TX_PAUSE, Transmit pause frame at the Rx side.
6889 * Tx on/off, flow control is enabled/disabled on TX side. This can indicate
6890 * the RTE_FC_RX_PAUSE, Respond to the pause frame at the Tx side.
6892 static enum rte_eth_fc_mode rx_tx_onoff_2_lfc_mode
[2][2] = {
6893 {RTE_FC_NONE
, RTE_FC_TX_PAUSE
}, {RTE_FC_RX_PAUSE
, RTE_FC_FULL
}
6896 /* Partial command line, retrieve current configuration */
6898 ret
= rte_eth_dev_flow_ctrl_get(res
->port_id
, &fc_conf
);
6900 printf("cannot get current flow ctrl parameters, return"
6901 "code = %d\n", ret
);
6905 if ((fc_conf
.mode
== RTE_FC_RX_PAUSE
) ||
6906 (fc_conf
.mode
== RTE_FC_FULL
))
6908 if ((fc_conf
.mode
== RTE_FC_TX_PAUSE
) ||
6909 (fc_conf
.mode
== RTE_FC_FULL
))
6913 if (!cmd
|| cmd
== &cmd_link_flow_control_set_rx
)
6914 rx_fc_en
= (!strcmp(res
->rx_lfc_mode
, "on")) ? 1 : 0;
6916 if (!cmd
|| cmd
== &cmd_link_flow_control_set_tx
)
6917 tx_fc_en
= (!strcmp(res
->tx_lfc_mode
, "on")) ? 1 : 0;
6919 fc_conf
.mode
= rx_tx_onoff_2_lfc_mode
[rx_fc_en
][tx_fc_en
];
6921 if (!cmd
|| cmd
== &cmd_link_flow_control_set_hw
)
6922 fc_conf
.high_water
= res
->high_water
;
6924 if (!cmd
|| cmd
== &cmd_link_flow_control_set_lw
)
6925 fc_conf
.low_water
= res
->low_water
;
6927 if (!cmd
|| cmd
== &cmd_link_flow_control_set_pt
)
6928 fc_conf
.pause_time
= res
->pause_time
;
6930 if (!cmd
|| cmd
== &cmd_link_flow_control_set_xon
)
6931 fc_conf
.send_xon
= res
->send_xon
;
6933 if (!cmd
|| cmd
== &cmd_link_flow_control_set_macfwd
) {
6934 if (!strcmp(res
->mac_ctrl_frame_fwd_mode
, "on"))
6935 fc_conf
.mac_ctrl_frame_fwd
= 1;
6937 fc_conf
.mac_ctrl_frame_fwd
= 0;
6940 if (!cmd
|| cmd
== &cmd_link_flow_control_set_autoneg
)
6941 fc_conf
.autoneg
= (!strcmp(res
->autoneg
, "on")) ? 1 : 0;
6943 ret
= rte_eth_dev_flow_ctrl_set(res
->port_id
, &fc_conf
);
6945 printf("bad flow contrl parameter, return code = %d \n", ret
);
6948 /* *** SETUP ETHERNET PRIORITY FLOW CONTROL *** */
6949 struct cmd_priority_flow_ctrl_set_result
{
6950 cmdline_fixed_string_t set
;
6951 cmdline_fixed_string_t pfc_ctrl
;
6952 cmdline_fixed_string_t rx
;
6953 cmdline_fixed_string_t rx_pfc_mode
;
6954 cmdline_fixed_string_t tx
;
6955 cmdline_fixed_string_t tx_pfc_mode
;
6956 uint32_t high_water
;
6958 uint16_t pause_time
;
6964 cmd_priority_flow_ctrl_set_parsed(void *parsed_result
,
6965 __attribute__((unused
)) struct cmdline
*cl
,
6966 __attribute__((unused
)) void *data
)
6968 struct cmd_priority_flow_ctrl_set_result
*res
= parsed_result
;
6969 struct rte_eth_pfc_conf pfc_conf
;
6970 int rx_fc_enable
, tx_fc_enable
;
6974 * Rx on/off, flow control is enabled/disabled on RX side. This can indicate
6975 * the RTE_FC_TX_PAUSE, Transmit pause frame at the Rx side.
6976 * Tx on/off, flow control is enabled/disabled on TX side. This can indicate
6977 * the RTE_FC_RX_PAUSE, Respond to the pause frame at the Tx side.
6979 static enum rte_eth_fc_mode rx_tx_onoff_2_pfc_mode
[2][2] = {
6980 {RTE_FC_NONE
, RTE_FC_RX_PAUSE
}, {RTE_FC_TX_PAUSE
, RTE_FC_FULL
}
6983 rx_fc_enable
= (!strncmp(res
->rx_pfc_mode
, "on",2)) ? 1 : 0;
6984 tx_fc_enable
= (!strncmp(res
->tx_pfc_mode
, "on",2)) ? 1 : 0;
6985 pfc_conf
.fc
.mode
= rx_tx_onoff_2_pfc_mode
[rx_fc_enable
][tx_fc_enable
];
6986 pfc_conf
.fc
.high_water
= res
->high_water
;
6987 pfc_conf
.fc
.low_water
= res
->low_water
;
6988 pfc_conf
.fc
.pause_time
= res
->pause_time
;
6989 pfc_conf
.priority
= res
->priority
;
6991 ret
= rte_eth_dev_priority_flow_ctrl_set(res
->port_id
, &pfc_conf
);
6993 printf("bad priority flow contrl parameter, return code = %d \n", ret
);
6996 cmdline_parse_token_string_t cmd_pfc_set_set
=
6997 TOKEN_STRING_INITIALIZER(struct cmd_priority_flow_ctrl_set_result
,
6999 cmdline_parse_token_string_t cmd_pfc_set_flow_ctrl
=
7000 TOKEN_STRING_INITIALIZER(struct cmd_priority_flow_ctrl_set_result
,
7001 pfc_ctrl
, "pfc_ctrl");
7002 cmdline_parse_token_string_t cmd_pfc_set_rx
=
7003 TOKEN_STRING_INITIALIZER(struct cmd_priority_flow_ctrl_set_result
,
7005 cmdline_parse_token_string_t cmd_pfc_set_rx_mode
=
7006 TOKEN_STRING_INITIALIZER(struct cmd_priority_flow_ctrl_set_result
,
7007 rx_pfc_mode
, "on#off");
7008 cmdline_parse_token_string_t cmd_pfc_set_tx
=
7009 TOKEN_STRING_INITIALIZER(struct cmd_priority_flow_ctrl_set_result
,
7011 cmdline_parse_token_string_t cmd_pfc_set_tx_mode
=
7012 TOKEN_STRING_INITIALIZER(struct cmd_priority_flow_ctrl_set_result
,
7013 tx_pfc_mode
, "on#off");
7014 cmdline_parse_token_num_t cmd_pfc_set_high_water
=
7015 TOKEN_NUM_INITIALIZER(struct cmd_priority_flow_ctrl_set_result
,
7016 high_water
, UINT32
);
7017 cmdline_parse_token_num_t cmd_pfc_set_low_water
=
7018 TOKEN_NUM_INITIALIZER(struct cmd_priority_flow_ctrl_set_result
,
7020 cmdline_parse_token_num_t cmd_pfc_set_pause_time
=
7021 TOKEN_NUM_INITIALIZER(struct cmd_priority_flow_ctrl_set_result
,
7022 pause_time
, UINT16
);
7023 cmdline_parse_token_num_t cmd_pfc_set_priority
=
7024 TOKEN_NUM_INITIALIZER(struct cmd_priority_flow_ctrl_set_result
,
7026 cmdline_parse_token_num_t cmd_pfc_set_portid
=
7027 TOKEN_NUM_INITIALIZER(struct cmd_priority_flow_ctrl_set_result
,
7030 cmdline_parse_inst_t cmd_priority_flow_control_set
= {
7031 .f
= cmd_priority_flow_ctrl_set_parsed
,
7033 .help_str
= "set pfc_ctrl rx on|off tx on|off <high_water> <low_water> "
7034 "<pause_time> <priority> <port_id>: "
7035 "Configure the Ethernet priority flow control",
7037 (void *)&cmd_pfc_set_set
,
7038 (void *)&cmd_pfc_set_flow_ctrl
,
7039 (void *)&cmd_pfc_set_rx
,
7040 (void *)&cmd_pfc_set_rx_mode
,
7041 (void *)&cmd_pfc_set_tx
,
7042 (void *)&cmd_pfc_set_tx_mode
,
7043 (void *)&cmd_pfc_set_high_water
,
7044 (void *)&cmd_pfc_set_low_water
,
7045 (void *)&cmd_pfc_set_pause_time
,
7046 (void *)&cmd_pfc_set_priority
,
7047 (void *)&cmd_pfc_set_portid
,
7052 /* *** RESET CONFIGURATION *** */
7053 struct cmd_reset_result
{
7054 cmdline_fixed_string_t reset
;
7055 cmdline_fixed_string_t def
;
7058 static void cmd_reset_parsed(__attribute__((unused
)) void *parsed_result
,
7060 __attribute__((unused
)) void *data
)
7062 cmdline_printf(cl
, "Reset to default forwarding configuration...\n");
7063 set_def_fwd_config();
7066 cmdline_parse_token_string_t cmd_reset_set
=
7067 TOKEN_STRING_INITIALIZER(struct cmd_reset_result
, reset
, "set");
7068 cmdline_parse_token_string_t cmd_reset_def
=
7069 TOKEN_STRING_INITIALIZER(struct cmd_reset_result
, def
,
7072 cmdline_parse_inst_t cmd_reset
= {
7073 .f
= cmd_reset_parsed
,
7075 .help_str
= "set default: Reset default forwarding configuration",
7077 (void *)&cmd_reset_set
,
7078 (void *)&cmd_reset_def
,
7083 /* *** START FORWARDING *** */
7084 struct cmd_start_result
{
7085 cmdline_fixed_string_t start
;
7088 cmdline_parse_token_string_t cmd_start_start
=
7089 TOKEN_STRING_INITIALIZER(struct cmd_start_result
, start
, "start");
7091 static void cmd_start_parsed(__attribute__((unused
)) void *parsed_result
,
7092 __attribute__((unused
)) struct cmdline
*cl
,
7093 __attribute__((unused
)) void *data
)
7095 start_packet_forwarding(0);
7098 cmdline_parse_inst_t cmd_start
= {
7099 .f
= cmd_start_parsed
,
7101 .help_str
= "start: Start packet forwarding",
7103 (void *)&cmd_start_start
,
7108 /* *** START FORWARDING WITH ONE TX BURST FIRST *** */
7109 struct cmd_start_tx_first_result
{
7110 cmdline_fixed_string_t start
;
7111 cmdline_fixed_string_t tx_first
;
7115 cmd_start_tx_first_parsed(__attribute__((unused
)) void *parsed_result
,
7116 __attribute__((unused
)) struct cmdline
*cl
,
7117 __attribute__((unused
)) void *data
)
7119 start_packet_forwarding(1);
7122 cmdline_parse_token_string_t cmd_start_tx_first_start
=
7123 TOKEN_STRING_INITIALIZER(struct cmd_start_tx_first_result
, start
,
7125 cmdline_parse_token_string_t cmd_start_tx_first_tx_first
=
7126 TOKEN_STRING_INITIALIZER(struct cmd_start_tx_first_result
,
7127 tx_first
, "tx_first");
7129 cmdline_parse_inst_t cmd_start_tx_first
= {
7130 .f
= cmd_start_tx_first_parsed
,
7132 .help_str
= "start tx_first: Start packet forwarding, "
7133 "after sending 1 burst of packets",
7135 (void *)&cmd_start_tx_first_start
,
7136 (void *)&cmd_start_tx_first_tx_first
,
7141 /* *** START FORWARDING WITH N TX BURST FIRST *** */
7142 struct cmd_start_tx_first_n_result
{
7143 cmdline_fixed_string_t start
;
7144 cmdline_fixed_string_t tx_first
;
7149 cmd_start_tx_first_n_parsed(void *parsed_result
,
7150 __attribute__((unused
)) struct cmdline
*cl
,
7151 __attribute__((unused
)) void *data
)
7153 struct cmd_start_tx_first_n_result
*res
= parsed_result
;
7155 start_packet_forwarding(res
->tx_num
);
7158 cmdline_parse_token_string_t cmd_start_tx_first_n_start
=
7159 TOKEN_STRING_INITIALIZER(struct cmd_start_tx_first_n_result
,
7161 cmdline_parse_token_string_t cmd_start_tx_first_n_tx_first
=
7162 TOKEN_STRING_INITIALIZER(struct cmd_start_tx_first_n_result
,
7163 tx_first
, "tx_first");
7164 cmdline_parse_token_num_t cmd_start_tx_first_n_tx_num
=
7165 TOKEN_NUM_INITIALIZER(struct cmd_start_tx_first_n_result
,
7168 cmdline_parse_inst_t cmd_start_tx_first_n
= {
7169 .f
= cmd_start_tx_first_n_parsed
,
7171 .help_str
= "start tx_first <num>: "
7172 "packet forwarding, after sending <num> bursts of packets",
7174 (void *)&cmd_start_tx_first_n_start
,
7175 (void *)&cmd_start_tx_first_n_tx_first
,
7176 (void *)&cmd_start_tx_first_n_tx_num
,
7181 /* *** SET LINK UP *** */
7182 struct cmd_set_link_up_result
{
7183 cmdline_fixed_string_t set
;
7184 cmdline_fixed_string_t link_up
;
7185 cmdline_fixed_string_t port
;
7189 cmdline_parse_token_string_t cmd_set_link_up_set
=
7190 TOKEN_STRING_INITIALIZER(struct cmd_set_link_up_result
, set
, "set");
7191 cmdline_parse_token_string_t cmd_set_link_up_link_up
=
7192 TOKEN_STRING_INITIALIZER(struct cmd_set_link_up_result
, link_up
,
7194 cmdline_parse_token_string_t cmd_set_link_up_port
=
7195 TOKEN_STRING_INITIALIZER(struct cmd_set_link_up_result
, port
, "port");
7196 cmdline_parse_token_num_t cmd_set_link_up_port_id
=
7197 TOKEN_NUM_INITIALIZER(struct cmd_set_link_up_result
, port_id
, UINT16
);
7199 static void cmd_set_link_up_parsed(__attribute__((unused
)) void *parsed_result
,
7200 __attribute__((unused
)) struct cmdline
*cl
,
7201 __attribute__((unused
)) void *data
)
7203 struct cmd_set_link_up_result
*res
= parsed_result
;
7204 dev_set_link_up(res
->port_id
);
7207 cmdline_parse_inst_t cmd_set_link_up
= {
7208 .f
= cmd_set_link_up_parsed
,
7210 .help_str
= "set link-up port <port id>",
7212 (void *)&cmd_set_link_up_set
,
7213 (void *)&cmd_set_link_up_link_up
,
7214 (void *)&cmd_set_link_up_port
,
7215 (void *)&cmd_set_link_up_port_id
,
7220 /* *** SET LINK DOWN *** */
7221 struct cmd_set_link_down_result
{
7222 cmdline_fixed_string_t set
;
7223 cmdline_fixed_string_t link_down
;
7224 cmdline_fixed_string_t port
;
7228 cmdline_parse_token_string_t cmd_set_link_down_set
=
7229 TOKEN_STRING_INITIALIZER(struct cmd_set_link_down_result
, set
, "set");
7230 cmdline_parse_token_string_t cmd_set_link_down_link_down
=
7231 TOKEN_STRING_INITIALIZER(struct cmd_set_link_down_result
, link_down
,
7233 cmdline_parse_token_string_t cmd_set_link_down_port
=
7234 TOKEN_STRING_INITIALIZER(struct cmd_set_link_down_result
, port
, "port");
7235 cmdline_parse_token_num_t cmd_set_link_down_port_id
=
7236 TOKEN_NUM_INITIALIZER(struct cmd_set_link_down_result
, port_id
, UINT16
);
7238 static void cmd_set_link_down_parsed(
7239 __attribute__((unused
)) void *parsed_result
,
7240 __attribute__((unused
)) struct cmdline
*cl
,
7241 __attribute__((unused
)) void *data
)
7243 struct cmd_set_link_down_result
*res
= parsed_result
;
7244 dev_set_link_down(res
->port_id
);
7247 cmdline_parse_inst_t cmd_set_link_down
= {
7248 .f
= cmd_set_link_down_parsed
,
7250 .help_str
= "set link-down port <port id>",
7252 (void *)&cmd_set_link_down_set
,
7253 (void *)&cmd_set_link_down_link_down
,
7254 (void *)&cmd_set_link_down_port
,
7255 (void *)&cmd_set_link_down_port_id
,
7260 /* *** SHOW CFG *** */
7261 struct cmd_showcfg_result
{
7262 cmdline_fixed_string_t show
;
7263 cmdline_fixed_string_t cfg
;
7264 cmdline_fixed_string_t what
;
7267 static void cmd_showcfg_parsed(void *parsed_result
,
7268 __attribute__((unused
)) struct cmdline
*cl
,
7269 __attribute__((unused
)) void *data
)
7271 struct cmd_showcfg_result
*res
= parsed_result
;
7272 if (!strcmp(res
->what
, "rxtx"))
7273 rxtx_config_display();
7274 else if (!strcmp(res
->what
, "cores"))
7275 fwd_lcores_config_display();
7276 else if (!strcmp(res
->what
, "fwd"))
7277 pkt_fwd_config_display(&cur_fwd_config
);
7278 else if (!strcmp(res
->what
, "txpkts"))
7279 show_tx_pkt_segments();
7282 cmdline_parse_token_string_t cmd_showcfg_show
=
7283 TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result
, show
, "show");
7284 cmdline_parse_token_string_t cmd_showcfg_port
=
7285 TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result
, cfg
, "config");
7286 cmdline_parse_token_string_t cmd_showcfg_what
=
7287 TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result
, what
,
7288 "rxtx#cores#fwd#txpkts");
7290 cmdline_parse_inst_t cmd_showcfg
= {
7291 .f
= cmd_showcfg_parsed
,
7293 .help_str
= "show config rxtx|cores|fwd|txpkts",
7295 (void *)&cmd_showcfg_show
,
7296 (void *)&cmd_showcfg_port
,
7297 (void *)&cmd_showcfg_what
,
7302 /* *** SHOW ALL PORT INFO *** */
7303 struct cmd_showportall_result
{
7304 cmdline_fixed_string_t show
;
7305 cmdline_fixed_string_t port
;
7306 cmdline_fixed_string_t what
;
7307 cmdline_fixed_string_t all
;
7310 static void cmd_showportall_parsed(void *parsed_result
,
7311 __attribute__((unused
)) struct cmdline
*cl
,
7312 __attribute__((unused
)) void *data
)
7316 struct cmd_showportall_result
*res
= parsed_result
;
7317 if (!strcmp(res
->show
, "clear")) {
7318 if (!strcmp(res
->what
, "stats"))
7319 RTE_ETH_FOREACH_DEV(i
)
7321 else if (!strcmp(res
->what
, "xstats"))
7322 RTE_ETH_FOREACH_DEV(i
)
7323 nic_xstats_clear(i
);
7324 } else if (!strcmp(res
->what
, "info"))
7325 RTE_ETH_FOREACH_DEV(i
)
7326 port_infos_display(i
);
7327 else if (!strcmp(res
->what
, "summary")) {
7328 port_summary_header_display();
7329 RTE_ETH_FOREACH_DEV(i
)
7330 port_summary_display(i
);
7332 else if (!strcmp(res
->what
, "stats"))
7333 RTE_ETH_FOREACH_DEV(i
)
7334 nic_stats_display(i
);
7335 else if (!strcmp(res
->what
, "xstats"))
7336 RTE_ETH_FOREACH_DEV(i
)
7337 nic_xstats_display(i
);
7338 else if (!strcmp(res
->what
, "fdir"))
7339 RTE_ETH_FOREACH_DEV(i
)
7341 else if (!strcmp(res
->what
, "stat_qmap"))
7342 RTE_ETH_FOREACH_DEV(i
)
7343 nic_stats_mapping_display(i
);
7344 else if (!strcmp(res
->what
, "dcb_tc"))
7345 RTE_ETH_FOREACH_DEV(i
)
7346 port_dcb_info_display(i
);
7347 else if (!strcmp(res
->what
, "cap"))
7348 RTE_ETH_FOREACH_DEV(i
)
7349 port_offload_cap_display(i
);
7352 cmdline_parse_token_string_t cmd_showportall_show
=
7353 TOKEN_STRING_INITIALIZER(struct cmd_showportall_result
, show
,
7355 cmdline_parse_token_string_t cmd_showportall_port
=
7356 TOKEN_STRING_INITIALIZER(struct cmd_showportall_result
, port
, "port");
7357 cmdline_parse_token_string_t cmd_showportall_what
=
7358 TOKEN_STRING_INITIALIZER(struct cmd_showportall_result
, what
,
7359 "info#summary#stats#xstats#fdir#stat_qmap#dcb_tc#cap");
7360 cmdline_parse_token_string_t cmd_showportall_all
=
7361 TOKEN_STRING_INITIALIZER(struct cmd_showportall_result
, all
, "all");
7362 cmdline_parse_inst_t cmd_showportall
= {
7363 .f
= cmd_showportall_parsed
,
7365 .help_str
= "show|clear port "
7366 "info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap all",
7368 (void *)&cmd_showportall_show
,
7369 (void *)&cmd_showportall_port
,
7370 (void *)&cmd_showportall_what
,
7371 (void *)&cmd_showportall_all
,
7376 /* *** SHOW PORT INFO *** */
7377 struct cmd_showport_result
{
7378 cmdline_fixed_string_t show
;
7379 cmdline_fixed_string_t port
;
7380 cmdline_fixed_string_t what
;
7384 static void cmd_showport_parsed(void *parsed_result
,
7385 __attribute__((unused
)) struct cmdline
*cl
,
7386 __attribute__((unused
)) void *data
)
7388 struct cmd_showport_result
*res
= parsed_result
;
7389 if (!strcmp(res
->show
, "clear")) {
7390 if (!strcmp(res
->what
, "stats"))
7391 nic_stats_clear(res
->portnum
);
7392 else if (!strcmp(res
->what
, "xstats"))
7393 nic_xstats_clear(res
->portnum
);
7394 } else if (!strcmp(res
->what
, "info"))
7395 port_infos_display(res
->portnum
);
7396 else if (!strcmp(res
->what
, "summary")) {
7397 port_summary_header_display();
7398 port_summary_display(res
->portnum
);
7400 else if (!strcmp(res
->what
, "stats"))
7401 nic_stats_display(res
->portnum
);
7402 else if (!strcmp(res
->what
, "xstats"))
7403 nic_xstats_display(res
->portnum
);
7404 else if (!strcmp(res
->what
, "fdir"))
7405 fdir_get_infos(res
->portnum
);
7406 else if (!strcmp(res
->what
, "stat_qmap"))
7407 nic_stats_mapping_display(res
->portnum
);
7408 else if (!strcmp(res
->what
, "dcb_tc"))
7409 port_dcb_info_display(res
->portnum
);
7410 else if (!strcmp(res
->what
, "cap"))
7411 port_offload_cap_display(res
->portnum
);
7414 cmdline_parse_token_string_t cmd_showport_show
=
7415 TOKEN_STRING_INITIALIZER(struct cmd_showport_result
, show
,
7417 cmdline_parse_token_string_t cmd_showport_port
=
7418 TOKEN_STRING_INITIALIZER(struct cmd_showport_result
, port
, "port");
7419 cmdline_parse_token_string_t cmd_showport_what
=
7420 TOKEN_STRING_INITIALIZER(struct cmd_showport_result
, what
,
7421 "info#summary#stats#xstats#fdir#stat_qmap#dcb_tc#cap");
7422 cmdline_parse_token_num_t cmd_showport_portnum
=
7423 TOKEN_NUM_INITIALIZER(struct cmd_showport_result
, portnum
, UINT16
);
7425 cmdline_parse_inst_t cmd_showport
= {
7426 .f
= cmd_showport_parsed
,
7428 .help_str
= "show|clear port "
7429 "info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap "
7432 (void *)&cmd_showport_show
,
7433 (void *)&cmd_showport_port
,
7434 (void *)&cmd_showport_what
,
7435 (void *)&cmd_showport_portnum
,
7440 /* *** SHOW QUEUE INFO *** */
7441 struct cmd_showqueue_result
{
7442 cmdline_fixed_string_t show
;
7443 cmdline_fixed_string_t type
;
7444 cmdline_fixed_string_t what
;
7450 cmd_showqueue_parsed(void *parsed_result
,
7451 __attribute__((unused
)) struct cmdline
*cl
,
7452 __attribute__((unused
)) void *data
)
7454 struct cmd_showqueue_result
*res
= parsed_result
;
7456 if (!strcmp(res
->type
, "rxq"))
7457 rx_queue_infos_display(res
->portnum
, res
->queuenum
);
7458 else if (!strcmp(res
->type
, "txq"))
7459 tx_queue_infos_display(res
->portnum
, res
->queuenum
);
7462 cmdline_parse_token_string_t cmd_showqueue_show
=
7463 TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result
, show
, "show");
7464 cmdline_parse_token_string_t cmd_showqueue_type
=
7465 TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result
, type
, "rxq#txq");
7466 cmdline_parse_token_string_t cmd_showqueue_what
=
7467 TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result
, what
, "info");
7468 cmdline_parse_token_num_t cmd_showqueue_portnum
=
7469 TOKEN_NUM_INITIALIZER(struct cmd_showqueue_result
, portnum
, UINT16
);
7470 cmdline_parse_token_num_t cmd_showqueue_queuenum
=
7471 TOKEN_NUM_INITIALIZER(struct cmd_showqueue_result
, queuenum
, UINT16
);
7473 cmdline_parse_inst_t cmd_showqueue
= {
7474 .f
= cmd_showqueue_parsed
,
7476 .help_str
= "show rxq|txq info <port_id> <queue_id>",
7478 (void *)&cmd_showqueue_show
,
7479 (void *)&cmd_showqueue_type
,
7480 (void *)&cmd_showqueue_what
,
7481 (void *)&cmd_showqueue_portnum
,
7482 (void *)&cmd_showqueue_queuenum
,
7487 /* show/clear fwd engine statistics */
7489 cmdline_fixed_string_t action
;
7490 cmdline_fixed_string_t fwd
;
7491 cmdline_fixed_string_t stats
;
7492 cmdline_fixed_string_t all
;
7495 cmdline_parse_token_string_t cmd_fwd_action
=
7496 TOKEN_STRING_INITIALIZER(struct fwd_result
, action
, "show#clear");
7497 cmdline_parse_token_string_t cmd_fwd_fwd
=
7498 TOKEN_STRING_INITIALIZER(struct fwd_result
, fwd
, "fwd");
7499 cmdline_parse_token_string_t cmd_fwd_stats
=
7500 TOKEN_STRING_INITIALIZER(struct fwd_result
, stats
, "stats");
7501 cmdline_parse_token_string_t cmd_fwd_all
=
7502 TOKEN_STRING_INITIALIZER(struct fwd_result
, all
, "all");
7505 cmd_showfwdall_parsed(void *parsed_result
,
7506 __rte_unused
struct cmdline
*cl
,
7507 __rte_unused
void *data
)
7509 struct fwd_result
*res
= parsed_result
;
7511 if (!strcmp(res
->action
, "show"))
7512 fwd_stats_display();
7517 static cmdline_parse_inst_t cmd_showfwdall
= {
7518 .f
= cmd_showfwdall_parsed
,
7520 .help_str
= "show|clear fwd stats all",
7522 (void *)&cmd_fwd_action
,
7523 (void *)&cmd_fwd_fwd
,
7524 (void *)&cmd_fwd_stats
,
7525 (void *)&cmd_fwd_all
,
7530 /* *** READ PORT REGISTER *** */
7531 struct cmd_read_reg_result
{
7532 cmdline_fixed_string_t read
;
7533 cmdline_fixed_string_t reg
;
7539 cmd_read_reg_parsed(void *parsed_result
,
7540 __attribute__((unused
)) struct cmdline
*cl
,
7541 __attribute__((unused
)) void *data
)
7543 struct cmd_read_reg_result
*res
= parsed_result
;
7544 port_reg_display(res
->port_id
, res
->reg_off
);
7547 cmdline_parse_token_string_t cmd_read_reg_read
=
7548 TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result
, read
, "read");
7549 cmdline_parse_token_string_t cmd_read_reg_reg
=
7550 TOKEN_STRING_INITIALIZER(struct cmd_read_reg_result
, reg
, "reg");
7551 cmdline_parse_token_num_t cmd_read_reg_port_id
=
7552 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result
, port_id
, UINT16
);
7553 cmdline_parse_token_num_t cmd_read_reg_reg_off
=
7554 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_result
, reg_off
, UINT32
);
7556 cmdline_parse_inst_t cmd_read_reg
= {
7557 .f
= cmd_read_reg_parsed
,
7559 .help_str
= "read reg <port_id> <reg_off>",
7561 (void *)&cmd_read_reg_read
,
7562 (void *)&cmd_read_reg_reg
,
7563 (void *)&cmd_read_reg_port_id
,
7564 (void *)&cmd_read_reg_reg_off
,
7569 /* *** READ PORT REGISTER BIT FIELD *** */
7570 struct cmd_read_reg_bit_field_result
{
7571 cmdline_fixed_string_t read
;
7572 cmdline_fixed_string_t regfield
;
7580 cmd_read_reg_bit_field_parsed(void *parsed_result
,
7581 __attribute__((unused
)) struct cmdline
*cl
,
7582 __attribute__((unused
)) void *data
)
7584 struct cmd_read_reg_bit_field_result
*res
= parsed_result
;
7585 port_reg_bit_field_display(res
->port_id
, res
->reg_off
,
7586 res
->bit1_pos
, res
->bit2_pos
);
7589 cmdline_parse_token_string_t cmd_read_reg_bit_field_read
=
7590 TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result
, read
,
7592 cmdline_parse_token_string_t cmd_read_reg_bit_field_regfield
=
7593 TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_field_result
,
7594 regfield
, "regfield");
7595 cmdline_parse_token_num_t cmd_read_reg_bit_field_port_id
=
7596 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result
, port_id
,
7598 cmdline_parse_token_num_t cmd_read_reg_bit_field_reg_off
=
7599 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result
, reg_off
,
7601 cmdline_parse_token_num_t cmd_read_reg_bit_field_bit1_pos
=
7602 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result
, bit1_pos
,
7604 cmdline_parse_token_num_t cmd_read_reg_bit_field_bit2_pos
=
7605 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_field_result
, bit2_pos
,
7608 cmdline_parse_inst_t cmd_read_reg_bit_field
= {
7609 .f
= cmd_read_reg_bit_field_parsed
,
7611 .help_str
= "read regfield <port_id> <reg_off> <bit_x> <bit_y>: "
7612 "Read register bit field between bit_x and bit_y included",
7614 (void *)&cmd_read_reg_bit_field_read
,
7615 (void *)&cmd_read_reg_bit_field_regfield
,
7616 (void *)&cmd_read_reg_bit_field_port_id
,
7617 (void *)&cmd_read_reg_bit_field_reg_off
,
7618 (void *)&cmd_read_reg_bit_field_bit1_pos
,
7619 (void *)&cmd_read_reg_bit_field_bit2_pos
,
7624 /* *** READ PORT REGISTER BIT *** */
7625 struct cmd_read_reg_bit_result
{
7626 cmdline_fixed_string_t read
;
7627 cmdline_fixed_string_t regbit
;
7634 cmd_read_reg_bit_parsed(void *parsed_result
,
7635 __attribute__((unused
)) struct cmdline
*cl
,
7636 __attribute__((unused
)) void *data
)
7638 struct cmd_read_reg_bit_result
*res
= parsed_result
;
7639 port_reg_bit_display(res
->port_id
, res
->reg_off
, res
->bit_pos
);
7642 cmdline_parse_token_string_t cmd_read_reg_bit_read
=
7643 TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result
, read
, "read");
7644 cmdline_parse_token_string_t cmd_read_reg_bit_regbit
=
7645 TOKEN_STRING_INITIALIZER(struct cmd_read_reg_bit_result
,
7647 cmdline_parse_token_num_t cmd_read_reg_bit_port_id
=
7648 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result
, port_id
, UINT16
);
7649 cmdline_parse_token_num_t cmd_read_reg_bit_reg_off
=
7650 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result
, reg_off
, UINT32
);
7651 cmdline_parse_token_num_t cmd_read_reg_bit_bit_pos
=
7652 TOKEN_NUM_INITIALIZER(struct cmd_read_reg_bit_result
, bit_pos
, UINT8
);
7654 cmdline_parse_inst_t cmd_read_reg_bit
= {
7655 .f
= cmd_read_reg_bit_parsed
,
7657 .help_str
= "read regbit <port_id> <reg_off> <bit_x>: 0 <= bit_x <= 31",
7659 (void *)&cmd_read_reg_bit_read
,
7660 (void *)&cmd_read_reg_bit_regbit
,
7661 (void *)&cmd_read_reg_bit_port_id
,
7662 (void *)&cmd_read_reg_bit_reg_off
,
7663 (void *)&cmd_read_reg_bit_bit_pos
,
7668 /* *** WRITE PORT REGISTER *** */
7669 struct cmd_write_reg_result
{
7670 cmdline_fixed_string_t write
;
7671 cmdline_fixed_string_t reg
;
7678 cmd_write_reg_parsed(void *parsed_result
,
7679 __attribute__((unused
)) struct cmdline
*cl
,
7680 __attribute__((unused
)) void *data
)
7682 struct cmd_write_reg_result
*res
= parsed_result
;
7683 port_reg_set(res
->port_id
, res
->reg_off
, res
->value
);
7686 cmdline_parse_token_string_t cmd_write_reg_write
=
7687 TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result
, write
, "write");
7688 cmdline_parse_token_string_t cmd_write_reg_reg
=
7689 TOKEN_STRING_INITIALIZER(struct cmd_write_reg_result
, reg
, "reg");
7690 cmdline_parse_token_num_t cmd_write_reg_port_id
=
7691 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result
, port_id
, UINT16
);
7692 cmdline_parse_token_num_t cmd_write_reg_reg_off
=
7693 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result
, reg_off
, UINT32
);
7694 cmdline_parse_token_num_t cmd_write_reg_value
=
7695 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_result
, value
, UINT32
);
7697 cmdline_parse_inst_t cmd_write_reg
= {
7698 .f
= cmd_write_reg_parsed
,
7700 .help_str
= "write reg <port_id> <reg_off> <reg_value>",
7702 (void *)&cmd_write_reg_write
,
7703 (void *)&cmd_write_reg_reg
,
7704 (void *)&cmd_write_reg_port_id
,
7705 (void *)&cmd_write_reg_reg_off
,
7706 (void *)&cmd_write_reg_value
,
7711 /* *** WRITE PORT REGISTER BIT FIELD *** */
7712 struct cmd_write_reg_bit_field_result
{
7713 cmdline_fixed_string_t write
;
7714 cmdline_fixed_string_t regfield
;
7723 cmd_write_reg_bit_field_parsed(void *parsed_result
,
7724 __attribute__((unused
)) struct cmdline
*cl
,
7725 __attribute__((unused
)) void *data
)
7727 struct cmd_write_reg_bit_field_result
*res
= parsed_result
;
7728 port_reg_bit_field_set(res
->port_id
, res
->reg_off
,
7729 res
->bit1_pos
, res
->bit2_pos
, res
->value
);
7732 cmdline_parse_token_string_t cmd_write_reg_bit_field_write
=
7733 TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result
, write
,
7735 cmdline_parse_token_string_t cmd_write_reg_bit_field_regfield
=
7736 TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_field_result
,
7737 regfield
, "regfield");
7738 cmdline_parse_token_num_t cmd_write_reg_bit_field_port_id
=
7739 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result
, port_id
,
7741 cmdline_parse_token_num_t cmd_write_reg_bit_field_reg_off
=
7742 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result
, reg_off
,
7744 cmdline_parse_token_num_t cmd_write_reg_bit_field_bit1_pos
=
7745 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result
, bit1_pos
,
7747 cmdline_parse_token_num_t cmd_write_reg_bit_field_bit2_pos
=
7748 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result
, bit2_pos
,
7750 cmdline_parse_token_num_t cmd_write_reg_bit_field_value
=
7751 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_field_result
, value
,
7754 cmdline_parse_inst_t cmd_write_reg_bit_field
= {
7755 .f
= cmd_write_reg_bit_field_parsed
,
7757 .help_str
= "write regfield <port_id> <reg_off> <bit_x> <bit_y> "
7759 "Set register bit field between bit_x and bit_y included",
7761 (void *)&cmd_write_reg_bit_field_write
,
7762 (void *)&cmd_write_reg_bit_field_regfield
,
7763 (void *)&cmd_write_reg_bit_field_port_id
,
7764 (void *)&cmd_write_reg_bit_field_reg_off
,
7765 (void *)&cmd_write_reg_bit_field_bit1_pos
,
7766 (void *)&cmd_write_reg_bit_field_bit2_pos
,
7767 (void *)&cmd_write_reg_bit_field_value
,
7772 /* *** WRITE PORT REGISTER BIT *** */
7773 struct cmd_write_reg_bit_result
{
7774 cmdline_fixed_string_t write
;
7775 cmdline_fixed_string_t regbit
;
7783 cmd_write_reg_bit_parsed(void *parsed_result
,
7784 __attribute__((unused
)) struct cmdline
*cl
,
7785 __attribute__((unused
)) void *data
)
7787 struct cmd_write_reg_bit_result
*res
= parsed_result
;
7788 port_reg_bit_set(res
->port_id
, res
->reg_off
, res
->bit_pos
, res
->value
);
7791 cmdline_parse_token_string_t cmd_write_reg_bit_write
=
7792 TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result
, write
,
7794 cmdline_parse_token_string_t cmd_write_reg_bit_regbit
=
7795 TOKEN_STRING_INITIALIZER(struct cmd_write_reg_bit_result
,
7797 cmdline_parse_token_num_t cmd_write_reg_bit_port_id
=
7798 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result
, port_id
, UINT16
);
7799 cmdline_parse_token_num_t cmd_write_reg_bit_reg_off
=
7800 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result
, reg_off
, UINT32
);
7801 cmdline_parse_token_num_t cmd_write_reg_bit_bit_pos
=
7802 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result
, bit_pos
, UINT8
);
7803 cmdline_parse_token_num_t cmd_write_reg_bit_value
=
7804 TOKEN_NUM_INITIALIZER(struct cmd_write_reg_bit_result
, value
, UINT8
);
7806 cmdline_parse_inst_t cmd_write_reg_bit
= {
7807 .f
= cmd_write_reg_bit_parsed
,
7809 .help_str
= "write regbit <port_id> <reg_off> <bit_x> 0|1: "
7812 (void *)&cmd_write_reg_bit_write
,
7813 (void *)&cmd_write_reg_bit_regbit
,
7814 (void *)&cmd_write_reg_bit_port_id
,
7815 (void *)&cmd_write_reg_bit_reg_off
,
7816 (void *)&cmd_write_reg_bit_bit_pos
,
7817 (void *)&cmd_write_reg_bit_value
,
7822 /* *** READ A RING DESCRIPTOR OF A PORT RX/TX QUEUE *** */
7823 struct cmd_read_rxd_txd_result
{
7824 cmdline_fixed_string_t read
;
7825 cmdline_fixed_string_t rxd_txd
;
7832 cmd_read_rxd_txd_parsed(void *parsed_result
,
7833 __attribute__((unused
)) struct cmdline
*cl
,
7834 __attribute__((unused
)) void *data
)
7836 struct cmd_read_rxd_txd_result
*res
= parsed_result
;
7838 if (!strcmp(res
->rxd_txd
, "rxd"))
7839 rx_ring_desc_display(res
->port_id
, res
->queue_id
, res
->desc_id
);
7840 else if (!strcmp(res
->rxd_txd
, "txd"))
7841 tx_ring_desc_display(res
->port_id
, res
->queue_id
, res
->desc_id
);
7844 cmdline_parse_token_string_t cmd_read_rxd_txd_read
=
7845 TOKEN_STRING_INITIALIZER(struct cmd_read_rxd_txd_result
, read
, "read");
7846 cmdline_parse_token_string_t cmd_read_rxd_txd_rxd_txd
=
7847 TOKEN_STRING_INITIALIZER(struct cmd_read_rxd_txd_result
, rxd_txd
,
7849 cmdline_parse_token_num_t cmd_read_rxd_txd_port_id
=
7850 TOKEN_NUM_INITIALIZER(struct cmd_read_rxd_txd_result
, port_id
, UINT16
);
7851 cmdline_parse_token_num_t cmd_read_rxd_txd_queue_id
=
7852 TOKEN_NUM_INITIALIZER(struct cmd_read_rxd_txd_result
, queue_id
, UINT16
);
7853 cmdline_parse_token_num_t cmd_read_rxd_txd_desc_id
=
7854 TOKEN_NUM_INITIALIZER(struct cmd_read_rxd_txd_result
, desc_id
, UINT16
);
7856 cmdline_parse_inst_t cmd_read_rxd_txd
= {
7857 .f
= cmd_read_rxd_txd_parsed
,
7859 .help_str
= "read rxd|txd <port_id> <queue_id> <desc_id>",
7861 (void *)&cmd_read_rxd_txd_read
,
7862 (void *)&cmd_read_rxd_txd_rxd_txd
,
7863 (void *)&cmd_read_rxd_txd_port_id
,
7864 (void *)&cmd_read_rxd_txd_queue_id
,
7865 (void *)&cmd_read_rxd_txd_desc_id
,
7871 struct cmd_quit_result
{
7872 cmdline_fixed_string_t quit
;
7875 static void cmd_quit_parsed(__attribute__((unused
)) void *parsed_result
,
7877 __attribute__((unused
)) void *data
)
7882 cmdline_parse_token_string_t cmd_quit_quit
=
7883 TOKEN_STRING_INITIALIZER(struct cmd_quit_result
, quit
, "quit");
7885 cmdline_parse_inst_t cmd_quit
= {
7886 .f
= cmd_quit_parsed
,
7888 .help_str
= "quit: Exit application",
7890 (void *)&cmd_quit_quit
,
7895 /* *** ADD/REMOVE MAC ADDRESS FROM A PORT *** */
7896 struct cmd_mac_addr_result
{
7897 cmdline_fixed_string_t mac_addr_cmd
;
7898 cmdline_fixed_string_t what
;
7900 struct ether_addr address
;
7903 static void cmd_mac_addr_parsed(void *parsed_result
,
7904 __attribute__((unused
)) struct cmdline
*cl
,
7905 __attribute__((unused
)) void *data
)
7907 struct cmd_mac_addr_result
*res
= parsed_result
;
7910 if (strcmp(res
->what
, "add") == 0)
7911 ret
= rte_eth_dev_mac_addr_add(res
->port_num
, &res
->address
, 0);
7912 else if (strcmp(res
->what
, "set") == 0)
7913 ret
= rte_eth_dev_default_mac_addr_set(res
->port_num
,
7916 ret
= rte_eth_dev_mac_addr_remove(res
->port_num
, &res
->address
);
7918 /* check the return value and print it if is < 0 */
7920 printf("mac_addr_cmd error: (%s)\n", strerror(-ret
));
7924 cmdline_parse_token_string_t cmd_mac_addr_cmd
=
7925 TOKEN_STRING_INITIALIZER(struct cmd_mac_addr_result
, mac_addr_cmd
,
7927 cmdline_parse_token_string_t cmd_mac_addr_what
=
7928 TOKEN_STRING_INITIALIZER(struct cmd_mac_addr_result
, what
,
7930 cmdline_parse_token_num_t cmd_mac_addr_portnum
=
7931 TOKEN_NUM_INITIALIZER(struct cmd_mac_addr_result
, port_num
,
7933 cmdline_parse_token_etheraddr_t cmd_mac_addr_addr
=
7934 TOKEN_ETHERADDR_INITIALIZER(struct cmd_mac_addr_result
, address
);
7936 cmdline_parse_inst_t cmd_mac_addr
= {
7937 .f
= cmd_mac_addr_parsed
,
7939 .help_str
= "mac_addr add|remove|set <port_id> <mac_addr>: "
7940 "Add/Remove/Set MAC address on port_id",
7942 (void *)&cmd_mac_addr_cmd
,
7943 (void *)&cmd_mac_addr_what
,
7944 (void *)&cmd_mac_addr_portnum
,
7945 (void *)&cmd_mac_addr_addr
,
7950 /* *** SET THE PEER ADDRESS FOR CERTAIN PORT *** */
7951 struct cmd_eth_peer_result
{
7952 cmdline_fixed_string_t set
;
7953 cmdline_fixed_string_t eth_peer
;
7955 cmdline_fixed_string_t peer_addr
;
7958 static void cmd_set_eth_peer_parsed(void *parsed_result
,
7959 __attribute__((unused
)) struct cmdline
*cl
,
7960 __attribute__((unused
)) void *data
)
7962 struct cmd_eth_peer_result
*res
= parsed_result
;
7964 if (test_done
== 0) {
7965 printf("Please stop forwarding first\n");
7968 if (!strcmp(res
->eth_peer
, "eth-peer")) {
7969 set_fwd_eth_peer(res
->port_id
, res
->peer_addr
);
7973 cmdline_parse_token_string_t cmd_eth_peer_set
=
7974 TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result
, set
, "set");
7975 cmdline_parse_token_string_t cmd_eth_peer
=
7976 TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result
, eth_peer
, "eth-peer");
7977 cmdline_parse_token_num_t cmd_eth_peer_port_id
=
7978 TOKEN_NUM_INITIALIZER(struct cmd_eth_peer_result
, port_id
, UINT16
);
7979 cmdline_parse_token_string_t cmd_eth_peer_addr
=
7980 TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result
, peer_addr
, NULL
);
7982 cmdline_parse_inst_t cmd_set_fwd_eth_peer
= {
7983 .f
= cmd_set_eth_peer_parsed
,
7985 .help_str
= "set eth-peer <port_id> <peer_mac>",
7987 (void *)&cmd_eth_peer_set
,
7988 (void *)&cmd_eth_peer
,
7989 (void *)&cmd_eth_peer_port_id
,
7990 (void *)&cmd_eth_peer_addr
,
7995 /* *** CONFIGURE QUEUE STATS COUNTER MAPPINGS *** */
7996 struct cmd_set_qmap_result
{
7997 cmdline_fixed_string_t set
;
7998 cmdline_fixed_string_t qmap
;
7999 cmdline_fixed_string_t what
;
8006 cmd_set_qmap_parsed(void *parsed_result
,
8007 __attribute__((unused
)) struct cmdline
*cl
,
8008 __attribute__((unused
)) void *data
)
8010 struct cmd_set_qmap_result
*res
= parsed_result
;
8011 int is_rx
= (strcmp(res
->what
, "tx") == 0) ? 0 : 1;
8013 set_qmap(res
->port_id
, (uint8_t)is_rx
, res
->queue_id
, res
->map_value
);
8016 cmdline_parse_token_string_t cmd_setqmap_set
=
8017 TOKEN_STRING_INITIALIZER(struct cmd_set_qmap_result
,
8019 cmdline_parse_token_string_t cmd_setqmap_qmap
=
8020 TOKEN_STRING_INITIALIZER(struct cmd_set_qmap_result
,
8022 cmdline_parse_token_string_t cmd_setqmap_what
=
8023 TOKEN_STRING_INITIALIZER(struct cmd_set_qmap_result
,
8025 cmdline_parse_token_num_t cmd_setqmap_portid
=
8026 TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result
,
8028 cmdline_parse_token_num_t cmd_setqmap_queueid
=
8029 TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result
,
8031 cmdline_parse_token_num_t cmd_setqmap_mapvalue
=
8032 TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result
,
8035 cmdline_parse_inst_t cmd_set_qmap
= {
8036 .f
= cmd_set_qmap_parsed
,
8038 .help_str
= "set stat_qmap rx|tx <port_id> <queue_id> <map_value>: "
8039 "Set statistics mapping value on tx|rx queue_id of port_id",
8041 (void *)&cmd_setqmap_set
,
8042 (void *)&cmd_setqmap_qmap
,
8043 (void *)&cmd_setqmap_what
,
8044 (void *)&cmd_setqmap_portid
,
8045 (void *)&cmd_setqmap_queueid
,
8046 (void *)&cmd_setqmap_mapvalue
,
8051 /* *** SET OPTION TO HIDE ZERO VALUES FOR XSTATS DISPLAY *** */
8052 struct cmd_set_xstats_hide_zero_result
{
8053 cmdline_fixed_string_t keyword
;
8054 cmdline_fixed_string_t name
;
8055 cmdline_fixed_string_t on_off
;
8059 cmd_set_xstats_hide_zero_parsed(void *parsed_result
,
8060 __attribute__((unused
)) struct cmdline
*cl
,
8061 __attribute__((unused
)) void *data
)
8063 struct cmd_set_xstats_hide_zero_result
*res
;
8064 uint16_t on_off
= 0;
8066 res
= parsed_result
;
8067 on_off
= !strcmp(res
->on_off
, "on") ? 1 : 0;
8068 set_xstats_hide_zero(on_off
);
8071 cmdline_parse_token_string_t cmd_set_xstats_hide_zero_keyword
=
8072 TOKEN_STRING_INITIALIZER(struct cmd_set_xstats_hide_zero_result
,
8074 cmdline_parse_token_string_t cmd_set_xstats_hide_zero_name
=
8075 TOKEN_STRING_INITIALIZER(struct cmd_set_xstats_hide_zero_result
,
8076 name
, "xstats-hide-zero");
8077 cmdline_parse_token_string_t cmd_set_xstats_hide_zero_on_off
=
8078 TOKEN_STRING_INITIALIZER(struct cmd_set_xstats_hide_zero_result
,
8081 cmdline_parse_inst_t cmd_set_xstats_hide_zero
= {
8082 .f
= cmd_set_xstats_hide_zero_parsed
,
8084 .help_str
= "set xstats-hide-zero on|off",
8086 (void *)&cmd_set_xstats_hide_zero_keyword
,
8087 (void *)&cmd_set_xstats_hide_zero_name
,
8088 (void *)&cmd_set_xstats_hide_zero_on_off
,
8093 /* *** CONFIGURE UNICAST HASH TABLE *** */
8094 struct cmd_set_uc_hash_table
{
8095 cmdline_fixed_string_t set
;
8096 cmdline_fixed_string_t port
;
8098 cmdline_fixed_string_t what
;
8099 struct ether_addr address
;
8100 cmdline_fixed_string_t mode
;
8104 cmd_set_uc_hash_parsed(void *parsed_result
,
8105 __attribute__((unused
)) struct cmdline
*cl
,
8106 __attribute__((unused
)) void *data
)
8109 struct cmd_set_uc_hash_table
*res
= parsed_result
;
8111 int is_on
= (strcmp(res
->mode
, "on") == 0) ? 1 : 0;
8113 if (strcmp(res
->what
, "uta") == 0)
8114 ret
= rte_eth_dev_uc_hash_table_set(res
->port_id
,
8115 &res
->address
,(uint8_t)is_on
);
8117 printf("bad unicast hash table parameter, return code = %d \n", ret
);
8121 cmdline_parse_token_string_t cmd_set_uc_hash_set
=
8122 TOKEN_STRING_INITIALIZER(struct cmd_set_uc_hash_table
,
8124 cmdline_parse_token_string_t cmd_set_uc_hash_port
=
8125 TOKEN_STRING_INITIALIZER(struct cmd_set_uc_hash_table
,
8127 cmdline_parse_token_num_t cmd_set_uc_hash_portid
=
8128 TOKEN_NUM_INITIALIZER(struct cmd_set_uc_hash_table
,
8130 cmdline_parse_token_string_t cmd_set_uc_hash_what
=
8131 TOKEN_STRING_INITIALIZER(struct cmd_set_uc_hash_table
,
8133 cmdline_parse_token_etheraddr_t cmd_set_uc_hash_mac
=
8134 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_uc_hash_table
,
8136 cmdline_parse_token_string_t cmd_set_uc_hash_mode
=
8137 TOKEN_STRING_INITIALIZER(struct cmd_set_uc_hash_table
,
8140 cmdline_parse_inst_t cmd_set_uc_hash_filter
= {
8141 .f
= cmd_set_uc_hash_parsed
,
8143 .help_str
= "set port <port_id> uta <mac_addr> on|off)",
8145 (void *)&cmd_set_uc_hash_set
,
8146 (void *)&cmd_set_uc_hash_port
,
8147 (void *)&cmd_set_uc_hash_portid
,
8148 (void *)&cmd_set_uc_hash_what
,
8149 (void *)&cmd_set_uc_hash_mac
,
8150 (void *)&cmd_set_uc_hash_mode
,
8155 struct cmd_set_uc_all_hash_table
{
8156 cmdline_fixed_string_t set
;
8157 cmdline_fixed_string_t port
;
8159 cmdline_fixed_string_t what
;
8160 cmdline_fixed_string_t value
;
8161 cmdline_fixed_string_t mode
;
8165 cmd_set_uc_all_hash_parsed(void *parsed_result
,
8166 __attribute__((unused
)) struct cmdline
*cl
,
8167 __attribute__((unused
)) void *data
)
8170 struct cmd_set_uc_all_hash_table
*res
= parsed_result
;
8172 int is_on
= (strcmp(res
->mode
, "on") == 0) ? 1 : 0;
8174 if ((strcmp(res
->what
, "uta") == 0) &&
8175 (strcmp(res
->value
, "all") == 0))
8176 ret
= rte_eth_dev_uc_all_hash_table_set(res
->port_id
,(uint8_t) is_on
);
8178 printf("bad unicast hash table parameter,"
8179 "return code = %d \n", ret
);
8182 cmdline_parse_token_string_t cmd_set_uc_all_hash_set
=
8183 TOKEN_STRING_INITIALIZER(struct cmd_set_uc_all_hash_table
,
8185 cmdline_parse_token_string_t cmd_set_uc_all_hash_port
=
8186 TOKEN_STRING_INITIALIZER(struct cmd_set_uc_all_hash_table
,
8188 cmdline_parse_token_num_t cmd_set_uc_all_hash_portid
=
8189 TOKEN_NUM_INITIALIZER(struct cmd_set_uc_all_hash_table
,
8191 cmdline_parse_token_string_t cmd_set_uc_all_hash_what
=
8192 TOKEN_STRING_INITIALIZER(struct cmd_set_uc_all_hash_table
,
8194 cmdline_parse_token_string_t cmd_set_uc_all_hash_value
=
8195 TOKEN_STRING_INITIALIZER(struct cmd_set_uc_all_hash_table
,
8197 cmdline_parse_token_string_t cmd_set_uc_all_hash_mode
=
8198 TOKEN_STRING_INITIALIZER(struct cmd_set_uc_all_hash_table
,
8201 cmdline_parse_inst_t cmd_set_uc_all_hash_filter
= {
8202 .f
= cmd_set_uc_all_hash_parsed
,
8204 .help_str
= "set port <port_id> uta all on|off",
8206 (void *)&cmd_set_uc_all_hash_set
,
8207 (void *)&cmd_set_uc_all_hash_port
,
8208 (void *)&cmd_set_uc_all_hash_portid
,
8209 (void *)&cmd_set_uc_all_hash_what
,
8210 (void *)&cmd_set_uc_all_hash_value
,
8211 (void *)&cmd_set_uc_all_hash_mode
,
8216 /* *** CONFIGURE MACVLAN FILTER FOR VF(s) *** */
8217 struct cmd_set_vf_macvlan_filter
{
8218 cmdline_fixed_string_t set
;
8219 cmdline_fixed_string_t port
;
8221 cmdline_fixed_string_t vf
;
8223 struct ether_addr address
;
8224 cmdline_fixed_string_t filter_type
;
8225 cmdline_fixed_string_t mode
;
8229 cmd_set_vf_macvlan_parsed(void *parsed_result
,
8230 __attribute__((unused
)) struct cmdline
*cl
,
8231 __attribute__((unused
)) void *data
)
8234 struct cmd_set_vf_macvlan_filter
*res
= parsed_result
;
8235 struct rte_eth_mac_filter filter
;
8237 memset(&filter
, 0, sizeof(struct rte_eth_mac_filter
));
8239 rte_memcpy(&filter
.mac_addr
, &res
->address
, ETHER_ADDR_LEN
);
8241 /* set VF MAC filter */
8245 filter
.dst_id
= res
->vf_id
;
8247 if (!strcmp(res
->filter_type
, "exact-mac"))
8248 filter
.filter_type
= RTE_MAC_PERFECT_MATCH
;
8249 else if (!strcmp(res
->filter_type
, "exact-mac-vlan"))
8250 filter
.filter_type
= RTE_MACVLAN_PERFECT_MATCH
;
8251 else if (!strcmp(res
->filter_type
, "hashmac"))
8252 filter
.filter_type
= RTE_MAC_HASH_MATCH
;
8253 else if (!strcmp(res
->filter_type
, "hashmac-vlan"))
8254 filter
.filter_type
= RTE_MACVLAN_HASH_MATCH
;
8256 is_on
= (strcmp(res
->mode
, "on") == 0) ? 1 : 0;
8259 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
8260 RTE_ETH_FILTER_MACVLAN
,
8264 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
8265 RTE_ETH_FILTER_MACVLAN
,
8266 RTE_ETH_FILTER_DELETE
,
8270 printf("bad set MAC hash parameter, return code = %d\n", ret
);
8274 cmdline_parse_token_string_t cmd_set_vf_macvlan_set
=
8275 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_macvlan_filter
,
8277 cmdline_parse_token_string_t cmd_set_vf_macvlan_port
=
8278 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_macvlan_filter
,
8280 cmdline_parse_token_num_t cmd_set_vf_macvlan_portid
=
8281 TOKEN_NUM_INITIALIZER(struct cmd_set_vf_macvlan_filter
,
8283 cmdline_parse_token_string_t cmd_set_vf_macvlan_vf
=
8284 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_macvlan_filter
,
8286 cmdline_parse_token_num_t cmd_set_vf_macvlan_vf_id
=
8287 TOKEN_NUM_INITIALIZER(struct cmd_set_vf_macvlan_filter
,
8289 cmdline_parse_token_etheraddr_t cmd_set_vf_macvlan_mac
=
8290 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_vf_macvlan_filter
,
8292 cmdline_parse_token_string_t cmd_set_vf_macvlan_filter_type
=
8293 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_macvlan_filter
,
8294 filter_type
, "exact-mac#exact-mac-vlan"
8295 "#hashmac#hashmac-vlan");
8296 cmdline_parse_token_string_t cmd_set_vf_macvlan_mode
=
8297 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_macvlan_filter
,
8300 cmdline_parse_inst_t cmd_set_vf_macvlan_filter
= {
8301 .f
= cmd_set_vf_macvlan_parsed
,
8303 .help_str
= "set port <port_id> vf <vf_id> <mac_addr> "
8304 "exact-mac|exact-mac-vlan|hashmac|hashmac-vlan on|off: "
8305 "Exact match rule: exact match of MAC or MAC and VLAN; "
8306 "hash match rule: hash match of MAC and exact match of VLAN",
8308 (void *)&cmd_set_vf_macvlan_set
,
8309 (void *)&cmd_set_vf_macvlan_port
,
8310 (void *)&cmd_set_vf_macvlan_portid
,
8311 (void *)&cmd_set_vf_macvlan_vf
,
8312 (void *)&cmd_set_vf_macvlan_vf_id
,
8313 (void *)&cmd_set_vf_macvlan_mac
,
8314 (void *)&cmd_set_vf_macvlan_filter_type
,
8315 (void *)&cmd_set_vf_macvlan_mode
,
8320 /* *** CONFIGURE VF TRAFFIC CONTROL *** */
8321 struct cmd_set_vf_traffic
{
8322 cmdline_fixed_string_t set
;
8323 cmdline_fixed_string_t port
;
8325 cmdline_fixed_string_t vf
;
8327 cmdline_fixed_string_t what
;
8328 cmdline_fixed_string_t mode
;
8332 cmd_set_vf_traffic_parsed(void *parsed_result
,
8333 __attribute__((unused
)) struct cmdline
*cl
,
8334 __attribute__((unused
)) void *data
)
8336 struct cmd_set_vf_traffic
*res
= parsed_result
;
8337 int is_rx
= (strcmp(res
->what
, "rx") == 0) ? 1 : 0;
8338 int is_on
= (strcmp(res
->mode
, "on") == 0) ? 1 : 0;
8340 set_vf_traffic(res
->port_id
, (uint8_t)is_rx
, res
->vf_id
,(uint8_t) is_on
);
8343 cmdline_parse_token_string_t cmd_setvf_traffic_set
=
8344 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_traffic
,
8346 cmdline_parse_token_string_t cmd_setvf_traffic_port
=
8347 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_traffic
,
8349 cmdline_parse_token_num_t cmd_setvf_traffic_portid
=
8350 TOKEN_NUM_INITIALIZER(struct cmd_set_vf_traffic
,
8352 cmdline_parse_token_string_t cmd_setvf_traffic_vf
=
8353 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_traffic
,
8355 cmdline_parse_token_num_t cmd_setvf_traffic_vfid
=
8356 TOKEN_NUM_INITIALIZER(struct cmd_set_vf_traffic
,
8358 cmdline_parse_token_string_t cmd_setvf_traffic_what
=
8359 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_traffic
,
8361 cmdline_parse_token_string_t cmd_setvf_traffic_mode
=
8362 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_traffic
,
8365 cmdline_parse_inst_t cmd_set_vf_traffic
= {
8366 .f
= cmd_set_vf_traffic_parsed
,
8368 .help_str
= "set port <port_id> vf <vf_id> rx|tx on|off",
8370 (void *)&cmd_setvf_traffic_set
,
8371 (void *)&cmd_setvf_traffic_port
,
8372 (void *)&cmd_setvf_traffic_portid
,
8373 (void *)&cmd_setvf_traffic_vf
,
8374 (void *)&cmd_setvf_traffic_vfid
,
8375 (void *)&cmd_setvf_traffic_what
,
8376 (void *)&cmd_setvf_traffic_mode
,
8381 /* *** CONFIGURE VF RECEIVE MODE *** */
8382 struct cmd_set_vf_rxmode
{
8383 cmdline_fixed_string_t set
;
8384 cmdline_fixed_string_t port
;
8386 cmdline_fixed_string_t vf
;
8388 cmdline_fixed_string_t what
;
8389 cmdline_fixed_string_t mode
;
8390 cmdline_fixed_string_t on
;
8394 cmd_set_vf_rxmode_parsed(void *parsed_result
,
8395 __attribute__((unused
)) struct cmdline
*cl
,
8396 __attribute__((unused
)) void *data
)
8399 uint16_t rx_mode
= 0;
8400 struct cmd_set_vf_rxmode
*res
= parsed_result
;
8402 int is_on
= (strcmp(res
->on
, "on") == 0) ? 1 : 0;
8403 if (!strcmp(res
->what
,"rxmode")) {
8404 if (!strcmp(res
->mode
, "AUPE"))
8405 rx_mode
|= ETH_VMDQ_ACCEPT_UNTAG
;
8406 else if (!strcmp(res
->mode
, "ROPE"))
8407 rx_mode
|= ETH_VMDQ_ACCEPT_HASH_UC
;
8408 else if (!strcmp(res
->mode
, "BAM"))
8409 rx_mode
|= ETH_VMDQ_ACCEPT_BROADCAST
;
8410 else if (!strncmp(res
->mode
, "MPE",3))
8411 rx_mode
|= ETH_VMDQ_ACCEPT_MULTICAST
;
8414 RTE_SET_USED(is_on
);
8416 #ifdef RTE_LIBRTE_IXGBE_PMD
8417 if (ret
== -ENOTSUP
)
8418 ret
= rte_pmd_ixgbe_set_vf_rxmode(res
->port_id
, res
->vf_id
,
8419 rx_mode
, (uint8_t)is_on
);
8421 #ifdef RTE_LIBRTE_BNXT_PMD
8422 if (ret
== -ENOTSUP
)
8423 ret
= rte_pmd_bnxt_set_vf_rxmode(res
->port_id
, res
->vf_id
,
8424 rx_mode
, (uint8_t)is_on
);
8427 printf("bad VF receive mode parameter, return code = %d \n",
8431 cmdline_parse_token_string_t cmd_set_vf_rxmode_set
=
8432 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_rxmode
,
8434 cmdline_parse_token_string_t cmd_set_vf_rxmode_port
=
8435 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_rxmode
,
8437 cmdline_parse_token_num_t cmd_set_vf_rxmode_portid
=
8438 TOKEN_NUM_INITIALIZER(struct cmd_set_vf_rxmode
,
8440 cmdline_parse_token_string_t cmd_set_vf_rxmode_vf
=
8441 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_rxmode
,
8443 cmdline_parse_token_num_t cmd_set_vf_rxmode_vfid
=
8444 TOKEN_NUM_INITIALIZER(struct cmd_set_vf_rxmode
,
8446 cmdline_parse_token_string_t cmd_set_vf_rxmode_what
=
8447 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_rxmode
,
8449 cmdline_parse_token_string_t cmd_set_vf_rxmode_mode
=
8450 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_rxmode
,
8451 mode
, "AUPE#ROPE#BAM#MPE");
8452 cmdline_parse_token_string_t cmd_set_vf_rxmode_on
=
8453 TOKEN_STRING_INITIALIZER(struct cmd_set_vf_rxmode
,
8456 cmdline_parse_inst_t cmd_set_vf_rxmode
= {
8457 .f
= cmd_set_vf_rxmode_parsed
,
8459 .help_str
= "set port <port_id> vf <vf_id> rxmode "
8460 "AUPE|ROPE|BAM|MPE on|off",
8462 (void *)&cmd_set_vf_rxmode_set
,
8463 (void *)&cmd_set_vf_rxmode_port
,
8464 (void *)&cmd_set_vf_rxmode_portid
,
8465 (void *)&cmd_set_vf_rxmode_vf
,
8466 (void *)&cmd_set_vf_rxmode_vfid
,
8467 (void *)&cmd_set_vf_rxmode_what
,
8468 (void *)&cmd_set_vf_rxmode_mode
,
8469 (void *)&cmd_set_vf_rxmode_on
,
8474 /* *** ADD MAC ADDRESS FILTER FOR A VF OF A PORT *** */
8475 struct cmd_vf_mac_addr_result
{
8476 cmdline_fixed_string_t mac_addr_cmd
;
8477 cmdline_fixed_string_t what
;
8478 cmdline_fixed_string_t port
;
8480 cmdline_fixed_string_t vf
;
8482 struct ether_addr address
;
8485 static void cmd_vf_mac_addr_parsed(void *parsed_result
,
8486 __attribute__((unused
)) struct cmdline
*cl
,
8487 __attribute__((unused
)) void *data
)
8489 struct cmd_vf_mac_addr_result
*res
= parsed_result
;
8492 if (strcmp(res
->what
, "add") != 0)
8495 #ifdef RTE_LIBRTE_I40E_PMD
8496 if (ret
== -ENOTSUP
)
8497 ret
= rte_pmd_i40e_add_vf_mac_addr(res
->port_num
, res
->vf_num
,
8500 #ifdef RTE_LIBRTE_BNXT_PMD
8501 if (ret
== -ENOTSUP
)
8502 ret
= rte_pmd_bnxt_mac_addr_add(res
->port_num
, &res
->address
,
8507 printf("vf_mac_addr_cmd error: (%s)\n", strerror(-ret
));
8511 cmdline_parse_token_string_t cmd_vf_mac_addr_cmd
=
8512 TOKEN_STRING_INITIALIZER(struct cmd_vf_mac_addr_result
,
8513 mac_addr_cmd
,"mac_addr");
8514 cmdline_parse_token_string_t cmd_vf_mac_addr_what
=
8515 TOKEN_STRING_INITIALIZER(struct cmd_vf_mac_addr_result
,
8517 cmdline_parse_token_string_t cmd_vf_mac_addr_port
=
8518 TOKEN_STRING_INITIALIZER(struct cmd_vf_mac_addr_result
,
8520 cmdline_parse_token_num_t cmd_vf_mac_addr_portnum
=
8521 TOKEN_NUM_INITIALIZER(struct cmd_vf_mac_addr_result
,
8523 cmdline_parse_token_string_t cmd_vf_mac_addr_vf
=
8524 TOKEN_STRING_INITIALIZER(struct cmd_vf_mac_addr_result
,
8526 cmdline_parse_token_num_t cmd_vf_mac_addr_vfnum
=
8527 TOKEN_NUM_INITIALIZER(struct cmd_vf_mac_addr_result
,
8529 cmdline_parse_token_etheraddr_t cmd_vf_mac_addr_addr
=
8530 TOKEN_ETHERADDR_INITIALIZER(struct cmd_vf_mac_addr_result
,
8533 cmdline_parse_inst_t cmd_vf_mac_addr_filter
= {
8534 .f
= cmd_vf_mac_addr_parsed
,
8536 .help_str
= "mac_addr add port <port_id> vf <vf_id> <mac_addr>: "
8537 "Add MAC address filtering for a VF on port_id",
8539 (void *)&cmd_vf_mac_addr_cmd
,
8540 (void *)&cmd_vf_mac_addr_what
,
8541 (void *)&cmd_vf_mac_addr_port
,
8542 (void *)&cmd_vf_mac_addr_portnum
,
8543 (void *)&cmd_vf_mac_addr_vf
,
8544 (void *)&cmd_vf_mac_addr_vfnum
,
8545 (void *)&cmd_vf_mac_addr_addr
,
8550 /* *** ADD/REMOVE A VLAN IDENTIFIER TO/FROM A PORT VLAN RX FILTER *** */
8551 struct cmd_vf_rx_vlan_filter
{
8552 cmdline_fixed_string_t rx_vlan
;
8553 cmdline_fixed_string_t what
;
8555 cmdline_fixed_string_t port
;
8557 cmdline_fixed_string_t vf
;
8562 cmd_vf_rx_vlan_filter_parsed(void *parsed_result
,
8563 __attribute__((unused
)) struct cmdline
*cl
,
8564 __attribute__((unused
)) void *data
)
8566 struct cmd_vf_rx_vlan_filter
*res
= parsed_result
;
8569 __rte_unused
int is_add
= (strcmp(res
->what
, "add") == 0) ? 1 : 0;
8571 #ifdef RTE_LIBRTE_IXGBE_PMD
8572 if (ret
== -ENOTSUP
)
8573 ret
= rte_pmd_ixgbe_set_vf_vlan_filter(res
->port_id
,
8574 res
->vlan_id
, res
->vf_mask
, is_add
);
8576 #ifdef RTE_LIBRTE_I40E_PMD
8577 if (ret
== -ENOTSUP
)
8578 ret
= rte_pmd_i40e_set_vf_vlan_filter(res
->port_id
,
8579 res
->vlan_id
, res
->vf_mask
, is_add
);
8581 #ifdef RTE_LIBRTE_BNXT_PMD
8582 if (ret
== -ENOTSUP
)
8583 ret
= rte_pmd_bnxt_set_vf_vlan_filter(res
->port_id
,
8584 res
->vlan_id
, res
->vf_mask
, is_add
);
8591 printf("invalid vlan_id %d or vf_mask %"PRIu64
"\n",
8592 res
->vlan_id
, res
->vf_mask
);
8595 printf("invalid port_id %d\n", res
->port_id
);
8598 printf("function not implemented or supported\n");
8601 printf("programming error: (%s)\n", strerror(-ret
));
8605 cmdline_parse_token_string_t cmd_vf_rx_vlan_filter_rx_vlan
=
8606 TOKEN_STRING_INITIALIZER(struct cmd_vf_rx_vlan_filter
,
8607 rx_vlan
, "rx_vlan");
8608 cmdline_parse_token_string_t cmd_vf_rx_vlan_filter_what
=
8609 TOKEN_STRING_INITIALIZER(struct cmd_vf_rx_vlan_filter
,
8611 cmdline_parse_token_num_t cmd_vf_rx_vlan_filter_vlanid
=
8612 TOKEN_NUM_INITIALIZER(struct cmd_vf_rx_vlan_filter
,
8614 cmdline_parse_token_string_t cmd_vf_rx_vlan_filter_port
=
8615 TOKEN_STRING_INITIALIZER(struct cmd_vf_rx_vlan_filter
,
8617 cmdline_parse_token_num_t cmd_vf_rx_vlan_filter_portid
=
8618 TOKEN_NUM_INITIALIZER(struct cmd_vf_rx_vlan_filter
,
8620 cmdline_parse_token_string_t cmd_vf_rx_vlan_filter_vf
=
8621 TOKEN_STRING_INITIALIZER(struct cmd_vf_rx_vlan_filter
,
8623 cmdline_parse_token_num_t cmd_vf_rx_vlan_filter_vf_mask
=
8624 TOKEN_NUM_INITIALIZER(struct cmd_vf_rx_vlan_filter
,
8627 cmdline_parse_inst_t cmd_vf_rxvlan_filter
= {
8628 .f
= cmd_vf_rx_vlan_filter_parsed
,
8630 .help_str
= "rx_vlan add|rm <vlan_id> port <port_id> vf <vf_mask>: "
8631 "(vf_mask = hexadecimal VF mask)",
8633 (void *)&cmd_vf_rx_vlan_filter_rx_vlan
,
8634 (void *)&cmd_vf_rx_vlan_filter_what
,
8635 (void *)&cmd_vf_rx_vlan_filter_vlanid
,
8636 (void *)&cmd_vf_rx_vlan_filter_port
,
8637 (void *)&cmd_vf_rx_vlan_filter_portid
,
8638 (void *)&cmd_vf_rx_vlan_filter_vf
,
8639 (void *)&cmd_vf_rx_vlan_filter_vf_mask
,
8644 /* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */
8645 struct cmd_queue_rate_limit_result
{
8646 cmdline_fixed_string_t set
;
8647 cmdline_fixed_string_t port
;
8649 cmdline_fixed_string_t queue
;
8651 cmdline_fixed_string_t rate
;
8655 static void cmd_queue_rate_limit_parsed(void *parsed_result
,
8656 __attribute__((unused
)) struct cmdline
*cl
,
8657 __attribute__((unused
)) void *data
)
8659 struct cmd_queue_rate_limit_result
*res
= parsed_result
;
8662 if ((strcmp(res
->set
, "set") == 0) && (strcmp(res
->port
, "port") == 0)
8663 && (strcmp(res
->queue
, "queue") == 0)
8664 && (strcmp(res
->rate
, "rate") == 0))
8665 ret
= set_queue_rate_limit(res
->port_num
, res
->queue_num
,
8668 printf("queue_rate_limit_cmd error: (%s)\n", strerror(-ret
));
8672 cmdline_parse_token_string_t cmd_queue_rate_limit_set
=
8673 TOKEN_STRING_INITIALIZER(struct cmd_queue_rate_limit_result
,
8675 cmdline_parse_token_string_t cmd_queue_rate_limit_port
=
8676 TOKEN_STRING_INITIALIZER(struct cmd_queue_rate_limit_result
,
8678 cmdline_parse_token_num_t cmd_queue_rate_limit_portnum
=
8679 TOKEN_NUM_INITIALIZER(struct cmd_queue_rate_limit_result
,
8681 cmdline_parse_token_string_t cmd_queue_rate_limit_queue
=
8682 TOKEN_STRING_INITIALIZER(struct cmd_queue_rate_limit_result
,
8684 cmdline_parse_token_num_t cmd_queue_rate_limit_queuenum
=
8685 TOKEN_NUM_INITIALIZER(struct cmd_queue_rate_limit_result
,
8687 cmdline_parse_token_string_t cmd_queue_rate_limit_rate
=
8688 TOKEN_STRING_INITIALIZER(struct cmd_queue_rate_limit_result
,
8690 cmdline_parse_token_num_t cmd_queue_rate_limit_ratenum
=
8691 TOKEN_NUM_INITIALIZER(struct cmd_queue_rate_limit_result
,
8694 cmdline_parse_inst_t cmd_queue_rate_limit
= {
8695 .f
= cmd_queue_rate_limit_parsed
,
8697 .help_str
= "set port <port_id> queue <queue_id> rate <rate_value>: "
8698 "Set rate limit for a queue on port_id",
8700 (void *)&cmd_queue_rate_limit_set
,
8701 (void *)&cmd_queue_rate_limit_port
,
8702 (void *)&cmd_queue_rate_limit_portnum
,
8703 (void *)&cmd_queue_rate_limit_queue
,
8704 (void *)&cmd_queue_rate_limit_queuenum
,
8705 (void *)&cmd_queue_rate_limit_rate
,
8706 (void *)&cmd_queue_rate_limit_ratenum
,
8711 /* *** SET RATE LIMIT FOR A VF OF A PORT *** */
8712 struct cmd_vf_rate_limit_result
{
8713 cmdline_fixed_string_t set
;
8714 cmdline_fixed_string_t port
;
8716 cmdline_fixed_string_t vf
;
8718 cmdline_fixed_string_t rate
;
8720 cmdline_fixed_string_t q_msk
;
8724 static void cmd_vf_rate_limit_parsed(void *parsed_result
,
8725 __attribute__((unused
)) struct cmdline
*cl
,
8726 __attribute__((unused
)) void *data
)
8728 struct cmd_vf_rate_limit_result
*res
= parsed_result
;
8731 if ((strcmp(res
->set
, "set") == 0) && (strcmp(res
->port
, "port") == 0)
8732 && (strcmp(res
->vf
, "vf") == 0)
8733 && (strcmp(res
->rate
, "rate") == 0)
8734 && (strcmp(res
->q_msk
, "queue_mask") == 0))
8735 ret
= set_vf_rate_limit(res
->port_num
, res
->vf_num
,
8736 res
->rate_num
, res
->q_msk_val
);
8738 printf("vf_rate_limit_cmd error: (%s)\n", strerror(-ret
));
8742 cmdline_parse_token_string_t cmd_vf_rate_limit_set
=
8743 TOKEN_STRING_INITIALIZER(struct cmd_vf_rate_limit_result
,
8745 cmdline_parse_token_string_t cmd_vf_rate_limit_port
=
8746 TOKEN_STRING_INITIALIZER(struct cmd_vf_rate_limit_result
,
8748 cmdline_parse_token_num_t cmd_vf_rate_limit_portnum
=
8749 TOKEN_NUM_INITIALIZER(struct cmd_vf_rate_limit_result
,
8751 cmdline_parse_token_string_t cmd_vf_rate_limit_vf
=
8752 TOKEN_STRING_INITIALIZER(struct cmd_vf_rate_limit_result
,
8754 cmdline_parse_token_num_t cmd_vf_rate_limit_vfnum
=
8755 TOKEN_NUM_INITIALIZER(struct cmd_vf_rate_limit_result
,
8757 cmdline_parse_token_string_t cmd_vf_rate_limit_rate
=
8758 TOKEN_STRING_INITIALIZER(struct cmd_vf_rate_limit_result
,
8760 cmdline_parse_token_num_t cmd_vf_rate_limit_ratenum
=
8761 TOKEN_NUM_INITIALIZER(struct cmd_vf_rate_limit_result
,
8763 cmdline_parse_token_string_t cmd_vf_rate_limit_q_msk
=
8764 TOKEN_STRING_INITIALIZER(struct cmd_vf_rate_limit_result
,
8765 q_msk
, "queue_mask");
8766 cmdline_parse_token_num_t cmd_vf_rate_limit_q_msk_val
=
8767 TOKEN_NUM_INITIALIZER(struct cmd_vf_rate_limit_result
,
8770 cmdline_parse_inst_t cmd_vf_rate_limit
= {
8771 .f
= cmd_vf_rate_limit_parsed
,
8773 .help_str
= "set port <port_id> vf <vf_id> rate <rate_value> "
8774 "queue_mask <queue_mask_value>: "
8775 "Set rate limit for queues of VF on port_id",
8777 (void *)&cmd_vf_rate_limit_set
,
8778 (void *)&cmd_vf_rate_limit_port
,
8779 (void *)&cmd_vf_rate_limit_portnum
,
8780 (void *)&cmd_vf_rate_limit_vf
,
8781 (void *)&cmd_vf_rate_limit_vfnum
,
8782 (void *)&cmd_vf_rate_limit_rate
,
8783 (void *)&cmd_vf_rate_limit_ratenum
,
8784 (void *)&cmd_vf_rate_limit_q_msk
,
8785 (void *)&cmd_vf_rate_limit_q_msk_val
,
8790 /* *** ADD TUNNEL FILTER OF A PORT *** */
8791 struct cmd_tunnel_filter_result
{
8792 cmdline_fixed_string_t cmd
;
8793 cmdline_fixed_string_t what
;
8795 struct ether_addr outer_mac
;
8796 struct ether_addr inner_mac
;
8797 cmdline_ipaddr_t ip_value
;
8798 uint16_t inner_vlan
;
8799 cmdline_fixed_string_t tunnel_type
;
8800 cmdline_fixed_string_t filter_type
;
8806 cmd_tunnel_filter_parsed(void *parsed_result
,
8807 __attribute__((unused
)) struct cmdline
*cl
,
8808 __attribute__((unused
)) void *data
)
8810 struct cmd_tunnel_filter_result
*res
= parsed_result
;
8811 struct rte_eth_tunnel_filter_conf tunnel_filter_conf
;
8814 memset(&tunnel_filter_conf
, 0, sizeof(tunnel_filter_conf
));
8816 ether_addr_copy(&res
->outer_mac
, &tunnel_filter_conf
.outer_mac
);
8817 ether_addr_copy(&res
->inner_mac
, &tunnel_filter_conf
.inner_mac
);
8818 tunnel_filter_conf
.inner_vlan
= res
->inner_vlan
;
8820 if (res
->ip_value
.family
== AF_INET
) {
8821 tunnel_filter_conf
.ip_addr
.ipv4_addr
=
8822 res
->ip_value
.addr
.ipv4
.s_addr
;
8823 tunnel_filter_conf
.ip_type
= RTE_TUNNEL_IPTYPE_IPV4
;
8825 memcpy(&(tunnel_filter_conf
.ip_addr
.ipv6_addr
),
8826 &(res
->ip_value
.addr
.ipv6
),
8827 sizeof(struct in6_addr
));
8828 tunnel_filter_conf
.ip_type
= RTE_TUNNEL_IPTYPE_IPV6
;
8831 if (!strcmp(res
->filter_type
, "imac-ivlan"))
8832 tunnel_filter_conf
.filter_type
= RTE_TUNNEL_FILTER_IMAC_IVLAN
;
8833 else if (!strcmp(res
->filter_type
, "imac-ivlan-tenid"))
8834 tunnel_filter_conf
.filter_type
=
8835 RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID
;
8836 else if (!strcmp(res
->filter_type
, "imac-tenid"))
8837 tunnel_filter_conf
.filter_type
= RTE_TUNNEL_FILTER_IMAC_TENID
;
8838 else if (!strcmp(res
->filter_type
, "imac"))
8839 tunnel_filter_conf
.filter_type
= ETH_TUNNEL_FILTER_IMAC
;
8840 else if (!strcmp(res
->filter_type
, "omac-imac-tenid"))
8841 tunnel_filter_conf
.filter_type
=
8842 RTE_TUNNEL_FILTER_OMAC_TENID_IMAC
;
8843 else if (!strcmp(res
->filter_type
, "oip"))
8844 tunnel_filter_conf
.filter_type
= ETH_TUNNEL_FILTER_OIP
;
8845 else if (!strcmp(res
->filter_type
, "iip"))
8846 tunnel_filter_conf
.filter_type
= ETH_TUNNEL_FILTER_IIP
;
8848 printf("The filter type is not supported");
8852 if (!strcmp(res
->tunnel_type
, "vxlan"))
8853 tunnel_filter_conf
.tunnel_type
= RTE_TUNNEL_TYPE_VXLAN
;
8854 else if (!strcmp(res
->tunnel_type
, "vxlan-gpe"))
8855 tunnel_filter_conf
.tunnel_type
= RTE_TUNNEL_TYPE_VXLAN_GPE
;
8856 else if (!strcmp(res
->tunnel_type
, "nvgre"))
8857 tunnel_filter_conf
.tunnel_type
= RTE_TUNNEL_TYPE_NVGRE
;
8858 else if (!strcmp(res
->tunnel_type
, "ipingre"))
8859 tunnel_filter_conf
.tunnel_type
= RTE_TUNNEL_TYPE_IP_IN_GRE
;
8861 printf("The tunnel type %s not supported.\n", res
->tunnel_type
);
8865 tunnel_filter_conf
.tenant_id
= res
->tenant_id
;
8866 tunnel_filter_conf
.queue_id
= res
->queue_num
;
8867 if (!strcmp(res
->what
, "add"))
8868 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
8869 RTE_ETH_FILTER_TUNNEL
,
8871 &tunnel_filter_conf
);
8873 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
8874 RTE_ETH_FILTER_TUNNEL
,
8875 RTE_ETH_FILTER_DELETE
,
8876 &tunnel_filter_conf
);
8878 printf("cmd_tunnel_filter_parsed error: (%s)\n",
8882 cmdline_parse_token_string_t cmd_tunnel_filter_cmd
=
8883 TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result
,
8884 cmd
, "tunnel_filter");
8885 cmdline_parse_token_string_t cmd_tunnel_filter_what
=
8886 TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result
,
8888 cmdline_parse_token_num_t cmd_tunnel_filter_port_id
=
8889 TOKEN_NUM_INITIALIZER(struct cmd_tunnel_filter_result
,
8891 cmdline_parse_token_etheraddr_t cmd_tunnel_filter_outer_mac
=
8892 TOKEN_ETHERADDR_INITIALIZER(struct cmd_tunnel_filter_result
,
8894 cmdline_parse_token_etheraddr_t cmd_tunnel_filter_inner_mac
=
8895 TOKEN_ETHERADDR_INITIALIZER(struct cmd_tunnel_filter_result
,
8897 cmdline_parse_token_num_t cmd_tunnel_filter_innner_vlan
=
8898 TOKEN_NUM_INITIALIZER(struct cmd_tunnel_filter_result
,
8899 inner_vlan
, UINT16
);
8900 cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value
=
8901 TOKEN_IPADDR_INITIALIZER(struct cmd_tunnel_filter_result
,
8903 cmdline_parse_token_string_t cmd_tunnel_filter_tunnel_type
=
8904 TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result
,
8905 tunnel_type
, "vxlan#nvgre#ipingre#vxlan-gpe");
8907 cmdline_parse_token_string_t cmd_tunnel_filter_filter_type
=
8908 TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result
,
8909 filter_type
, "oip#iip#imac-ivlan#imac-ivlan-tenid#imac-tenid#"
8910 "imac#omac-imac-tenid");
8911 cmdline_parse_token_num_t cmd_tunnel_filter_tenant_id
=
8912 TOKEN_NUM_INITIALIZER(struct cmd_tunnel_filter_result
,
8914 cmdline_parse_token_num_t cmd_tunnel_filter_queue_num
=
8915 TOKEN_NUM_INITIALIZER(struct cmd_tunnel_filter_result
,
8918 cmdline_parse_inst_t cmd_tunnel_filter
= {
8919 .f
= cmd_tunnel_filter_parsed
,
8921 .help_str
= "tunnel_filter add|rm <port_id> <outer_mac> <inner_mac> "
8922 "<ip> <inner_vlan> vxlan|nvgre|ipingre oip|iip|imac-ivlan|"
8923 "imac-ivlan-tenid|imac-tenid|imac|omac-imac-tenid <tenant_id> "
8924 "<queue_id>: Add/Rm tunnel filter of a port",
8926 (void *)&cmd_tunnel_filter_cmd
,
8927 (void *)&cmd_tunnel_filter_what
,
8928 (void *)&cmd_tunnel_filter_port_id
,
8929 (void *)&cmd_tunnel_filter_outer_mac
,
8930 (void *)&cmd_tunnel_filter_inner_mac
,
8931 (void *)&cmd_tunnel_filter_ip_value
,
8932 (void *)&cmd_tunnel_filter_innner_vlan
,
8933 (void *)&cmd_tunnel_filter_tunnel_type
,
8934 (void *)&cmd_tunnel_filter_filter_type
,
8935 (void *)&cmd_tunnel_filter_tenant_id
,
8936 (void *)&cmd_tunnel_filter_queue_num
,
8941 /* *** CONFIGURE TUNNEL UDP PORT *** */
8942 struct cmd_tunnel_udp_config
{
8943 cmdline_fixed_string_t cmd
;
8944 cmdline_fixed_string_t what
;
8950 cmd_tunnel_udp_config_parsed(void *parsed_result
,
8951 __attribute__((unused
)) struct cmdline
*cl
,
8952 __attribute__((unused
)) void *data
)
8954 struct cmd_tunnel_udp_config
*res
= parsed_result
;
8955 struct rte_eth_udp_tunnel tunnel_udp
;
8958 tunnel_udp
.udp_port
= res
->udp_port
;
8960 if (!strcmp(res
->cmd
, "rx_vxlan_port"))
8961 tunnel_udp
.prot_type
= RTE_TUNNEL_TYPE_VXLAN
;
8963 if (!strcmp(res
->what
, "add"))
8964 ret
= rte_eth_dev_udp_tunnel_port_add(res
->port_id
,
8967 ret
= rte_eth_dev_udp_tunnel_port_delete(res
->port_id
,
8971 printf("udp tunneling add error: (%s)\n", strerror(-ret
));
8974 cmdline_parse_token_string_t cmd_tunnel_udp_config_cmd
=
8975 TOKEN_STRING_INITIALIZER(struct cmd_tunnel_udp_config
,
8976 cmd
, "rx_vxlan_port");
8977 cmdline_parse_token_string_t cmd_tunnel_udp_config_what
=
8978 TOKEN_STRING_INITIALIZER(struct cmd_tunnel_udp_config
,
8980 cmdline_parse_token_num_t cmd_tunnel_udp_config_udp_port
=
8981 TOKEN_NUM_INITIALIZER(struct cmd_tunnel_udp_config
,
8983 cmdline_parse_token_num_t cmd_tunnel_udp_config_port_id
=
8984 TOKEN_NUM_INITIALIZER(struct cmd_tunnel_udp_config
,
8987 cmdline_parse_inst_t cmd_tunnel_udp_config
= {
8988 .f
= cmd_tunnel_udp_config_parsed
,
8990 .help_str
= "rx_vxlan_port add|rm <udp_port> <port_id>: "
8991 "Add/Remove a tunneling UDP port filter",
8993 (void *)&cmd_tunnel_udp_config_cmd
,
8994 (void *)&cmd_tunnel_udp_config_what
,
8995 (void *)&cmd_tunnel_udp_config_udp_port
,
8996 (void *)&cmd_tunnel_udp_config_port_id
,
9001 struct cmd_config_tunnel_udp_port
{
9002 cmdline_fixed_string_t port
;
9003 cmdline_fixed_string_t config
;
9005 cmdline_fixed_string_t udp_tunnel_port
;
9006 cmdline_fixed_string_t action
;
9007 cmdline_fixed_string_t tunnel_type
;
9012 cmd_cfg_tunnel_udp_port_parsed(void *parsed_result
,
9013 __attribute__((unused
)) struct cmdline
*cl
,
9014 __attribute__((unused
)) void *data
)
9016 struct cmd_config_tunnel_udp_port
*res
= parsed_result
;
9017 struct rte_eth_udp_tunnel tunnel_udp
;
9020 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
9023 tunnel_udp
.udp_port
= res
->udp_port
;
9025 if (!strcmp(res
->tunnel_type
, "vxlan")) {
9026 tunnel_udp
.prot_type
= RTE_TUNNEL_TYPE_VXLAN
;
9027 } else if (!strcmp(res
->tunnel_type
, "geneve")) {
9028 tunnel_udp
.prot_type
= RTE_TUNNEL_TYPE_GENEVE
;
9029 } else if (!strcmp(res
->tunnel_type
, "vxlan-gpe")) {
9030 tunnel_udp
.prot_type
= RTE_TUNNEL_TYPE_VXLAN_GPE
;
9032 printf("Invalid tunnel type\n");
9036 if (!strcmp(res
->action
, "add"))
9037 ret
= rte_eth_dev_udp_tunnel_port_add(res
->port_id
,
9040 ret
= rte_eth_dev_udp_tunnel_port_delete(res
->port_id
,
9044 printf("udp tunneling port add error: (%s)\n", strerror(-ret
));
9047 cmdline_parse_token_string_t cmd_config_tunnel_udp_port_port
=
9048 TOKEN_STRING_INITIALIZER(struct cmd_config_tunnel_udp_port
, port
,
9050 cmdline_parse_token_string_t cmd_config_tunnel_udp_port_config
=
9051 TOKEN_STRING_INITIALIZER(struct cmd_config_tunnel_udp_port
, config
,
9053 cmdline_parse_token_num_t cmd_config_tunnel_udp_port_port_id
=
9054 TOKEN_NUM_INITIALIZER(struct cmd_config_tunnel_udp_port
, port_id
,
9056 cmdline_parse_token_string_t cmd_config_tunnel_udp_port_tunnel_port
=
9057 TOKEN_STRING_INITIALIZER(struct cmd_config_tunnel_udp_port
,
9060 cmdline_parse_token_string_t cmd_config_tunnel_udp_port_action
=
9061 TOKEN_STRING_INITIALIZER(struct cmd_config_tunnel_udp_port
, action
,
9063 cmdline_parse_token_string_t cmd_config_tunnel_udp_port_tunnel_type
=
9064 TOKEN_STRING_INITIALIZER(struct cmd_config_tunnel_udp_port
, tunnel_type
,
9065 "vxlan#geneve#vxlan-gpe");
9066 cmdline_parse_token_num_t cmd_config_tunnel_udp_port_value
=
9067 TOKEN_NUM_INITIALIZER(struct cmd_config_tunnel_udp_port
, udp_port
,
9070 cmdline_parse_inst_t cmd_cfg_tunnel_udp_port
= {
9071 .f
= cmd_cfg_tunnel_udp_port_parsed
,
9073 .help_str
= "port config <port_id> udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe <udp_port>",
9075 (void *)&cmd_config_tunnel_udp_port_port
,
9076 (void *)&cmd_config_tunnel_udp_port_config
,
9077 (void *)&cmd_config_tunnel_udp_port_port_id
,
9078 (void *)&cmd_config_tunnel_udp_port_tunnel_port
,
9079 (void *)&cmd_config_tunnel_udp_port_action
,
9080 (void *)&cmd_config_tunnel_udp_port_tunnel_type
,
9081 (void *)&cmd_config_tunnel_udp_port_value
,
9086 /* *** GLOBAL CONFIG *** */
9087 struct cmd_global_config_result
{
9088 cmdline_fixed_string_t cmd
;
9090 cmdline_fixed_string_t cfg_type
;
9095 cmd_global_config_parsed(void *parsed_result
,
9096 __attribute__((unused
)) struct cmdline
*cl
,
9097 __attribute__((unused
)) void *data
)
9099 struct cmd_global_config_result
*res
= parsed_result
;
9100 struct rte_eth_global_cfg conf
;
9103 memset(&conf
, 0, sizeof(conf
));
9104 conf
.cfg_type
= RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN
;
9105 conf
.cfg
.gre_key_len
= res
->len
;
9106 ret
= rte_eth_dev_filter_ctrl(res
->port_id
, RTE_ETH_FILTER_NONE
,
9107 RTE_ETH_FILTER_SET
, &conf
);
9109 printf("Global config error\n");
9112 cmdline_parse_token_string_t cmd_global_config_cmd
=
9113 TOKEN_STRING_INITIALIZER(struct cmd_global_config_result
, cmd
,
9115 cmdline_parse_token_num_t cmd_global_config_port_id
=
9116 TOKEN_NUM_INITIALIZER(struct cmd_global_config_result
, port_id
,
9118 cmdline_parse_token_string_t cmd_global_config_type
=
9119 TOKEN_STRING_INITIALIZER(struct cmd_global_config_result
,
9120 cfg_type
, "gre-key-len");
9121 cmdline_parse_token_num_t cmd_global_config_gre_key_len
=
9122 TOKEN_NUM_INITIALIZER(struct cmd_global_config_result
,
9125 cmdline_parse_inst_t cmd_global_config
= {
9126 .f
= cmd_global_config_parsed
,
9127 .data
= (void *)NULL
,
9128 .help_str
= "global_config <port_id> gre-key-len <key_len>",
9130 (void *)&cmd_global_config_cmd
,
9131 (void *)&cmd_global_config_port_id
,
9132 (void *)&cmd_global_config_type
,
9133 (void *)&cmd_global_config_gre_key_len
,
9138 /* *** CONFIGURE VM MIRROR VLAN/POOL RULE *** */
9139 struct cmd_set_mirror_mask_result
{
9140 cmdline_fixed_string_t set
;
9141 cmdline_fixed_string_t port
;
9143 cmdline_fixed_string_t mirror
;
9145 cmdline_fixed_string_t what
;
9146 cmdline_fixed_string_t value
;
9147 cmdline_fixed_string_t dstpool
;
9149 cmdline_fixed_string_t on
;
9152 cmdline_parse_token_string_t cmd_mirror_mask_set
=
9153 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result
,
9155 cmdline_parse_token_string_t cmd_mirror_mask_port
=
9156 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result
,
9158 cmdline_parse_token_num_t cmd_mirror_mask_portid
=
9159 TOKEN_NUM_INITIALIZER(struct cmd_set_mirror_mask_result
,
9161 cmdline_parse_token_string_t cmd_mirror_mask_mirror
=
9162 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result
,
9163 mirror
, "mirror-rule");
9164 cmdline_parse_token_num_t cmd_mirror_mask_ruleid
=
9165 TOKEN_NUM_INITIALIZER(struct cmd_set_mirror_mask_result
,
9167 cmdline_parse_token_string_t cmd_mirror_mask_what
=
9168 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result
,
9169 what
, "pool-mirror-up#pool-mirror-down"
9171 cmdline_parse_token_string_t cmd_mirror_mask_value
=
9172 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result
,
9174 cmdline_parse_token_string_t cmd_mirror_mask_dstpool
=
9175 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result
,
9176 dstpool
, "dst-pool");
9177 cmdline_parse_token_num_t cmd_mirror_mask_poolid
=
9178 TOKEN_NUM_INITIALIZER(struct cmd_set_mirror_mask_result
,
9180 cmdline_parse_token_string_t cmd_mirror_mask_on
=
9181 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_mask_result
,
9185 cmd_set_mirror_mask_parsed(void *parsed_result
,
9186 __attribute__((unused
)) struct cmdline
*cl
,
9187 __attribute__((unused
)) void *data
)
9190 struct cmd_set_mirror_mask_result
*res
= parsed_result
;
9191 struct rte_eth_mirror_conf mr_conf
;
9193 memset(&mr_conf
, 0, sizeof(struct rte_eth_mirror_conf
));
9195 unsigned int vlan_list
[ETH_MIRROR_MAX_VLANS
];
9197 mr_conf
.dst_pool
= res
->dstpool_id
;
9199 if (!strcmp(res
->what
, "pool-mirror-up")) {
9200 mr_conf
.pool_mask
= strtoull(res
->value
, NULL
, 16);
9201 mr_conf
.rule_type
= ETH_MIRROR_VIRTUAL_POOL_UP
;
9202 } else if (!strcmp(res
->what
, "pool-mirror-down")) {
9203 mr_conf
.pool_mask
= strtoull(res
->value
, NULL
, 16);
9204 mr_conf
.rule_type
= ETH_MIRROR_VIRTUAL_POOL_DOWN
;
9205 } else if (!strcmp(res
->what
, "vlan-mirror")) {
9206 mr_conf
.rule_type
= ETH_MIRROR_VLAN
;
9207 nb_item
= parse_item_list(res
->value
, "vlan",
9208 ETH_MIRROR_MAX_VLANS
, vlan_list
, 1);
9212 for (i
= 0; i
< nb_item
; i
++) {
9213 if (vlan_list
[i
] > ETHER_MAX_VLAN_ID
) {
9214 printf("Invalid vlan_id: must be < 4096\n");
9218 mr_conf
.vlan
.vlan_id
[i
] = (uint16_t)vlan_list
[i
];
9219 mr_conf
.vlan
.vlan_mask
|= 1ULL << i
;
9223 if (!strcmp(res
->on
, "on"))
9224 ret
= rte_eth_mirror_rule_set(res
->port_id
, &mr_conf
,
9227 ret
= rte_eth_mirror_rule_set(res
->port_id
, &mr_conf
,
9230 printf("mirror rule add error: (%s)\n", strerror(-ret
));
9233 cmdline_parse_inst_t cmd_set_mirror_mask
= {
9234 .f
= cmd_set_mirror_mask_parsed
,
9236 .help_str
= "set port <port_id> mirror-rule <rule_id> "
9237 "pool-mirror-up|pool-mirror-down|vlan-mirror "
9238 "<pool_mask|vlan_id[,vlan_id]*> dst-pool <pool_id> on|off",
9240 (void *)&cmd_mirror_mask_set
,
9241 (void *)&cmd_mirror_mask_port
,
9242 (void *)&cmd_mirror_mask_portid
,
9243 (void *)&cmd_mirror_mask_mirror
,
9244 (void *)&cmd_mirror_mask_ruleid
,
9245 (void *)&cmd_mirror_mask_what
,
9246 (void *)&cmd_mirror_mask_value
,
9247 (void *)&cmd_mirror_mask_dstpool
,
9248 (void *)&cmd_mirror_mask_poolid
,
9249 (void *)&cmd_mirror_mask_on
,
9254 /* *** CONFIGURE VM MIRROR UPLINK/DOWNLINK RULE *** */
9255 struct cmd_set_mirror_link_result
{
9256 cmdline_fixed_string_t set
;
9257 cmdline_fixed_string_t port
;
9259 cmdline_fixed_string_t mirror
;
9261 cmdline_fixed_string_t what
;
9262 cmdline_fixed_string_t dstpool
;
9264 cmdline_fixed_string_t on
;
9267 cmdline_parse_token_string_t cmd_mirror_link_set
=
9268 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_link_result
,
9270 cmdline_parse_token_string_t cmd_mirror_link_port
=
9271 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_link_result
,
9273 cmdline_parse_token_num_t cmd_mirror_link_portid
=
9274 TOKEN_NUM_INITIALIZER(struct cmd_set_mirror_link_result
,
9276 cmdline_parse_token_string_t cmd_mirror_link_mirror
=
9277 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_link_result
,
9278 mirror
, "mirror-rule");
9279 cmdline_parse_token_num_t cmd_mirror_link_ruleid
=
9280 TOKEN_NUM_INITIALIZER(struct cmd_set_mirror_link_result
,
9282 cmdline_parse_token_string_t cmd_mirror_link_what
=
9283 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_link_result
,
9284 what
, "uplink-mirror#downlink-mirror");
9285 cmdline_parse_token_string_t cmd_mirror_link_dstpool
=
9286 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_link_result
,
9287 dstpool
, "dst-pool");
9288 cmdline_parse_token_num_t cmd_mirror_link_poolid
=
9289 TOKEN_NUM_INITIALIZER(struct cmd_set_mirror_link_result
,
9291 cmdline_parse_token_string_t cmd_mirror_link_on
=
9292 TOKEN_STRING_INITIALIZER(struct cmd_set_mirror_link_result
,
9296 cmd_set_mirror_link_parsed(void *parsed_result
,
9297 __attribute__((unused
)) struct cmdline
*cl
,
9298 __attribute__((unused
)) void *data
)
9301 struct cmd_set_mirror_link_result
*res
= parsed_result
;
9302 struct rte_eth_mirror_conf mr_conf
;
9304 memset(&mr_conf
, 0, sizeof(struct rte_eth_mirror_conf
));
9305 if (!strcmp(res
->what
, "uplink-mirror"))
9306 mr_conf
.rule_type
= ETH_MIRROR_UPLINK_PORT
;
9308 mr_conf
.rule_type
= ETH_MIRROR_DOWNLINK_PORT
;
9310 mr_conf
.dst_pool
= res
->dstpool_id
;
9312 if (!strcmp(res
->on
, "on"))
9313 ret
= rte_eth_mirror_rule_set(res
->port_id
, &mr_conf
,
9316 ret
= rte_eth_mirror_rule_set(res
->port_id
, &mr_conf
,
9319 /* check the return value and print it if is < 0 */
9321 printf("mirror rule add error: (%s)\n", strerror(-ret
));
9325 cmdline_parse_inst_t cmd_set_mirror_link
= {
9326 .f
= cmd_set_mirror_link_parsed
,
9328 .help_str
= "set port <port_id> mirror-rule <rule_id> "
9329 "uplink-mirror|downlink-mirror dst-pool <pool_id> on|off",
9331 (void *)&cmd_mirror_link_set
,
9332 (void *)&cmd_mirror_link_port
,
9333 (void *)&cmd_mirror_link_portid
,
9334 (void *)&cmd_mirror_link_mirror
,
9335 (void *)&cmd_mirror_link_ruleid
,
9336 (void *)&cmd_mirror_link_what
,
9337 (void *)&cmd_mirror_link_dstpool
,
9338 (void *)&cmd_mirror_link_poolid
,
9339 (void *)&cmd_mirror_link_on
,
9344 /* *** RESET VM MIRROR RULE *** */
9345 struct cmd_rm_mirror_rule_result
{
9346 cmdline_fixed_string_t reset
;
9347 cmdline_fixed_string_t port
;
9349 cmdline_fixed_string_t mirror
;
9353 cmdline_parse_token_string_t cmd_rm_mirror_rule_reset
=
9354 TOKEN_STRING_INITIALIZER(struct cmd_rm_mirror_rule_result
,
9356 cmdline_parse_token_string_t cmd_rm_mirror_rule_port
=
9357 TOKEN_STRING_INITIALIZER(struct cmd_rm_mirror_rule_result
,
9359 cmdline_parse_token_num_t cmd_rm_mirror_rule_portid
=
9360 TOKEN_NUM_INITIALIZER(struct cmd_rm_mirror_rule_result
,
9362 cmdline_parse_token_string_t cmd_rm_mirror_rule_mirror
=
9363 TOKEN_STRING_INITIALIZER(struct cmd_rm_mirror_rule_result
,
9364 mirror
, "mirror-rule");
9365 cmdline_parse_token_num_t cmd_rm_mirror_rule_ruleid
=
9366 TOKEN_NUM_INITIALIZER(struct cmd_rm_mirror_rule_result
,
9370 cmd_reset_mirror_rule_parsed(void *parsed_result
,
9371 __attribute__((unused
)) struct cmdline
*cl
,
9372 __attribute__((unused
)) void *data
)
9375 struct cmd_set_mirror_link_result
*res
= parsed_result
;
9377 ret
= rte_eth_mirror_rule_reset(res
->port_id
,res
->rule_id
);
9379 printf("mirror rule remove error: (%s)\n", strerror(-ret
));
9382 cmdline_parse_inst_t cmd_reset_mirror_rule
= {
9383 .f
= cmd_reset_mirror_rule_parsed
,
9385 .help_str
= "reset port <port_id> mirror-rule <rule_id>",
9387 (void *)&cmd_rm_mirror_rule_reset
,
9388 (void *)&cmd_rm_mirror_rule_port
,
9389 (void *)&cmd_rm_mirror_rule_portid
,
9390 (void *)&cmd_rm_mirror_rule_mirror
,
9391 (void *)&cmd_rm_mirror_rule_ruleid
,
9396 /* ******************************************************************************** */
9398 struct cmd_dump_result
{
9399 cmdline_fixed_string_t dump
;
9403 dump_struct_sizes(void)
9405 #define DUMP_SIZE(t) printf("sizeof(" #t ") = %u\n", (unsigned)sizeof(t));
9406 DUMP_SIZE(struct rte_mbuf
);
9407 DUMP_SIZE(struct rte_mempool
);
9408 DUMP_SIZE(struct rte_ring
);
9412 static void cmd_dump_parsed(void *parsed_result
,
9413 __attribute__((unused
)) struct cmdline
*cl
,
9414 __attribute__((unused
)) void *data
)
9416 struct cmd_dump_result
*res
= parsed_result
;
9418 if (!strcmp(res
->dump
, "dump_physmem"))
9419 rte_dump_physmem_layout(stdout
);
9420 else if (!strcmp(res
->dump
, "dump_memzone"))
9421 rte_memzone_dump(stdout
);
9422 else if (!strcmp(res
->dump
, "dump_struct_sizes"))
9423 dump_struct_sizes();
9424 else if (!strcmp(res
->dump
, "dump_ring"))
9425 rte_ring_list_dump(stdout
);
9426 else if (!strcmp(res
->dump
, "dump_mempool"))
9427 rte_mempool_list_dump(stdout
);
9428 else if (!strcmp(res
->dump
, "dump_devargs"))
9429 rte_devargs_dump(stdout
);
9430 else if (!strcmp(res
->dump
, "dump_log_types"))
9431 rte_log_dump(stdout
);
9434 cmdline_parse_token_string_t cmd_dump_dump
=
9435 TOKEN_STRING_INITIALIZER(struct cmd_dump_result
, dump
,
9438 "dump_struct_sizes#"
9444 cmdline_parse_inst_t cmd_dump
= {
9445 .f
= cmd_dump_parsed
, /* function to call */
9446 .data
= NULL
, /* 2nd arg of func */
9447 .help_str
= "Dump status",
9448 .tokens
= { /* token list, NULL terminated */
9449 (void *)&cmd_dump_dump
,
9454 /* ******************************************************************************** */
9456 struct cmd_dump_one_result
{
9457 cmdline_fixed_string_t dump
;
9458 cmdline_fixed_string_t name
;
9461 static void cmd_dump_one_parsed(void *parsed_result
, struct cmdline
*cl
,
9462 __attribute__((unused
)) void *data
)
9464 struct cmd_dump_one_result
*res
= parsed_result
;
9466 if (!strcmp(res
->dump
, "dump_ring")) {
9468 r
= rte_ring_lookup(res
->name
);
9470 cmdline_printf(cl
, "Cannot find ring\n");
9473 rte_ring_dump(stdout
, r
);
9474 } else if (!strcmp(res
->dump
, "dump_mempool")) {
9475 struct rte_mempool
*mp
;
9476 mp
= rte_mempool_lookup(res
->name
);
9478 cmdline_printf(cl
, "Cannot find mempool\n");
9481 rte_mempool_dump(stdout
, mp
);
9485 cmdline_parse_token_string_t cmd_dump_one_dump
=
9486 TOKEN_STRING_INITIALIZER(struct cmd_dump_one_result
, dump
,
9487 "dump_ring#dump_mempool");
9489 cmdline_parse_token_string_t cmd_dump_one_name
=
9490 TOKEN_STRING_INITIALIZER(struct cmd_dump_one_result
, name
, NULL
);
9492 cmdline_parse_inst_t cmd_dump_one
= {
9493 .f
= cmd_dump_one_parsed
, /* function to call */
9494 .data
= NULL
, /* 2nd arg of func */
9495 .help_str
= "dump_ring|dump_mempool <name>: Dump one ring/mempool",
9496 .tokens
= { /* token list, NULL terminated */
9497 (void *)&cmd_dump_one_dump
,
9498 (void *)&cmd_dump_one_name
,
9503 /* *** Add/Del syn filter *** */
9504 struct cmd_syn_filter_result
{
9505 cmdline_fixed_string_t filter
;
9507 cmdline_fixed_string_t ops
;
9508 cmdline_fixed_string_t priority
;
9509 cmdline_fixed_string_t high
;
9510 cmdline_fixed_string_t queue
;
9515 cmd_syn_filter_parsed(void *parsed_result
,
9516 __attribute__((unused
)) struct cmdline
*cl
,
9517 __attribute__((unused
)) void *data
)
9519 struct cmd_syn_filter_result
*res
= parsed_result
;
9520 struct rte_eth_syn_filter syn_filter
;
9523 ret
= rte_eth_dev_filter_supported(res
->port_id
,
9524 RTE_ETH_FILTER_SYN
);
9526 printf("syn filter is not supported on port %u.\n",
9531 memset(&syn_filter
, 0, sizeof(syn_filter
));
9533 if (!strcmp(res
->ops
, "add")) {
9534 if (!strcmp(res
->high
, "high"))
9535 syn_filter
.hig_pri
= 1;
9537 syn_filter
.hig_pri
= 0;
9539 syn_filter
.queue
= res
->queue_id
;
9540 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
9545 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
9547 RTE_ETH_FILTER_DELETE
,
9551 printf("syn filter programming error: (%s)\n",
9555 cmdline_parse_token_string_t cmd_syn_filter_filter
=
9556 TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result
,
9557 filter
, "syn_filter");
9558 cmdline_parse_token_num_t cmd_syn_filter_port_id
=
9559 TOKEN_NUM_INITIALIZER(struct cmd_syn_filter_result
,
9561 cmdline_parse_token_string_t cmd_syn_filter_ops
=
9562 TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result
,
9564 cmdline_parse_token_string_t cmd_syn_filter_priority
=
9565 TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result
,
9566 priority
, "priority");
9567 cmdline_parse_token_string_t cmd_syn_filter_high
=
9568 TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result
,
9570 cmdline_parse_token_string_t cmd_syn_filter_queue
=
9571 TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result
,
9573 cmdline_parse_token_num_t cmd_syn_filter_queue_id
=
9574 TOKEN_NUM_INITIALIZER(struct cmd_syn_filter_result
,
9577 cmdline_parse_inst_t cmd_syn_filter
= {
9578 .f
= cmd_syn_filter_parsed
,
9580 .help_str
= "syn_filter <port_id> add|del priority high|low queue "
9581 "<queue_id>: Add/Delete syn filter",
9583 (void *)&cmd_syn_filter_filter
,
9584 (void *)&cmd_syn_filter_port_id
,
9585 (void *)&cmd_syn_filter_ops
,
9586 (void *)&cmd_syn_filter_priority
,
9587 (void *)&cmd_syn_filter_high
,
9588 (void *)&cmd_syn_filter_queue
,
9589 (void *)&cmd_syn_filter_queue_id
,
9594 /* *** queue region set *** */
9595 struct cmd_queue_region_result
{
9596 cmdline_fixed_string_t set
;
9597 cmdline_fixed_string_t port
;
9599 cmdline_fixed_string_t cmd
;
9600 cmdline_fixed_string_t region
;
9602 cmdline_fixed_string_t queue_start_index
;
9604 cmdline_fixed_string_t queue_num
;
9605 uint8_t queue_num_value
;
9609 cmd_queue_region_parsed(void *parsed_result
,
9610 __attribute__((unused
)) struct cmdline
*cl
,
9611 __attribute__((unused
)) void *data
)
9613 struct cmd_queue_region_result
*res
= parsed_result
;
9615 #ifdef RTE_LIBRTE_I40E_PMD
9616 struct rte_pmd_i40e_queue_region_conf region_conf
;
9617 enum rte_pmd_i40e_queue_region_op op_type
;
9620 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
9623 #ifdef RTE_LIBRTE_I40E_PMD
9624 memset(®ion_conf
, 0, sizeof(region_conf
));
9625 op_type
= RTE_PMD_I40E_RSS_QUEUE_REGION_SET
;
9626 region_conf
.region_id
= res
->region_id
;
9627 region_conf
.queue_num
= res
->queue_num_value
;
9628 region_conf
.queue_start_index
= res
->queue_id
;
9630 ret
= rte_pmd_i40e_rss_queue_region_conf(res
->port_id
,
9631 op_type
, ®ion_conf
);
9638 printf("function not implemented or supported\n");
9641 printf("queue region config error: (%s)\n", strerror(-ret
));
9645 cmdline_parse_token_string_t cmd_queue_region_set
=
9646 TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result
,
9648 cmdline_parse_token_string_t cmd_queue_region_port
=
9649 TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result
, port
, "port");
9650 cmdline_parse_token_num_t cmd_queue_region_port_id
=
9651 TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result
,
9653 cmdline_parse_token_string_t cmd_queue_region_cmd
=
9654 TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result
,
9655 cmd
, "queue-region");
9656 cmdline_parse_token_string_t cmd_queue_region_id
=
9657 TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result
,
9658 region
, "region_id");
9659 cmdline_parse_token_num_t cmd_queue_region_index
=
9660 TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result
,
9662 cmdline_parse_token_string_t cmd_queue_region_queue_start_index
=
9663 TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result
,
9664 queue_start_index
, "queue_start_index");
9665 cmdline_parse_token_num_t cmd_queue_region_queue_id
=
9666 TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result
,
9668 cmdline_parse_token_string_t cmd_queue_region_queue_num
=
9669 TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result
,
9670 queue_num
, "queue_num");
9671 cmdline_parse_token_num_t cmd_queue_region_queue_num_value
=
9672 TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result
,
9673 queue_num_value
, UINT8
);
9675 cmdline_parse_inst_t cmd_queue_region
= {
9676 .f
= cmd_queue_region_parsed
,
9678 .help_str
= "set port <port_id> queue-region region_id <value> "
9679 "queue_start_index <value> queue_num <value>: Set a queue region",
9681 (void *)&cmd_queue_region_set
,
9682 (void *)&cmd_queue_region_port
,
9683 (void *)&cmd_queue_region_port_id
,
9684 (void *)&cmd_queue_region_cmd
,
9685 (void *)&cmd_queue_region_id
,
9686 (void *)&cmd_queue_region_index
,
9687 (void *)&cmd_queue_region_queue_start_index
,
9688 (void *)&cmd_queue_region_queue_id
,
9689 (void *)&cmd_queue_region_queue_num
,
9690 (void *)&cmd_queue_region_queue_num_value
,
9695 /* *** queue region and flowtype set *** */
9696 struct cmd_region_flowtype_result
{
9697 cmdline_fixed_string_t set
;
9698 cmdline_fixed_string_t port
;
9700 cmdline_fixed_string_t cmd
;
9701 cmdline_fixed_string_t region
;
9703 cmdline_fixed_string_t flowtype
;
9704 uint8_t flowtype_id
;
9708 cmd_region_flowtype_parsed(void *parsed_result
,
9709 __attribute__((unused
)) struct cmdline
*cl
,
9710 __attribute__((unused
)) void *data
)
9712 struct cmd_region_flowtype_result
*res
= parsed_result
;
9714 #ifdef RTE_LIBRTE_I40E_PMD
9715 struct rte_pmd_i40e_queue_region_conf region_conf
;
9716 enum rte_pmd_i40e_queue_region_op op_type
;
9719 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
9722 #ifdef RTE_LIBRTE_I40E_PMD
9723 memset(®ion_conf
, 0, sizeof(region_conf
));
9725 op_type
= RTE_PMD_I40E_RSS_QUEUE_REGION_FLOWTYPE_SET
;
9726 region_conf
.region_id
= res
->region_id
;
9727 region_conf
.hw_flowtype
= res
->flowtype_id
;
9729 ret
= rte_pmd_i40e_rss_queue_region_conf(res
->port_id
,
9730 op_type
, ®ion_conf
);
9737 printf("function not implemented or supported\n");
9740 printf("region flowtype config error: (%s)\n", strerror(-ret
));
9744 cmdline_parse_token_string_t cmd_region_flowtype_set
=
9745 TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result
,
9747 cmdline_parse_token_string_t cmd_region_flowtype_port
=
9748 TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result
,
9750 cmdline_parse_token_num_t cmd_region_flowtype_port_index
=
9751 TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result
,
9753 cmdline_parse_token_string_t cmd_region_flowtype_cmd
=
9754 TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result
,
9755 cmd
, "queue-region");
9756 cmdline_parse_token_string_t cmd_region_flowtype_index
=
9757 TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result
,
9758 region
, "region_id");
9759 cmdline_parse_token_num_t cmd_region_flowtype_id
=
9760 TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result
,
9762 cmdline_parse_token_string_t cmd_region_flowtype_flow_index
=
9763 TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result
,
9764 flowtype
, "flowtype");
9765 cmdline_parse_token_num_t cmd_region_flowtype_flow_id
=
9766 TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result
,
9767 flowtype_id
, UINT8
);
9768 cmdline_parse_inst_t cmd_region_flowtype
= {
9769 .f
= cmd_region_flowtype_parsed
,
9771 .help_str
= "set port <port_id> queue-region region_id <value> "
9772 "flowtype <value>: Set a flowtype region index",
9774 (void *)&cmd_region_flowtype_set
,
9775 (void *)&cmd_region_flowtype_port
,
9776 (void *)&cmd_region_flowtype_port_index
,
9777 (void *)&cmd_region_flowtype_cmd
,
9778 (void *)&cmd_region_flowtype_index
,
9779 (void *)&cmd_region_flowtype_id
,
9780 (void *)&cmd_region_flowtype_flow_index
,
9781 (void *)&cmd_region_flowtype_flow_id
,
9786 /* *** User Priority (UP) to queue region (region_id) set *** */
9787 struct cmd_user_priority_region_result
{
9788 cmdline_fixed_string_t set
;
9789 cmdline_fixed_string_t port
;
9791 cmdline_fixed_string_t cmd
;
9792 cmdline_fixed_string_t user_priority
;
9793 uint8_t user_priority_id
;
9794 cmdline_fixed_string_t region
;
9799 cmd_user_priority_region_parsed(void *parsed_result
,
9800 __attribute__((unused
)) struct cmdline
*cl
,
9801 __attribute__((unused
)) void *data
)
9803 struct cmd_user_priority_region_result
*res
= parsed_result
;
9805 #ifdef RTE_LIBRTE_I40E_PMD
9806 struct rte_pmd_i40e_queue_region_conf region_conf
;
9807 enum rte_pmd_i40e_queue_region_op op_type
;
9810 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
9813 #ifdef RTE_LIBRTE_I40E_PMD
9814 memset(®ion_conf
, 0, sizeof(region_conf
));
9815 op_type
= RTE_PMD_I40E_RSS_QUEUE_REGION_USER_PRIORITY_SET
;
9816 region_conf
.user_priority
= res
->user_priority_id
;
9817 region_conf
.region_id
= res
->region_id
;
9819 ret
= rte_pmd_i40e_rss_queue_region_conf(res
->port_id
,
9820 op_type
, ®ion_conf
);
9827 printf("function not implemented or supported\n");
9830 printf("user_priority region config error: (%s)\n",
9835 cmdline_parse_token_string_t cmd_user_priority_region_set
=
9836 TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result
,
9838 cmdline_parse_token_string_t cmd_user_priority_region_port
=
9839 TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result
,
9841 cmdline_parse_token_num_t cmd_user_priority_region_port_index
=
9842 TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result
,
9844 cmdline_parse_token_string_t cmd_user_priority_region_cmd
=
9845 TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result
,
9846 cmd
, "queue-region");
9847 cmdline_parse_token_string_t cmd_user_priority_region_UP
=
9848 TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result
,
9849 user_priority
, "UP");
9850 cmdline_parse_token_num_t cmd_user_priority_region_UP_id
=
9851 TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result
,
9852 user_priority_id
, UINT8
);
9853 cmdline_parse_token_string_t cmd_user_priority_region_region
=
9854 TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result
,
9855 region
, "region_id");
9856 cmdline_parse_token_num_t cmd_user_priority_region_region_id
=
9857 TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result
,
9860 cmdline_parse_inst_t cmd_user_priority_region
= {
9861 .f
= cmd_user_priority_region_parsed
,
9863 .help_str
= "set port <port_id> queue-region UP <value> "
9864 "region_id <value>: Set the mapping of User Priority (UP) "
9865 "to queue region (region_id) ",
9867 (void *)&cmd_user_priority_region_set
,
9868 (void *)&cmd_user_priority_region_port
,
9869 (void *)&cmd_user_priority_region_port_index
,
9870 (void *)&cmd_user_priority_region_cmd
,
9871 (void *)&cmd_user_priority_region_UP
,
9872 (void *)&cmd_user_priority_region_UP_id
,
9873 (void *)&cmd_user_priority_region_region
,
9874 (void *)&cmd_user_priority_region_region_id
,
9879 /* *** flush all queue region related configuration *** */
9880 struct cmd_flush_queue_region_result
{
9881 cmdline_fixed_string_t set
;
9882 cmdline_fixed_string_t port
;
9884 cmdline_fixed_string_t cmd
;
9885 cmdline_fixed_string_t flush
;
9886 cmdline_fixed_string_t what
;
9890 cmd_flush_queue_region_parsed(void *parsed_result
,
9891 __attribute__((unused
)) struct cmdline
*cl
,
9892 __attribute__((unused
)) void *data
)
9894 struct cmd_flush_queue_region_result
*res
= parsed_result
;
9896 #ifdef RTE_LIBRTE_I40E_PMD
9897 struct rte_pmd_i40e_queue_region_conf region_conf
;
9898 enum rte_pmd_i40e_queue_region_op op_type
;
9901 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
9904 #ifdef RTE_LIBRTE_I40E_PMD
9905 memset(®ion_conf
, 0, sizeof(region_conf
));
9907 if (strcmp(res
->what
, "on") == 0)
9908 op_type
= RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON
;
9910 op_type
= RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF
;
9912 ret
= rte_pmd_i40e_rss_queue_region_conf(res
->port_id
,
9913 op_type
, ®ion_conf
);
9920 printf("function not implemented or supported\n");
9923 printf("queue region config flush error: (%s)\n",
9928 cmdline_parse_token_string_t cmd_flush_queue_region_set
=
9929 TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result
,
9931 cmdline_parse_token_string_t cmd_flush_queue_region_port
=
9932 TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result
,
9934 cmdline_parse_token_num_t cmd_flush_queue_region_port_index
=
9935 TOKEN_NUM_INITIALIZER(struct cmd_flush_queue_region_result
,
9937 cmdline_parse_token_string_t cmd_flush_queue_region_cmd
=
9938 TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result
,
9939 cmd
, "queue-region");
9940 cmdline_parse_token_string_t cmd_flush_queue_region_flush
=
9941 TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result
,
9943 cmdline_parse_token_string_t cmd_flush_queue_region_what
=
9944 TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result
,
9947 cmdline_parse_inst_t cmd_flush_queue_region
= {
9948 .f
= cmd_flush_queue_region_parsed
,
9950 .help_str
= "set port <port_id> queue-region flush on|off"
9951 ": flush all queue region related configuration",
9953 (void *)&cmd_flush_queue_region_set
,
9954 (void *)&cmd_flush_queue_region_port
,
9955 (void *)&cmd_flush_queue_region_port_index
,
9956 (void *)&cmd_flush_queue_region_cmd
,
9957 (void *)&cmd_flush_queue_region_flush
,
9958 (void *)&cmd_flush_queue_region_what
,
9963 /* *** get all queue region related configuration info *** */
9964 struct cmd_show_queue_region_info
{
9965 cmdline_fixed_string_t show
;
9966 cmdline_fixed_string_t port
;
9968 cmdline_fixed_string_t cmd
;
9972 cmd_show_queue_region_info_parsed(void *parsed_result
,
9973 __attribute__((unused
)) struct cmdline
*cl
,
9974 __attribute__((unused
)) void *data
)
9976 struct cmd_show_queue_region_info
*res
= parsed_result
;
9978 #ifdef RTE_LIBRTE_I40E_PMD
9979 struct rte_pmd_i40e_queue_regions rte_pmd_regions
;
9980 enum rte_pmd_i40e_queue_region_op op_type
;
9983 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
9986 #ifdef RTE_LIBRTE_I40E_PMD
9987 memset(&rte_pmd_regions
, 0, sizeof(rte_pmd_regions
));
9989 op_type
= RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET
;
9991 ret
= rte_pmd_i40e_rss_queue_region_conf(res
->port_id
,
9992 op_type
, &rte_pmd_regions
);
9994 port_queue_region_info_display(res
->port_id
, &rte_pmd_regions
);
10001 printf("function not implemented or supported\n");
10004 printf("queue region config info show error: (%s)\n",
10009 cmdline_parse_token_string_t cmd_show_queue_region_info_get
=
10010 TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info
,
10012 cmdline_parse_token_string_t cmd_show_queue_region_info_port
=
10013 TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info
,
10015 cmdline_parse_token_num_t cmd_show_queue_region_info_port_index
=
10016 TOKEN_NUM_INITIALIZER(struct cmd_show_queue_region_info
,
10018 cmdline_parse_token_string_t cmd_show_queue_region_info_cmd
=
10019 TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info
,
10020 cmd
, "queue-region");
10022 cmdline_parse_inst_t cmd_show_queue_region_info_all
= {
10023 .f
= cmd_show_queue_region_info_parsed
,
10025 .help_str
= "show port <port_id> queue-region"
10026 ": show all queue region related configuration info",
10028 (void *)&cmd_show_queue_region_info_get
,
10029 (void *)&cmd_show_queue_region_info_port
,
10030 (void *)&cmd_show_queue_region_info_port_index
,
10031 (void *)&cmd_show_queue_region_info_cmd
,
10036 /* *** ADD/REMOVE A 2tuple FILTER *** */
10037 struct cmd_2tuple_filter_result
{
10038 cmdline_fixed_string_t filter
;
10040 cmdline_fixed_string_t ops
;
10041 cmdline_fixed_string_t dst_port
;
10042 uint16_t dst_port_value
;
10043 cmdline_fixed_string_t protocol
;
10044 uint8_t protocol_value
;
10045 cmdline_fixed_string_t mask
;
10046 uint8_t mask_value
;
10047 cmdline_fixed_string_t tcp_flags
;
10048 uint8_t tcp_flags_value
;
10049 cmdline_fixed_string_t priority
;
10050 uint8_t priority_value
;
10051 cmdline_fixed_string_t queue
;
10056 cmd_2tuple_filter_parsed(void *parsed_result
,
10057 __attribute__((unused
)) struct cmdline
*cl
,
10058 __attribute__((unused
)) void *data
)
10060 struct rte_eth_ntuple_filter filter
;
10061 struct cmd_2tuple_filter_result
*res
= parsed_result
;
10064 ret
= rte_eth_dev_filter_supported(res
->port_id
, RTE_ETH_FILTER_NTUPLE
);
10066 printf("ntuple filter is not supported on port %u.\n",
10071 memset(&filter
, 0, sizeof(struct rte_eth_ntuple_filter
));
10073 filter
.flags
= RTE_2TUPLE_FLAGS
;
10074 filter
.dst_port_mask
= (res
->mask_value
& 0x02) ? UINT16_MAX
: 0;
10075 filter
.proto_mask
= (res
->mask_value
& 0x01) ? UINT8_MAX
: 0;
10076 filter
.proto
= res
->protocol_value
;
10077 filter
.priority
= res
->priority_value
;
10078 if (res
->tcp_flags_value
!= 0 && filter
.proto
!= IPPROTO_TCP
) {
10079 printf("nonzero tcp_flags is only meaningful"
10080 " when protocol is TCP.\n");
10083 if (res
->tcp_flags_value
> TCP_FLAG_ALL
) {
10084 printf("invalid TCP flags.\n");
10088 if (res
->tcp_flags_value
!= 0) {
10089 filter
.flags
|= RTE_NTUPLE_FLAGS_TCP_FLAG
;
10090 filter
.tcp_flags
= res
->tcp_flags_value
;
10093 /* need convert to big endian. */
10094 filter
.dst_port
= rte_cpu_to_be_16(res
->dst_port_value
);
10095 filter
.queue
= res
->queue_id
;
10097 if (!strcmp(res
->ops
, "add"))
10098 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
10099 RTE_ETH_FILTER_NTUPLE
,
10100 RTE_ETH_FILTER_ADD
,
10103 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
10104 RTE_ETH_FILTER_NTUPLE
,
10105 RTE_ETH_FILTER_DELETE
,
10108 printf("2tuple filter programming error: (%s)\n",
10113 cmdline_parse_token_string_t cmd_2tuple_filter_filter
=
10114 TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result
,
10115 filter
, "2tuple_filter");
10116 cmdline_parse_token_num_t cmd_2tuple_filter_port_id
=
10117 TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result
,
10119 cmdline_parse_token_string_t cmd_2tuple_filter_ops
=
10120 TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result
,
10122 cmdline_parse_token_string_t cmd_2tuple_filter_dst_port
=
10123 TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result
,
10124 dst_port
, "dst_port");
10125 cmdline_parse_token_num_t cmd_2tuple_filter_dst_port_value
=
10126 TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result
,
10127 dst_port_value
, UINT16
);
10128 cmdline_parse_token_string_t cmd_2tuple_filter_protocol
=
10129 TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result
,
10130 protocol
, "protocol");
10131 cmdline_parse_token_num_t cmd_2tuple_filter_protocol_value
=
10132 TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result
,
10133 protocol_value
, UINT8
);
10134 cmdline_parse_token_string_t cmd_2tuple_filter_mask
=
10135 TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result
,
10137 cmdline_parse_token_num_t cmd_2tuple_filter_mask_value
=
10138 TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result
,
10140 cmdline_parse_token_string_t cmd_2tuple_filter_tcp_flags
=
10141 TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result
,
10142 tcp_flags
, "tcp_flags");
10143 cmdline_parse_token_num_t cmd_2tuple_filter_tcp_flags_value
=
10144 TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result
,
10145 tcp_flags_value
, UINT8
);
10146 cmdline_parse_token_string_t cmd_2tuple_filter_priority
=
10147 TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result
,
10148 priority
, "priority");
10149 cmdline_parse_token_num_t cmd_2tuple_filter_priority_value
=
10150 TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result
,
10151 priority_value
, UINT8
);
10152 cmdline_parse_token_string_t cmd_2tuple_filter_queue
=
10153 TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result
,
10155 cmdline_parse_token_num_t cmd_2tuple_filter_queue_id
=
10156 TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result
,
10159 cmdline_parse_inst_t cmd_2tuple_filter
= {
10160 .f
= cmd_2tuple_filter_parsed
,
10162 .help_str
= "2tuple_filter <port_id> add|del dst_port <value> protocol "
10163 "<value> mask <value> tcp_flags <value> priority <value> queue "
10164 "<queue_id>: Add a 2tuple filter",
10166 (void *)&cmd_2tuple_filter_filter
,
10167 (void *)&cmd_2tuple_filter_port_id
,
10168 (void *)&cmd_2tuple_filter_ops
,
10169 (void *)&cmd_2tuple_filter_dst_port
,
10170 (void *)&cmd_2tuple_filter_dst_port_value
,
10171 (void *)&cmd_2tuple_filter_protocol
,
10172 (void *)&cmd_2tuple_filter_protocol_value
,
10173 (void *)&cmd_2tuple_filter_mask
,
10174 (void *)&cmd_2tuple_filter_mask_value
,
10175 (void *)&cmd_2tuple_filter_tcp_flags
,
10176 (void *)&cmd_2tuple_filter_tcp_flags_value
,
10177 (void *)&cmd_2tuple_filter_priority
,
10178 (void *)&cmd_2tuple_filter_priority_value
,
10179 (void *)&cmd_2tuple_filter_queue
,
10180 (void *)&cmd_2tuple_filter_queue_id
,
10185 /* *** ADD/REMOVE A 5tuple FILTER *** */
10186 struct cmd_5tuple_filter_result
{
10187 cmdline_fixed_string_t filter
;
10189 cmdline_fixed_string_t ops
;
10190 cmdline_fixed_string_t dst_ip
;
10191 cmdline_ipaddr_t dst_ip_value
;
10192 cmdline_fixed_string_t src_ip
;
10193 cmdline_ipaddr_t src_ip_value
;
10194 cmdline_fixed_string_t dst_port
;
10195 uint16_t dst_port_value
;
10196 cmdline_fixed_string_t src_port
;
10197 uint16_t src_port_value
;
10198 cmdline_fixed_string_t protocol
;
10199 uint8_t protocol_value
;
10200 cmdline_fixed_string_t mask
;
10201 uint8_t mask_value
;
10202 cmdline_fixed_string_t tcp_flags
;
10203 uint8_t tcp_flags_value
;
10204 cmdline_fixed_string_t priority
;
10205 uint8_t priority_value
;
10206 cmdline_fixed_string_t queue
;
10211 cmd_5tuple_filter_parsed(void *parsed_result
,
10212 __attribute__((unused
)) struct cmdline
*cl
,
10213 __attribute__((unused
)) void *data
)
10215 struct rte_eth_ntuple_filter filter
;
10216 struct cmd_5tuple_filter_result
*res
= parsed_result
;
10219 ret
= rte_eth_dev_filter_supported(res
->port_id
, RTE_ETH_FILTER_NTUPLE
);
10221 printf("ntuple filter is not supported on port %u.\n",
10226 memset(&filter
, 0, sizeof(struct rte_eth_ntuple_filter
));
10228 filter
.flags
= RTE_5TUPLE_FLAGS
;
10229 filter
.dst_ip_mask
= (res
->mask_value
& 0x10) ? UINT32_MAX
: 0;
10230 filter
.src_ip_mask
= (res
->mask_value
& 0x08) ? UINT32_MAX
: 0;
10231 filter
.dst_port_mask
= (res
->mask_value
& 0x04) ? UINT16_MAX
: 0;
10232 filter
.src_port_mask
= (res
->mask_value
& 0x02) ? UINT16_MAX
: 0;
10233 filter
.proto_mask
= (res
->mask_value
& 0x01) ? UINT8_MAX
: 0;
10234 filter
.proto
= res
->protocol_value
;
10235 filter
.priority
= res
->priority_value
;
10236 if (res
->tcp_flags_value
!= 0 && filter
.proto
!= IPPROTO_TCP
) {
10237 printf("nonzero tcp_flags is only meaningful"
10238 " when protocol is TCP.\n");
10241 if (res
->tcp_flags_value
> TCP_FLAG_ALL
) {
10242 printf("invalid TCP flags.\n");
10246 if (res
->tcp_flags_value
!= 0) {
10247 filter
.flags
|= RTE_NTUPLE_FLAGS_TCP_FLAG
;
10248 filter
.tcp_flags
= res
->tcp_flags_value
;
10251 if (res
->dst_ip_value
.family
== AF_INET
)
10252 /* no need to convert, already big endian. */
10253 filter
.dst_ip
= res
->dst_ip_value
.addr
.ipv4
.s_addr
;
10255 if (filter
.dst_ip_mask
== 0) {
10256 printf("can not support ipv6 involved compare.\n");
10262 if (res
->src_ip_value
.family
== AF_INET
)
10263 /* no need to convert, already big endian. */
10264 filter
.src_ip
= res
->src_ip_value
.addr
.ipv4
.s_addr
;
10266 if (filter
.src_ip_mask
== 0) {
10267 printf("can not support ipv6 involved compare.\n");
10272 /* need convert to big endian. */
10273 filter
.dst_port
= rte_cpu_to_be_16(res
->dst_port_value
);
10274 filter
.src_port
= rte_cpu_to_be_16(res
->src_port_value
);
10275 filter
.queue
= res
->queue_id
;
10277 if (!strcmp(res
->ops
, "add"))
10278 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
10279 RTE_ETH_FILTER_NTUPLE
,
10280 RTE_ETH_FILTER_ADD
,
10283 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
10284 RTE_ETH_FILTER_NTUPLE
,
10285 RTE_ETH_FILTER_DELETE
,
10288 printf("5tuple filter programming error: (%s)\n",
10292 cmdline_parse_token_string_t cmd_5tuple_filter_filter
=
10293 TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result
,
10294 filter
, "5tuple_filter");
10295 cmdline_parse_token_num_t cmd_5tuple_filter_port_id
=
10296 TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result
,
10298 cmdline_parse_token_string_t cmd_5tuple_filter_ops
=
10299 TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result
,
10301 cmdline_parse_token_string_t cmd_5tuple_filter_dst_ip
=
10302 TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result
,
10304 cmdline_parse_token_ipaddr_t cmd_5tuple_filter_dst_ip_value
=
10305 TOKEN_IPADDR_INITIALIZER(struct cmd_5tuple_filter_result
,
10307 cmdline_parse_token_string_t cmd_5tuple_filter_src_ip
=
10308 TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result
,
10310 cmdline_parse_token_ipaddr_t cmd_5tuple_filter_src_ip_value
=
10311 TOKEN_IPADDR_INITIALIZER(struct cmd_5tuple_filter_result
,
10313 cmdline_parse_token_string_t cmd_5tuple_filter_dst_port
=
10314 TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result
,
10315 dst_port
, "dst_port");
10316 cmdline_parse_token_num_t cmd_5tuple_filter_dst_port_value
=
10317 TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result
,
10318 dst_port_value
, UINT16
);
10319 cmdline_parse_token_string_t cmd_5tuple_filter_src_port
=
10320 TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result
,
10321 src_port
, "src_port");
10322 cmdline_parse_token_num_t cmd_5tuple_filter_src_port_value
=
10323 TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result
,
10324 src_port_value
, UINT16
);
10325 cmdline_parse_token_string_t cmd_5tuple_filter_protocol
=
10326 TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result
,
10327 protocol
, "protocol");
10328 cmdline_parse_token_num_t cmd_5tuple_filter_protocol_value
=
10329 TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result
,
10330 protocol_value
, UINT8
);
10331 cmdline_parse_token_string_t cmd_5tuple_filter_mask
=
10332 TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result
,
10334 cmdline_parse_token_num_t cmd_5tuple_filter_mask_value
=
10335 TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result
,
10337 cmdline_parse_token_string_t cmd_5tuple_filter_tcp_flags
=
10338 TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result
,
10339 tcp_flags
, "tcp_flags");
10340 cmdline_parse_token_num_t cmd_5tuple_filter_tcp_flags_value
=
10341 TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result
,
10342 tcp_flags_value
, UINT8
);
10343 cmdline_parse_token_string_t cmd_5tuple_filter_priority
=
10344 TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result
,
10345 priority
, "priority");
10346 cmdline_parse_token_num_t cmd_5tuple_filter_priority_value
=
10347 TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result
,
10348 priority_value
, UINT8
);
10349 cmdline_parse_token_string_t cmd_5tuple_filter_queue
=
10350 TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result
,
10352 cmdline_parse_token_num_t cmd_5tuple_filter_queue_id
=
10353 TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result
,
10356 cmdline_parse_inst_t cmd_5tuple_filter
= {
10357 .f
= cmd_5tuple_filter_parsed
,
10359 .help_str
= "5tuple_filter <port_id> add|del dst_ip <value> "
10360 "src_ip <value> dst_port <value> src_port <value> "
10361 "protocol <value> mask <value> tcp_flags <value> "
10362 "priority <value> queue <queue_id>: Add/Del a 5tuple filter",
10364 (void *)&cmd_5tuple_filter_filter
,
10365 (void *)&cmd_5tuple_filter_port_id
,
10366 (void *)&cmd_5tuple_filter_ops
,
10367 (void *)&cmd_5tuple_filter_dst_ip
,
10368 (void *)&cmd_5tuple_filter_dst_ip_value
,
10369 (void *)&cmd_5tuple_filter_src_ip
,
10370 (void *)&cmd_5tuple_filter_src_ip_value
,
10371 (void *)&cmd_5tuple_filter_dst_port
,
10372 (void *)&cmd_5tuple_filter_dst_port_value
,
10373 (void *)&cmd_5tuple_filter_src_port
,
10374 (void *)&cmd_5tuple_filter_src_port_value
,
10375 (void *)&cmd_5tuple_filter_protocol
,
10376 (void *)&cmd_5tuple_filter_protocol_value
,
10377 (void *)&cmd_5tuple_filter_mask
,
10378 (void *)&cmd_5tuple_filter_mask_value
,
10379 (void *)&cmd_5tuple_filter_tcp_flags
,
10380 (void *)&cmd_5tuple_filter_tcp_flags_value
,
10381 (void *)&cmd_5tuple_filter_priority
,
10382 (void *)&cmd_5tuple_filter_priority_value
,
10383 (void *)&cmd_5tuple_filter_queue
,
10384 (void *)&cmd_5tuple_filter_queue_id
,
10389 /* *** ADD/REMOVE A flex FILTER *** */
10390 struct cmd_flex_filter_result
{
10391 cmdline_fixed_string_t filter
;
10392 cmdline_fixed_string_t ops
;
10394 cmdline_fixed_string_t len
;
10396 cmdline_fixed_string_t bytes
;
10397 cmdline_fixed_string_t bytes_value
;
10398 cmdline_fixed_string_t mask
;
10399 cmdline_fixed_string_t mask_value
;
10400 cmdline_fixed_string_t priority
;
10401 uint8_t priority_value
;
10402 cmdline_fixed_string_t queue
;
10406 static int xdigit2val(unsigned char c
)
10411 else if (isupper(c
))
10412 val
= c
- 'A' + 10;
10414 val
= c
- 'a' + 10;
10419 cmd_flex_filter_parsed(void *parsed_result
,
10420 __attribute__((unused
)) struct cmdline
*cl
,
10421 __attribute__((unused
)) void *data
)
10424 struct rte_eth_flex_filter filter
;
10425 struct cmd_flex_filter_result
*res
= parsed_result
;
10426 char *bytes_ptr
, *mask_ptr
;
10427 uint16_t len
, i
, j
= 0;
10432 if (res
->len_value
> RTE_FLEX_FILTER_MAXLEN
) {
10433 printf("the len exceed the max length 128\n");
10436 memset(&filter
, 0, sizeof(struct rte_eth_flex_filter
));
10437 filter
.len
= res
->len_value
;
10438 filter
.priority
= res
->priority_value
;
10439 filter
.queue
= res
->queue_id
;
10440 bytes_ptr
= res
->bytes_value
;
10441 mask_ptr
= res
->mask_value
;
10443 /* translate bytes string to array. */
10444 if (bytes_ptr
[0] == '0' && ((bytes_ptr
[1] == 'x') ||
10445 (bytes_ptr
[1] == 'X')))
10447 len
= strnlen(bytes_ptr
, res
->len_value
* 2);
10448 if (len
== 0 || (len
% 8 != 0)) {
10449 printf("please check len and bytes input\n");
10452 for (i
= 0; i
< len
; i
++) {
10454 if (isxdigit(c
) == 0) {
10455 /* invalid characters. */
10456 printf("invalid input\n");
10459 val
= xdigit2val(c
);
10462 filter
.bytes
[j
] = byte
;
10463 printf("bytes[%d]:%02x ", j
, filter
.bytes
[j
]);
10470 /* translate mask string to uint8_t array. */
10471 if (mask_ptr
[0] == '0' && ((mask_ptr
[1] == 'x') ||
10472 (mask_ptr
[1] == 'X')))
10474 len
= strnlen(mask_ptr
, (res
->len_value
+ 3) / 4);
10476 printf("invalid input\n");
10481 for (i
= 0; i
< len
; i
++) {
10483 if (isxdigit(c
) == 0) {
10484 /* invalid characters. */
10485 printf("invalid input\n");
10488 val
= xdigit2val(c
);
10491 filter
.mask
[j
] = byte
;
10492 printf("mask[%d]:%02x ", j
, filter
.mask
[j
]);
10500 if (!strcmp(res
->ops
, "add"))
10501 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
10502 RTE_ETH_FILTER_FLEXIBLE
,
10503 RTE_ETH_FILTER_ADD
,
10506 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
10507 RTE_ETH_FILTER_FLEXIBLE
,
10508 RTE_ETH_FILTER_DELETE
,
10512 printf("flex filter setting error: (%s)\n", strerror(-ret
));
10515 cmdline_parse_token_string_t cmd_flex_filter_filter
=
10516 TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result
,
10517 filter
, "flex_filter");
10518 cmdline_parse_token_num_t cmd_flex_filter_port_id
=
10519 TOKEN_NUM_INITIALIZER(struct cmd_flex_filter_result
,
10521 cmdline_parse_token_string_t cmd_flex_filter_ops
=
10522 TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result
,
10524 cmdline_parse_token_string_t cmd_flex_filter_len
=
10525 TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result
,
10527 cmdline_parse_token_num_t cmd_flex_filter_len_value
=
10528 TOKEN_NUM_INITIALIZER(struct cmd_flex_filter_result
,
10530 cmdline_parse_token_string_t cmd_flex_filter_bytes
=
10531 TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result
,
10533 cmdline_parse_token_string_t cmd_flex_filter_bytes_value
=
10534 TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result
,
10535 bytes_value
, NULL
);
10536 cmdline_parse_token_string_t cmd_flex_filter_mask
=
10537 TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result
,
10539 cmdline_parse_token_string_t cmd_flex_filter_mask_value
=
10540 TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result
,
10542 cmdline_parse_token_string_t cmd_flex_filter_priority
=
10543 TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result
,
10544 priority
, "priority");
10545 cmdline_parse_token_num_t cmd_flex_filter_priority_value
=
10546 TOKEN_NUM_INITIALIZER(struct cmd_flex_filter_result
,
10547 priority_value
, UINT8
);
10548 cmdline_parse_token_string_t cmd_flex_filter_queue
=
10549 TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result
,
10551 cmdline_parse_token_num_t cmd_flex_filter_queue_id
=
10552 TOKEN_NUM_INITIALIZER(struct cmd_flex_filter_result
,
10554 cmdline_parse_inst_t cmd_flex_filter
= {
10555 .f
= cmd_flex_filter_parsed
,
10557 .help_str
= "flex_filter <port_id> add|del len <value> bytes "
10558 "<value> mask <value> priority <value> queue <queue_id>: "
10559 "Add/Del a flex filter",
10561 (void *)&cmd_flex_filter_filter
,
10562 (void *)&cmd_flex_filter_port_id
,
10563 (void *)&cmd_flex_filter_ops
,
10564 (void *)&cmd_flex_filter_len
,
10565 (void *)&cmd_flex_filter_len_value
,
10566 (void *)&cmd_flex_filter_bytes
,
10567 (void *)&cmd_flex_filter_bytes_value
,
10568 (void *)&cmd_flex_filter_mask
,
10569 (void *)&cmd_flex_filter_mask_value
,
10570 (void *)&cmd_flex_filter_priority
,
10571 (void *)&cmd_flex_filter_priority_value
,
10572 (void *)&cmd_flex_filter_queue
,
10573 (void *)&cmd_flex_filter_queue_id
,
10578 /* *** Filters Control *** */
10580 /* *** deal with ethertype filter *** */
10581 struct cmd_ethertype_filter_result
{
10582 cmdline_fixed_string_t filter
;
10584 cmdline_fixed_string_t ops
;
10585 cmdline_fixed_string_t mac
;
10586 struct ether_addr mac_addr
;
10587 cmdline_fixed_string_t ethertype
;
10588 uint16_t ethertype_value
;
10589 cmdline_fixed_string_t drop
;
10590 cmdline_fixed_string_t queue
;
10594 cmdline_parse_token_string_t cmd_ethertype_filter_filter
=
10595 TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result
,
10596 filter
, "ethertype_filter");
10597 cmdline_parse_token_num_t cmd_ethertype_filter_port_id
=
10598 TOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result
,
10600 cmdline_parse_token_string_t cmd_ethertype_filter_ops
=
10601 TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result
,
10603 cmdline_parse_token_string_t cmd_ethertype_filter_mac
=
10604 TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result
,
10605 mac
, "mac_addr#mac_ignr");
10606 cmdline_parse_token_etheraddr_t cmd_ethertype_filter_mac_addr
=
10607 TOKEN_ETHERADDR_INITIALIZER(struct cmd_ethertype_filter_result
,
10609 cmdline_parse_token_string_t cmd_ethertype_filter_ethertype
=
10610 TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result
,
10611 ethertype
, "ethertype");
10612 cmdline_parse_token_num_t cmd_ethertype_filter_ethertype_value
=
10613 TOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result
,
10614 ethertype_value
, UINT16
);
10615 cmdline_parse_token_string_t cmd_ethertype_filter_drop
=
10616 TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result
,
10618 cmdline_parse_token_string_t cmd_ethertype_filter_queue
=
10619 TOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result
,
10621 cmdline_parse_token_num_t cmd_ethertype_filter_queue_id
=
10622 TOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result
,
10626 cmd_ethertype_filter_parsed(void *parsed_result
,
10627 __attribute__((unused
)) struct cmdline
*cl
,
10628 __attribute__((unused
)) void *data
)
10630 struct cmd_ethertype_filter_result
*res
= parsed_result
;
10631 struct rte_eth_ethertype_filter filter
;
10634 ret
= rte_eth_dev_filter_supported(res
->port_id
,
10635 RTE_ETH_FILTER_ETHERTYPE
);
10637 printf("ethertype filter is not supported on port %u.\n",
10642 memset(&filter
, 0, sizeof(filter
));
10643 if (!strcmp(res
->mac
, "mac_addr")) {
10644 filter
.flags
|= RTE_ETHTYPE_FLAGS_MAC
;
10645 rte_memcpy(&filter
.mac_addr
, &res
->mac_addr
,
10646 sizeof(struct ether_addr
));
10648 if (!strcmp(res
->drop
, "drop"))
10649 filter
.flags
|= RTE_ETHTYPE_FLAGS_DROP
;
10650 filter
.ether_type
= res
->ethertype_value
;
10651 filter
.queue
= res
->queue_id
;
10653 if (!strcmp(res
->ops
, "add"))
10654 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
10655 RTE_ETH_FILTER_ETHERTYPE
,
10656 RTE_ETH_FILTER_ADD
,
10659 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
10660 RTE_ETH_FILTER_ETHERTYPE
,
10661 RTE_ETH_FILTER_DELETE
,
10664 printf("ethertype filter programming error: (%s)\n",
10668 cmdline_parse_inst_t cmd_ethertype_filter
= {
10669 .f
= cmd_ethertype_filter_parsed
,
10671 .help_str
= "ethertype_filter <port_id> add|del mac_addr|mac_ignr "
10672 "<mac_addr> ethertype <value> drop|fw queue <queue_id>: "
10673 "Add or delete an ethertype filter entry",
10675 (void *)&cmd_ethertype_filter_filter
,
10676 (void *)&cmd_ethertype_filter_port_id
,
10677 (void *)&cmd_ethertype_filter_ops
,
10678 (void *)&cmd_ethertype_filter_mac
,
10679 (void *)&cmd_ethertype_filter_mac_addr
,
10680 (void *)&cmd_ethertype_filter_ethertype
,
10681 (void *)&cmd_ethertype_filter_ethertype_value
,
10682 (void *)&cmd_ethertype_filter_drop
,
10683 (void *)&cmd_ethertype_filter_queue
,
10684 (void *)&cmd_ethertype_filter_queue_id
,
10689 /* *** deal with flow director filter *** */
10690 struct cmd_flow_director_result
{
10691 cmdline_fixed_string_t flow_director_filter
;
10693 cmdline_fixed_string_t mode
;
10694 cmdline_fixed_string_t mode_value
;
10695 cmdline_fixed_string_t ops
;
10696 cmdline_fixed_string_t flow
;
10697 cmdline_fixed_string_t flow_type
;
10698 cmdline_fixed_string_t ether
;
10699 uint16_t ether_type
;
10700 cmdline_fixed_string_t src
;
10701 cmdline_ipaddr_t ip_src
;
10703 cmdline_fixed_string_t dst
;
10704 cmdline_ipaddr_t ip_dst
;
10706 cmdline_fixed_string_t verify_tag
;
10707 uint32_t verify_tag_value
;
10708 cmdline_fixed_string_t tos
;
10710 cmdline_fixed_string_t proto
;
10711 uint8_t proto_value
;
10712 cmdline_fixed_string_t ttl
;
10714 cmdline_fixed_string_t vlan
;
10715 uint16_t vlan_value
;
10716 cmdline_fixed_string_t flexbytes
;
10717 cmdline_fixed_string_t flexbytes_value
;
10718 cmdline_fixed_string_t pf_vf
;
10719 cmdline_fixed_string_t drop
;
10720 cmdline_fixed_string_t queue
;
10722 cmdline_fixed_string_t fd_id
;
10723 uint32_t fd_id_value
;
10724 cmdline_fixed_string_t mac
;
10725 struct ether_addr mac_addr
;
10726 cmdline_fixed_string_t tunnel
;
10727 cmdline_fixed_string_t tunnel_type
;
10728 cmdline_fixed_string_t tunnel_id
;
10729 uint32_t tunnel_id_value
;
10730 cmdline_fixed_string_t packet
;
10735 parse_flexbytes(const char *q_arg
, uint8_t *flexbytes
, uint16_t max_num
)
10738 const char *p
, *p0
= q_arg
;
10740 unsigned long int_fld
;
10741 char *str_fld
[max_num
];
10746 p
= strchr(p0
, '(');
10750 p0
= strchr(p
, ')');
10755 if (size
>= sizeof(s
))
10758 snprintf(s
, sizeof(s
), "%.*s", size
, p
);
10759 ret
= rte_strsplit(s
, sizeof(s
), str_fld
, max_num
, ',');
10760 if (ret
< 0 || ret
> max_num
)
10762 for (i
= 0; i
< ret
; i
++) {
10764 int_fld
= strtoul(str_fld
[i
], &end
, 0);
10765 if (errno
!= 0 || *end
!= '\0' || int_fld
> UINT8_MAX
)
10767 flexbytes
[i
] = (uint8_t)int_fld
;
10773 str2flowtype(char *string
)
10776 static const struct {
10779 } flowtype_str
[] = {
10780 {"raw", RTE_ETH_FLOW_RAW
},
10781 {"ipv4", RTE_ETH_FLOW_IPV4
},
10782 {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4
},
10783 {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP
},
10784 {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP
},
10785 {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP
},
10786 {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER
},
10787 {"ipv6", RTE_ETH_FLOW_IPV6
},
10788 {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6
},
10789 {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP
},
10790 {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP
},
10791 {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP
},
10792 {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER
},
10793 {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD
},
10796 for (i
= 0; i
< RTE_DIM(flowtype_str
); i
++) {
10797 if (!strcmp(flowtype_str
[i
].str
, string
))
10798 return flowtype_str
[i
].type
;
10801 if (isdigit(string
[0]) && atoi(string
) > 0 && atoi(string
) < 64)
10802 return (uint16_t)atoi(string
);
10804 return RTE_ETH_FLOW_UNKNOWN
;
10807 static enum rte_eth_fdir_tunnel_type
10808 str2fdir_tunneltype(char *string
)
10812 static const struct {
10814 enum rte_eth_fdir_tunnel_type type
;
10815 } tunneltype_str
[] = {
10816 {"NVGRE", RTE_FDIR_TUNNEL_TYPE_NVGRE
},
10817 {"VxLAN", RTE_FDIR_TUNNEL_TYPE_VXLAN
},
10820 for (i
= 0; i
< RTE_DIM(tunneltype_str
); i
++) {
10821 if (!strcmp(tunneltype_str
[i
].str
, string
))
10822 return tunneltype_str
[i
].type
;
10824 return RTE_FDIR_TUNNEL_TYPE_UNKNOWN
;
10827 #define IPV4_ADDR_TO_UINT(ip_addr, ip) \
10829 if ((ip_addr).family == AF_INET) \
10830 (ip) = (ip_addr).addr.ipv4.s_addr; \
10832 printf("invalid parameter.\n"); \
10837 #define IPV6_ADDR_TO_ARRAY(ip_addr, ip) \
10839 if ((ip_addr).family == AF_INET6) \
10840 rte_memcpy(&(ip), \
10841 &((ip_addr).addr.ipv6), \
10842 sizeof(struct in6_addr)); \
10844 printf("invalid parameter.\n"); \
10850 cmd_flow_director_filter_parsed(void *parsed_result
,
10851 __attribute__((unused
)) struct cmdline
*cl
,
10852 __attribute__((unused
)) void *data
)
10854 struct cmd_flow_director_result
*res
= parsed_result
;
10855 struct rte_eth_fdir_filter entry
;
10856 uint8_t flexbytes
[RTE_ETH_FDIR_MAX_FLEXLEN
];
10858 unsigned long vf_id
;
10861 ret
= rte_eth_dev_filter_supported(res
->port_id
, RTE_ETH_FILTER_FDIR
);
10863 printf("flow director is not supported on port %u.\n",
10867 memset(flexbytes
, 0, sizeof(flexbytes
));
10868 memset(&entry
, 0, sizeof(struct rte_eth_fdir_filter
));
10870 if (fdir_conf
.mode
== RTE_FDIR_MODE_PERFECT_MAC_VLAN
) {
10871 if (strcmp(res
->mode_value
, "MAC-VLAN")) {
10872 printf("Please set mode to MAC-VLAN.\n");
10875 } else if (fdir_conf
.mode
== RTE_FDIR_MODE_PERFECT_TUNNEL
) {
10876 if (strcmp(res
->mode_value
, "Tunnel")) {
10877 printf("Please set mode to Tunnel.\n");
10881 if (!strcmp(res
->mode_value
, "raw")) {
10882 #ifdef RTE_LIBRTE_I40E_PMD
10883 struct rte_pmd_i40e_flow_type_mapping
10884 mapping
[RTE_PMD_I40E_FLOW_TYPE_MAX
];
10885 struct rte_pmd_i40e_pkt_template_conf conf
;
10886 uint16_t flow_type
= str2flowtype(res
->flow_type
);
10887 uint16_t i
, port
= res
->port_id
;
10890 memset(&conf
, 0, sizeof(conf
));
10892 if (flow_type
== RTE_ETH_FLOW_UNKNOWN
) {
10893 printf("Invalid flow type specified.\n");
10896 ret
= rte_pmd_i40e_flow_type_mapping_get(res
->port_id
,
10900 if (mapping
[flow_type
].pctype
== 0ULL) {
10901 printf("Invalid flow type specified.\n");
10904 for (i
= 0; i
< RTE_PMD_I40E_PCTYPE_MAX
; i
++) {
10905 if (mapping
[flow_type
].pctype
& (1ULL << i
)) {
10906 conf
.input
.pctype
= i
;
10911 conf
.input
.packet
= open_file(res
->filepath
,
10912 &conf
.input
.length
);
10913 if (!conf
.input
.packet
)
10915 if (!strcmp(res
->drop
, "drop"))
10916 conf
.action
.behavior
=
10917 RTE_PMD_I40E_PKT_TEMPLATE_REJECT
;
10919 conf
.action
.behavior
=
10920 RTE_PMD_I40E_PKT_TEMPLATE_ACCEPT
;
10921 conf
.action
.report_status
=
10922 RTE_PMD_I40E_PKT_TEMPLATE_REPORT_ID
;
10923 conf
.action
.rx_queue
= res
->queue_id
;
10924 conf
.soft_id
= res
->fd_id_value
;
10925 add
= strcmp(res
->ops
, "del") ? 1 : 0;
10926 ret
= rte_pmd_i40e_flow_add_del_packet_template(port
,
10930 printf("flow director config error: (%s)\n",
10932 close_file(conf
.input
.packet
);
10935 } else if (strcmp(res
->mode_value
, "IP")) {
10936 printf("Please set mode to IP or raw.\n");
10939 entry
.input
.flow_type
= str2flowtype(res
->flow_type
);
10942 ret
= parse_flexbytes(res
->flexbytes_value
,
10944 RTE_ETH_FDIR_MAX_FLEXLEN
);
10946 printf("error: Cannot parse flexbytes input.\n");
10950 switch (entry
.input
.flow_type
) {
10951 case RTE_ETH_FLOW_FRAG_IPV4
:
10952 case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER
:
10953 entry
.input
.flow
.ip4_flow
.proto
= res
->proto_value
;
10955 case RTE_ETH_FLOW_NONFRAG_IPV4_UDP
:
10956 case RTE_ETH_FLOW_NONFRAG_IPV4_TCP
:
10957 IPV4_ADDR_TO_UINT(res
->ip_dst
,
10958 entry
.input
.flow
.ip4_flow
.dst_ip
);
10959 IPV4_ADDR_TO_UINT(res
->ip_src
,
10960 entry
.input
.flow
.ip4_flow
.src_ip
);
10961 entry
.input
.flow
.ip4_flow
.tos
= res
->tos_value
;
10962 entry
.input
.flow
.ip4_flow
.ttl
= res
->ttl_value
;
10963 /* need convert to big endian. */
10964 entry
.input
.flow
.udp4_flow
.dst_port
=
10965 rte_cpu_to_be_16(res
->port_dst
);
10966 entry
.input
.flow
.udp4_flow
.src_port
=
10967 rte_cpu_to_be_16(res
->port_src
);
10969 case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP
:
10970 IPV4_ADDR_TO_UINT(res
->ip_dst
,
10971 entry
.input
.flow
.sctp4_flow
.ip
.dst_ip
);
10972 IPV4_ADDR_TO_UINT(res
->ip_src
,
10973 entry
.input
.flow
.sctp4_flow
.ip
.src_ip
);
10974 entry
.input
.flow
.ip4_flow
.tos
= res
->tos_value
;
10975 entry
.input
.flow
.ip4_flow
.ttl
= res
->ttl_value
;
10976 /* need convert to big endian. */
10977 entry
.input
.flow
.sctp4_flow
.dst_port
=
10978 rte_cpu_to_be_16(res
->port_dst
);
10979 entry
.input
.flow
.sctp4_flow
.src_port
=
10980 rte_cpu_to_be_16(res
->port_src
);
10981 entry
.input
.flow
.sctp4_flow
.verify_tag
=
10982 rte_cpu_to_be_32(res
->verify_tag_value
);
10984 case RTE_ETH_FLOW_FRAG_IPV6
:
10985 case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER
:
10986 entry
.input
.flow
.ipv6_flow
.proto
= res
->proto_value
;
10988 case RTE_ETH_FLOW_NONFRAG_IPV6_UDP
:
10989 case RTE_ETH_FLOW_NONFRAG_IPV6_TCP
:
10990 IPV6_ADDR_TO_ARRAY(res
->ip_dst
,
10991 entry
.input
.flow
.ipv6_flow
.dst_ip
);
10992 IPV6_ADDR_TO_ARRAY(res
->ip_src
,
10993 entry
.input
.flow
.ipv6_flow
.src_ip
);
10994 entry
.input
.flow
.ipv6_flow
.tc
= res
->tos_value
;
10995 entry
.input
.flow
.ipv6_flow
.hop_limits
= res
->ttl_value
;
10996 /* need convert to big endian. */
10997 entry
.input
.flow
.udp6_flow
.dst_port
=
10998 rte_cpu_to_be_16(res
->port_dst
);
10999 entry
.input
.flow
.udp6_flow
.src_port
=
11000 rte_cpu_to_be_16(res
->port_src
);
11002 case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP
:
11003 IPV6_ADDR_TO_ARRAY(res
->ip_dst
,
11004 entry
.input
.flow
.sctp6_flow
.ip
.dst_ip
);
11005 IPV6_ADDR_TO_ARRAY(res
->ip_src
,
11006 entry
.input
.flow
.sctp6_flow
.ip
.src_ip
);
11007 entry
.input
.flow
.ipv6_flow
.tc
= res
->tos_value
;
11008 entry
.input
.flow
.ipv6_flow
.hop_limits
= res
->ttl_value
;
11009 /* need convert to big endian. */
11010 entry
.input
.flow
.sctp6_flow
.dst_port
=
11011 rte_cpu_to_be_16(res
->port_dst
);
11012 entry
.input
.flow
.sctp6_flow
.src_port
=
11013 rte_cpu_to_be_16(res
->port_src
);
11014 entry
.input
.flow
.sctp6_flow
.verify_tag
=
11015 rte_cpu_to_be_32(res
->verify_tag_value
);
11017 case RTE_ETH_FLOW_L2_PAYLOAD
:
11018 entry
.input
.flow
.l2_flow
.ether_type
=
11019 rte_cpu_to_be_16(res
->ether_type
);
11025 if (fdir_conf
.mode
== RTE_FDIR_MODE_PERFECT_MAC_VLAN
)
11026 rte_memcpy(&entry
.input
.flow
.mac_vlan_flow
.mac_addr
,
11028 sizeof(struct ether_addr
));
11030 if (fdir_conf
.mode
== RTE_FDIR_MODE_PERFECT_TUNNEL
) {
11031 rte_memcpy(&entry
.input
.flow
.tunnel_flow
.mac_addr
,
11033 sizeof(struct ether_addr
));
11034 entry
.input
.flow
.tunnel_flow
.tunnel_type
=
11035 str2fdir_tunneltype(res
->tunnel_type
);
11036 entry
.input
.flow
.tunnel_flow
.tunnel_id
=
11037 rte_cpu_to_be_32(res
->tunnel_id_value
);
11040 rte_memcpy(entry
.input
.flow_ext
.flexbytes
,
11042 RTE_ETH_FDIR_MAX_FLEXLEN
);
11044 entry
.input
.flow_ext
.vlan_tci
= rte_cpu_to_be_16(res
->vlan_value
);
11046 entry
.action
.flex_off
= 0; /*use 0 by default */
11047 if (!strcmp(res
->drop
, "drop"))
11048 entry
.action
.behavior
= RTE_ETH_FDIR_REJECT
;
11050 entry
.action
.behavior
= RTE_ETH_FDIR_ACCEPT
;
11052 if (fdir_conf
.mode
!= RTE_FDIR_MODE_PERFECT_MAC_VLAN
&&
11053 fdir_conf
.mode
!= RTE_FDIR_MODE_PERFECT_TUNNEL
) {
11054 if (!strcmp(res
->pf_vf
, "pf"))
11055 entry
.input
.flow_ext
.is_vf
= 0;
11056 else if (!strncmp(res
->pf_vf
, "vf", 2)) {
11057 struct rte_eth_dev_info dev_info
;
11059 memset(&dev_info
, 0, sizeof(dev_info
));
11060 rte_eth_dev_info_get(res
->port_id
, &dev_info
);
11062 vf_id
= strtoul(res
->pf_vf
+ 2, &end
, 10);
11063 if (errno
!= 0 || *end
!= '\0' ||
11064 vf_id
>= dev_info
.max_vfs
) {
11065 printf("invalid parameter %s.\n", res
->pf_vf
);
11068 entry
.input
.flow_ext
.is_vf
= 1;
11069 entry
.input
.flow_ext
.dst_id
= (uint16_t)vf_id
;
11071 printf("invalid parameter %s.\n", res
->pf_vf
);
11076 /* set to report FD ID by default */
11077 entry
.action
.report_status
= RTE_ETH_FDIR_REPORT_ID
;
11078 entry
.action
.rx_queue
= res
->queue_id
;
11079 entry
.soft_id
= res
->fd_id_value
;
11080 if (!strcmp(res
->ops
, "add"))
11081 ret
= rte_eth_dev_filter_ctrl(res
->port_id
, RTE_ETH_FILTER_FDIR
,
11082 RTE_ETH_FILTER_ADD
, &entry
);
11083 else if (!strcmp(res
->ops
, "del"))
11084 ret
= rte_eth_dev_filter_ctrl(res
->port_id
, RTE_ETH_FILTER_FDIR
,
11085 RTE_ETH_FILTER_DELETE
, &entry
);
11087 ret
= rte_eth_dev_filter_ctrl(res
->port_id
, RTE_ETH_FILTER_FDIR
,
11088 RTE_ETH_FILTER_UPDATE
, &entry
);
11090 printf("flow director programming error: (%s)\n",
11094 cmdline_parse_token_string_t cmd_flow_director_filter
=
11095 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11096 flow_director_filter
, "flow_director_filter");
11097 cmdline_parse_token_num_t cmd_flow_director_port_id
=
11098 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result
,
11100 cmdline_parse_token_string_t cmd_flow_director_ops
=
11101 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11102 ops
, "add#del#update");
11103 cmdline_parse_token_string_t cmd_flow_director_flow
=
11104 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11106 cmdline_parse_token_string_t cmd_flow_director_flow_type
=
11107 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11109 cmdline_parse_token_string_t cmd_flow_director_ether
=
11110 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11112 cmdline_parse_token_num_t cmd_flow_director_ether_type
=
11113 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result
,
11114 ether_type
, UINT16
);
11115 cmdline_parse_token_string_t cmd_flow_director_src
=
11116 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11118 cmdline_parse_token_ipaddr_t cmd_flow_director_ip_src
=
11119 TOKEN_IPADDR_INITIALIZER(struct cmd_flow_director_result
,
11121 cmdline_parse_token_num_t cmd_flow_director_port_src
=
11122 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result
,
11124 cmdline_parse_token_string_t cmd_flow_director_dst
=
11125 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11127 cmdline_parse_token_ipaddr_t cmd_flow_director_ip_dst
=
11128 TOKEN_IPADDR_INITIALIZER(struct cmd_flow_director_result
,
11130 cmdline_parse_token_num_t cmd_flow_director_port_dst
=
11131 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result
,
11133 cmdline_parse_token_string_t cmd_flow_director_verify_tag
=
11134 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11135 verify_tag
, "verify_tag");
11136 cmdline_parse_token_num_t cmd_flow_director_verify_tag_value
=
11137 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result
,
11138 verify_tag_value
, UINT32
);
11139 cmdline_parse_token_string_t cmd_flow_director_tos
=
11140 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11142 cmdline_parse_token_num_t cmd_flow_director_tos_value
=
11143 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result
,
11145 cmdline_parse_token_string_t cmd_flow_director_proto
=
11146 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11148 cmdline_parse_token_num_t cmd_flow_director_proto_value
=
11149 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result
,
11150 proto_value
, UINT8
);
11151 cmdline_parse_token_string_t cmd_flow_director_ttl
=
11152 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11154 cmdline_parse_token_num_t cmd_flow_director_ttl_value
=
11155 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result
,
11157 cmdline_parse_token_string_t cmd_flow_director_vlan
=
11158 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11160 cmdline_parse_token_num_t cmd_flow_director_vlan_value
=
11161 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result
,
11162 vlan_value
, UINT16
);
11163 cmdline_parse_token_string_t cmd_flow_director_flexbytes
=
11164 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11165 flexbytes
, "flexbytes");
11166 cmdline_parse_token_string_t cmd_flow_director_flexbytes_value
=
11167 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11168 flexbytes_value
, NULL
);
11169 cmdline_parse_token_string_t cmd_flow_director_drop
=
11170 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11172 cmdline_parse_token_string_t cmd_flow_director_pf_vf
=
11173 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11175 cmdline_parse_token_string_t cmd_flow_director_queue
=
11176 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11178 cmdline_parse_token_num_t cmd_flow_director_queue_id
=
11179 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result
,
11181 cmdline_parse_token_string_t cmd_flow_director_fd_id
=
11182 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11184 cmdline_parse_token_num_t cmd_flow_director_fd_id_value
=
11185 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result
,
11186 fd_id_value
, UINT32
);
11188 cmdline_parse_token_string_t cmd_flow_director_mode
=
11189 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11191 cmdline_parse_token_string_t cmd_flow_director_mode_ip
=
11192 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11194 cmdline_parse_token_string_t cmd_flow_director_mode_mac_vlan
=
11195 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11196 mode_value
, "MAC-VLAN");
11197 cmdline_parse_token_string_t cmd_flow_director_mode_tunnel
=
11198 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11199 mode_value
, "Tunnel");
11200 cmdline_parse_token_string_t cmd_flow_director_mode_raw
=
11201 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11202 mode_value
, "raw");
11203 cmdline_parse_token_string_t cmd_flow_director_mac
=
11204 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11206 cmdline_parse_token_etheraddr_t cmd_flow_director_mac_addr
=
11207 TOKEN_ETHERADDR_INITIALIZER(struct cmd_flow_director_result
,
11209 cmdline_parse_token_string_t cmd_flow_director_tunnel
=
11210 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11212 cmdline_parse_token_string_t cmd_flow_director_tunnel_type
=
11213 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11214 tunnel_type
, "NVGRE#VxLAN");
11215 cmdline_parse_token_string_t cmd_flow_director_tunnel_id
=
11216 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11217 tunnel_id
, "tunnel-id");
11218 cmdline_parse_token_num_t cmd_flow_director_tunnel_id_value
=
11219 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result
,
11220 tunnel_id_value
, UINT32
);
11221 cmdline_parse_token_string_t cmd_flow_director_packet
=
11222 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11224 cmdline_parse_token_string_t cmd_flow_director_filepath
=
11225 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result
,
11228 cmdline_parse_inst_t cmd_add_del_ip_flow_director
= {
11229 .f
= cmd_flow_director_filter_parsed
,
11231 .help_str
= "flow_director_filter <port_id> mode IP add|del|update flow"
11232 " ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|"
11233 "ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|"
11234 "l2_payload src <src_ip> dst <dst_ip> tos <tos_value> "
11235 "proto <proto_value> ttl <ttl_value> vlan <vlan_value> "
11236 "flexbytes <flexbyte_values> drop|fw <pf_vf> queue <queue_id> "
11237 "fd_id <fd_id_value>: "
11238 "Add or delete an ip flow director entry on NIC",
11240 (void *)&cmd_flow_director_filter
,
11241 (void *)&cmd_flow_director_port_id
,
11242 (void *)&cmd_flow_director_mode
,
11243 (void *)&cmd_flow_director_mode_ip
,
11244 (void *)&cmd_flow_director_ops
,
11245 (void *)&cmd_flow_director_flow
,
11246 (void *)&cmd_flow_director_flow_type
,
11247 (void *)&cmd_flow_director_src
,
11248 (void *)&cmd_flow_director_ip_src
,
11249 (void *)&cmd_flow_director_dst
,
11250 (void *)&cmd_flow_director_ip_dst
,
11251 (void *)&cmd_flow_director_tos
,
11252 (void *)&cmd_flow_director_tos_value
,
11253 (void *)&cmd_flow_director_proto
,
11254 (void *)&cmd_flow_director_proto_value
,
11255 (void *)&cmd_flow_director_ttl
,
11256 (void *)&cmd_flow_director_ttl_value
,
11257 (void *)&cmd_flow_director_vlan
,
11258 (void *)&cmd_flow_director_vlan_value
,
11259 (void *)&cmd_flow_director_flexbytes
,
11260 (void *)&cmd_flow_director_flexbytes_value
,
11261 (void *)&cmd_flow_director_drop
,
11262 (void *)&cmd_flow_director_pf_vf
,
11263 (void *)&cmd_flow_director_queue
,
11264 (void *)&cmd_flow_director_queue_id
,
11265 (void *)&cmd_flow_director_fd_id
,
11266 (void *)&cmd_flow_director_fd_id_value
,
11271 cmdline_parse_inst_t cmd_add_del_udp_flow_director
= {
11272 .f
= cmd_flow_director_filter_parsed
,
11274 .help_str
= "flow_director_filter ... : Add or delete an udp/tcp flow "
11275 "director entry on NIC",
11277 (void *)&cmd_flow_director_filter
,
11278 (void *)&cmd_flow_director_port_id
,
11279 (void *)&cmd_flow_director_mode
,
11280 (void *)&cmd_flow_director_mode_ip
,
11281 (void *)&cmd_flow_director_ops
,
11282 (void *)&cmd_flow_director_flow
,
11283 (void *)&cmd_flow_director_flow_type
,
11284 (void *)&cmd_flow_director_src
,
11285 (void *)&cmd_flow_director_ip_src
,
11286 (void *)&cmd_flow_director_port_src
,
11287 (void *)&cmd_flow_director_dst
,
11288 (void *)&cmd_flow_director_ip_dst
,
11289 (void *)&cmd_flow_director_port_dst
,
11290 (void *)&cmd_flow_director_tos
,
11291 (void *)&cmd_flow_director_tos_value
,
11292 (void *)&cmd_flow_director_ttl
,
11293 (void *)&cmd_flow_director_ttl_value
,
11294 (void *)&cmd_flow_director_vlan
,
11295 (void *)&cmd_flow_director_vlan_value
,
11296 (void *)&cmd_flow_director_flexbytes
,
11297 (void *)&cmd_flow_director_flexbytes_value
,
11298 (void *)&cmd_flow_director_drop
,
11299 (void *)&cmd_flow_director_pf_vf
,
11300 (void *)&cmd_flow_director_queue
,
11301 (void *)&cmd_flow_director_queue_id
,
11302 (void *)&cmd_flow_director_fd_id
,
11303 (void *)&cmd_flow_director_fd_id_value
,
11308 cmdline_parse_inst_t cmd_add_del_sctp_flow_director
= {
11309 .f
= cmd_flow_director_filter_parsed
,
11311 .help_str
= "flow_director_filter ... : Add or delete a sctp flow "
11312 "director entry on NIC",
11314 (void *)&cmd_flow_director_filter
,
11315 (void *)&cmd_flow_director_port_id
,
11316 (void *)&cmd_flow_director_mode
,
11317 (void *)&cmd_flow_director_mode_ip
,
11318 (void *)&cmd_flow_director_ops
,
11319 (void *)&cmd_flow_director_flow
,
11320 (void *)&cmd_flow_director_flow_type
,
11321 (void *)&cmd_flow_director_src
,
11322 (void *)&cmd_flow_director_ip_src
,
11323 (void *)&cmd_flow_director_port_src
,
11324 (void *)&cmd_flow_director_dst
,
11325 (void *)&cmd_flow_director_ip_dst
,
11326 (void *)&cmd_flow_director_port_dst
,
11327 (void *)&cmd_flow_director_verify_tag
,
11328 (void *)&cmd_flow_director_verify_tag_value
,
11329 (void *)&cmd_flow_director_tos
,
11330 (void *)&cmd_flow_director_tos_value
,
11331 (void *)&cmd_flow_director_ttl
,
11332 (void *)&cmd_flow_director_ttl_value
,
11333 (void *)&cmd_flow_director_vlan
,
11334 (void *)&cmd_flow_director_vlan_value
,
11335 (void *)&cmd_flow_director_flexbytes
,
11336 (void *)&cmd_flow_director_flexbytes_value
,
11337 (void *)&cmd_flow_director_drop
,
11338 (void *)&cmd_flow_director_pf_vf
,
11339 (void *)&cmd_flow_director_queue
,
11340 (void *)&cmd_flow_director_queue_id
,
11341 (void *)&cmd_flow_director_fd_id
,
11342 (void *)&cmd_flow_director_fd_id_value
,
11347 cmdline_parse_inst_t cmd_add_del_l2_flow_director
= {
11348 .f
= cmd_flow_director_filter_parsed
,
11350 .help_str
= "flow_director_filter ... : Add or delete a L2 flow "
11351 "director entry on NIC",
11353 (void *)&cmd_flow_director_filter
,
11354 (void *)&cmd_flow_director_port_id
,
11355 (void *)&cmd_flow_director_mode
,
11356 (void *)&cmd_flow_director_mode_ip
,
11357 (void *)&cmd_flow_director_ops
,
11358 (void *)&cmd_flow_director_flow
,
11359 (void *)&cmd_flow_director_flow_type
,
11360 (void *)&cmd_flow_director_ether
,
11361 (void *)&cmd_flow_director_ether_type
,
11362 (void *)&cmd_flow_director_flexbytes
,
11363 (void *)&cmd_flow_director_flexbytes_value
,
11364 (void *)&cmd_flow_director_drop
,
11365 (void *)&cmd_flow_director_pf_vf
,
11366 (void *)&cmd_flow_director_queue
,
11367 (void *)&cmd_flow_director_queue_id
,
11368 (void *)&cmd_flow_director_fd_id
,
11369 (void *)&cmd_flow_director_fd_id_value
,
11374 cmdline_parse_inst_t cmd_add_del_mac_vlan_flow_director
= {
11375 .f
= cmd_flow_director_filter_parsed
,
11377 .help_str
= "flow_director_filter ... : Add or delete a MAC VLAN flow "
11378 "director entry on NIC",
11380 (void *)&cmd_flow_director_filter
,
11381 (void *)&cmd_flow_director_port_id
,
11382 (void *)&cmd_flow_director_mode
,
11383 (void *)&cmd_flow_director_mode_mac_vlan
,
11384 (void *)&cmd_flow_director_ops
,
11385 (void *)&cmd_flow_director_mac
,
11386 (void *)&cmd_flow_director_mac_addr
,
11387 (void *)&cmd_flow_director_vlan
,
11388 (void *)&cmd_flow_director_vlan_value
,
11389 (void *)&cmd_flow_director_flexbytes
,
11390 (void *)&cmd_flow_director_flexbytes_value
,
11391 (void *)&cmd_flow_director_drop
,
11392 (void *)&cmd_flow_director_queue
,
11393 (void *)&cmd_flow_director_queue_id
,
11394 (void *)&cmd_flow_director_fd_id
,
11395 (void *)&cmd_flow_director_fd_id_value
,
11400 cmdline_parse_inst_t cmd_add_del_tunnel_flow_director
= {
11401 .f
= cmd_flow_director_filter_parsed
,
11403 .help_str
= "flow_director_filter ... : Add or delete a tunnel flow "
11404 "director entry on NIC",
11406 (void *)&cmd_flow_director_filter
,
11407 (void *)&cmd_flow_director_port_id
,
11408 (void *)&cmd_flow_director_mode
,
11409 (void *)&cmd_flow_director_mode_tunnel
,
11410 (void *)&cmd_flow_director_ops
,
11411 (void *)&cmd_flow_director_mac
,
11412 (void *)&cmd_flow_director_mac_addr
,
11413 (void *)&cmd_flow_director_vlan
,
11414 (void *)&cmd_flow_director_vlan_value
,
11415 (void *)&cmd_flow_director_tunnel
,
11416 (void *)&cmd_flow_director_tunnel_type
,
11417 (void *)&cmd_flow_director_tunnel_id
,
11418 (void *)&cmd_flow_director_tunnel_id_value
,
11419 (void *)&cmd_flow_director_flexbytes
,
11420 (void *)&cmd_flow_director_flexbytes_value
,
11421 (void *)&cmd_flow_director_drop
,
11422 (void *)&cmd_flow_director_queue
,
11423 (void *)&cmd_flow_director_queue_id
,
11424 (void *)&cmd_flow_director_fd_id
,
11425 (void *)&cmd_flow_director_fd_id_value
,
11430 cmdline_parse_inst_t cmd_add_del_raw_flow_director
= {
11431 .f
= cmd_flow_director_filter_parsed
,
11433 .help_str
= "flow_director_filter ... : Add or delete a raw flow "
11434 "director entry on NIC",
11436 (void *)&cmd_flow_director_filter
,
11437 (void *)&cmd_flow_director_port_id
,
11438 (void *)&cmd_flow_director_mode
,
11439 (void *)&cmd_flow_director_mode_raw
,
11440 (void *)&cmd_flow_director_ops
,
11441 (void *)&cmd_flow_director_flow
,
11442 (void *)&cmd_flow_director_flow_type
,
11443 (void *)&cmd_flow_director_drop
,
11444 (void *)&cmd_flow_director_queue
,
11445 (void *)&cmd_flow_director_queue_id
,
11446 (void *)&cmd_flow_director_fd_id
,
11447 (void *)&cmd_flow_director_fd_id_value
,
11448 (void *)&cmd_flow_director_packet
,
11449 (void *)&cmd_flow_director_filepath
,
11454 struct cmd_flush_flow_director_result
{
11455 cmdline_fixed_string_t flush_flow_director
;
11459 cmdline_parse_token_string_t cmd_flush_flow_director_flush
=
11460 TOKEN_STRING_INITIALIZER(struct cmd_flush_flow_director_result
,
11461 flush_flow_director
, "flush_flow_director");
11462 cmdline_parse_token_num_t cmd_flush_flow_director_port_id
=
11463 TOKEN_NUM_INITIALIZER(struct cmd_flush_flow_director_result
,
11467 cmd_flush_flow_director_parsed(void *parsed_result
,
11468 __attribute__((unused
)) struct cmdline
*cl
,
11469 __attribute__((unused
)) void *data
)
11471 struct cmd_flow_director_result
*res
= parsed_result
;
11474 ret
= rte_eth_dev_filter_supported(res
->port_id
, RTE_ETH_FILTER_FDIR
);
11476 printf("flow director is not supported on port %u.\n",
11481 ret
= rte_eth_dev_filter_ctrl(res
->port_id
, RTE_ETH_FILTER_FDIR
,
11482 RTE_ETH_FILTER_FLUSH
, NULL
);
11484 printf("flow director table flushing error: (%s)\n",
11488 cmdline_parse_inst_t cmd_flush_flow_director
= {
11489 .f
= cmd_flush_flow_director_parsed
,
11491 .help_str
= "flush_flow_director <port_id>: "
11492 "Flush all flow director entries of a device on NIC",
11494 (void *)&cmd_flush_flow_director_flush
,
11495 (void *)&cmd_flush_flow_director_port_id
,
11500 /* *** deal with flow director mask *** */
11501 struct cmd_flow_director_mask_result
{
11502 cmdline_fixed_string_t flow_director_mask
;
11504 cmdline_fixed_string_t mode
;
11505 cmdline_fixed_string_t mode_value
;
11506 cmdline_fixed_string_t vlan
;
11507 uint16_t vlan_mask
;
11508 cmdline_fixed_string_t src_mask
;
11509 cmdline_ipaddr_t ipv4_src
;
11510 cmdline_ipaddr_t ipv6_src
;
11512 cmdline_fixed_string_t dst_mask
;
11513 cmdline_ipaddr_t ipv4_dst
;
11514 cmdline_ipaddr_t ipv6_dst
;
11516 cmdline_fixed_string_t mac
;
11517 uint8_t mac_addr_byte_mask
;
11518 cmdline_fixed_string_t tunnel_id
;
11519 uint32_t tunnel_id_mask
;
11520 cmdline_fixed_string_t tunnel_type
;
11521 uint8_t tunnel_type_mask
;
11525 cmd_flow_director_mask_parsed(void *parsed_result
,
11526 __attribute__((unused
)) struct cmdline
*cl
,
11527 __attribute__((unused
)) void *data
)
11529 struct cmd_flow_director_mask_result
*res
= parsed_result
;
11530 struct rte_eth_fdir_masks
*mask
;
11531 struct rte_port
*port
;
11533 port
= &ports
[res
->port_id
];
11534 /** Check if the port is not started **/
11535 if (port
->port_status
!= RTE_PORT_STOPPED
) {
11536 printf("Please stop port %d first\n", res
->port_id
);
11540 mask
= &port
->dev_conf
.fdir_conf
.mask
;
11542 if (fdir_conf
.mode
== RTE_FDIR_MODE_PERFECT_MAC_VLAN
) {
11543 if (strcmp(res
->mode_value
, "MAC-VLAN")) {
11544 printf("Please set mode to MAC-VLAN.\n");
11548 mask
->vlan_tci_mask
= rte_cpu_to_be_16(res
->vlan_mask
);
11549 } else if (fdir_conf
.mode
== RTE_FDIR_MODE_PERFECT_TUNNEL
) {
11550 if (strcmp(res
->mode_value
, "Tunnel")) {
11551 printf("Please set mode to Tunnel.\n");
11555 mask
->vlan_tci_mask
= rte_cpu_to_be_16(res
->vlan_mask
);
11556 mask
->mac_addr_byte_mask
= res
->mac_addr_byte_mask
;
11557 mask
->tunnel_id_mask
= rte_cpu_to_be_32(res
->tunnel_id_mask
);
11558 mask
->tunnel_type_mask
= res
->tunnel_type_mask
;
11560 if (strcmp(res
->mode_value
, "IP")) {
11561 printf("Please set mode to IP.\n");
11565 mask
->vlan_tci_mask
= rte_cpu_to_be_16(res
->vlan_mask
);
11566 IPV4_ADDR_TO_UINT(res
->ipv4_src
, mask
->ipv4_mask
.src_ip
);
11567 IPV4_ADDR_TO_UINT(res
->ipv4_dst
, mask
->ipv4_mask
.dst_ip
);
11568 IPV6_ADDR_TO_ARRAY(res
->ipv6_src
, mask
->ipv6_mask
.src_ip
);
11569 IPV6_ADDR_TO_ARRAY(res
->ipv6_dst
, mask
->ipv6_mask
.dst_ip
);
11570 mask
->src_port_mask
= rte_cpu_to_be_16(res
->port_src
);
11571 mask
->dst_port_mask
= rte_cpu_to_be_16(res
->port_dst
);
11574 cmd_reconfig_device_queue(res
->port_id
, 1, 1);
11577 cmdline_parse_token_string_t cmd_flow_director_mask
=
11578 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result
,
11579 flow_director_mask
, "flow_director_mask");
11580 cmdline_parse_token_num_t cmd_flow_director_mask_port_id
=
11581 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result
,
11583 cmdline_parse_token_string_t cmd_flow_director_mask_vlan
=
11584 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result
,
11586 cmdline_parse_token_num_t cmd_flow_director_mask_vlan_value
=
11587 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result
,
11588 vlan_mask
, UINT16
);
11589 cmdline_parse_token_string_t cmd_flow_director_mask_src
=
11590 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result
,
11591 src_mask
, "src_mask");
11592 cmdline_parse_token_ipaddr_t cmd_flow_director_mask_ipv4_src
=
11593 TOKEN_IPADDR_INITIALIZER(struct cmd_flow_director_mask_result
,
11595 cmdline_parse_token_ipaddr_t cmd_flow_director_mask_ipv6_src
=
11596 TOKEN_IPADDR_INITIALIZER(struct cmd_flow_director_mask_result
,
11598 cmdline_parse_token_num_t cmd_flow_director_mask_port_src
=
11599 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result
,
11601 cmdline_parse_token_string_t cmd_flow_director_mask_dst
=
11602 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result
,
11603 dst_mask
, "dst_mask");
11604 cmdline_parse_token_ipaddr_t cmd_flow_director_mask_ipv4_dst
=
11605 TOKEN_IPADDR_INITIALIZER(struct cmd_flow_director_mask_result
,
11607 cmdline_parse_token_ipaddr_t cmd_flow_director_mask_ipv6_dst
=
11608 TOKEN_IPADDR_INITIALIZER(struct cmd_flow_director_mask_result
,
11610 cmdline_parse_token_num_t cmd_flow_director_mask_port_dst
=
11611 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result
,
11614 cmdline_parse_token_string_t cmd_flow_director_mask_mode
=
11615 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result
,
11617 cmdline_parse_token_string_t cmd_flow_director_mask_mode_ip
=
11618 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result
,
11620 cmdline_parse_token_string_t cmd_flow_director_mask_mode_mac_vlan
=
11621 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result
,
11622 mode_value
, "MAC-VLAN");
11623 cmdline_parse_token_string_t cmd_flow_director_mask_mode_tunnel
=
11624 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result
,
11625 mode_value
, "Tunnel");
11626 cmdline_parse_token_string_t cmd_flow_director_mask_mac
=
11627 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result
,
11629 cmdline_parse_token_num_t cmd_flow_director_mask_mac_value
=
11630 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result
,
11631 mac_addr_byte_mask
, UINT8
);
11632 cmdline_parse_token_string_t cmd_flow_director_mask_tunnel_type
=
11633 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result
,
11634 tunnel_type
, "tunnel-type");
11635 cmdline_parse_token_num_t cmd_flow_director_mask_tunnel_type_value
=
11636 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result
,
11637 tunnel_type_mask
, UINT8
);
11638 cmdline_parse_token_string_t cmd_flow_director_mask_tunnel_id
=
11639 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result
,
11640 tunnel_id
, "tunnel-id");
11641 cmdline_parse_token_num_t cmd_flow_director_mask_tunnel_id_value
=
11642 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result
,
11643 tunnel_id_mask
, UINT32
);
11645 cmdline_parse_inst_t cmd_set_flow_director_ip_mask
= {
11646 .f
= cmd_flow_director_mask_parsed
,
11648 .help_str
= "flow_director_mask ... : "
11649 "Set IP mode flow director's mask on NIC",
11651 (void *)&cmd_flow_director_mask
,
11652 (void *)&cmd_flow_director_mask_port_id
,
11653 (void *)&cmd_flow_director_mask_mode
,
11654 (void *)&cmd_flow_director_mask_mode_ip
,
11655 (void *)&cmd_flow_director_mask_vlan
,
11656 (void *)&cmd_flow_director_mask_vlan_value
,
11657 (void *)&cmd_flow_director_mask_src
,
11658 (void *)&cmd_flow_director_mask_ipv4_src
,
11659 (void *)&cmd_flow_director_mask_ipv6_src
,
11660 (void *)&cmd_flow_director_mask_port_src
,
11661 (void *)&cmd_flow_director_mask_dst
,
11662 (void *)&cmd_flow_director_mask_ipv4_dst
,
11663 (void *)&cmd_flow_director_mask_ipv6_dst
,
11664 (void *)&cmd_flow_director_mask_port_dst
,
11669 cmdline_parse_inst_t cmd_set_flow_director_mac_vlan_mask
= {
11670 .f
= cmd_flow_director_mask_parsed
,
11672 .help_str
= "flow_director_mask ... : Set MAC VLAN mode "
11673 "flow director's mask on NIC",
11675 (void *)&cmd_flow_director_mask
,
11676 (void *)&cmd_flow_director_mask_port_id
,
11677 (void *)&cmd_flow_director_mask_mode
,
11678 (void *)&cmd_flow_director_mask_mode_mac_vlan
,
11679 (void *)&cmd_flow_director_mask_vlan
,
11680 (void *)&cmd_flow_director_mask_vlan_value
,
11685 cmdline_parse_inst_t cmd_set_flow_director_tunnel_mask
= {
11686 .f
= cmd_flow_director_mask_parsed
,
11688 .help_str
= "flow_director_mask ... : Set tunnel mode "
11689 "flow director's mask on NIC",
11691 (void *)&cmd_flow_director_mask
,
11692 (void *)&cmd_flow_director_mask_port_id
,
11693 (void *)&cmd_flow_director_mask_mode
,
11694 (void *)&cmd_flow_director_mask_mode_tunnel
,
11695 (void *)&cmd_flow_director_mask_vlan
,
11696 (void *)&cmd_flow_director_mask_vlan_value
,
11697 (void *)&cmd_flow_director_mask_mac
,
11698 (void *)&cmd_flow_director_mask_mac_value
,
11699 (void *)&cmd_flow_director_mask_tunnel_type
,
11700 (void *)&cmd_flow_director_mask_tunnel_type_value
,
11701 (void *)&cmd_flow_director_mask_tunnel_id
,
11702 (void *)&cmd_flow_director_mask_tunnel_id_value
,
11707 /* *** deal with flow director mask on flexible payload *** */
11708 struct cmd_flow_director_flex_mask_result
{
11709 cmdline_fixed_string_t flow_director_flexmask
;
11711 cmdline_fixed_string_t flow
;
11712 cmdline_fixed_string_t flow_type
;
11713 cmdline_fixed_string_t mask
;
11717 cmd_flow_director_flex_mask_parsed(void *parsed_result
,
11718 __attribute__((unused
)) struct cmdline
*cl
,
11719 __attribute__((unused
)) void *data
)
11721 struct cmd_flow_director_flex_mask_result
*res
= parsed_result
;
11722 struct rte_eth_fdir_info fdir_info
;
11723 struct rte_eth_fdir_flex_mask flex_mask
;
11724 struct rte_port
*port
;
11725 uint64_t flow_type_mask
;
11729 port
= &ports
[res
->port_id
];
11730 /** Check if the port is not started **/
11731 if (port
->port_status
!= RTE_PORT_STOPPED
) {
11732 printf("Please stop port %d first\n", res
->port_id
);
11736 memset(&flex_mask
, 0, sizeof(struct rte_eth_fdir_flex_mask
));
11737 ret
= parse_flexbytes(res
->mask
,
11739 RTE_ETH_FDIR_MAX_FLEXLEN
);
11741 printf("error: Cannot parse mask input.\n");
11745 memset(&fdir_info
, 0, sizeof(fdir_info
));
11746 ret
= rte_eth_dev_filter_ctrl(res
->port_id
, RTE_ETH_FILTER_FDIR
,
11747 RTE_ETH_FILTER_INFO
, &fdir_info
);
11749 printf("Cannot get FDir filter info\n");
11753 if (!strcmp(res
->flow_type
, "none")) {
11754 /* means don't specify the flow type */
11755 flex_mask
.flow_type
= RTE_ETH_FLOW_UNKNOWN
;
11756 for (i
= 0; i
< RTE_ETH_FLOW_MAX
; i
++)
11757 memset(&port
->dev_conf
.fdir_conf
.flex_conf
.flex_mask
[i
],
11758 0, sizeof(struct rte_eth_fdir_flex_mask
));
11759 port
->dev_conf
.fdir_conf
.flex_conf
.nb_flexmasks
= 1;
11760 rte_memcpy(&port
->dev_conf
.fdir_conf
.flex_conf
.flex_mask
[0],
11762 sizeof(struct rte_eth_fdir_flex_mask
));
11763 cmd_reconfig_device_queue(res
->port_id
, 1, 1);
11766 flow_type_mask
= fdir_info
.flow_types_mask
[0];
11767 if (!strcmp(res
->flow_type
, "all")) {
11768 if (!flow_type_mask
) {
11769 printf("No flow type supported\n");
11772 for (i
= RTE_ETH_FLOW_UNKNOWN
; i
< RTE_ETH_FLOW_MAX
; i
++) {
11773 if (flow_type_mask
& (1ULL << i
)) {
11774 flex_mask
.flow_type
= i
;
11775 fdir_set_flex_mask(res
->port_id
, &flex_mask
);
11778 cmd_reconfig_device_queue(res
->port_id
, 1, 1);
11781 flex_mask
.flow_type
= str2flowtype(res
->flow_type
);
11782 if (!(flow_type_mask
& (1ULL << flex_mask
.flow_type
))) {
11783 printf("Flow type %s not supported on port %d\n",
11784 res
->flow_type
, res
->port_id
);
11787 fdir_set_flex_mask(res
->port_id
, &flex_mask
);
11788 cmd_reconfig_device_queue(res
->port_id
, 1, 1);
11791 cmdline_parse_token_string_t cmd_flow_director_flexmask
=
11792 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result
,
11793 flow_director_flexmask
,
11794 "flow_director_flex_mask");
11795 cmdline_parse_token_num_t cmd_flow_director_flexmask_port_id
=
11796 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_flex_mask_result
,
11798 cmdline_parse_token_string_t cmd_flow_director_flexmask_flow
=
11799 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result
,
11801 cmdline_parse_token_string_t cmd_flow_director_flexmask_flow_type
=
11802 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result
,
11803 flow_type
, "none#ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
11804 "ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#l2_payload#all");
11805 cmdline_parse_token_string_t cmd_flow_director_flexmask_mask
=
11806 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result
,
11809 cmdline_parse_inst_t cmd_set_flow_director_flex_mask
= {
11810 .f
= cmd_flow_director_flex_mask_parsed
,
11812 .help_str
= "flow_director_flex_mask ... : "
11813 "Set flow director's flex mask on NIC",
11815 (void *)&cmd_flow_director_flexmask
,
11816 (void *)&cmd_flow_director_flexmask_port_id
,
11817 (void *)&cmd_flow_director_flexmask_flow
,
11818 (void *)&cmd_flow_director_flexmask_flow_type
,
11819 (void *)&cmd_flow_director_flexmask_mask
,
11824 /* *** deal with flow director flexible payload configuration *** */
11825 struct cmd_flow_director_flexpayload_result
{
11826 cmdline_fixed_string_t flow_director_flexpayload
;
11828 cmdline_fixed_string_t payload_layer
;
11829 cmdline_fixed_string_t payload_cfg
;
11833 parse_offsets(const char *q_arg
, uint16_t *offsets
, uint16_t max_num
)
11836 const char *p
, *p0
= q_arg
;
11838 unsigned long int_fld
;
11839 char *str_fld
[max_num
];
11844 p
= strchr(p0
, '(');
11848 p0
= strchr(p
, ')');
11853 if (size
>= sizeof(s
))
11856 snprintf(s
, sizeof(s
), "%.*s", size
, p
);
11857 ret
= rte_strsplit(s
, sizeof(s
), str_fld
, max_num
, ',');
11858 if (ret
< 0 || ret
> max_num
)
11860 for (i
= 0; i
< ret
; i
++) {
11862 int_fld
= strtoul(str_fld
[i
], &end
, 0);
11863 if (errno
!= 0 || *end
!= '\0' || int_fld
> UINT16_MAX
)
11865 offsets
[i
] = (uint16_t)int_fld
;
11871 cmd_flow_director_flxpld_parsed(void *parsed_result
,
11872 __attribute__((unused
)) struct cmdline
*cl
,
11873 __attribute__((unused
)) void *data
)
11875 struct cmd_flow_director_flexpayload_result
*res
= parsed_result
;
11876 struct rte_eth_flex_payload_cfg flex_cfg
;
11877 struct rte_port
*port
;
11880 port
= &ports
[res
->port_id
];
11881 /** Check if the port is not started **/
11882 if (port
->port_status
!= RTE_PORT_STOPPED
) {
11883 printf("Please stop port %d first\n", res
->port_id
);
11887 memset(&flex_cfg
, 0, sizeof(struct rte_eth_flex_payload_cfg
));
11889 if (!strcmp(res
->payload_layer
, "raw"))
11890 flex_cfg
.type
= RTE_ETH_RAW_PAYLOAD
;
11891 else if (!strcmp(res
->payload_layer
, "l2"))
11892 flex_cfg
.type
= RTE_ETH_L2_PAYLOAD
;
11893 else if (!strcmp(res
->payload_layer
, "l3"))
11894 flex_cfg
.type
= RTE_ETH_L3_PAYLOAD
;
11895 else if (!strcmp(res
->payload_layer
, "l4"))
11896 flex_cfg
.type
= RTE_ETH_L4_PAYLOAD
;
11898 ret
= parse_offsets(res
->payload_cfg
, flex_cfg
.src_offset
,
11899 RTE_ETH_FDIR_MAX_FLEXLEN
);
11901 printf("error: Cannot parse flex payload input.\n");
11905 fdir_set_flex_payload(res
->port_id
, &flex_cfg
);
11906 cmd_reconfig_device_queue(res
->port_id
, 1, 1);
11909 cmdline_parse_token_string_t cmd_flow_director_flexpayload
=
11910 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flexpayload_result
,
11911 flow_director_flexpayload
,
11912 "flow_director_flex_payload");
11913 cmdline_parse_token_num_t cmd_flow_director_flexpayload_port_id
=
11914 TOKEN_NUM_INITIALIZER(struct cmd_flow_director_flexpayload_result
,
11916 cmdline_parse_token_string_t cmd_flow_director_flexpayload_payload_layer
=
11917 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flexpayload_result
,
11918 payload_layer
, "raw#l2#l3#l4");
11919 cmdline_parse_token_string_t cmd_flow_director_flexpayload_payload_cfg
=
11920 TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flexpayload_result
,
11921 payload_cfg
, NULL
);
11923 cmdline_parse_inst_t cmd_set_flow_director_flex_payload
= {
11924 .f
= cmd_flow_director_flxpld_parsed
,
11926 .help_str
= "flow_director_flexpayload ... : "
11927 "Set flow director's flex payload on NIC",
11929 (void *)&cmd_flow_director_flexpayload
,
11930 (void *)&cmd_flow_director_flexpayload_port_id
,
11931 (void *)&cmd_flow_director_flexpayload_payload_layer
,
11932 (void *)&cmd_flow_director_flexpayload_payload_cfg
,
11937 /* Generic flow interface command. */
11938 extern cmdline_parse_inst_t cmd_flow
;
11940 /* *** Classification Filters Control *** */
11941 /* *** Get symmetric hash enable per port *** */
11942 struct cmd_get_sym_hash_ena_per_port_result
{
11943 cmdline_fixed_string_t get_sym_hash_ena_per_port
;
11948 cmd_get_sym_hash_per_port_parsed(void *parsed_result
,
11949 __rte_unused
struct cmdline
*cl
,
11950 __rte_unused
void *data
)
11952 struct cmd_get_sym_hash_ena_per_port_result
*res
= parsed_result
;
11953 struct rte_eth_hash_filter_info info
;
11956 if (rte_eth_dev_filter_supported(res
->port_id
,
11957 RTE_ETH_FILTER_HASH
) < 0) {
11958 printf("RTE_ETH_FILTER_HASH not supported on port: %d\n",
11963 memset(&info
, 0, sizeof(info
));
11964 info
.info_type
= RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT
;
11965 ret
= rte_eth_dev_filter_ctrl(res
->port_id
, RTE_ETH_FILTER_HASH
,
11966 RTE_ETH_FILTER_GET
, &info
);
11969 printf("Cannot get symmetric hash enable per port "
11970 "on port %u\n", res
->port_id
);
11974 printf("Symmetric hash is %s on port %u\n", info
.info
.enable
?
11975 "enabled" : "disabled", res
->port_id
);
11978 cmdline_parse_token_string_t cmd_get_sym_hash_ena_per_port_all
=
11979 TOKEN_STRING_INITIALIZER(struct cmd_get_sym_hash_ena_per_port_result
,
11980 get_sym_hash_ena_per_port
, "get_sym_hash_ena_per_port");
11981 cmdline_parse_token_num_t cmd_get_sym_hash_ena_per_port_port_id
=
11982 TOKEN_NUM_INITIALIZER(struct cmd_get_sym_hash_ena_per_port_result
,
11985 cmdline_parse_inst_t cmd_get_sym_hash_ena_per_port
= {
11986 .f
= cmd_get_sym_hash_per_port_parsed
,
11988 .help_str
= "get_sym_hash_ena_per_port <port_id>",
11990 (void *)&cmd_get_sym_hash_ena_per_port_all
,
11991 (void *)&cmd_get_sym_hash_ena_per_port_port_id
,
11996 /* *** Set symmetric hash enable per port *** */
11997 struct cmd_set_sym_hash_ena_per_port_result
{
11998 cmdline_fixed_string_t set_sym_hash_ena_per_port
;
11999 cmdline_fixed_string_t enable
;
12004 cmd_set_sym_hash_per_port_parsed(void *parsed_result
,
12005 __rte_unused
struct cmdline
*cl
,
12006 __rte_unused
void *data
)
12008 struct cmd_set_sym_hash_ena_per_port_result
*res
= parsed_result
;
12009 struct rte_eth_hash_filter_info info
;
12012 if (rte_eth_dev_filter_supported(res
->port_id
,
12013 RTE_ETH_FILTER_HASH
) < 0) {
12014 printf("RTE_ETH_FILTER_HASH not supported on port: %d\n",
12019 memset(&info
, 0, sizeof(info
));
12020 info
.info_type
= RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT
;
12021 if (!strcmp(res
->enable
, "enable"))
12022 info
.info
.enable
= 1;
12023 ret
= rte_eth_dev_filter_ctrl(res
->port_id
, RTE_ETH_FILTER_HASH
,
12024 RTE_ETH_FILTER_SET
, &info
);
12026 printf("Cannot set symmetric hash enable per port on "
12027 "port %u\n", res
->port_id
);
12030 printf("Symmetric hash has been set to %s on port %u\n",
12031 res
->enable
, res
->port_id
);
12034 cmdline_parse_token_string_t cmd_set_sym_hash_ena_per_port_all
=
12035 TOKEN_STRING_INITIALIZER(struct cmd_set_sym_hash_ena_per_port_result
,
12036 set_sym_hash_ena_per_port
, "set_sym_hash_ena_per_port");
12037 cmdline_parse_token_num_t cmd_set_sym_hash_ena_per_port_port_id
=
12038 TOKEN_NUM_INITIALIZER(struct cmd_set_sym_hash_ena_per_port_result
,
12040 cmdline_parse_token_string_t cmd_set_sym_hash_ena_per_port_enable
=
12041 TOKEN_STRING_INITIALIZER(struct cmd_set_sym_hash_ena_per_port_result
,
12042 enable
, "enable#disable");
12044 cmdline_parse_inst_t cmd_set_sym_hash_ena_per_port
= {
12045 .f
= cmd_set_sym_hash_per_port_parsed
,
12047 .help_str
= "set_sym_hash_ena_per_port <port_id> enable|disable",
12049 (void *)&cmd_set_sym_hash_ena_per_port_all
,
12050 (void *)&cmd_set_sym_hash_ena_per_port_port_id
,
12051 (void *)&cmd_set_sym_hash_ena_per_port_enable
,
12056 /* Get global config of hash function */
12057 struct cmd_get_hash_global_config_result
{
12058 cmdline_fixed_string_t get_hash_global_config
;
12063 flowtype_to_str(uint16_t ftype
)
12069 } ftype_table
[] = {
12070 {"ipv4", RTE_ETH_FLOW_IPV4
},
12071 {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4
},
12072 {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP
},
12073 {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP
},
12074 {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP
},
12075 {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER
},
12076 {"ipv6", RTE_ETH_FLOW_IPV6
},
12077 {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6
},
12078 {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP
},
12079 {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP
},
12080 {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP
},
12081 {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER
},
12082 {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD
},
12083 {"port", RTE_ETH_FLOW_PORT
},
12084 {"vxlan", RTE_ETH_FLOW_VXLAN
},
12085 {"geneve", RTE_ETH_FLOW_GENEVE
},
12086 {"nvgre", RTE_ETH_FLOW_NVGRE
},
12087 {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE
},
12090 for (i
= 0; i
< RTE_DIM(ftype_table
); i
++) {
12091 if (ftype_table
[i
].ftype
== ftype
)
12092 return ftype_table
[i
].str
;
12099 cmd_get_hash_global_config_parsed(void *parsed_result
,
12100 __rte_unused
struct cmdline
*cl
,
12101 __rte_unused
void *data
)
12103 struct cmd_get_hash_global_config_result
*res
= parsed_result
;
12104 struct rte_eth_hash_filter_info info
;
12105 uint32_t idx
, offset
;
12110 if (rte_eth_dev_filter_supported(res
->port_id
,
12111 RTE_ETH_FILTER_HASH
) < 0) {
12112 printf("RTE_ETH_FILTER_HASH not supported on port %d\n",
12117 memset(&info
, 0, sizeof(info
));
12118 info
.info_type
= RTE_ETH_HASH_FILTER_GLOBAL_CONFIG
;
12119 ret
= rte_eth_dev_filter_ctrl(res
->port_id
, RTE_ETH_FILTER_HASH
,
12120 RTE_ETH_FILTER_GET
, &info
);
12122 printf("Cannot get hash global configurations by port %d\n",
12127 switch (info
.info
.global_conf
.hash_func
) {
12128 case RTE_ETH_HASH_FUNCTION_TOEPLITZ
:
12129 printf("Hash function is Toeplitz\n");
12131 case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR
:
12132 printf("Hash function is Simple XOR\n");
12135 printf("Unknown hash function\n");
12139 for (i
= 0; i
< RTE_ETH_FLOW_MAX
; i
++) {
12140 idx
= i
/ UINT64_BIT
;
12141 offset
= i
% UINT64_BIT
;
12142 if (!(info
.info
.global_conf
.valid_bit_mask
[idx
] &
12145 str
= flowtype_to_str(i
);
12148 printf("Symmetric hash is %s globally for flow type %s "
12150 ((info
.info
.global_conf
.sym_hash_enable_mask
[idx
] &
12151 (1ULL << offset
)) ? "enabled" : "disabled"), str
,
12156 cmdline_parse_token_string_t cmd_get_hash_global_config_all
=
12157 TOKEN_STRING_INITIALIZER(struct cmd_get_hash_global_config_result
,
12158 get_hash_global_config
, "get_hash_global_config");
12159 cmdline_parse_token_num_t cmd_get_hash_global_config_port_id
=
12160 TOKEN_NUM_INITIALIZER(struct cmd_get_hash_global_config_result
,
12163 cmdline_parse_inst_t cmd_get_hash_global_config
= {
12164 .f
= cmd_get_hash_global_config_parsed
,
12166 .help_str
= "get_hash_global_config <port_id>",
12168 (void *)&cmd_get_hash_global_config_all
,
12169 (void *)&cmd_get_hash_global_config_port_id
,
12174 /* Set global config of hash function */
12175 struct cmd_set_hash_global_config_result
{
12176 cmdline_fixed_string_t set_hash_global_config
;
12178 cmdline_fixed_string_t hash_func
;
12179 cmdline_fixed_string_t flow_type
;
12180 cmdline_fixed_string_t enable
;
12184 cmd_set_hash_global_config_parsed(void *parsed_result
,
12185 __rte_unused
struct cmdline
*cl
,
12186 __rte_unused
void *data
)
12188 struct cmd_set_hash_global_config_result
*res
= parsed_result
;
12189 struct rte_eth_hash_filter_info info
;
12190 uint32_t ftype
, idx
, offset
;
12193 if (rte_eth_dev_filter_supported(res
->port_id
,
12194 RTE_ETH_FILTER_HASH
) < 0) {
12195 printf("RTE_ETH_FILTER_HASH not supported on port %d\n",
12199 memset(&info
, 0, sizeof(info
));
12200 info
.info_type
= RTE_ETH_HASH_FILTER_GLOBAL_CONFIG
;
12201 if (!strcmp(res
->hash_func
, "toeplitz"))
12202 info
.info
.global_conf
.hash_func
=
12203 RTE_ETH_HASH_FUNCTION_TOEPLITZ
;
12204 else if (!strcmp(res
->hash_func
, "simple_xor"))
12205 info
.info
.global_conf
.hash_func
=
12206 RTE_ETH_HASH_FUNCTION_SIMPLE_XOR
;
12207 else if (!strcmp(res
->hash_func
, "default"))
12208 info
.info
.global_conf
.hash_func
=
12209 RTE_ETH_HASH_FUNCTION_DEFAULT
;
12211 ftype
= str2flowtype(res
->flow_type
);
12212 idx
= ftype
/ UINT64_BIT
;
12213 offset
= ftype
% UINT64_BIT
;
12214 info
.info
.global_conf
.valid_bit_mask
[idx
] |= (1ULL << offset
);
12215 if (!strcmp(res
->enable
, "enable"))
12216 info
.info
.global_conf
.sym_hash_enable_mask
[idx
] |=
12218 ret
= rte_eth_dev_filter_ctrl(res
->port_id
, RTE_ETH_FILTER_HASH
,
12219 RTE_ETH_FILTER_SET
, &info
);
12221 printf("Cannot set global hash configurations by port %d\n",
12224 printf("Global hash configurations have been set "
12225 "successfully by port %d\n", res
->port_id
);
12228 cmdline_parse_token_string_t cmd_set_hash_global_config_all
=
12229 TOKEN_STRING_INITIALIZER(struct cmd_set_hash_global_config_result
,
12230 set_hash_global_config
, "set_hash_global_config");
12231 cmdline_parse_token_num_t cmd_set_hash_global_config_port_id
=
12232 TOKEN_NUM_INITIALIZER(struct cmd_set_hash_global_config_result
,
12234 cmdline_parse_token_string_t cmd_set_hash_global_config_hash_func
=
12235 TOKEN_STRING_INITIALIZER(struct cmd_set_hash_global_config_result
,
12236 hash_func
, "toeplitz#simple_xor#default");
12237 cmdline_parse_token_string_t cmd_set_hash_global_config_flow_type
=
12238 TOKEN_STRING_INITIALIZER(struct cmd_set_hash_global_config_result
,
12240 "ipv4#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#ipv4-other#ipv6#"
12241 "ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#ipv6-other#l2_payload");
12242 cmdline_parse_token_string_t cmd_set_hash_global_config_enable
=
12243 TOKEN_STRING_INITIALIZER(struct cmd_set_hash_global_config_result
,
12244 enable
, "enable#disable");
12246 cmdline_parse_inst_t cmd_set_hash_global_config
= {
12247 .f
= cmd_set_hash_global_config_parsed
,
12249 .help_str
= "set_hash_global_config <port_id> "
12250 "toeplitz|simple_xor|default "
12251 "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
12252 "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|"
12253 "l2_payload enable|disable",
12255 (void *)&cmd_set_hash_global_config_all
,
12256 (void *)&cmd_set_hash_global_config_port_id
,
12257 (void *)&cmd_set_hash_global_config_hash_func
,
12258 (void *)&cmd_set_hash_global_config_flow_type
,
12259 (void *)&cmd_set_hash_global_config_enable
,
12264 /* Set hash input set */
12265 struct cmd_set_hash_input_set_result
{
12266 cmdline_fixed_string_t set_hash_input_set
;
12268 cmdline_fixed_string_t flow_type
;
12269 cmdline_fixed_string_t inset_field
;
12270 cmdline_fixed_string_t select
;
12273 static enum rte_eth_input_set_field
12274 str2inset(char *string
)
12278 static const struct {
12280 enum rte_eth_input_set_field inset
;
12281 } inset_table
[] = {
12282 {"ethertype", RTE_ETH_INPUT_SET_L2_ETHERTYPE
},
12283 {"ovlan", RTE_ETH_INPUT_SET_L2_OUTER_VLAN
},
12284 {"ivlan", RTE_ETH_INPUT_SET_L2_INNER_VLAN
},
12285 {"src-ipv4", RTE_ETH_INPUT_SET_L3_SRC_IP4
},
12286 {"dst-ipv4", RTE_ETH_INPUT_SET_L3_DST_IP4
},
12287 {"ipv4-tos", RTE_ETH_INPUT_SET_L3_IP4_TOS
},
12288 {"ipv4-proto", RTE_ETH_INPUT_SET_L3_IP4_PROTO
},
12289 {"ipv4-ttl", RTE_ETH_INPUT_SET_L3_IP4_TTL
},
12290 {"src-ipv6", RTE_ETH_INPUT_SET_L3_SRC_IP6
},
12291 {"dst-ipv6", RTE_ETH_INPUT_SET_L3_DST_IP6
},
12292 {"ipv6-tc", RTE_ETH_INPUT_SET_L3_IP6_TC
},
12293 {"ipv6-next-header", RTE_ETH_INPUT_SET_L3_IP6_NEXT_HEADER
},
12294 {"ipv6-hop-limits", RTE_ETH_INPUT_SET_L3_IP6_HOP_LIMITS
},
12295 {"udp-src-port", RTE_ETH_INPUT_SET_L4_UDP_SRC_PORT
},
12296 {"udp-dst-port", RTE_ETH_INPUT_SET_L4_UDP_DST_PORT
},
12297 {"tcp-src-port", RTE_ETH_INPUT_SET_L4_TCP_SRC_PORT
},
12298 {"tcp-dst-port", RTE_ETH_INPUT_SET_L4_TCP_DST_PORT
},
12299 {"sctp-src-port", RTE_ETH_INPUT_SET_L4_SCTP_SRC_PORT
},
12300 {"sctp-dst-port", RTE_ETH_INPUT_SET_L4_SCTP_DST_PORT
},
12301 {"sctp-veri-tag", RTE_ETH_INPUT_SET_L4_SCTP_VERIFICATION_TAG
},
12302 {"udp-key", RTE_ETH_INPUT_SET_TUNNEL_L4_UDP_KEY
},
12303 {"gre-key", RTE_ETH_INPUT_SET_TUNNEL_GRE_KEY
},
12304 {"fld-1st", RTE_ETH_INPUT_SET_FLEX_PAYLOAD_1ST_WORD
},
12305 {"fld-2nd", RTE_ETH_INPUT_SET_FLEX_PAYLOAD_2ND_WORD
},
12306 {"fld-3rd", RTE_ETH_INPUT_SET_FLEX_PAYLOAD_3RD_WORD
},
12307 {"fld-4th", RTE_ETH_INPUT_SET_FLEX_PAYLOAD_4TH_WORD
},
12308 {"fld-5th", RTE_ETH_INPUT_SET_FLEX_PAYLOAD_5TH_WORD
},
12309 {"fld-6th", RTE_ETH_INPUT_SET_FLEX_PAYLOAD_6TH_WORD
},
12310 {"fld-7th", RTE_ETH_INPUT_SET_FLEX_PAYLOAD_7TH_WORD
},
12311 {"fld-8th", RTE_ETH_INPUT_SET_FLEX_PAYLOAD_8TH_WORD
},
12312 {"none", RTE_ETH_INPUT_SET_NONE
},
12315 for (i
= 0; i
< RTE_DIM(inset_table
); i
++) {
12316 if (!strcmp(string
, inset_table
[i
].str
))
12317 return inset_table
[i
].inset
;
12320 return RTE_ETH_INPUT_SET_UNKNOWN
;
12324 cmd_set_hash_input_set_parsed(void *parsed_result
,
12325 __rte_unused
struct cmdline
*cl
,
12326 __rte_unused
void *data
)
12328 struct cmd_set_hash_input_set_result
*res
= parsed_result
;
12329 struct rte_eth_hash_filter_info info
;
12331 memset(&info
, 0, sizeof(info
));
12332 info
.info_type
= RTE_ETH_HASH_FILTER_INPUT_SET_SELECT
;
12333 info
.info
.input_set_conf
.flow_type
= str2flowtype(res
->flow_type
);
12334 info
.info
.input_set_conf
.field
[0] = str2inset(res
->inset_field
);
12335 info
.info
.input_set_conf
.inset_size
= 1;
12336 if (!strcmp(res
->select
, "select"))
12337 info
.info
.input_set_conf
.op
= RTE_ETH_INPUT_SET_SELECT
;
12338 else if (!strcmp(res
->select
, "add"))
12339 info
.info
.input_set_conf
.op
= RTE_ETH_INPUT_SET_ADD
;
12340 rte_eth_dev_filter_ctrl(res
->port_id
, RTE_ETH_FILTER_HASH
,
12341 RTE_ETH_FILTER_SET
, &info
);
12344 cmdline_parse_token_string_t cmd_set_hash_input_set_cmd
=
12345 TOKEN_STRING_INITIALIZER(struct cmd_set_hash_input_set_result
,
12346 set_hash_input_set
, "set_hash_input_set");
12347 cmdline_parse_token_num_t cmd_set_hash_input_set_port_id
=
12348 TOKEN_NUM_INITIALIZER(struct cmd_set_hash_input_set_result
,
12350 cmdline_parse_token_string_t cmd_set_hash_input_set_flow_type
=
12351 TOKEN_STRING_INITIALIZER(struct cmd_set_hash_input_set_result
,
12353 cmdline_parse_token_string_t cmd_set_hash_input_set_field
=
12354 TOKEN_STRING_INITIALIZER(struct cmd_set_hash_input_set_result
,
12356 "ovlan#ivlan#src-ipv4#dst-ipv4#src-ipv6#dst-ipv6#"
12357 "ipv4-tos#ipv4-proto#ipv6-tc#ipv6-next-header#udp-src-port#"
12358 "udp-dst-port#tcp-src-port#tcp-dst-port#sctp-src-port#"
12359 "sctp-dst-port#sctp-veri-tag#udp-key#gre-key#fld-1st#"
12360 "fld-2nd#fld-3rd#fld-4th#fld-5th#fld-6th#fld-7th#"
12362 cmdline_parse_token_string_t cmd_set_hash_input_set_select
=
12363 TOKEN_STRING_INITIALIZER(struct cmd_set_hash_input_set_result
,
12364 select
, "select#add");
12366 cmdline_parse_inst_t cmd_set_hash_input_set
= {
12367 .f
= cmd_set_hash_input_set_parsed
,
12369 .help_str
= "set_hash_input_set <port_id> "
12370 "ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
12371 "ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload|<flowtype_id> "
12372 "ovlan|ivlan|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6|ipv4-tos|ipv4-proto|"
12373 "ipv6-tc|ipv6-next-header|udp-src-port|udp-dst-port|tcp-src-port|"
12374 "tcp-dst-port|sctp-src-port|sctp-dst-port|sctp-veri-tag|udp-key|"
12375 "gre-key|fld-1st|fld-2nd|fld-3rd|fld-4th|fld-5th|fld-6th|"
12376 "fld-7th|fld-8th|none select|add",
12378 (void *)&cmd_set_hash_input_set_cmd
,
12379 (void *)&cmd_set_hash_input_set_port_id
,
12380 (void *)&cmd_set_hash_input_set_flow_type
,
12381 (void *)&cmd_set_hash_input_set_field
,
12382 (void *)&cmd_set_hash_input_set_select
,
12387 /* Set flow director input set */
12388 struct cmd_set_fdir_input_set_result
{
12389 cmdline_fixed_string_t set_fdir_input_set
;
12391 cmdline_fixed_string_t flow_type
;
12392 cmdline_fixed_string_t inset_field
;
12393 cmdline_fixed_string_t select
;
12397 cmd_set_fdir_input_set_parsed(void *parsed_result
,
12398 __rte_unused
struct cmdline
*cl
,
12399 __rte_unused
void *data
)
12401 struct cmd_set_fdir_input_set_result
*res
= parsed_result
;
12402 struct rte_eth_fdir_filter_info info
;
12404 memset(&info
, 0, sizeof(info
));
12405 info
.info_type
= RTE_ETH_FDIR_FILTER_INPUT_SET_SELECT
;
12406 info
.info
.input_set_conf
.flow_type
= str2flowtype(res
->flow_type
);
12407 info
.info
.input_set_conf
.field
[0] = str2inset(res
->inset_field
);
12408 info
.info
.input_set_conf
.inset_size
= 1;
12409 if (!strcmp(res
->select
, "select"))
12410 info
.info
.input_set_conf
.op
= RTE_ETH_INPUT_SET_SELECT
;
12411 else if (!strcmp(res
->select
, "add"))
12412 info
.info
.input_set_conf
.op
= RTE_ETH_INPUT_SET_ADD
;
12413 rte_eth_dev_filter_ctrl(res
->port_id
, RTE_ETH_FILTER_FDIR
,
12414 RTE_ETH_FILTER_SET
, &info
);
12417 cmdline_parse_token_string_t cmd_set_fdir_input_set_cmd
=
12418 TOKEN_STRING_INITIALIZER(struct cmd_set_fdir_input_set_result
,
12419 set_fdir_input_set
, "set_fdir_input_set");
12420 cmdline_parse_token_num_t cmd_set_fdir_input_set_port_id
=
12421 TOKEN_NUM_INITIALIZER(struct cmd_set_fdir_input_set_result
,
12423 cmdline_parse_token_string_t cmd_set_fdir_input_set_flow_type
=
12424 TOKEN_STRING_INITIALIZER(struct cmd_set_fdir_input_set_result
,
12426 "ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#ipv4-other#"
12427 "ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#ipv6-other#l2_payload");
12428 cmdline_parse_token_string_t cmd_set_fdir_input_set_field
=
12429 TOKEN_STRING_INITIALIZER(struct cmd_set_fdir_input_set_result
,
12431 "ivlan#ethertype#src-ipv4#dst-ipv4#src-ipv6#dst-ipv6#"
12432 "ipv4-tos#ipv4-proto#ipv4-ttl#ipv6-tc#ipv6-next-header#"
12433 "ipv6-hop-limits#udp-src-port#udp-dst-port#"
12434 "tcp-src-port#tcp-dst-port#sctp-src-port#sctp-dst-port#"
12435 "sctp-veri-tag#none");
12436 cmdline_parse_token_string_t cmd_set_fdir_input_set_select
=
12437 TOKEN_STRING_INITIALIZER(struct cmd_set_fdir_input_set_result
,
12438 select
, "select#add");
12440 cmdline_parse_inst_t cmd_set_fdir_input_set
= {
12441 .f
= cmd_set_fdir_input_set_parsed
,
12443 .help_str
= "set_fdir_input_set <port_id> "
12444 "ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
12445 "ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload "
12446 "ivlan|ethertype|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6|"
12447 "ipv4-tos|ipv4-proto|ipv4-ttl|ipv6-tc|ipv6-next-header|"
12448 "ipv6-hop-limits|udp-src-port|udp-dst-port|"
12449 "tcp-src-port|tcp-dst-port|sctp-src-port|sctp-dst-port|"
12450 "sctp-veri-tag|none select|add",
12452 (void *)&cmd_set_fdir_input_set_cmd
,
12453 (void *)&cmd_set_fdir_input_set_port_id
,
12454 (void *)&cmd_set_fdir_input_set_flow_type
,
12455 (void *)&cmd_set_fdir_input_set_field
,
12456 (void *)&cmd_set_fdir_input_set_select
,
12461 /* *** ADD/REMOVE A MULTICAST MAC ADDRESS TO/FROM A PORT *** */
12462 struct cmd_mcast_addr_result
{
12463 cmdline_fixed_string_t mcast_addr_cmd
;
12464 cmdline_fixed_string_t what
;
12466 struct ether_addr mc_addr
;
12469 static void cmd_mcast_addr_parsed(void *parsed_result
,
12470 __attribute__((unused
)) struct cmdline
*cl
,
12471 __attribute__((unused
)) void *data
)
12473 struct cmd_mcast_addr_result
*res
= parsed_result
;
12475 if (!is_multicast_ether_addr(&res
->mc_addr
)) {
12476 printf("Invalid multicast addr %02X:%02X:%02X:%02X:%02X:%02X\n",
12477 res
->mc_addr
.addr_bytes
[0], res
->mc_addr
.addr_bytes
[1],
12478 res
->mc_addr
.addr_bytes
[2], res
->mc_addr
.addr_bytes
[3],
12479 res
->mc_addr
.addr_bytes
[4], res
->mc_addr
.addr_bytes
[5]);
12482 if (strcmp(res
->what
, "add") == 0)
12483 mcast_addr_add(res
->port_num
, &res
->mc_addr
);
12485 mcast_addr_remove(res
->port_num
, &res
->mc_addr
);
12488 cmdline_parse_token_string_t cmd_mcast_addr_cmd
=
12489 TOKEN_STRING_INITIALIZER(struct cmd_mcast_addr_result
,
12490 mcast_addr_cmd
, "mcast_addr");
12491 cmdline_parse_token_string_t cmd_mcast_addr_what
=
12492 TOKEN_STRING_INITIALIZER(struct cmd_mcast_addr_result
, what
,
12494 cmdline_parse_token_num_t cmd_mcast_addr_portnum
=
12495 TOKEN_NUM_INITIALIZER(struct cmd_mcast_addr_result
, port_num
, UINT16
);
12496 cmdline_parse_token_etheraddr_t cmd_mcast_addr_addr
=
12497 TOKEN_ETHERADDR_INITIALIZER(struct cmd_mac_addr_result
, address
);
12499 cmdline_parse_inst_t cmd_mcast_addr
= {
12500 .f
= cmd_mcast_addr_parsed
,
12502 .help_str
= "mcast_addr add|remove <port_id> <mcast_addr>: "
12503 "Add/Remove multicast MAC address on port_id",
12505 (void *)&cmd_mcast_addr_cmd
,
12506 (void *)&cmd_mcast_addr_what
,
12507 (void *)&cmd_mcast_addr_portnum
,
12508 (void *)&cmd_mcast_addr_addr
,
12513 /* l2 tunnel config
12514 * only support E-tag now.
12517 /* Ether type config */
12518 struct cmd_config_l2_tunnel_eth_type_result
{
12519 cmdline_fixed_string_t port
;
12520 cmdline_fixed_string_t config
;
12521 cmdline_fixed_string_t all
;
12523 cmdline_fixed_string_t l2_tunnel
;
12524 cmdline_fixed_string_t l2_tunnel_type
;
12525 cmdline_fixed_string_t eth_type
;
12526 uint16_t eth_type_val
;
12529 cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_port
=
12530 TOKEN_STRING_INITIALIZER
12531 (struct cmd_config_l2_tunnel_eth_type_result
,
12533 cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_config
=
12534 TOKEN_STRING_INITIALIZER
12535 (struct cmd_config_l2_tunnel_eth_type_result
,
12537 cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_all_str
=
12538 TOKEN_STRING_INITIALIZER
12539 (struct cmd_config_l2_tunnel_eth_type_result
,
12541 cmdline_parse_token_num_t cmd_config_l2_tunnel_eth_type_id
=
12542 TOKEN_NUM_INITIALIZER
12543 (struct cmd_config_l2_tunnel_eth_type_result
,
12545 cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_l2_tunnel
=
12546 TOKEN_STRING_INITIALIZER
12547 (struct cmd_config_l2_tunnel_eth_type_result
,
12548 l2_tunnel
, "l2-tunnel");
12549 cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_l2_tunnel_type
=
12550 TOKEN_STRING_INITIALIZER
12551 (struct cmd_config_l2_tunnel_eth_type_result
,
12552 l2_tunnel_type
, "E-tag");
12553 cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_eth_type
=
12554 TOKEN_STRING_INITIALIZER
12555 (struct cmd_config_l2_tunnel_eth_type_result
,
12556 eth_type
, "ether-type");
12557 cmdline_parse_token_num_t cmd_config_l2_tunnel_eth_type_eth_type_val
=
12558 TOKEN_NUM_INITIALIZER
12559 (struct cmd_config_l2_tunnel_eth_type_result
,
12560 eth_type_val
, UINT16
);
12562 static enum rte_eth_tunnel_type
12563 str2fdir_l2_tunnel_type(char *string
)
12567 static const struct {
12569 enum rte_eth_tunnel_type type
;
12570 } l2_tunnel_type_str
[] = {
12571 {"E-tag", RTE_L2_TUNNEL_TYPE_E_TAG
},
12574 for (i
= 0; i
< RTE_DIM(l2_tunnel_type_str
); i
++) {
12575 if (!strcmp(l2_tunnel_type_str
[i
].str
, string
))
12576 return l2_tunnel_type_str
[i
].type
;
12578 return RTE_TUNNEL_TYPE_NONE
;
12581 /* ether type config for all ports */
12583 cmd_config_l2_tunnel_eth_type_all_parsed
12584 (void *parsed_result
,
12585 __attribute__((unused
)) struct cmdline
*cl
,
12586 __attribute__((unused
)) void *data
)
12588 struct cmd_config_l2_tunnel_eth_type_result
*res
= parsed_result
;
12589 struct rte_eth_l2_tunnel_conf entry
;
12592 entry
.l2_tunnel_type
= str2fdir_l2_tunnel_type(res
->l2_tunnel_type
);
12593 entry
.ether_type
= res
->eth_type_val
;
12595 RTE_ETH_FOREACH_DEV(pid
) {
12596 rte_eth_dev_l2_tunnel_eth_type_conf(pid
, &entry
);
12600 cmdline_parse_inst_t cmd_config_l2_tunnel_eth_type_all
= {
12601 .f
= cmd_config_l2_tunnel_eth_type_all_parsed
,
12603 .help_str
= "port config all l2-tunnel E-tag ether-type <value>",
12605 (void *)&cmd_config_l2_tunnel_eth_type_port
,
12606 (void *)&cmd_config_l2_tunnel_eth_type_config
,
12607 (void *)&cmd_config_l2_tunnel_eth_type_all_str
,
12608 (void *)&cmd_config_l2_tunnel_eth_type_l2_tunnel
,
12609 (void *)&cmd_config_l2_tunnel_eth_type_l2_tunnel_type
,
12610 (void *)&cmd_config_l2_tunnel_eth_type_eth_type
,
12611 (void *)&cmd_config_l2_tunnel_eth_type_eth_type_val
,
12616 /* ether type config for a specific port */
12618 cmd_config_l2_tunnel_eth_type_specific_parsed(
12619 void *parsed_result
,
12620 __attribute__((unused
)) struct cmdline
*cl
,
12621 __attribute__((unused
)) void *data
)
12623 struct cmd_config_l2_tunnel_eth_type_result
*res
=
12625 struct rte_eth_l2_tunnel_conf entry
;
12627 if (port_id_is_invalid(res
->id
, ENABLED_WARN
))
12630 entry
.l2_tunnel_type
= str2fdir_l2_tunnel_type(res
->l2_tunnel_type
);
12631 entry
.ether_type
= res
->eth_type_val
;
12633 rte_eth_dev_l2_tunnel_eth_type_conf(res
->id
, &entry
);
12636 cmdline_parse_inst_t cmd_config_l2_tunnel_eth_type_specific
= {
12637 .f
= cmd_config_l2_tunnel_eth_type_specific_parsed
,
12639 .help_str
= "port config <port_id> l2-tunnel E-tag ether-type <value>",
12641 (void *)&cmd_config_l2_tunnel_eth_type_port
,
12642 (void *)&cmd_config_l2_tunnel_eth_type_config
,
12643 (void *)&cmd_config_l2_tunnel_eth_type_id
,
12644 (void *)&cmd_config_l2_tunnel_eth_type_l2_tunnel
,
12645 (void *)&cmd_config_l2_tunnel_eth_type_l2_tunnel_type
,
12646 (void *)&cmd_config_l2_tunnel_eth_type_eth_type
,
12647 (void *)&cmd_config_l2_tunnel_eth_type_eth_type_val
,
12652 /* Enable/disable l2 tunnel */
12653 struct cmd_config_l2_tunnel_en_dis_result
{
12654 cmdline_fixed_string_t port
;
12655 cmdline_fixed_string_t config
;
12656 cmdline_fixed_string_t all
;
12658 cmdline_fixed_string_t l2_tunnel
;
12659 cmdline_fixed_string_t l2_tunnel_type
;
12660 cmdline_fixed_string_t en_dis
;
12663 cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_port
=
12664 TOKEN_STRING_INITIALIZER
12665 (struct cmd_config_l2_tunnel_en_dis_result
,
12667 cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_config
=
12668 TOKEN_STRING_INITIALIZER
12669 (struct cmd_config_l2_tunnel_en_dis_result
,
12671 cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_all_str
=
12672 TOKEN_STRING_INITIALIZER
12673 (struct cmd_config_l2_tunnel_en_dis_result
,
12675 cmdline_parse_token_num_t cmd_config_l2_tunnel_en_dis_id
=
12676 TOKEN_NUM_INITIALIZER
12677 (struct cmd_config_l2_tunnel_en_dis_result
,
12679 cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_l2_tunnel
=
12680 TOKEN_STRING_INITIALIZER
12681 (struct cmd_config_l2_tunnel_en_dis_result
,
12682 l2_tunnel
, "l2-tunnel");
12683 cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_l2_tunnel_type
=
12684 TOKEN_STRING_INITIALIZER
12685 (struct cmd_config_l2_tunnel_en_dis_result
,
12686 l2_tunnel_type
, "E-tag");
12687 cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_en_dis
=
12688 TOKEN_STRING_INITIALIZER
12689 (struct cmd_config_l2_tunnel_en_dis_result
,
12690 en_dis
, "enable#disable");
12692 /* enable/disable l2 tunnel for all ports */
12694 cmd_config_l2_tunnel_en_dis_all_parsed(
12695 void *parsed_result
,
12696 __attribute__((unused
)) struct cmdline
*cl
,
12697 __attribute__((unused
)) void *data
)
12699 struct cmd_config_l2_tunnel_en_dis_result
*res
= parsed_result
;
12700 struct rte_eth_l2_tunnel_conf entry
;
12704 entry
.l2_tunnel_type
= str2fdir_l2_tunnel_type(res
->l2_tunnel_type
);
12706 if (!strcmp("enable", res
->en_dis
))
12711 RTE_ETH_FOREACH_DEV(pid
) {
12712 rte_eth_dev_l2_tunnel_offload_set(pid
,
12714 ETH_L2_TUNNEL_ENABLE_MASK
,
12719 cmdline_parse_inst_t cmd_config_l2_tunnel_en_dis_all
= {
12720 .f
= cmd_config_l2_tunnel_en_dis_all_parsed
,
12722 .help_str
= "port config all l2-tunnel E-tag enable|disable",
12724 (void *)&cmd_config_l2_tunnel_en_dis_port
,
12725 (void *)&cmd_config_l2_tunnel_en_dis_config
,
12726 (void *)&cmd_config_l2_tunnel_en_dis_all_str
,
12727 (void *)&cmd_config_l2_tunnel_en_dis_l2_tunnel
,
12728 (void *)&cmd_config_l2_tunnel_en_dis_l2_tunnel_type
,
12729 (void *)&cmd_config_l2_tunnel_en_dis_en_dis
,
12734 /* enable/disable l2 tunnel for a port */
12736 cmd_config_l2_tunnel_en_dis_specific_parsed(
12737 void *parsed_result
,
12738 __attribute__((unused
)) struct cmdline
*cl
,
12739 __attribute__((unused
)) void *data
)
12741 struct cmd_config_l2_tunnel_en_dis_result
*res
=
12743 struct rte_eth_l2_tunnel_conf entry
;
12745 if (port_id_is_invalid(res
->id
, ENABLED_WARN
))
12748 entry
.l2_tunnel_type
= str2fdir_l2_tunnel_type(res
->l2_tunnel_type
);
12750 if (!strcmp("enable", res
->en_dis
))
12751 rte_eth_dev_l2_tunnel_offload_set(res
->id
,
12753 ETH_L2_TUNNEL_ENABLE_MASK
,
12756 rte_eth_dev_l2_tunnel_offload_set(res
->id
,
12758 ETH_L2_TUNNEL_ENABLE_MASK
,
12762 cmdline_parse_inst_t cmd_config_l2_tunnel_en_dis_specific
= {
12763 .f
= cmd_config_l2_tunnel_en_dis_specific_parsed
,
12765 .help_str
= "port config <port_id> l2-tunnel E-tag enable|disable",
12767 (void *)&cmd_config_l2_tunnel_en_dis_port
,
12768 (void *)&cmd_config_l2_tunnel_en_dis_config
,
12769 (void *)&cmd_config_l2_tunnel_en_dis_id
,
12770 (void *)&cmd_config_l2_tunnel_en_dis_l2_tunnel
,
12771 (void *)&cmd_config_l2_tunnel_en_dis_l2_tunnel_type
,
12772 (void *)&cmd_config_l2_tunnel_en_dis_en_dis
,
12777 /* E-tag configuration */
12779 /* Common result structure for all E-tag configuration */
12780 struct cmd_config_e_tag_result
{
12781 cmdline_fixed_string_t e_tag
;
12782 cmdline_fixed_string_t set
;
12783 cmdline_fixed_string_t insertion
;
12784 cmdline_fixed_string_t stripping
;
12785 cmdline_fixed_string_t forwarding
;
12786 cmdline_fixed_string_t filter
;
12787 cmdline_fixed_string_t add
;
12788 cmdline_fixed_string_t del
;
12789 cmdline_fixed_string_t on
;
12790 cmdline_fixed_string_t off
;
12791 cmdline_fixed_string_t on_off
;
12792 cmdline_fixed_string_t port_tag_id
;
12793 uint32_t port_tag_id_val
;
12794 cmdline_fixed_string_t e_tag_id
;
12795 uint16_t e_tag_id_val
;
12796 cmdline_fixed_string_t dst_pool
;
12797 uint8_t dst_pool_val
;
12798 cmdline_fixed_string_t port
;
12800 cmdline_fixed_string_t vf
;
12804 /* Common CLI fields for all E-tag configuration */
12805 cmdline_parse_token_string_t cmd_config_e_tag_e_tag
=
12806 TOKEN_STRING_INITIALIZER
12807 (struct cmd_config_e_tag_result
,
12809 cmdline_parse_token_string_t cmd_config_e_tag_set
=
12810 TOKEN_STRING_INITIALIZER
12811 (struct cmd_config_e_tag_result
,
12813 cmdline_parse_token_string_t cmd_config_e_tag_insertion
=
12814 TOKEN_STRING_INITIALIZER
12815 (struct cmd_config_e_tag_result
,
12816 insertion
, "insertion");
12817 cmdline_parse_token_string_t cmd_config_e_tag_stripping
=
12818 TOKEN_STRING_INITIALIZER
12819 (struct cmd_config_e_tag_result
,
12820 stripping
, "stripping");
12821 cmdline_parse_token_string_t cmd_config_e_tag_forwarding
=
12822 TOKEN_STRING_INITIALIZER
12823 (struct cmd_config_e_tag_result
,
12824 forwarding
, "forwarding");
12825 cmdline_parse_token_string_t cmd_config_e_tag_filter
=
12826 TOKEN_STRING_INITIALIZER
12827 (struct cmd_config_e_tag_result
,
12829 cmdline_parse_token_string_t cmd_config_e_tag_add
=
12830 TOKEN_STRING_INITIALIZER
12831 (struct cmd_config_e_tag_result
,
12833 cmdline_parse_token_string_t cmd_config_e_tag_del
=
12834 TOKEN_STRING_INITIALIZER
12835 (struct cmd_config_e_tag_result
,
12837 cmdline_parse_token_string_t cmd_config_e_tag_on
=
12838 TOKEN_STRING_INITIALIZER
12839 (struct cmd_config_e_tag_result
,
12841 cmdline_parse_token_string_t cmd_config_e_tag_off
=
12842 TOKEN_STRING_INITIALIZER
12843 (struct cmd_config_e_tag_result
,
12845 cmdline_parse_token_string_t cmd_config_e_tag_on_off
=
12846 TOKEN_STRING_INITIALIZER
12847 (struct cmd_config_e_tag_result
,
12849 cmdline_parse_token_string_t cmd_config_e_tag_port_tag_id
=
12850 TOKEN_STRING_INITIALIZER
12851 (struct cmd_config_e_tag_result
,
12852 port_tag_id
, "port-tag-id");
12853 cmdline_parse_token_num_t cmd_config_e_tag_port_tag_id_val
=
12854 TOKEN_NUM_INITIALIZER
12855 (struct cmd_config_e_tag_result
,
12856 port_tag_id_val
, UINT32
);
12857 cmdline_parse_token_string_t cmd_config_e_tag_e_tag_id
=
12858 TOKEN_STRING_INITIALIZER
12859 (struct cmd_config_e_tag_result
,
12860 e_tag_id
, "e-tag-id");
12861 cmdline_parse_token_num_t cmd_config_e_tag_e_tag_id_val
=
12862 TOKEN_NUM_INITIALIZER
12863 (struct cmd_config_e_tag_result
,
12864 e_tag_id_val
, UINT16
);
12865 cmdline_parse_token_string_t cmd_config_e_tag_dst_pool
=
12866 TOKEN_STRING_INITIALIZER
12867 (struct cmd_config_e_tag_result
,
12868 dst_pool
, "dst-pool");
12869 cmdline_parse_token_num_t cmd_config_e_tag_dst_pool_val
=
12870 TOKEN_NUM_INITIALIZER
12871 (struct cmd_config_e_tag_result
,
12872 dst_pool_val
, UINT8
);
12873 cmdline_parse_token_string_t cmd_config_e_tag_port
=
12874 TOKEN_STRING_INITIALIZER
12875 (struct cmd_config_e_tag_result
,
12877 cmdline_parse_token_num_t cmd_config_e_tag_port_id
=
12878 TOKEN_NUM_INITIALIZER
12879 (struct cmd_config_e_tag_result
,
12881 cmdline_parse_token_string_t cmd_config_e_tag_vf
=
12882 TOKEN_STRING_INITIALIZER
12883 (struct cmd_config_e_tag_result
,
12885 cmdline_parse_token_num_t cmd_config_e_tag_vf_id
=
12886 TOKEN_NUM_INITIALIZER
12887 (struct cmd_config_e_tag_result
,
12890 /* E-tag insertion configuration */
12892 cmd_config_e_tag_insertion_en_parsed(
12893 void *parsed_result
,
12894 __attribute__((unused
)) struct cmdline
*cl
,
12895 __attribute__((unused
)) void *data
)
12897 struct cmd_config_e_tag_result
*res
=
12899 struct rte_eth_l2_tunnel_conf entry
;
12901 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
12904 entry
.l2_tunnel_type
= RTE_L2_TUNNEL_TYPE_E_TAG
;
12905 entry
.tunnel_id
= res
->port_tag_id_val
;
12906 entry
.vf_id
= res
->vf_id
;
12907 rte_eth_dev_l2_tunnel_offload_set(res
->port_id
,
12909 ETH_L2_TUNNEL_INSERTION_MASK
,
12914 cmd_config_e_tag_insertion_dis_parsed(
12915 void *parsed_result
,
12916 __attribute__((unused
)) struct cmdline
*cl
,
12917 __attribute__((unused
)) void *data
)
12919 struct cmd_config_e_tag_result
*res
=
12921 struct rte_eth_l2_tunnel_conf entry
;
12923 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
12926 entry
.l2_tunnel_type
= RTE_L2_TUNNEL_TYPE_E_TAG
;
12927 entry
.vf_id
= res
->vf_id
;
12929 rte_eth_dev_l2_tunnel_offload_set(res
->port_id
,
12931 ETH_L2_TUNNEL_INSERTION_MASK
,
12935 cmdline_parse_inst_t cmd_config_e_tag_insertion_en
= {
12936 .f
= cmd_config_e_tag_insertion_en_parsed
,
12938 .help_str
= "E-tag ... : E-tag insertion enable",
12940 (void *)&cmd_config_e_tag_e_tag
,
12941 (void *)&cmd_config_e_tag_set
,
12942 (void *)&cmd_config_e_tag_insertion
,
12943 (void *)&cmd_config_e_tag_on
,
12944 (void *)&cmd_config_e_tag_port_tag_id
,
12945 (void *)&cmd_config_e_tag_port_tag_id_val
,
12946 (void *)&cmd_config_e_tag_port
,
12947 (void *)&cmd_config_e_tag_port_id
,
12948 (void *)&cmd_config_e_tag_vf
,
12949 (void *)&cmd_config_e_tag_vf_id
,
12954 cmdline_parse_inst_t cmd_config_e_tag_insertion_dis
= {
12955 .f
= cmd_config_e_tag_insertion_dis_parsed
,
12957 .help_str
= "E-tag ... : E-tag insertion disable",
12959 (void *)&cmd_config_e_tag_e_tag
,
12960 (void *)&cmd_config_e_tag_set
,
12961 (void *)&cmd_config_e_tag_insertion
,
12962 (void *)&cmd_config_e_tag_off
,
12963 (void *)&cmd_config_e_tag_port
,
12964 (void *)&cmd_config_e_tag_port_id
,
12965 (void *)&cmd_config_e_tag_vf
,
12966 (void *)&cmd_config_e_tag_vf_id
,
12971 /* E-tag stripping configuration */
12973 cmd_config_e_tag_stripping_parsed(
12974 void *parsed_result
,
12975 __attribute__((unused
)) struct cmdline
*cl
,
12976 __attribute__((unused
)) void *data
)
12978 struct cmd_config_e_tag_result
*res
=
12980 struct rte_eth_l2_tunnel_conf entry
;
12982 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
12985 entry
.l2_tunnel_type
= RTE_L2_TUNNEL_TYPE_E_TAG
;
12987 if (!strcmp(res
->on_off
, "on"))
12988 rte_eth_dev_l2_tunnel_offload_set
12991 ETH_L2_TUNNEL_STRIPPING_MASK
,
12994 rte_eth_dev_l2_tunnel_offload_set
12997 ETH_L2_TUNNEL_STRIPPING_MASK
,
13001 cmdline_parse_inst_t cmd_config_e_tag_stripping_en_dis
= {
13002 .f
= cmd_config_e_tag_stripping_parsed
,
13004 .help_str
= "E-tag ... : E-tag stripping enable/disable",
13006 (void *)&cmd_config_e_tag_e_tag
,
13007 (void *)&cmd_config_e_tag_set
,
13008 (void *)&cmd_config_e_tag_stripping
,
13009 (void *)&cmd_config_e_tag_on_off
,
13010 (void *)&cmd_config_e_tag_port
,
13011 (void *)&cmd_config_e_tag_port_id
,
13016 /* E-tag forwarding configuration */
13018 cmd_config_e_tag_forwarding_parsed(
13019 void *parsed_result
,
13020 __attribute__((unused
)) struct cmdline
*cl
,
13021 __attribute__((unused
)) void *data
)
13023 struct cmd_config_e_tag_result
*res
= parsed_result
;
13024 struct rte_eth_l2_tunnel_conf entry
;
13026 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
13029 entry
.l2_tunnel_type
= RTE_L2_TUNNEL_TYPE_E_TAG
;
13031 if (!strcmp(res
->on_off
, "on"))
13032 rte_eth_dev_l2_tunnel_offload_set
13035 ETH_L2_TUNNEL_FORWARDING_MASK
,
13038 rte_eth_dev_l2_tunnel_offload_set
13041 ETH_L2_TUNNEL_FORWARDING_MASK
,
13045 cmdline_parse_inst_t cmd_config_e_tag_forwarding_en_dis
= {
13046 .f
= cmd_config_e_tag_forwarding_parsed
,
13048 .help_str
= "E-tag ... : E-tag forwarding enable/disable",
13050 (void *)&cmd_config_e_tag_e_tag
,
13051 (void *)&cmd_config_e_tag_set
,
13052 (void *)&cmd_config_e_tag_forwarding
,
13053 (void *)&cmd_config_e_tag_on_off
,
13054 (void *)&cmd_config_e_tag_port
,
13055 (void *)&cmd_config_e_tag_port_id
,
13060 /* E-tag filter configuration */
13062 cmd_config_e_tag_filter_add_parsed(
13063 void *parsed_result
,
13064 __attribute__((unused
)) struct cmdline
*cl
,
13065 __attribute__((unused
)) void *data
)
13067 struct cmd_config_e_tag_result
*res
= parsed_result
;
13068 struct rte_eth_l2_tunnel_conf entry
;
13071 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
13074 if (res
->e_tag_id_val
> 0x3fff) {
13075 printf("e-tag-id must be equal or less than 0x3fff.\n");
13079 ret
= rte_eth_dev_filter_supported(res
->port_id
,
13080 RTE_ETH_FILTER_L2_TUNNEL
);
13082 printf("E-tag filter is not supported on port %u.\n",
13087 entry
.l2_tunnel_type
= RTE_L2_TUNNEL_TYPE_E_TAG
;
13088 entry
.tunnel_id
= res
->e_tag_id_val
;
13089 entry
.pool
= res
->dst_pool_val
;
13091 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
13092 RTE_ETH_FILTER_L2_TUNNEL
,
13093 RTE_ETH_FILTER_ADD
,
13096 printf("E-tag filter programming error: (%s)\n",
13100 cmdline_parse_inst_t cmd_config_e_tag_filter_add
= {
13101 .f
= cmd_config_e_tag_filter_add_parsed
,
13103 .help_str
= "E-tag ... : E-tag filter add",
13105 (void *)&cmd_config_e_tag_e_tag
,
13106 (void *)&cmd_config_e_tag_set
,
13107 (void *)&cmd_config_e_tag_filter
,
13108 (void *)&cmd_config_e_tag_add
,
13109 (void *)&cmd_config_e_tag_e_tag_id
,
13110 (void *)&cmd_config_e_tag_e_tag_id_val
,
13111 (void *)&cmd_config_e_tag_dst_pool
,
13112 (void *)&cmd_config_e_tag_dst_pool_val
,
13113 (void *)&cmd_config_e_tag_port
,
13114 (void *)&cmd_config_e_tag_port_id
,
13120 cmd_config_e_tag_filter_del_parsed(
13121 void *parsed_result
,
13122 __attribute__((unused
)) struct cmdline
*cl
,
13123 __attribute__((unused
)) void *data
)
13125 struct cmd_config_e_tag_result
*res
= parsed_result
;
13126 struct rte_eth_l2_tunnel_conf entry
;
13129 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
13132 if (res
->e_tag_id_val
> 0x3fff) {
13133 printf("e-tag-id must be less than 0x3fff.\n");
13137 ret
= rte_eth_dev_filter_supported(res
->port_id
,
13138 RTE_ETH_FILTER_L2_TUNNEL
);
13140 printf("E-tag filter is not supported on port %u.\n",
13145 entry
.l2_tunnel_type
= RTE_L2_TUNNEL_TYPE_E_TAG
;
13146 entry
.tunnel_id
= res
->e_tag_id_val
;
13148 ret
= rte_eth_dev_filter_ctrl(res
->port_id
,
13149 RTE_ETH_FILTER_L2_TUNNEL
,
13150 RTE_ETH_FILTER_DELETE
,
13153 printf("E-tag filter programming error: (%s)\n",
13157 cmdline_parse_inst_t cmd_config_e_tag_filter_del
= {
13158 .f
= cmd_config_e_tag_filter_del_parsed
,
13160 .help_str
= "E-tag ... : E-tag filter delete",
13162 (void *)&cmd_config_e_tag_e_tag
,
13163 (void *)&cmd_config_e_tag_set
,
13164 (void *)&cmd_config_e_tag_filter
,
13165 (void *)&cmd_config_e_tag_del
,
13166 (void *)&cmd_config_e_tag_e_tag_id
,
13167 (void *)&cmd_config_e_tag_e_tag_id_val
,
13168 (void *)&cmd_config_e_tag_port
,
13169 (void *)&cmd_config_e_tag_port_id
,
13174 /* vf vlan anti spoof configuration */
13176 /* Common result structure for vf vlan anti spoof */
13177 struct cmd_vf_vlan_anti_spoof_result
{
13178 cmdline_fixed_string_t set
;
13179 cmdline_fixed_string_t vf
;
13180 cmdline_fixed_string_t vlan
;
13181 cmdline_fixed_string_t antispoof
;
13184 cmdline_fixed_string_t on_off
;
13187 /* Common CLI fields for vf vlan anti spoof enable disable */
13188 cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_set
=
13189 TOKEN_STRING_INITIALIZER
13190 (struct cmd_vf_vlan_anti_spoof_result
,
13192 cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vf
=
13193 TOKEN_STRING_INITIALIZER
13194 (struct cmd_vf_vlan_anti_spoof_result
,
13196 cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vlan
=
13197 TOKEN_STRING_INITIALIZER
13198 (struct cmd_vf_vlan_anti_spoof_result
,
13200 cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_antispoof
=
13201 TOKEN_STRING_INITIALIZER
13202 (struct cmd_vf_vlan_anti_spoof_result
,
13203 antispoof
, "antispoof");
13204 cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_port_id
=
13205 TOKEN_NUM_INITIALIZER
13206 (struct cmd_vf_vlan_anti_spoof_result
,
13208 cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_vf_id
=
13209 TOKEN_NUM_INITIALIZER
13210 (struct cmd_vf_vlan_anti_spoof_result
,
13212 cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_on_off
=
13213 TOKEN_STRING_INITIALIZER
13214 (struct cmd_vf_vlan_anti_spoof_result
,
13218 cmd_set_vf_vlan_anti_spoof_parsed(
13219 void *parsed_result
,
13220 __attribute__((unused
)) struct cmdline
*cl
,
13221 __attribute__((unused
)) void *data
)
13223 struct cmd_vf_vlan_anti_spoof_result
*res
= parsed_result
;
13224 int ret
= -ENOTSUP
;
13226 __rte_unused
int is_on
= (strcmp(res
->on_off
, "on") == 0) ? 1 : 0;
13228 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
13231 #ifdef RTE_LIBRTE_IXGBE_PMD
13232 if (ret
== -ENOTSUP
)
13233 ret
= rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res
->port_id
,
13234 res
->vf_id
, is_on
);
13236 #ifdef RTE_LIBRTE_I40E_PMD
13237 if (ret
== -ENOTSUP
)
13238 ret
= rte_pmd_i40e_set_vf_vlan_anti_spoof(res
->port_id
,
13239 res
->vf_id
, is_on
);
13241 #ifdef RTE_LIBRTE_BNXT_PMD
13242 if (ret
== -ENOTSUP
)
13243 ret
= rte_pmd_bnxt_set_vf_vlan_anti_spoof(res
->port_id
,
13244 res
->vf_id
, is_on
);
13251 printf("invalid vf_id %d\n", res
->vf_id
);
13254 printf("invalid port_id %d\n", res
->port_id
);
13257 printf("function not implemented\n");
13260 printf("programming error: (%s)\n", strerror(-ret
));
13264 cmdline_parse_inst_t cmd_set_vf_vlan_anti_spoof
= {
13265 .f
= cmd_set_vf_vlan_anti_spoof_parsed
,
13267 .help_str
= "set vf vlan antispoof <port_id> <vf_id> on|off",
13269 (void *)&cmd_vf_vlan_anti_spoof_set
,
13270 (void *)&cmd_vf_vlan_anti_spoof_vf
,
13271 (void *)&cmd_vf_vlan_anti_spoof_vlan
,
13272 (void *)&cmd_vf_vlan_anti_spoof_antispoof
,
13273 (void *)&cmd_vf_vlan_anti_spoof_port_id
,
13274 (void *)&cmd_vf_vlan_anti_spoof_vf_id
,
13275 (void *)&cmd_vf_vlan_anti_spoof_on_off
,
13280 /* vf mac anti spoof configuration */
13282 /* Common result structure for vf mac anti spoof */
13283 struct cmd_vf_mac_anti_spoof_result
{
13284 cmdline_fixed_string_t set
;
13285 cmdline_fixed_string_t vf
;
13286 cmdline_fixed_string_t mac
;
13287 cmdline_fixed_string_t antispoof
;
13290 cmdline_fixed_string_t on_off
;
13293 /* Common CLI fields for vf mac anti spoof enable disable */
13294 cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_set
=
13295 TOKEN_STRING_INITIALIZER
13296 (struct cmd_vf_mac_anti_spoof_result
,
13298 cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_vf
=
13299 TOKEN_STRING_INITIALIZER
13300 (struct cmd_vf_mac_anti_spoof_result
,
13302 cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_mac
=
13303 TOKEN_STRING_INITIALIZER
13304 (struct cmd_vf_mac_anti_spoof_result
,
13306 cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_antispoof
=
13307 TOKEN_STRING_INITIALIZER
13308 (struct cmd_vf_mac_anti_spoof_result
,
13309 antispoof
, "antispoof");
13310 cmdline_parse_token_num_t cmd_vf_mac_anti_spoof_port_id
=
13311 TOKEN_NUM_INITIALIZER
13312 (struct cmd_vf_mac_anti_spoof_result
,
13314 cmdline_parse_token_num_t cmd_vf_mac_anti_spoof_vf_id
=
13315 TOKEN_NUM_INITIALIZER
13316 (struct cmd_vf_mac_anti_spoof_result
,
13318 cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_on_off
=
13319 TOKEN_STRING_INITIALIZER
13320 (struct cmd_vf_mac_anti_spoof_result
,
13324 cmd_set_vf_mac_anti_spoof_parsed(
13325 void *parsed_result
,
13326 __attribute__((unused
)) struct cmdline
*cl
,
13327 __attribute__((unused
)) void *data
)
13329 struct cmd_vf_mac_anti_spoof_result
*res
= parsed_result
;
13330 int ret
= -ENOTSUP
;
13332 __rte_unused
int is_on
= (strcmp(res
->on_off
, "on") == 0) ? 1 : 0;
13334 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
13337 #ifdef RTE_LIBRTE_IXGBE_PMD
13338 if (ret
== -ENOTSUP
)
13339 ret
= rte_pmd_ixgbe_set_vf_mac_anti_spoof(res
->port_id
,
13340 res
->vf_id
, is_on
);
13342 #ifdef RTE_LIBRTE_I40E_PMD
13343 if (ret
== -ENOTSUP
)
13344 ret
= rte_pmd_i40e_set_vf_mac_anti_spoof(res
->port_id
,
13345 res
->vf_id
, is_on
);
13347 #ifdef RTE_LIBRTE_BNXT_PMD
13348 if (ret
== -ENOTSUP
)
13349 ret
= rte_pmd_bnxt_set_vf_mac_anti_spoof(res
->port_id
,
13350 res
->vf_id
, is_on
);
13357 printf("invalid vf_id %d or is_on %d\n", res
->vf_id
, is_on
);
13360 printf("invalid port_id %d\n", res
->port_id
);
13363 printf("function not implemented\n");
13366 printf("programming error: (%s)\n", strerror(-ret
));
13370 cmdline_parse_inst_t cmd_set_vf_mac_anti_spoof
= {
13371 .f
= cmd_set_vf_mac_anti_spoof_parsed
,
13373 .help_str
= "set vf mac antispoof <port_id> <vf_id> on|off",
13375 (void *)&cmd_vf_mac_anti_spoof_set
,
13376 (void *)&cmd_vf_mac_anti_spoof_vf
,
13377 (void *)&cmd_vf_mac_anti_spoof_mac
,
13378 (void *)&cmd_vf_mac_anti_spoof_antispoof
,
13379 (void *)&cmd_vf_mac_anti_spoof_port_id
,
13380 (void *)&cmd_vf_mac_anti_spoof_vf_id
,
13381 (void *)&cmd_vf_mac_anti_spoof_on_off
,
13386 /* vf vlan strip queue configuration */
13388 /* Common result structure for vf mac anti spoof */
13389 struct cmd_vf_vlan_stripq_result
{
13390 cmdline_fixed_string_t set
;
13391 cmdline_fixed_string_t vf
;
13392 cmdline_fixed_string_t vlan
;
13393 cmdline_fixed_string_t stripq
;
13396 cmdline_fixed_string_t on_off
;
13399 /* Common CLI fields for vf vlan strip enable disable */
13400 cmdline_parse_token_string_t cmd_vf_vlan_stripq_set
=
13401 TOKEN_STRING_INITIALIZER
13402 (struct cmd_vf_vlan_stripq_result
,
13404 cmdline_parse_token_string_t cmd_vf_vlan_stripq_vf
=
13405 TOKEN_STRING_INITIALIZER
13406 (struct cmd_vf_vlan_stripq_result
,
13408 cmdline_parse_token_string_t cmd_vf_vlan_stripq_vlan
=
13409 TOKEN_STRING_INITIALIZER
13410 (struct cmd_vf_vlan_stripq_result
,
13412 cmdline_parse_token_string_t cmd_vf_vlan_stripq_stripq
=
13413 TOKEN_STRING_INITIALIZER
13414 (struct cmd_vf_vlan_stripq_result
,
13416 cmdline_parse_token_num_t cmd_vf_vlan_stripq_port_id
=
13417 TOKEN_NUM_INITIALIZER
13418 (struct cmd_vf_vlan_stripq_result
,
13420 cmdline_parse_token_num_t cmd_vf_vlan_stripq_vf_id
=
13421 TOKEN_NUM_INITIALIZER
13422 (struct cmd_vf_vlan_stripq_result
,
13424 cmdline_parse_token_string_t cmd_vf_vlan_stripq_on_off
=
13425 TOKEN_STRING_INITIALIZER
13426 (struct cmd_vf_vlan_stripq_result
,
13430 cmd_set_vf_vlan_stripq_parsed(
13431 void *parsed_result
,
13432 __attribute__((unused
)) struct cmdline
*cl
,
13433 __attribute__((unused
)) void *data
)
13435 struct cmd_vf_vlan_stripq_result
*res
= parsed_result
;
13436 int ret
= -ENOTSUP
;
13438 __rte_unused
int is_on
= (strcmp(res
->on_off
, "on") == 0) ? 1 : 0;
13440 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
13443 #ifdef RTE_LIBRTE_IXGBE_PMD
13444 if (ret
== -ENOTSUP
)
13445 ret
= rte_pmd_ixgbe_set_vf_vlan_stripq(res
->port_id
,
13446 res
->vf_id
, is_on
);
13448 #ifdef RTE_LIBRTE_I40E_PMD
13449 if (ret
== -ENOTSUP
)
13450 ret
= rte_pmd_i40e_set_vf_vlan_stripq(res
->port_id
,
13451 res
->vf_id
, is_on
);
13453 #ifdef RTE_LIBRTE_BNXT_PMD
13454 if (ret
== -ENOTSUP
)
13455 ret
= rte_pmd_bnxt_set_vf_vlan_stripq(res
->port_id
,
13456 res
->vf_id
, is_on
);
13463 printf("invalid vf_id %d or is_on %d\n", res
->vf_id
, is_on
);
13466 printf("invalid port_id %d\n", res
->port_id
);
13469 printf("function not implemented\n");
13472 printf("programming error: (%s)\n", strerror(-ret
));
13476 cmdline_parse_inst_t cmd_set_vf_vlan_stripq
= {
13477 .f
= cmd_set_vf_vlan_stripq_parsed
,
13479 .help_str
= "set vf vlan stripq <port_id> <vf_id> on|off",
13481 (void *)&cmd_vf_vlan_stripq_set
,
13482 (void *)&cmd_vf_vlan_stripq_vf
,
13483 (void *)&cmd_vf_vlan_stripq_vlan
,
13484 (void *)&cmd_vf_vlan_stripq_stripq
,
13485 (void *)&cmd_vf_vlan_stripq_port_id
,
13486 (void *)&cmd_vf_vlan_stripq_vf_id
,
13487 (void *)&cmd_vf_vlan_stripq_on_off
,
13492 /* vf vlan insert configuration */
13494 /* Common result structure for vf vlan insert */
13495 struct cmd_vf_vlan_insert_result
{
13496 cmdline_fixed_string_t set
;
13497 cmdline_fixed_string_t vf
;
13498 cmdline_fixed_string_t vlan
;
13499 cmdline_fixed_string_t insert
;
13505 /* Common CLI fields for vf vlan insert enable disable */
13506 cmdline_parse_token_string_t cmd_vf_vlan_insert_set
=
13507 TOKEN_STRING_INITIALIZER
13508 (struct cmd_vf_vlan_insert_result
,
13510 cmdline_parse_token_string_t cmd_vf_vlan_insert_vf
=
13511 TOKEN_STRING_INITIALIZER
13512 (struct cmd_vf_vlan_insert_result
,
13514 cmdline_parse_token_string_t cmd_vf_vlan_insert_vlan
=
13515 TOKEN_STRING_INITIALIZER
13516 (struct cmd_vf_vlan_insert_result
,
13518 cmdline_parse_token_string_t cmd_vf_vlan_insert_insert
=
13519 TOKEN_STRING_INITIALIZER
13520 (struct cmd_vf_vlan_insert_result
,
13522 cmdline_parse_token_num_t cmd_vf_vlan_insert_port_id
=
13523 TOKEN_NUM_INITIALIZER
13524 (struct cmd_vf_vlan_insert_result
,
13526 cmdline_parse_token_num_t cmd_vf_vlan_insert_vf_id
=
13527 TOKEN_NUM_INITIALIZER
13528 (struct cmd_vf_vlan_insert_result
,
13530 cmdline_parse_token_num_t cmd_vf_vlan_insert_vlan_id
=
13531 TOKEN_NUM_INITIALIZER
13532 (struct cmd_vf_vlan_insert_result
,
13536 cmd_set_vf_vlan_insert_parsed(
13537 void *parsed_result
,
13538 __attribute__((unused
)) struct cmdline
*cl
,
13539 __attribute__((unused
)) void *data
)
13541 struct cmd_vf_vlan_insert_result
*res
= parsed_result
;
13542 int ret
= -ENOTSUP
;
13544 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
13547 #ifdef RTE_LIBRTE_IXGBE_PMD
13548 if (ret
== -ENOTSUP
)
13549 ret
= rte_pmd_ixgbe_set_vf_vlan_insert(res
->port_id
, res
->vf_id
,
13552 #ifdef RTE_LIBRTE_I40E_PMD
13553 if (ret
== -ENOTSUP
)
13554 ret
= rte_pmd_i40e_set_vf_vlan_insert(res
->port_id
, res
->vf_id
,
13557 #ifdef RTE_LIBRTE_BNXT_PMD
13558 if (ret
== -ENOTSUP
)
13559 ret
= rte_pmd_bnxt_set_vf_vlan_insert(res
->port_id
, res
->vf_id
,
13567 printf("invalid vf_id %d or vlan_id %d\n", res
->vf_id
, res
->vlan_id
);
13570 printf("invalid port_id %d\n", res
->port_id
);
13573 printf("function not implemented\n");
13576 printf("programming error: (%s)\n", strerror(-ret
));
13580 cmdline_parse_inst_t cmd_set_vf_vlan_insert
= {
13581 .f
= cmd_set_vf_vlan_insert_parsed
,
13583 .help_str
= "set vf vlan insert <port_id> <vf_id> <vlan_id>",
13585 (void *)&cmd_vf_vlan_insert_set
,
13586 (void *)&cmd_vf_vlan_insert_vf
,
13587 (void *)&cmd_vf_vlan_insert_vlan
,
13588 (void *)&cmd_vf_vlan_insert_insert
,
13589 (void *)&cmd_vf_vlan_insert_port_id
,
13590 (void *)&cmd_vf_vlan_insert_vf_id
,
13591 (void *)&cmd_vf_vlan_insert_vlan_id
,
13596 /* tx loopback configuration */
13598 /* Common result structure for tx loopback */
13599 struct cmd_tx_loopback_result
{
13600 cmdline_fixed_string_t set
;
13601 cmdline_fixed_string_t tx
;
13602 cmdline_fixed_string_t loopback
;
13604 cmdline_fixed_string_t on_off
;
13607 /* Common CLI fields for tx loopback enable disable */
13608 cmdline_parse_token_string_t cmd_tx_loopback_set
=
13609 TOKEN_STRING_INITIALIZER
13610 (struct cmd_tx_loopback_result
,
13612 cmdline_parse_token_string_t cmd_tx_loopback_tx
=
13613 TOKEN_STRING_INITIALIZER
13614 (struct cmd_tx_loopback_result
,
13616 cmdline_parse_token_string_t cmd_tx_loopback_loopback
=
13617 TOKEN_STRING_INITIALIZER
13618 (struct cmd_tx_loopback_result
,
13619 loopback
, "loopback");
13620 cmdline_parse_token_num_t cmd_tx_loopback_port_id
=
13621 TOKEN_NUM_INITIALIZER
13622 (struct cmd_tx_loopback_result
,
13624 cmdline_parse_token_string_t cmd_tx_loopback_on_off
=
13625 TOKEN_STRING_INITIALIZER
13626 (struct cmd_tx_loopback_result
,
13630 cmd_set_tx_loopback_parsed(
13631 void *parsed_result
,
13632 __attribute__((unused
)) struct cmdline
*cl
,
13633 __attribute__((unused
)) void *data
)
13635 struct cmd_tx_loopback_result
*res
= parsed_result
;
13636 int ret
= -ENOTSUP
;
13638 __rte_unused
int is_on
= (strcmp(res
->on_off
, "on") == 0) ? 1 : 0;
13640 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
13643 #ifdef RTE_LIBRTE_IXGBE_PMD
13644 if (ret
== -ENOTSUP
)
13645 ret
= rte_pmd_ixgbe_set_tx_loopback(res
->port_id
, is_on
);
13647 #ifdef RTE_LIBRTE_I40E_PMD
13648 if (ret
== -ENOTSUP
)
13649 ret
= rte_pmd_i40e_set_tx_loopback(res
->port_id
, is_on
);
13651 #ifdef RTE_LIBRTE_BNXT_PMD
13652 if (ret
== -ENOTSUP
)
13653 ret
= rte_pmd_bnxt_set_tx_loopback(res
->port_id
, is_on
);
13655 #if defined RTE_LIBRTE_DPAA_BUS && defined RTE_LIBRTE_DPAA_PMD
13656 if (ret
== -ENOTSUP
)
13657 ret
= rte_pmd_dpaa_set_tx_loopback(res
->port_id
, is_on
);
13664 printf("invalid is_on %d\n", is_on
);
13667 printf("invalid port_id %d\n", res
->port_id
);
13670 printf("function not implemented\n");
13673 printf("programming error: (%s)\n", strerror(-ret
));
13677 cmdline_parse_inst_t cmd_set_tx_loopback
= {
13678 .f
= cmd_set_tx_loopback_parsed
,
13680 .help_str
= "set tx loopback <port_id> on|off",
13682 (void *)&cmd_tx_loopback_set
,
13683 (void *)&cmd_tx_loopback_tx
,
13684 (void *)&cmd_tx_loopback_loopback
,
13685 (void *)&cmd_tx_loopback_port_id
,
13686 (void *)&cmd_tx_loopback_on_off
,
13691 /* all queues drop enable configuration */
13693 /* Common result structure for all queues drop enable */
13694 struct cmd_all_queues_drop_en_result
{
13695 cmdline_fixed_string_t set
;
13696 cmdline_fixed_string_t all
;
13697 cmdline_fixed_string_t queues
;
13698 cmdline_fixed_string_t drop
;
13700 cmdline_fixed_string_t on_off
;
13703 /* Common CLI fields for tx loopback enable disable */
13704 cmdline_parse_token_string_t cmd_all_queues_drop_en_set
=
13705 TOKEN_STRING_INITIALIZER
13706 (struct cmd_all_queues_drop_en_result
,
13708 cmdline_parse_token_string_t cmd_all_queues_drop_en_all
=
13709 TOKEN_STRING_INITIALIZER
13710 (struct cmd_all_queues_drop_en_result
,
13712 cmdline_parse_token_string_t cmd_all_queues_drop_en_queues
=
13713 TOKEN_STRING_INITIALIZER
13714 (struct cmd_all_queues_drop_en_result
,
13716 cmdline_parse_token_string_t cmd_all_queues_drop_en_drop
=
13717 TOKEN_STRING_INITIALIZER
13718 (struct cmd_all_queues_drop_en_result
,
13720 cmdline_parse_token_num_t cmd_all_queues_drop_en_port_id
=
13721 TOKEN_NUM_INITIALIZER
13722 (struct cmd_all_queues_drop_en_result
,
13724 cmdline_parse_token_string_t cmd_all_queues_drop_en_on_off
=
13725 TOKEN_STRING_INITIALIZER
13726 (struct cmd_all_queues_drop_en_result
,
13730 cmd_set_all_queues_drop_en_parsed(
13731 void *parsed_result
,
13732 __attribute__((unused
)) struct cmdline
*cl
,
13733 __attribute__((unused
)) void *data
)
13735 struct cmd_all_queues_drop_en_result
*res
= parsed_result
;
13736 int ret
= -ENOTSUP
;
13737 int is_on
= (strcmp(res
->on_off
, "on") == 0) ? 1 : 0;
13739 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
13742 #ifdef RTE_LIBRTE_IXGBE_PMD
13743 if (ret
== -ENOTSUP
)
13744 ret
= rte_pmd_ixgbe_set_all_queues_drop_en(res
->port_id
, is_on
);
13746 #ifdef RTE_LIBRTE_BNXT_PMD
13747 if (ret
== -ENOTSUP
)
13748 ret
= rte_pmd_bnxt_set_all_queues_drop_en(res
->port_id
, is_on
);
13754 printf("invalid is_on %d\n", is_on
);
13757 printf("invalid port_id %d\n", res
->port_id
);
13760 printf("function not implemented\n");
13763 printf("programming error: (%s)\n", strerror(-ret
));
13767 cmdline_parse_inst_t cmd_set_all_queues_drop_en
= {
13768 .f
= cmd_set_all_queues_drop_en_parsed
,
13770 .help_str
= "set all queues drop <port_id> on|off",
13772 (void *)&cmd_all_queues_drop_en_set
,
13773 (void *)&cmd_all_queues_drop_en_all
,
13774 (void *)&cmd_all_queues_drop_en_queues
,
13775 (void *)&cmd_all_queues_drop_en_drop
,
13776 (void *)&cmd_all_queues_drop_en_port_id
,
13777 (void *)&cmd_all_queues_drop_en_on_off
,
13782 /* vf split drop enable configuration */
13784 /* Common result structure for vf split drop enable */
13785 struct cmd_vf_split_drop_en_result
{
13786 cmdline_fixed_string_t set
;
13787 cmdline_fixed_string_t vf
;
13788 cmdline_fixed_string_t split
;
13789 cmdline_fixed_string_t drop
;
13792 cmdline_fixed_string_t on_off
;
13795 /* Common CLI fields for vf split drop enable disable */
13796 cmdline_parse_token_string_t cmd_vf_split_drop_en_set
=
13797 TOKEN_STRING_INITIALIZER
13798 (struct cmd_vf_split_drop_en_result
,
13800 cmdline_parse_token_string_t cmd_vf_split_drop_en_vf
=
13801 TOKEN_STRING_INITIALIZER
13802 (struct cmd_vf_split_drop_en_result
,
13804 cmdline_parse_token_string_t cmd_vf_split_drop_en_split
=
13805 TOKEN_STRING_INITIALIZER
13806 (struct cmd_vf_split_drop_en_result
,
13808 cmdline_parse_token_string_t cmd_vf_split_drop_en_drop
=
13809 TOKEN_STRING_INITIALIZER
13810 (struct cmd_vf_split_drop_en_result
,
13812 cmdline_parse_token_num_t cmd_vf_split_drop_en_port_id
=
13813 TOKEN_NUM_INITIALIZER
13814 (struct cmd_vf_split_drop_en_result
,
13816 cmdline_parse_token_num_t cmd_vf_split_drop_en_vf_id
=
13817 TOKEN_NUM_INITIALIZER
13818 (struct cmd_vf_split_drop_en_result
,
13820 cmdline_parse_token_string_t cmd_vf_split_drop_en_on_off
=
13821 TOKEN_STRING_INITIALIZER
13822 (struct cmd_vf_split_drop_en_result
,
13826 cmd_set_vf_split_drop_en_parsed(
13827 void *parsed_result
,
13828 __attribute__((unused
)) struct cmdline
*cl
,
13829 __attribute__((unused
)) void *data
)
13831 struct cmd_vf_split_drop_en_result
*res
= parsed_result
;
13832 int ret
= -ENOTSUP
;
13833 int is_on
= (strcmp(res
->on_off
, "on") == 0) ? 1 : 0;
13835 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
13838 #ifdef RTE_LIBRTE_IXGBE_PMD
13839 ret
= rte_pmd_ixgbe_set_vf_split_drop_en(res
->port_id
, res
->vf_id
,
13846 printf("invalid vf_id %d or is_on %d\n", res
->vf_id
, is_on
);
13849 printf("invalid port_id %d\n", res
->port_id
);
13852 printf("not supported on port %d\n", res
->port_id
);
13855 printf("programming error: (%s)\n", strerror(-ret
));
13859 cmdline_parse_inst_t cmd_set_vf_split_drop_en
= {
13860 .f
= cmd_set_vf_split_drop_en_parsed
,
13862 .help_str
= "set vf split drop <port_id> <vf_id> on|off",
13864 (void *)&cmd_vf_split_drop_en_set
,
13865 (void *)&cmd_vf_split_drop_en_vf
,
13866 (void *)&cmd_vf_split_drop_en_split
,
13867 (void *)&cmd_vf_split_drop_en_drop
,
13868 (void *)&cmd_vf_split_drop_en_port_id
,
13869 (void *)&cmd_vf_split_drop_en_vf_id
,
13870 (void *)&cmd_vf_split_drop_en_on_off
,
13875 /* vf mac address configuration */
13877 /* Common result structure for vf mac address */
13878 struct cmd_set_vf_mac_addr_result
{
13879 cmdline_fixed_string_t set
;
13880 cmdline_fixed_string_t vf
;
13881 cmdline_fixed_string_t mac
;
13882 cmdline_fixed_string_t addr
;
13885 struct ether_addr mac_addr
;
13889 /* Common CLI fields for vf split drop enable disable */
13890 cmdline_parse_token_string_t cmd_set_vf_mac_addr_set
=
13891 TOKEN_STRING_INITIALIZER
13892 (struct cmd_set_vf_mac_addr_result
,
13894 cmdline_parse_token_string_t cmd_set_vf_mac_addr_vf
=
13895 TOKEN_STRING_INITIALIZER
13896 (struct cmd_set_vf_mac_addr_result
,
13898 cmdline_parse_token_string_t cmd_set_vf_mac_addr_mac
=
13899 TOKEN_STRING_INITIALIZER
13900 (struct cmd_set_vf_mac_addr_result
,
13902 cmdline_parse_token_string_t cmd_set_vf_mac_addr_addr
=
13903 TOKEN_STRING_INITIALIZER
13904 (struct cmd_set_vf_mac_addr_result
,
13906 cmdline_parse_token_num_t cmd_set_vf_mac_addr_port_id
=
13907 TOKEN_NUM_INITIALIZER
13908 (struct cmd_set_vf_mac_addr_result
,
13910 cmdline_parse_token_num_t cmd_set_vf_mac_addr_vf_id
=
13911 TOKEN_NUM_INITIALIZER
13912 (struct cmd_set_vf_mac_addr_result
,
13914 cmdline_parse_token_etheraddr_t cmd_set_vf_mac_addr_mac_addr
=
13915 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_vf_mac_addr_result
,
13919 cmd_set_vf_mac_addr_parsed(
13920 void *parsed_result
,
13921 __attribute__((unused
)) struct cmdline
*cl
,
13922 __attribute__((unused
)) void *data
)
13924 struct cmd_set_vf_mac_addr_result
*res
= parsed_result
;
13925 int ret
= -ENOTSUP
;
13927 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
13930 #ifdef RTE_LIBRTE_IXGBE_PMD
13931 if (ret
== -ENOTSUP
)
13932 ret
= rte_pmd_ixgbe_set_vf_mac_addr(res
->port_id
, res
->vf_id
,
13935 #ifdef RTE_LIBRTE_I40E_PMD
13936 if (ret
== -ENOTSUP
)
13937 ret
= rte_pmd_i40e_set_vf_mac_addr(res
->port_id
, res
->vf_id
,
13940 #ifdef RTE_LIBRTE_BNXT_PMD
13941 if (ret
== -ENOTSUP
)
13942 ret
= rte_pmd_bnxt_set_vf_mac_addr(res
->port_id
, res
->vf_id
,
13950 printf("invalid vf_id %d or mac_addr\n", res
->vf_id
);
13953 printf("invalid port_id %d\n", res
->port_id
);
13956 printf("function not implemented\n");
13959 printf("programming error: (%s)\n", strerror(-ret
));
13963 cmdline_parse_inst_t cmd_set_vf_mac_addr
= {
13964 .f
= cmd_set_vf_mac_addr_parsed
,
13966 .help_str
= "set vf mac addr <port_id> <vf_id> <mac_addr>",
13968 (void *)&cmd_set_vf_mac_addr_set
,
13969 (void *)&cmd_set_vf_mac_addr_vf
,
13970 (void *)&cmd_set_vf_mac_addr_mac
,
13971 (void *)&cmd_set_vf_mac_addr_addr
,
13972 (void *)&cmd_set_vf_mac_addr_port_id
,
13973 (void *)&cmd_set_vf_mac_addr_vf_id
,
13974 (void *)&cmd_set_vf_mac_addr_mac_addr
,
13979 /* MACsec configuration */
13981 /* Common result structure for MACsec offload enable */
13982 struct cmd_macsec_offload_on_result
{
13983 cmdline_fixed_string_t set
;
13984 cmdline_fixed_string_t macsec
;
13985 cmdline_fixed_string_t offload
;
13987 cmdline_fixed_string_t on
;
13988 cmdline_fixed_string_t encrypt
;
13989 cmdline_fixed_string_t en_on_off
;
13990 cmdline_fixed_string_t replay_protect
;
13991 cmdline_fixed_string_t rp_on_off
;
13994 /* Common CLI fields for MACsec offload disable */
13995 cmdline_parse_token_string_t cmd_macsec_offload_on_set
=
13996 TOKEN_STRING_INITIALIZER
13997 (struct cmd_macsec_offload_on_result
,
13999 cmdline_parse_token_string_t cmd_macsec_offload_on_macsec
=
14000 TOKEN_STRING_INITIALIZER
14001 (struct cmd_macsec_offload_on_result
,
14003 cmdline_parse_token_string_t cmd_macsec_offload_on_offload
=
14004 TOKEN_STRING_INITIALIZER
14005 (struct cmd_macsec_offload_on_result
,
14006 offload
, "offload");
14007 cmdline_parse_token_num_t cmd_macsec_offload_on_port_id
=
14008 TOKEN_NUM_INITIALIZER
14009 (struct cmd_macsec_offload_on_result
,
14011 cmdline_parse_token_string_t cmd_macsec_offload_on_on
=
14012 TOKEN_STRING_INITIALIZER
14013 (struct cmd_macsec_offload_on_result
,
14015 cmdline_parse_token_string_t cmd_macsec_offload_on_encrypt
=
14016 TOKEN_STRING_INITIALIZER
14017 (struct cmd_macsec_offload_on_result
,
14018 encrypt
, "encrypt");
14019 cmdline_parse_token_string_t cmd_macsec_offload_on_en_on_off
=
14020 TOKEN_STRING_INITIALIZER
14021 (struct cmd_macsec_offload_on_result
,
14022 en_on_off
, "on#off");
14023 cmdline_parse_token_string_t cmd_macsec_offload_on_replay_protect
=
14024 TOKEN_STRING_INITIALIZER
14025 (struct cmd_macsec_offload_on_result
,
14026 replay_protect
, "replay-protect");
14027 cmdline_parse_token_string_t cmd_macsec_offload_on_rp_on_off
=
14028 TOKEN_STRING_INITIALIZER
14029 (struct cmd_macsec_offload_on_result
,
14030 rp_on_off
, "on#off");
14033 cmd_set_macsec_offload_on_parsed(
14034 void *parsed_result
,
14035 __attribute__((unused
)) struct cmdline
*cl
,
14036 __attribute__((unused
)) void *data
)
14038 struct cmd_macsec_offload_on_result
*res
= parsed_result
;
14039 int ret
= -ENOTSUP
;
14040 portid_t port_id
= res
->port_id
;
14041 int en
= (strcmp(res
->en_on_off
, "on") == 0) ? 1 : 0;
14042 int rp
= (strcmp(res
->rp_on_off
, "on") == 0) ? 1 : 0;
14043 struct rte_eth_dev_info dev_info
;
14045 if (port_id_is_invalid(port_id
, ENABLED_WARN
))
14047 if (!port_is_stopped(port_id
)) {
14048 printf("Please stop port %d first\n", port_id
);
14052 rte_eth_dev_info_get(port_id
, &dev_info
);
14053 if (dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_MACSEC_INSERT
) {
14054 #ifdef RTE_LIBRTE_IXGBE_PMD
14055 ret
= rte_pmd_ixgbe_macsec_enable(port_id
, en
, rp
);
14063 ports
[port_id
].dev_conf
.txmode
.offloads
|=
14064 DEV_TX_OFFLOAD_MACSEC_INSERT
;
14065 cmd_reconfig_device_queue(port_id
, 1, 1);
14068 printf("invalid port_id %d\n", port_id
);
14071 printf("not supported on port %d\n", port_id
);
14074 printf("programming error: (%s)\n", strerror(-ret
));
14078 cmdline_parse_inst_t cmd_set_macsec_offload_on
= {
14079 .f
= cmd_set_macsec_offload_on_parsed
,
14081 .help_str
= "set macsec offload <port_id> on "
14082 "encrypt on|off replay-protect on|off",
14084 (void *)&cmd_macsec_offload_on_set
,
14085 (void *)&cmd_macsec_offload_on_macsec
,
14086 (void *)&cmd_macsec_offload_on_offload
,
14087 (void *)&cmd_macsec_offload_on_port_id
,
14088 (void *)&cmd_macsec_offload_on_on
,
14089 (void *)&cmd_macsec_offload_on_encrypt
,
14090 (void *)&cmd_macsec_offload_on_en_on_off
,
14091 (void *)&cmd_macsec_offload_on_replay_protect
,
14092 (void *)&cmd_macsec_offload_on_rp_on_off
,
14097 /* Common result structure for MACsec offload disable */
14098 struct cmd_macsec_offload_off_result
{
14099 cmdline_fixed_string_t set
;
14100 cmdline_fixed_string_t macsec
;
14101 cmdline_fixed_string_t offload
;
14103 cmdline_fixed_string_t off
;
14106 /* Common CLI fields for MACsec offload disable */
14107 cmdline_parse_token_string_t cmd_macsec_offload_off_set
=
14108 TOKEN_STRING_INITIALIZER
14109 (struct cmd_macsec_offload_off_result
,
14111 cmdline_parse_token_string_t cmd_macsec_offload_off_macsec
=
14112 TOKEN_STRING_INITIALIZER
14113 (struct cmd_macsec_offload_off_result
,
14115 cmdline_parse_token_string_t cmd_macsec_offload_off_offload
=
14116 TOKEN_STRING_INITIALIZER
14117 (struct cmd_macsec_offload_off_result
,
14118 offload
, "offload");
14119 cmdline_parse_token_num_t cmd_macsec_offload_off_port_id
=
14120 TOKEN_NUM_INITIALIZER
14121 (struct cmd_macsec_offload_off_result
,
14123 cmdline_parse_token_string_t cmd_macsec_offload_off_off
=
14124 TOKEN_STRING_INITIALIZER
14125 (struct cmd_macsec_offload_off_result
,
14129 cmd_set_macsec_offload_off_parsed(
14130 void *parsed_result
,
14131 __attribute__((unused
)) struct cmdline
*cl
,
14132 __attribute__((unused
)) void *data
)
14134 struct cmd_macsec_offload_off_result
*res
= parsed_result
;
14135 int ret
= -ENOTSUP
;
14136 struct rte_eth_dev_info dev_info
;
14137 portid_t port_id
= res
->port_id
;
14139 if (port_id_is_invalid(port_id
, ENABLED_WARN
))
14141 if (!port_is_stopped(port_id
)) {
14142 printf("Please stop port %d first\n", port_id
);
14146 rte_eth_dev_info_get(port_id
, &dev_info
);
14147 if (dev_info
.tx_offload_capa
& DEV_TX_OFFLOAD_MACSEC_INSERT
) {
14148 #ifdef RTE_LIBRTE_IXGBE_PMD
14149 ret
= rte_pmd_ixgbe_macsec_disable(port_id
);
14154 ports
[port_id
].dev_conf
.txmode
.offloads
&=
14155 ~DEV_TX_OFFLOAD_MACSEC_INSERT
;
14156 cmd_reconfig_device_queue(port_id
, 1, 1);
14159 printf("invalid port_id %d\n", port_id
);
14162 printf("not supported on port %d\n", port_id
);
14165 printf("programming error: (%s)\n", strerror(-ret
));
14169 cmdline_parse_inst_t cmd_set_macsec_offload_off
= {
14170 .f
= cmd_set_macsec_offload_off_parsed
,
14172 .help_str
= "set macsec offload <port_id> off",
14174 (void *)&cmd_macsec_offload_off_set
,
14175 (void *)&cmd_macsec_offload_off_macsec
,
14176 (void *)&cmd_macsec_offload_off_offload
,
14177 (void *)&cmd_macsec_offload_off_port_id
,
14178 (void *)&cmd_macsec_offload_off_off
,
14183 /* Common result structure for MACsec secure connection configure */
14184 struct cmd_macsec_sc_result
{
14185 cmdline_fixed_string_t set
;
14186 cmdline_fixed_string_t macsec
;
14187 cmdline_fixed_string_t sc
;
14188 cmdline_fixed_string_t tx_rx
;
14190 struct ether_addr mac
;
14194 /* Common CLI fields for MACsec secure connection configure */
14195 cmdline_parse_token_string_t cmd_macsec_sc_set
=
14196 TOKEN_STRING_INITIALIZER
14197 (struct cmd_macsec_sc_result
,
14199 cmdline_parse_token_string_t cmd_macsec_sc_macsec
=
14200 TOKEN_STRING_INITIALIZER
14201 (struct cmd_macsec_sc_result
,
14203 cmdline_parse_token_string_t cmd_macsec_sc_sc
=
14204 TOKEN_STRING_INITIALIZER
14205 (struct cmd_macsec_sc_result
,
14207 cmdline_parse_token_string_t cmd_macsec_sc_tx_rx
=
14208 TOKEN_STRING_INITIALIZER
14209 (struct cmd_macsec_sc_result
,
14211 cmdline_parse_token_num_t cmd_macsec_sc_port_id
=
14212 TOKEN_NUM_INITIALIZER
14213 (struct cmd_macsec_sc_result
,
14215 cmdline_parse_token_etheraddr_t cmd_macsec_sc_mac
=
14216 TOKEN_ETHERADDR_INITIALIZER
14217 (struct cmd_macsec_sc_result
,
14219 cmdline_parse_token_num_t cmd_macsec_sc_pi
=
14220 TOKEN_NUM_INITIALIZER
14221 (struct cmd_macsec_sc_result
,
14225 cmd_set_macsec_sc_parsed(
14226 void *parsed_result
,
14227 __attribute__((unused
)) struct cmdline
*cl
,
14228 __attribute__((unused
)) void *data
)
14230 struct cmd_macsec_sc_result
*res
= parsed_result
;
14231 int ret
= -ENOTSUP
;
14232 int is_tx
= (strcmp(res
->tx_rx
, "tx") == 0) ? 1 : 0;
14234 #ifdef RTE_LIBRTE_IXGBE_PMD
14236 rte_pmd_ixgbe_macsec_config_txsc(res
->port_id
,
14237 res
->mac
.addr_bytes
) :
14238 rte_pmd_ixgbe_macsec_config_rxsc(res
->port_id
,
14239 res
->mac
.addr_bytes
, res
->pi
);
14241 RTE_SET_USED(is_tx
);
14247 printf("invalid port_id %d\n", res
->port_id
);
14250 printf("not supported on port %d\n", res
->port_id
);
14253 printf("programming error: (%s)\n", strerror(-ret
));
14257 cmdline_parse_inst_t cmd_set_macsec_sc
= {
14258 .f
= cmd_set_macsec_sc_parsed
,
14260 .help_str
= "set macsec sc tx|rx <port_id> <mac> <pi>",
14262 (void *)&cmd_macsec_sc_set
,
14263 (void *)&cmd_macsec_sc_macsec
,
14264 (void *)&cmd_macsec_sc_sc
,
14265 (void *)&cmd_macsec_sc_tx_rx
,
14266 (void *)&cmd_macsec_sc_port_id
,
14267 (void *)&cmd_macsec_sc_mac
,
14268 (void *)&cmd_macsec_sc_pi
,
14273 /* Common result structure for MACsec secure connection configure */
14274 struct cmd_macsec_sa_result
{
14275 cmdline_fixed_string_t set
;
14276 cmdline_fixed_string_t macsec
;
14277 cmdline_fixed_string_t sa
;
14278 cmdline_fixed_string_t tx_rx
;
14283 cmdline_fixed_string_t key
;
14286 /* Common CLI fields for MACsec secure connection configure */
14287 cmdline_parse_token_string_t cmd_macsec_sa_set
=
14288 TOKEN_STRING_INITIALIZER
14289 (struct cmd_macsec_sa_result
,
14291 cmdline_parse_token_string_t cmd_macsec_sa_macsec
=
14292 TOKEN_STRING_INITIALIZER
14293 (struct cmd_macsec_sa_result
,
14295 cmdline_parse_token_string_t cmd_macsec_sa_sa
=
14296 TOKEN_STRING_INITIALIZER
14297 (struct cmd_macsec_sa_result
,
14299 cmdline_parse_token_string_t cmd_macsec_sa_tx_rx
=
14300 TOKEN_STRING_INITIALIZER
14301 (struct cmd_macsec_sa_result
,
14303 cmdline_parse_token_num_t cmd_macsec_sa_port_id
=
14304 TOKEN_NUM_INITIALIZER
14305 (struct cmd_macsec_sa_result
,
14307 cmdline_parse_token_num_t cmd_macsec_sa_idx
=
14308 TOKEN_NUM_INITIALIZER
14309 (struct cmd_macsec_sa_result
,
14311 cmdline_parse_token_num_t cmd_macsec_sa_an
=
14312 TOKEN_NUM_INITIALIZER
14313 (struct cmd_macsec_sa_result
,
14315 cmdline_parse_token_num_t cmd_macsec_sa_pn
=
14316 TOKEN_NUM_INITIALIZER
14317 (struct cmd_macsec_sa_result
,
14319 cmdline_parse_token_string_t cmd_macsec_sa_key
=
14320 TOKEN_STRING_INITIALIZER
14321 (struct cmd_macsec_sa_result
,
14325 cmd_set_macsec_sa_parsed(
14326 void *parsed_result
,
14327 __attribute__((unused
)) struct cmdline
*cl
,
14328 __attribute__((unused
)) void *data
)
14330 struct cmd_macsec_sa_result
*res
= parsed_result
;
14331 int ret
= -ENOTSUP
;
14332 int is_tx
= (strcmp(res
->tx_rx
, "tx") == 0) ? 1 : 0;
14333 uint8_t key
[16] = { 0 };
14339 key_len
= strlen(res
->key
) / 2;
14343 for (i
= 0; i
< key_len
; i
++) {
14344 xdgt0
= parse_and_check_key_hexa_digit(res
->key
, (i
* 2));
14347 xdgt1
= parse_and_check_key_hexa_digit(res
->key
, (i
* 2) + 1);
14350 key
[i
] = (uint8_t) ((xdgt0
* 16) + xdgt1
);
14353 #ifdef RTE_LIBRTE_IXGBE_PMD
14355 rte_pmd_ixgbe_macsec_select_txsa(res
->port_id
,
14356 res
->idx
, res
->an
, res
->pn
, key
) :
14357 rte_pmd_ixgbe_macsec_select_rxsa(res
->port_id
,
14358 res
->idx
, res
->an
, res
->pn
, key
);
14360 RTE_SET_USED(is_tx
);
14367 printf("invalid idx %d or an %d\n", res
->idx
, res
->an
);
14370 printf("invalid port_id %d\n", res
->port_id
);
14373 printf("not supported on port %d\n", res
->port_id
);
14376 printf("programming error: (%s)\n", strerror(-ret
));
14380 cmdline_parse_inst_t cmd_set_macsec_sa
= {
14381 .f
= cmd_set_macsec_sa_parsed
,
14383 .help_str
= "set macsec sa tx|rx <port_id> <idx> <an> <pn> <key>",
14385 (void *)&cmd_macsec_sa_set
,
14386 (void *)&cmd_macsec_sa_macsec
,
14387 (void *)&cmd_macsec_sa_sa
,
14388 (void *)&cmd_macsec_sa_tx_rx
,
14389 (void *)&cmd_macsec_sa_port_id
,
14390 (void *)&cmd_macsec_sa_idx
,
14391 (void *)&cmd_macsec_sa_an
,
14392 (void *)&cmd_macsec_sa_pn
,
14393 (void *)&cmd_macsec_sa_key
,
14398 /* VF unicast promiscuous mode configuration */
14400 /* Common result structure for VF unicast promiscuous mode */
14401 struct cmd_vf_promisc_result
{
14402 cmdline_fixed_string_t set
;
14403 cmdline_fixed_string_t vf
;
14404 cmdline_fixed_string_t promisc
;
14407 cmdline_fixed_string_t on_off
;
14410 /* Common CLI fields for VF unicast promiscuous mode enable disable */
14411 cmdline_parse_token_string_t cmd_vf_promisc_set
=
14412 TOKEN_STRING_INITIALIZER
14413 (struct cmd_vf_promisc_result
,
14415 cmdline_parse_token_string_t cmd_vf_promisc_vf
=
14416 TOKEN_STRING_INITIALIZER
14417 (struct cmd_vf_promisc_result
,
14419 cmdline_parse_token_string_t cmd_vf_promisc_promisc
=
14420 TOKEN_STRING_INITIALIZER
14421 (struct cmd_vf_promisc_result
,
14422 promisc
, "promisc");
14423 cmdline_parse_token_num_t cmd_vf_promisc_port_id
=
14424 TOKEN_NUM_INITIALIZER
14425 (struct cmd_vf_promisc_result
,
14427 cmdline_parse_token_num_t cmd_vf_promisc_vf_id
=
14428 TOKEN_NUM_INITIALIZER
14429 (struct cmd_vf_promisc_result
,
14431 cmdline_parse_token_string_t cmd_vf_promisc_on_off
=
14432 TOKEN_STRING_INITIALIZER
14433 (struct cmd_vf_promisc_result
,
14437 cmd_set_vf_promisc_parsed(
14438 void *parsed_result
,
14439 __attribute__((unused
)) struct cmdline
*cl
,
14440 __attribute__((unused
)) void *data
)
14442 struct cmd_vf_promisc_result
*res
= parsed_result
;
14443 int ret
= -ENOTSUP
;
14445 __rte_unused
int is_on
= (strcmp(res
->on_off
, "on") == 0) ? 1 : 0;
14447 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
14450 #ifdef RTE_LIBRTE_I40E_PMD
14451 ret
= rte_pmd_i40e_set_vf_unicast_promisc(res
->port_id
,
14452 res
->vf_id
, is_on
);
14459 printf("invalid vf_id %d\n", res
->vf_id
);
14462 printf("invalid port_id %d\n", res
->port_id
);
14465 printf("function not implemented\n");
14468 printf("programming error: (%s)\n", strerror(-ret
));
14472 cmdline_parse_inst_t cmd_set_vf_promisc
= {
14473 .f
= cmd_set_vf_promisc_parsed
,
14475 .help_str
= "set vf promisc <port_id> <vf_id> on|off: "
14476 "Set unicast promiscuous mode for a VF from the PF",
14478 (void *)&cmd_vf_promisc_set
,
14479 (void *)&cmd_vf_promisc_vf
,
14480 (void *)&cmd_vf_promisc_promisc
,
14481 (void *)&cmd_vf_promisc_port_id
,
14482 (void *)&cmd_vf_promisc_vf_id
,
14483 (void *)&cmd_vf_promisc_on_off
,
14488 /* VF multicast promiscuous mode configuration */
14490 /* Common result structure for VF multicast promiscuous mode */
14491 struct cmd_vf_allmulti_result
{
14492 cmdline_fixed_string_t set
;
14493 cmdline_fixed_string_t vf
;
14494 cmdline_fixed_string_t allmulti
;
14497 cmdline_fixed_string_t on_off
;
14500 /* Common CLI fields for VF multicast promiscuous mode enable disable */
14501 cmdline_parse_token_string_t cmd_vf_allmulti_set
=
14502 TOKEN_STRING_INITIALIZER
14503 (struct cmd_vf_allmulti_result
,
14505 cmdline_parse_token_string_t cmd_vf_allmulti_vf
=
14506 TOKEN_STRING_INITIALIZER
14507 (struct cmd_vf_allmulti_result
,
14509 cmdline_parse_token_string_t cmd_vf_allmulti_allmulti
=
14510 TOKEN_STRING_INITIALIZER
14511 (struct cmd_vf_allmulti_result
,
14512 allmulti
, "allmulti");
14513 cmdline_parse_token_num_t cmd_vf_allmulti_port_id
=
14514 TOKEN_NUM_INITIALIZER
14515 (struct cmd_vf_allmulti_result
,
14517 cmdline_parse_token_num_t cmd_vf_allmulti_vf_id
=
14518 TOKEN_NUM_INITIALIZER
14519 (struct cmd_vf_allmulti_result
,
14521 cmdline_parse_token_string_t cmd_vf_allmulti_on_off
=
14522 TOKEN_STRING_INITIALIZER
14523 (struct cmd_vf_allmulti_result
,
14527 cmd_set_vf_allmulti_parsed(
14528 void *parsed_result
,
14529 __attribute__((unused
)) struct cmdline
*cl
,
14530 __attribute__((unused
)) void *data
)
14532 struct cmd_vf_allmulti_result
*res
= parsed_result
;
14533 int ret
= -ENOTSUP
;
14535 __rte_unused
int is_on
= (strcmp(res
->on_off
, "on") == 0) ? 1 : 0;
14537 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
14540 #ifdef RTE_LIBRTE_I40E_PMD
14541 ret
= rte_pmd_i40e_set_vf_multicast_promisc(res
->port_id
,
14542 res
->vf_id
, is_on
);
14549 printf("invalid vf_id %d\n", res
->vf_id
);
14552 printf("invalid port_id %d\n", res
->port_id
);
14555 printf("function not implemented\n");
14558 printf("programming error: (%s)\n", strerror(-ret
));
14562 cmdline_parse_inst_t cmd_set_vf_allmulti
= {
14563 .f
= cmd_set_vf_allmulti_parsed
,
14565 .help_str
= "set vf allmulti <port_id> <vf_id> on|off: "
14566 "Set multicast promiscuous mode for a VF from the PF",
14568 (void *)&cmd_vf_allmulti_set
,
14569 (void *)&cmd_vf_allmulti_vf
,
14570 (void *)&cmd_vf_allmulti_allmulti
,
14571 (void *)&cmd_vf_allmulti_port_id
,
14572 (void *)&cmd_vf_allmulti_vf_id
,
14573 (void *)&cmd_vf_allmulti_on_off
,
14578 /* vf broadcast mode configuration */
14580 /* Common result structure for vf broadcast */
14581 struct cmd_set_vf_broadcast_result
{
14582 cmdline_fixed_string_t set
;
14583 cmdline_fixed_string_t vf
;
14584 cmdline_fixed_string_t broadcast
;
14587 cmdline_fixed_string_t on_off
;
14590 /* Common CLI fields for vf broadcast enable disable */
14591 cmdline_parse_token_string_t cmd_set_vf_broadcast_set
=
14592 TOKEN_STRING_INITIALIZER
14593 (struct cmd_set_vf_broadcast_result
,
14595 cmdline_parse_token_string_t cmd_set_vf_broadcast_vf
=
14596 TOKEN_STRING_INITIALIZER
14597 (struct cmd_set_vf_broadcast_result
,
14599 cmdline_parse_token_string_t cmd_set_vf_broadcast_broadcast
=
14600 TOKEN_STRING_INITIALIZER
14601 (struct cmd_set_vf_broadcast_result
,
14602 broadcast
, "broadcast");
14603 cmdline_parse_token_num_t cmd_set_vf_broadcast_port_id
=
14604 TOKEN_NUM_INITIALIZER
14605 (struct cmd_set_vf_broadcast_result
,
14607 cmdline_parse_token_num_t cmd_set_vf_broadcast_vf_id
=
14608 TOKEN_NUM_INITIALIZER
14609 (struct cmd_set_vf_broadcast_result
,
14611 cmdline_parse_token_string_t cmd_set_vf_broadcast_on_off
=
14612 TOKEN_STRING_INITIALIZER
14613 (struct cmd_set_vf_broadcast_result
,
14617 cmd_set_vf_broadcast_parsed(
14618 void *parsed_result
,
14619 __attribute__((unused
)) struct cmdline
*cl
,
14620 __attribute__((unused
)) void *data
)
14622 struct cmd_set_vf_broadcast_result
*res
= parsed_result
;
14623 int ret
= -ENOTSUP
;
14625 __rte_unused
int is_on
= (strcmp(res
->on_off
, "on") == 0) ? 1 : 0;
14627 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
14630 #ifdef RTE_LIBRTE_I40E_PMD
14631 ret
= rte_pmd_i40e_set_vf_broadcast(res
->port_id
,
14632 res
->vf_id
, is_on
);
14639 printf("invalid vf_id %d or is_on %d\n", res
->vf_id
, is_on
);
14642 printf("invalid port_id %d\n", res
->port_id
);
14645 printf("function not implemented\n");
14648 printf("programming error: (%s)\n", strerror(-ret
));
14652 cmdline_parse_inst_t cmd_set_vf_broadcast
= {
14653 .f
= cmd_set_vf_broadcast_parsed
,
14655 .help_str
= "set vf broadcast <port_id> <vf_id> on|off",
14657 (void *)&cmd_set_vf_broadcast_set
,
14658 (void *)&cmd_set_vf_broadcast_vf
,
14659 (void *)&cmd_set_vf_broadcast_broadcast
,
14660 (void *)&cmd_set_vf_broadcast_port_id
,
14661 (void *)&cmd_set_vf_broadcast_vf_id
,
14662 (void *)&cmd_set_vf_broadcast_on_off
,
14667 /* vf vlan tag configuration */
14669 /* Common result structure for vf vlan tag */
14670 struct cmd_set_vf_vlan_tag_result
{
14671 cmdline_fixed_string_t set
;
14672 cmdline_fixed_string_t vf
;
14673 cmdline_fixed_string_t vlan
;
14674 cmdline_fixed_string_t tag
;
14677 cmdline_fixed_string_t on_off
;
14680 /* Common CLI fields for vf vlan tag enable disable */
14681 cmdline_parse_token_string_t cmd_set_vf_vlan_tag_set
=
14682 TOKEN_STRING_INITIALIZER
14683 (struct cmd_set_vf_vlan_tag_result
,
14685 cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vf
=
14686 TOKEN_STRING_INITIALIZER
14687 (struct cmd_set_vf_vlan_tag_result
,
14689 cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vlan
=
14690 TOKEN_STRING_INITIALIZER
14691 (struct cmd_set_vf_vlan_tag_result
,
14693 cmdline_parse_token_string_t cmd_set_vf_vlan_tag_tag
=
14694 TOKEN_STRING_INITIALIZER
14695 (struct cmd_set_vf_vlan_tag_result
,
14697 cmdline_parse_token_num_t cmd_set_vf_vlan_tag_port_id
=
14698 TOKEN_NUM_INITIALIZER
14699 (struct cmd_set_vf_vlan_tag_result
,
14701 cmdline_parse_token_num_t cmd_set_vf_vlan_tag_vf_id
=
14702 TOKEN_NUM_INITIALIZER
14703 (struct cmd_set_vf_vlan_tag_result
,
14705 cmdline_parse_token_string_t cmd_set_vf_vlan_tag_on_off
=
14706 TOKEN_STRING_INITIALIZER
14707 (struct cmd_set_vf_vlan_tag_result
,
14711 cmd_set_vf_vlan_tag_parsed(
14712 void *parsed_result
,
14713 __attribute__((unused
)) struct cmdline
*cl
,
14714 __attribute__((unused
)) void *data
)
14716 struct cmd_set_vf_vlan_tag_result
*res
= parsed_result
;
14717 int ret
= -ENOTSUP
;
14719 __rte_unused
int is_on
= (strcmp(res
->on_off
, "on") == 0) ? 1 : 0;
14721 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
14724 #ifdef RTE_LIBRTE_I40E_PMD
14725 ret
= rte_pmd_i40e_set_vf_vlan_tag(res
->port_id
,
14726 res
->vf_id
, is_on
);
14733 printf("invalid vf_id %d or is_on %d\n", res
->vf_id
, is_on
);
14736 printf("invalid port_id %d\n", res
->port_id
);
14739 printf("function not implemented\n");
14742 printf("programming error: (%s)\n", strerror(-ret
));
14746 cmdline_parse_inst_t cmd_set_vf_vlan_tag
= {
14747 .f
= cmd_set_vf_vlan_tag_parsed
,
14749 .help_str
= "set vf vlan tag <port_id> <vf_id> on|off",
14751 (void *)&cmd_set_vf_vlan_tag_set
,
14752 (void *)&cmd_set_vf_vlan_tag_vf
,
14753 (void *)&cmd_set_vf_vlan_tag_vlan
,
14754 (void *)&cmd_set_vf_vlan_tag_tag
,
14755 (void *)&cmd_set_vf_vlan_tag_port_id
,
14756 (void *)&cmd_set_vf_vlan_tag_vf_id
,
14757 (void *)&cmd_set_vf_vlan_tag_on_off
,
14762 /* Common definition of VF and TC TX bandwidth configuration */
14763 struct cmd_vf_tc_bw_result
{
14764 cmdline_fixed_string_t set
;
14765 cmdline_fixed_string_t vf
;
14766 cmdline_fixed_string_t tc
;
14767 cmdline_fixed_string_t tx
;
14768 cmdline_fixed_string_t min_bw
;
14769 cmdline_fixed_string_t max_bw
;
14770 cmdline_fixed_string_t strict_link_prio
;
14775 cmdline_fixed_string_t bw_list
;
14779 cmdline_parse_token_string_t cmd_vf_tc_bw_set
=
14780 TOKEN_STRING_INITIALIZER
14781 (struct cmd_vf_tc_bw_result
,
14783 cmdline_parse_token_string_t cmd_vf_tc_bw_vf
=
14784 TOKEN_STRING_INITIALIZER
14785 (struct cmd_vf_tc_bw_result
,
14787 cmdline_parse_token_string_t cmd_vf_tc_bw_tc
=
14788 TOKEN_STRING_INITIALIZER
14789 (struct cmd_vf_tc_bw_result
,
14791 cmdline_parse_token_string_t cmd_vf_tc_bw_tx
=
14792 TOKEN_STRING_INITIALIZER
14793 (struct cmd_vf_tc_bw_result
,
14795 cmdline_parse_token_string_t cmd_vf_tc_bw_strict_link_prio
=
14796 TOKEN_STRING_INITIALIZER
14797 (struct cmd_vf_tc_bw_result
,
14798 strict_link_prio
, "strict-link-priority");
14799 cmdline_parse_token_string_t cmd_vf_tc_bw_min_bw
=
14800 TOKEN_STRING_INITIALIZER
14801 (struct cmd_vf_tc_bw_result
,
14802 min_bw
, "min-bandwidth");
14803 cmdline_parse_token_string_t cmd_vf_tc_bw_max_bw
=
14804 TOKEN_STRING_INITIALIZER
14805 (struct cmd_vf_tc_bw_result
,
14806 max_bw
, "max-bandwidth");
14807 cmdline_parse_token_num_t cmd_vf_tc_bw_port_id
=
14808 TOKEN_NUM_INITIALIZER
14809 (struct cmd_vf_tc_bw_result
,
14811 cmdline_parse_token_num_t cmd_vf_tc_bw_vf_id
=
14812 TOKEN_NUM_INITIALIZER
14813 (struct cmd_vf_tc_bw_result
,
14815 cmdline_parse_token_num_t cmd_vf_tc_bw_tc_no
=
14816 TOKEN_NUM_INITIALIZER
14817 (struct cmd_vf_tc_bw_result
,
14819 cmdline_parse_token_num_t cmd_vf_tc_bw_bw
=
14820 TOKEN_NUM_INITIALIZER
14821 (struct cmd_vf_tc_bw_result
,
14823 cmdline_parse_token_string_t cmd_vf_tc_bw_bw_list
=
14824 TOKEN_STRING_INITIALIZER
14825 (struct cmd_vf_tc_bw_result
,
14827 cmdline_parse_token_num_t cmd_vf_tc_bw_tc_map
=
14828 TOKEN_NUM_INITIALIZER
14829 (struct cmd_vf_tc_bw_result
,
14832 /* VF max bandwidth setting */
14834 cmd_vf_max_bw_parsed(
14835 void *parsed_result
,
14836 __attribute__((unused
)) struct cmdline
*cl
,
14837 __attribute__((unused
)) void *data
)
14839 struct cmd_vf_tc_bw_result
*res
= parsed_result
;
14840 int ret
= -ENOTSUP
;
14842 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
14845 #ifdef RTE_LIBRTE_I40E_PMD
14846 ret
= rte_pmd_i40e_set_vf_max_bw(res
->port_id
,
14847 res
->vf_id
, res
->bw
);
14854 printf("invalid vf_id %d or bandwidth %d\n",
14855 res
->vf_id
, res
->bw
);
14858 printf("invalid port_id %d\n", res
->port_id
);
14861 printf("function not implemented\n");
14864 printf("programming error: (%s)\n", strerror(-ret
));
14868 cmdline_parse_inst_t cmd_vf_max_bw
= {
14869 .f
= cmd_vf_max_bw_parsed
,
14871 .help_str
= "set vf tx max-bandwidth <port_id> <vf_id> <bandwidth>",
14873 (void *)&cmd_vf_tc_bw_set
,
14874 (void *)&cmd_vf_tc_bw_vf
,
14875 (void *)&cmd_vf_tc_bw_tx
,
14876 (void *)&cmd_vf_tc_bw_max_bw
,
14877 (void *)&cmd_vf_tc_bw_port_id
,
14878 (void *)&cmd_vf_tc_bw_vf_id
,
14879 (void *)&cmd_vf_tc_bw_bw
,
14885 vf_tc_min_bw_parse_bw_list(uint8_t *bw_list
,
14890 const char *p
, *p0
= str
;
14897 p
= strchr(p0
, '(');
14899 printf("The bandwidth-list should be '(bw1, bw2, ...)'\n");
14903 p0
= strchr(p
, ')');
14905 printf("The bandwidth-list should be '(bw1, bw2, ...)'\n");
14909 if (size
>= sizeof(s
)) {
14910 printf("The string size exceeds the internal buffer size\n");
14913 snprintf(s
, sizeof(s
), "%.*s", size
, p
);
14914 ret
= rte_strsplit(s
, sizeof(s
), str_fld
, 16, ',');
14916 printf("Failed to get the bandwidth list. ");
14920 for (i
= 0; i
< ret
; i
++)
14921 bw_list
[i
] = (uint8_t)strtoul(str_fld
[i
], &end
, 0);
14926 /* TC min bandwidth setting */
14928 cmd_vf_tc_min_bw_parsed(
14929 void *parsed_result
,
14930 __attribute__((unused
)) struct cmdline
*cl
,
14931 __attribute__((unused
)) void *data
)
14933 struct cmd_vf_tc_bw_result
*res
= parsed_result
;
14936 int ret
= -ENOTSUP
;
14938 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
14941 ret
= vf_tc_min_bw_parse_bw_list(bw
, &tc_num
, res
->bw_list
);
14945 #ifdef RTE_LIBRTE_I40E_PMD
14946 ret
= rte_pmd_i40e_set_vf_tc_bw_alloc(res
->port_id
, res
->vf_id
,
14954 printf("invalid vf_id %d or bandwidth\n", res
->vf_id
);
14957 printf("invalid port_id %d\n", res
->port_id
);
14960 printf("function not implemented\n");
14963 printf("programming error: (%s)\n", strerror(-ret
));
14967 cmdline_parse_inst_t cmd_vf_tc_min_bw
= {
14968 .f
= cmd_vf_tc_min_bw_parsed
,
14970 .help_str
= "set vf tc tx min-bandwidth <port_id> <vf_id>"
14971 " <bw1, bw2, ...>",
14973 (void *)&cmd_vf_tc_bw_set
,
14974 (void *)&cmd_vf_tc_bw_vf
,
14975 (void *)&cmd_vf_tc_bw_tc
,
14976 (void *)&cmd_vf_tc_bw_tx
,
14977 (void *)&cmd_vf_tc_bw_min_bw
,
14978 (void *)&cmd_vf_tc_bw_port_id
,
14979 (void *)&cmd_vf_tc_bw_vf_id
,
14980 (void *)&cmd_vf_tc_bw_bw_list
,
14986 cmd_tc_min_bw_parsed(
14987 void *parsed_result
,
14988 __attribute__((unused
)) struct cmdline
*cl
,
14989 __attribute__((unused
)) void *data
)
14991 struct cmd_vf_tc_bw_result
*res
= parsed_result
;
14992 struct rte_port
*port
;
14995 int ret
= -ENOTSUP
;
14997 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
15000 port
= &ports
[res
->port_id
];
15001 /** Check if the port is not started **/
15002 if (port
->port_status
!= RTE_PORT_STOPPED
) {
15003 printf("Please stop port %d first\n", res
->port_id
);
15007 ret
= vf_tc_min_bw_parse_bw_list(bw
, &tc_num
, res
->bw_list
);
15011 #ifdef RTE_LIBRTE_IXGBE_PMD
15012 ret
= rte_pmd_ixgbe_set_tc_bw_alloc(res
->port_id
, tc_num
, bw
);
15019 printf("invalid bandwidth\n");
15022 printf("invalid port_id %d\n", res
->port_id
);
15025 printf("function not implemented\n");
15028 printf("programming error: (%s)\n", strerror(-ret
));
15032 cmdline_parse_inst_t cmd_tc_min_bw
= {
15033 .f
= cmd_tc_min_bw_parsed
,
15035 .help_str
= "set tc tx min-bandwidth <port_id> <bw1, bw2, ...>",
15037 (void *)&cmd_vf_tc_bw_set
,
15038 (void *)&cmd_vf_tc_bw_tc
,
15039 (void *)&cmd_vf_tc_bw_tx
,
15040 (void *)&cmd_vf_tc_bw_min_bw
,
15041 (void *)&cmd_vf_tc_bw_port_id
,
15042 (void *)&cmd_vf_tc_bw_bw_list
,
15047 /* TC max bandwidth setting */
15049 cmd_vf_tc_max_bw_parsed(
15050 void *parsed_result
,
15051 __attribute__((unused
)) struct cmdline
*cl
,
15052 __attribute__((unused
)) void *data
)
15054 struct cmd_vf_tc_bw_result
*res
= parsed_result
;
15055 int ret
= -ENOTSUP
;
15057 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
15060 #ifdef RTE_LIBRTE_I40E_PMD
15061 ret
= rte_pmd_i40e_set_vf_tc_max_bw(res
->port_id
, res
->vf_id
,
15062 res
->tc_no
, res
->bw
);
15069 printf("invalid vf_id %d, tc_no %d or bandwidth %d\n",
15070 res
->vf_id
, res
->tc_no
, res
->bw
);
15073 printf("invalid port_id %d\n", res
->port_id
);
15076 printf("function not implemented\n");
15079 printf("programming error: (%s)\n", strerror(-ret
));
15083 cmdline_parse_inst_t cmd_vf_tc_max_bw
= {
15084 .f
= cmd_vf_tc_max_bw_parsed
,
15086 .help_str
= "set vf tc tx max-bandwidth <port_id> <vf_id> <tc_no>"
15089 (void *)&cmd_vf_tc_bw_set
,
15090 (void *)&cmd_vf_tc_bw_vf
,
15091 (void *)&cmd_vf_tc_bw_tc
,
15092 (void *)&cmd_vf_tc_bw_tx
,
15093 (void *)&cmd_vf_tc_bw_max_bw
,
15094 (void *)&cmd_vf_tc_bw_port_id
,
15095 (void *)&cmd_vf_tc_bw_vf_id
,
15096 (void *)&cmd_vf_tc_bw_tc_no
,
15097 (void *)&cmd_vf_tc_bw_bw
,
15103 #if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED
15105 /* *** Set Port default Traffic Management Hierarchy *** */
15106 struct cmd_set_port_tm_hierarchy_default_result
{
15107 cmdline_fixed_string_t set
;
15108 cmdline_fixed_string_t port
;
15109 cmdline_fixed_string_t tm
;
15110 cmdline_fixed_string_t hierarchy
;
15111 cmdline_fixed_string_t def
;
15115 cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_set
=
15116 TOKEN_STRING_INITIALIZER(
15117 struct cmd_set_port_tm_hierarchy_default_result
, set
, "set");
15118 cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_port
=
15119 TOKEN_STRING_INITIALIZER(
15120 struct cmd_set_port_tm_hierarchy_default_result
, port
, "port");
15121 cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_tm
=
15122 TOKEN_STRING_INITIALIZER(
15123 struct cmd_set_port_tm_hierarchy_default_result
, tm
, "tm");
15124 cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_hierarchy
=
15125 TOKEN_STRING_INITIALIZER(
15126 struct cmd_set_port_tm_hierarchy_default_result
,
15127 hierarchy
, "hierarchy");
15128 cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_default
=
15129 TOKEN_STRING_INITIALIZER(
15130 struct cmd_set_port_tm_hierarchy_default_result
,
15132 cmdline_parse_token_num_t cmd_set_port_tm_hierarchy_default_port_id
=
15133 TOKEN_NUM_INITIALIZER(
15134 struct cmd_set_port_tm_hierarchy_default_result
,
15137 static void cmd_set_port_tm_hierarchy_default_parsed(void *parsed_result
,
15138 __attribute__((unused
)) struct cmdline
*cl
,
15139 __attribute__((unused
)) void *data
)
15141 struct cmd_set_port_tm_hierarchy_default_result
*res
= parsed_result
;
15142 struct rte_port
*p
;
15143 portid_t port_id
= res
->port_id
;
15145 if (port_id_is_invalid(port_id
, ENABLED_WARN
))
15148 p
= &ports
[port_id
];
15150 /* Forward mode: tm */
15151 if (strcmp(cur_fwd_config
.fwd_eng
->fwd_mode_name
, "softnic")) {
15152 printf(" softnicfwd mode not enabled(error)\n");
15156 /* Set the default tm hierarchy */
15157 p
->softport
.default_tm_hierarchy_enable
= 1;
15160 cmdline_parse_inst_t cmd_set_port_tm_hierarchy_default
= {
15161 .f
= cmd_set_port_tm_hierarchy_default_parsed
,
15163 .help_str
= "set port tm hierarchy default <port_id>",
15165 (void *)&cmd_set_port_tm_hierarchy_default_set
,
15166 (void *)&cmd_set_port_tm_hierarchy_default_port
,
15167 (void *)&cmd_set_port_tm_hierarchy_default_tm
,
15168 (void *)&cmd_set_port_tm_hierarchy_default_hierarchy
,
15169 (void *)&cmd_set_port_tm_hierarchy_default_default
,
15170 (void *)&cmd_set_port_tm_hierarchy_default_port_id
,
15176 /** Set VXLAN encapsulation details */
15177 struct cmd_set_vxlan_result
{
15178 cmdline_fixed_string_t set
;
15179 cmdline_fixed_string_t vxlan
;
15180 cmdline_fixed_string_t pos_token
;
15181 cmdline_fixed_string_t ip_version
;
15182 uint32_t vlan_present
:1;
15186 cmdline_ipaddr_t ip_src
;
15187 cmdline_ipaddr_t ip_dst
;
15191 struct ether_addr eth_src
;
15192 struct ether_addr eth_dst
;
15195 cmdline_parse_token_string_t cmd_set_vxlan_set
=
15196 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, set
, "set");
15197 cmdline_parse_token_string_t cmd_set_vxlan_vxlan
=
15198 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, vxlan
, "vxlan");
15199 cmdline_parse_token_string_t cmd_set_vxlan_vxlan_tos_ttl
=
15200 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, vxlan
,
15202 cmdline_parse_token_string_t cmd_set_vxlan_vxlan_with_vlan
=
15203 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, vxlan
,
15204 "vxlan-with-vlan");
15205 cmdline_parse_token_string_t cmd_set_vxlan_ip_version
=
15206 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, pos_token
,
15208 cmdline_parse_token_string_t cmd_set_vxlan_ip_version_value
=
15209 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, ip_version
,
15211 cmdline_parse_token_string_t cmd_set_vxlan_vni
=
15212 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, pos_token
,
15214 cmdline_parse_token_num_t cmd_set_vxlan_vni_value
=
15215 TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result
, vni
, UINT32
);
15216 cmdline_parse_token_string_t cmd_set_vxlan_udp_src
=
15217 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, pos_token
,
15219 cmdline_parse_token_num_t cmd_set_vxlan_udp_src_value
=
15220 TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result
, udp_src
, UINT16
);
15221 cmdline_parse_token_string_t cmd_set_vxlan_udp_dst
=
15222 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, pos_token
,
15224 cmdline_parse_token_num_t cmd_set_vxlan_udp_dst_value
=
15225 TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result
, udp_dst
, UINT16
);
15226 cmdline_parse_token_string_t cmd_set_vxlan_ip_tos
=
15227 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, pos_token
,
15229 cmdline_parse_token_num_t cmd_set_vxlan_ip_tos_value
=
15230 TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result
, tos
, UINT8
);
15231 cmdline_parse_token_string_t cmd_set_vxlan_ip_ttl
=
15232 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, pos_token
,
15234 cmdline_parse_token_num_t cmd_set_vxlan_ip_ttl_value
=
15235 TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result
, ttl
, UINT8
);
15236 cmdline_parse_token_string_t cmd_set_vxlan_ip_src
=
15237 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, pos_token
,
15239 cmdline_parse_token_ipaddr_t cmd_set_vxlan_ip_src_value
=
15240 TOKEN_IPADDR_INITIALIZER(struct cmd_set_vxlan_result
, ip_src
);
15241 cmdline_parse_token_string_t cmd_set_vxlan_ip_dst
=
15242 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, pos_token
,
15244 cmdline_parse_token_ipaddr_t cmd_set_vxlan_ip_dst_value
=
15245 TOKEN_IPADDR_INITIALIZER(struct cmd_set_vxlan_result
, ip_dst
);
15246 cmdline_parse_token_string_t cmd_set_vxlan_vlan
=
15247 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, pos_token
,
15249 cmdline_parse_token_num_t cmd_set_vxlan_vlan_value
=
15250 TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result
, tci
, UINT16
);
15251 cmdline_parse_token_string_t cmd_set_vxlan_eth_src
=
15252 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, pos_token
,
15254 cmdline_parse_token_etheraddr_t cmd_set_vxlan_eth_src_value
=
15255 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_vxlan_result
, eth_src
);
15256 cmdline_parse_token_string_t cmd_set_vxlan_eth_dst
=
15257 TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result
, pos_token
,
15259 cmdline_parse_token_etheraddr_t cmd_set_vxlan_eth_dst_value
=
15260 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_vxlan_result
, eth_dst
);
15262 static void cmd_set_vxlan_parsed(void *parsed_result
,
15263 __attribute__((unused
)) struct cmdline
*cl
,
15264 __attribute__((unused
)) void *data
)
15266 struct cmd_set_vxlan_result
*res
= parsed_result
;
15271 .vxlan_id
= rte_cpu_to_be_32(res
->vni
) & RTE_BE32(0x00ffffff),
15274 vxlan_encap_conf
.select_tos_ttl
= 0;
15275 if (strcmp(res
->vxlan
, "vxlan") == 0)
15276 vxlan_encap_conf
.select_vlan
= 0;
15277 else if (strcmp(res
->vxlan
, "vxlan-with-vlan") == 0)
15278 vxlan_encap_conf
.select_vlan
= 1;
15279 else if (strcmp(res
->vxlan
, "vxlan-tos-ttl") == 0) {
15280 vxlan_encap_conf
.select_vlan
= 0;
15281 vxlan_encap_conf
.select_tos_ttl
= 1;
15283 if (strcmp(res
->ip_version
, "ipv4") == 0)
15284 vxlan_encap_conf
.select_ipv4
= 1;
15285 else if (strcmp(res
->ip_version
, "ipv6") == 0)
15286 vxlan_encap_conf
.select_ipv4
= 0;
15289 rte_memcpy(vxlan_encap_conf
.vni
, &id
.vni
[1], 3);
15290 vxlan_encap_conf
.udp_src
= rte_cpu_to_be_16(res
->udp_src
);
15291 vxlan_encap_conf
.udp_dst
= rte_cpu_to_be_16(res
->udp_dst
);
15292 vxlan_encap_conf
.ip_tos
= res
->tos
;
15293 vxlan_encap_conf
.ip_ttl
= res
->ttl
;
15294 if (vxlan_encap_conf
.select_ipv4
) {
15295 IPV4_ADDR_TO_UINT(res
->ip_src
, vxlan_encap_conf
.ipv4_src
);
15296 IPV4_ADDR_TO_UINT(res
->ip_dst
, vxlan_encap_conf
.ipv4_dst
);
15298 IPV6_ADDR_TO_ARRAY(res
->ip_src
, vxlan_encap_conf
.ipv6_src
);
15299 IPV6_ADDR_TO_ARRAY(res
->ip_dst
, vxlan_encap_conf
.ipv6_dst
);
15301 if (vxlan_encap_conf
.select_vlan
)
15302 vxlan_encap_conf
.vlan_tci
= rte_cpu_to_be_16(res
->tci
);
15303 rte_memcpy(vxlan_encap_conf
.eth_src
, res
->eth_src
.addr_bytes
,
15305 rte_memcpy(vxlan_encap_conf
.eth_dst
, res
->eth_dst
.addr_bytes
,
15309 cmdline_parse_inst_t cmd_set_vxlan
= {
15310 .f
= cmd_set_vxlan_parsed
,
15312 .help_str
= "set vxlan ip-version ipv4|ipv6 vni <vni> udp-src"
15313 " <udp-src> udp-dst <udp-dst> ip-src <ip-src> ip-dst <ip-dst>"
15314 " eth-src <eth-src> eth-dst <eth-dst>",
15316 (void *)&cmd_set_vxlan_set
,
15317 (void *)&cmd_set_vxlan_vxlan
,
15318 (void *)&cmd_set_vxlan_ip_version
,
15319 (void *)&cmd_set_vxlan_ip_version_value
,
15320 (void *)&cmd_set_vxlan_vni
,
15321 (void *)&cmd_set_vxlan_vni_value
,
15322 (void *)&cmd_set_vxlan_udp_src
,
15323 (void *)&cmd_set_vxlan_udp_src_value
,
15324 (void *)&cmd_set_vxlan_udp_dst
,
15325 (void *)&cmd_set_vxlan_udp_dst_value
,
15326 (void *)&cmd_set_vxlan_ip_src
,
15327 (void *)&cmd_set_vxlan_ip_src_value
,
15328 (void *)&cmd_set_vxlan_ip_dst
,
15329 (void *)&cmd_set_vxlan_ip_dst_value
,
15330 (void *)&cmd_set_vxlan_eth_src
,
15331 (void *)&cmd_set_vxlan_eth_src_value
,
15332 (void *)&cmd_set_vxlan_eth_dst
,
15333 (void *)&cmd_set_vxlan_eth_dst_value
,
15338 cmdline_parse_inst_t cmd_set_vxlan_tos_ttl
= {
15339 .f
= cmd_set_vxlan_parsed
,
15341 .help_str
= "set vxlan-tos-ttl ip-version ipv4|ipv6 vni <vni> udp-src"
15342 " <udp-src> udp-dst <udp-dst> ip-tos <ip-tos> ip-ttl <ip-ttl>"
15343 " ip-src <ip-src> ip-dst <ip-dst> eth-src <eth-src>"
15344 " eth-dst <eth-dst>",
15346 (void *)&cmd_set_vxlan_set
,
15347 (void *)&cmd_set_vxlan_vxlan_tos_ttl
,
15348 (void *)&cmd_set_vxlan_ip_version
,
15349 (void *)&cmd_set_vxlan_ip_version_value
,
15350 (void *)&cmd_set_vxlan_vni
,
15351 (void *)&cmd_set_vxlan_vni_value
,
15352 (void *)&cmd_set_vxlan_udp_src
,
15353 (void *)&cmd_set_vxlan_udp_src_value
,
15354 (void *)&cmd_set_vxlan_udp_dst
,
15355 (void *)&cmd_set_vxlan_udp_dst_value
,
15356 (void *)&cmd_set_vxlan_ip_tos
,
15357 (void *)&cmd_set_vxlan_ip_tos_value
,
15358 (void *)&cmd_set_vxlan_ip_ttl
,
15359 (void *)&cmd_set_vxlan_ip_ttl_value
,
15360 (void *)&cmd_set_vxlan_ip_src
,
15361 (void *)&cmd_set_vxlan_ip_src_value
,
15362 (void *)&cmd_set_vxlan_ip_dst
,
15363 (void *)&cmd_set_vxlan_ip_dst_value
,
15364 (void *)&cmd_set_vxlan_eth_src
,
15365 (void *)&cmd_set_vxlan_eth_src_value
,
15366 (void *)&cmd_set_vxlan_eth_dst
,
15367 (void *)&cmd_set_vxlan_eth_dst_value
,
15372 cmdline_parse_inst_t cmd_set_vxlan_with_vlan
= {
15373 .f
= cmd_set_vxlan_parsed
,
15375 .help_str
= "set vxlan-with-vlan ip-version ipv4|ipv6 vni <vni>"
15376 " udp-src <udp-src> udp-dst <udp-dst> ip-src <ip-src> ip-dst"
15377 " <ip-dst> vlan-tci <vlan-tci> eth-src <eth-src> eth-dst"
15380 (void *)&cmd_set_vxlan_set
,
15381 (void *)&cmd_set_vxlan_vxlan_with_vlan
,
15382 (void *)&cmd_set_vxlan_ip_version
,
15383 (void *)&cmd_set_vxlan_ip_version_value
,
15384 (void *)&cmd_set_vxlan_vni
,
15385 (void *)&cmd_set_vxlan_vni_value
,
15386 (void *)&cmd_set_vxlan_udp_src
,
15387 (void *)&cmd_set_vxlan_udp_src_value
,
15388 (void *)&cmd_set_vxlan_udp_dst
,
15389 (void *)&cmd_set_vxlan_udp_dst_value
,
15390 (void *)&cmd_set_vxlan_ip_src
,
15391 (void *)&cmd_set_vxlan_ip_src_value
,
15392 (void *)&cmd_set_vxlan_ip_dst
,
15393 (void *)&cmd_set_vxlan_ip_dst_value
,
15394 (void *)&cmd_set_vxlan_vlan
,
15395 (void *)&cmd_set_vxlan_vlan_value
,
15396 (void *)&cmd_set_vxlan_eth_src
,
15397 (void *)&cmd_set_vxlan_eth_src_value
,
15398 (void *)&cmd_set_vxlan_eth_dst
,
15399 (void *)&cmd_set_vxlan_eth_dst_value
,
15404 /** Set NVGRE encapsulation details */
15405 struct cmd_set_nvgre_result
{
15406 cmdline_fixed_string_t set
;
15407 cmdline_fixed_string_t nvgre
;
15408 cmdline_fixed_string_t pos_token
;
15409 cmdline_fixed_string_t ip_version
;
15411 cmdline_ipaddr_t ip_src
;
15412 cmdline_ipaddr_t ip_dst
;
15414 struct ether_addr eth_src
;
15415 struct ether_addr eth_dst
;
15418 cmdline_parse_token_string_t cmd_set_nvgre_set
=
15419 TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result
, set
, "set");
15420 cmdline_parse_token_string_t cmd_set_nvgre_nvgre
=
15421 TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result
, nvgre
, "nvgre");
15422 cmdline_parse_token_string_t cmd_set_nvgre_nvgre_with_vlan
=
15423 TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result
, nvgre
,
15424 "nvgre-with-vlan");
15425 cmdline_parse_token_string_t cmd_set_nvgre_ip_version
=
15426 TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result
, pos_token
,
15428 cmdline_parse_token_string_t cmd_set_nvgre_ip_version_value
=
15429 TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result
, ip_version
,
15431 cmdline_parse_token_string_t cmd_set_nvgre_tni
=
15432 TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result
, pos_token
,
15434 cmdline_parse_token_num_t cmd_set_nvgre_tni_value
=
15435 TOKEN_NUM_INITIALIZER(struct cmd_set_nvgre_result
, tni
, UINT32
);
15436 cmdline_parse_token_string_t cmd_set_nvgre_ip_src
=
15437 TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result
, pos_token
,
15439 cmdline_parse_token_num_t cmd_set_nvgre_ip_src_value
=
15440 TOKEN_IPADDR_INITIALIZER(struct cmd_set_nvgre_result
, ip_src
);
15441 cmdline_parse_token_string_t cmd_set_nvgre_ip_dst
=
15442 TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result
, pos_token
,
15444 cmdline_parse_token_ipaddr_t cmd_set_nvgre_ip_dst_value
=
15445 TOKEN_IPADDR_INITIALIZER(struct cmd_set_nvgre_result
, ip_dst
);
15446 cmdline_parse_token_string_t cmd_set_nvgre_vlan
=
15447 TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result
, pos_token
,
15449 cmdline_parse_token_num_t cmd_set_nvgre_vlan_value
=
15450 TOKEN_NUM_INITIALIZER(struct cmd_set_nvgre_result
, tci
, UINT16
);
15451 cmdline_parse_token_string_t cmd_set_nvgre_eth_src
=
15452 TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result
, pos_token
,
15454 cmdline_parse_token_etheraddr_t cmd_set_nvgre_eth_src_value
=
15455 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_nvgre_result
, eth_src
);
15456 cmdline_parse_token_string_t cmd_set_nvgre_eth_dst
=
15457 TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result
, pos_token
,
15459 cmdline_parse_token_etheraddr_t cmd_set_nvgre_eth_dst_value
=
15460 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_nvgre_result
, eth_dst
);
15462 static void cmd_set_nvgre_parsed(void *parsed_result
,
15463 __attribute__((unused
)) struct cmdline
*cl
,
15464 __attribute__((unused
)) void *data
)
15466 struct cmd_set_nvgre_result
*res
= parsed_result
;
15468 uint32_t nvgre_tni
;
15471 .nvgre_tni
= rte_cpu_to_be_32(res
->tni
) & RTE_BE32(0x00ffffff),
15474 if (strcmp(res
->nvgre
, "nvgre") == 0)
15475 nvgre_encap_conf
.select_vlan
= 0;
15476 else if (strcmp(res
->nvgre
, "nvgre-with-vlan") == 0)
15477 nvgre_encap_conf
.select_vlan
= 1;
15478 if (strcmp(res
->ip_version
, "ipv4") == 0)
15479 nvgre_encap_conf
.select_ipv4
= 1;
15480 else if (strcmp(res
->ip_version
, "ipv6") == 0)
15481 nvgre_encap_conf
.select_ipv4
= 0;
15484 rte_memcpy(nvgre_encap_conf
.tni
, &id
.tni
[1], 3);
15485 if (nvgre_encap_conf
.select_ipv4
) {
15486 IPV4_ADDR_TO_UINT(res
->ip_src
, nvgre_encap_conf
.ipv4_src
);
15487 IPV4_ADDR_TO_UINT(res
->ip_dst
, nvgre_encap_conf
.ipv4_dst
);
15489 IPV6_ADDR_TO_ARRAY(res
->ip_src
, nvgre_encap_conf
.ipv6_src
);
15490 IPV6_ADDR_TO_ARRAY(res
->ip_dst
, nvgre_encap_conf
.ipv6_dst
);
15492 if (nvgre_encap_conf
.select_vlan
)
15493 nvgre_encap_conf
.vlan_tci
= rte_cpu_to_be_16(res
->tci
);
15494 rte_memcpy(nvgre_encap_conf
.eth_src
, res
->eth_src
.addr_bytes
,
15496 rte_memcpy(nvgre_encap_conf
.eth_dst
, res
->eth_dst
.addr_bytes
,
15500 cmdline_parse_inst_t cmd_set_nvgre
= {
15501 .f
= cmd_set_nvgre_parsed
,
15503 .help_str
= "set nvgre ip-version <ipv4|ipv6> tni <tni> ip-src"
15504 " <ip-src> ip-dst <ip-dst> eth-src <eth-src>"
15505 " eth-dst <eth-dst>",
15507 (void *)&cmd_set_nvgre_set
,
15508 (void *)&cmd_set_nvgre_nvgre
,
15509 (void *)&cmd_set_nvgre_ip_version
,
15510 (void *)&cmd_set_nvgre_ip_version_value
,
15511 (void *)&cmd_set_nvgre_tni
,
15512 (void *)&cmd_set_nvgre_tni_value
,
15513 (void *)&cmd_set_nvgre_ip_src
,
15514 (void *)&cmd_set_nvgre_ip_src_value
,
15515 (void *)&cmd_set_nvgre_ip_dst
,
15516 (void *)&cmd_set_nvgre_ip_dst_value
,
15517 (void *)&cmd_set_nvgre_eth_src
,
15518 (void *)&cmd_set_nvgre_eth_src_value
,
15519 (void *)&cmd_set_nvgre_eth_dst
,
15520 (void *)&cmd_set_nvgre_eth_dst_value
,
15525 cmdline_parse_inst_t cmd_set_nvgre_with_vlan
= {
15526 .f
= cmd_set_nvgre_parsed
,
15528 .help_str
= "set nvgre-with-vlan ip-version <ipv4|ipv6> tni <tni>"
15529 " ip-src <ip-src> ip-dst <ip-dst> vlan-tci <vlan-tci>"
15530 " eth-src <eth-src> eth-dst <eth-dst>",
15532 (void *)&cmd_set_nvgre_set
,
15533 (void *)&cmd_set_nvgre_nvgre_with_vlan
,
15534 (void *)&cmd_set_nvgre_ip_version
,
15535 (void *)&cmd_set_nvgre_ip_version_value
,
15536 (void *)&cmd_set_nvgre_tni
,
15537 (void *)&cmd_set_nvgre_tni_value
,
15538 (void *)&cmd_set_nvgre_ip_src
,
15539 (void *)&cmd_set_nvgre_ip_src_value
,
15540 (void *)&cmd_set_nvgre_ip_dst
,
15541 (void *)&cmd_set_nvgre_ip_dst_value
,
15542 (void *)&cmd_set_nvgre_vlan
,
15543 (void *)&cmd_set_nvgre_vlan_value
,
15544 (void *)&cmd_set_nvgre_eth_src
,
15545 (void *)&cmd_set_nvgre_eth_src_value
,
15546 (void *)&cmd_set_nvgre_eth_dst
,
15547 (void *)&cmd_set_nvgre_eth_dst_value
,
15552 /** Set L2 encapsulation details */
15553 struct cmd_set_l2_encap_result
{
15554 cmdline_fixed_string_t set
;
15555 cmdline_fixed_string_t l2_encap
;
15556 cmdline_fixed_string_t pos_token
;
15557 cmdline_fixed_string_t ip_version
;
15558 uint32_t vlan_present
:1;
15560 struct ether_addr eth_src
;
15561 struct ether_addr eth_dst
;
15564 cmdline_parse_token_string_t cmd_set_l2_encap_set
=
15565 TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result
, set
, "set");
15566 cmdline_parse_token_string_t cmd_set_l2_encap_l2_encap
=
15567 TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result
, l2_encap
, "l2_encap");
15568 cmdline_parse_token_string_t cmd_set_l2_encap_l2_encap_with_vlan
=
15569 TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result
, l2_encap
,
15570 "l2_encap-with-vlan");
15571 cmdline_parse_token_string_t cmd_set_l2_encap_ip_version
=
15572 TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result
, pos_token
,
15574 cmdline_parse_token_string_t cmd_set_l2_encap_ip_version_value
=
15575 TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result
, ip_version
,
15577 cmdline_parse_token_string_t cmd_set_l2_encap_vlan
=
15578 TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result
, pos_token
,
15580 cmdline_parse_token_num_t cmd_set_l2_encap_vlan_value
=
15581 TOKEN_NUM_INITIALIZER(struct cmd_set_l2_encap_result
, tci
, UINT16
);
15582 cmdline_parse_token_string_t cmd_set_l2_encap_eth_src
=
15583 TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result
, pos_token
,
15585 cmdline_parse_token_etheraddr_t cmd_set_l2_encap_eth_src_value
=
15586 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_l2_encap_result
, eth_src
);
15587 cmdline_parse_token_string_t cmd_set_l2_encap_eth_dst
=
15588 TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result
, pos_token
,
15590 cmdline_parse_token_etheraddr_t cmd_set_l2_encap_eth_dst_value
=
15591 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_l2_encap_result
, eth_dst
);
15593 static void cmd_set_l2_encap_parsed(void *parsed_result
,
15594 __attribute__((unused
)) struct cmdline
*cl
,
15595 __attribute__((unused
)) void *data
)
15597 struct cmd_set_l2_encap_result
*res
= parsed_result
;
15599 if (strcmp(res
->l2_encap
, "l2_encap") == 0)
15600 l2_encap_conf
.select_vlan
= 0;
15601 else if (strcmp(res
->l2_encap
, "l2_encap-with-vlan") == 0)
15602 l2_encap_conf
.select_vlan
= 1;
15603 if (strcmp(res
->ip_version
, "ipv4") == 0)
15604 l2_encap_conf
.select_ipv4
= 1;
15605 else if (strcmp(res
->ip_version
, "ipv6") == 0)
15606 l2_encap_conf
.select_ipv4
= 0;
15609 if (l2_encap_conf
.select_vlan
)
15610 l2_encap_conf
.vlan_tci
= rte_cpu_to_be_16(res
->tci
);
15611 rte_memcpy(l2_encap_conf
.eth_src
, res
->eth_src
.addr_bytes
,
15613 rte_memcpy(l2_encap_conf
.eth_dst
, res
->eth_dst
.addr_bytes
,
15617 cmdline_parse_inst_t cmd_set_l2_encap
= {
15618 .f
= cmd_set_l2_encap_parsed
,
15620 .help_str
= "set l2_encap ip-version ipv4|ipv6"
15621 " eth-src <eth-src> eth-dst <eth-dst>",
15623 (void *)&cmd_set_l2_encap_set
,
15624 (void *)&cmd_set_l2_encap_l2_encap
,
15625 (void *)&cmd_set_l2_encap_ip_version
,
15626 (void *)&cmd_set_l2_encap_ip_version_value
,
15627 (void *)&cmd_set_l2_encap_eth_src
,
15628 (void *)&cmd_set_l2_encap_eth_src_value
,
15629 (void *)&cmd_set_l2_encap_eth_dst
,
15630 (void *)&cmd_set_l2_encap_eth_dst_value
,
15635 cmdline_parse_inst_t cmd_set_l2_encap_with_vlan
= {
15636 .f
= cmd_set_l2_encap_parsed
,
15638 .help_str
= "set l2_encap-with-vlan ip-version ipv4|ipv6"
15639 " vlan-tci <vlan-tci> eth-src <eth-src> eth-dst <eth-dst>",
15641 (void *)&cmd_set_l2_encap_set
,
15642 (void *)&cmd_set_l2_encap_l2_encap_with_vlan
,
15643 (void *)&cmd_set_l2_encap_ip_version
,
15644 (void *)&cmd_set_l2_encap_ip_version_value
,
15645 (void *)&cmd_set_l2_encap_vlan
,
15646 (void *)&cmd_set_l2_encap_vlan_value
,
15647 (void *)&cmd_set_l2_encap_eth_src
,
15648 (void *)&cmd_set_l2_encap_eth_src_value
,
15649 (void *)&cmd_set_l2_encap_eth_dst
,
15650 (void *)&cmd_set_l2_encap_eth_dst_value
,
15655 /** Set L2 decapsulation details */
15656 struct cmd_set_l2_decap_result
{
15657 cmdline_fixed_string_t set
;
15658 cmdline_fixed_string_t l2_decap
;
15659 cmdline_fixed_string_t pos_token
;
15660 uint32_t vlan_present
:1;
15663 cmdline_parse_token_string_t cmd_set_l2_decap_set
=
15664 TOKEN_STRING_INITIALIZER(struct cmd_set_l2_decap_result
, set
, "set");
15665 cmdline_parse_token_string_t cmd_set_l2_decap_l2_decap
=
15666 TOKEN_STRING_INITIALIZER(struct cmd_set_l2_decap_result
, l2_decap
,
15668 cmdline_parse_token_string_t cmd_set_l2_decap_l2_decap_with_vlan
=
15669 TOKEN_STRING_INITIALIZER(struct cmd_set_l2_decap_result
, l2_decap
,
15670 "l2_decap-with-vlan");
15672 static void cmd_set_l2_decap_parsed(void *parsed_result
,
15673 __attribute__((unused
)) struct cmdline
*cl
,
15674 __attribute__((unused
)) void *data
)
15676 struct cmd_set_l2_decap_result
*res
= parsed_result
;
15678 if (strcmp(res
->l2_decap
, "l2_decap") == 0)
15679 l2_decap_conf
.select_vlan
= 0;
15680 else if (strcmp(res
->l2_decap
, "l2_decap-with-vlan") == 0)
15681 l2_decap_conf
.select_vlan
= 1;
15684 cmdline_parse_inst_t cmd_set_l2_decap
= {
15685 .f
= cmd_set_l2_decap_parsed
,
15687 .help_str
= "set l2_decap",
15689 (void *)&cmd_set_l2_decap_set
,
15690 (void *)&cmd_set_l2_decap_l2_decap
,
15695 cmdline_parse_inst_t cmd_set_l2_decap_with_vlan
= {
15696 .f
= cmd_set_l2_decap_parsed
,
15698 .help_str
= "set l2_decap-with-vlan",
15700 (void *)&cmd_set_l2_decap_set
,
15701 (void *)&cmd_set_l2_decap_l2_decap_with_vlan
,
15706 /** Set MPLSoGRE encapsulation details */
15707 struct cmd_set_mplsogre_encap_result
{
15708 cmdline_fixed_string_t set
;
15709 cmdline_fixed_string_t mplsogre
;
15710 cmdline_fixed_string_t pos_token
;
15711 cmdline_fixed_string_t ip_version
;
15712 uint32_t vlan_present
:1;
15714 cmdline_ipaddr_t ip_src
;
15715 cmdline_ipaddr_t ip_dst
;
15717 struct ether_addr eth_src
;
15718 struct ether_addr eth_dst
;
15721 cmdline_parse_token_string_t cmd_set_mplsogre_encap_set
=
15722 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result
, set
,
15724 cmdline_parse_token_string_t cmd_set_mplsogre_encap_mplsogre_encap
=
15725 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result
, mplsogre
,
15727 cmdline_parse_token_string_t cmd_set_mplsogre_encap_mplsogre_encap_with_vlan
=
15728 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result
,
15729 mplsogre
, "mplsogre_encap-with-vlan");
15730 cmdline_parse_token_string_t cmd_set_mplsogre_encap_ip_version
=
15731 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result
,
15732 pos_token
, "ip-version");
15733 cmdline_parse_token_string_t cmd_set_mplsogre_encap_ip_version_value
=
15734 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result
,
15735 ip_version
, "ipv4#ipv6");
15736 cmdline_parse_token_string_t cmd_set_mplsogre_encap_label
=
15737 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result
,
15738 pos_token
, "label");
15739 cmdline_parse_token_num_t cmd_set_mplsogre_encap_label_value
=
15740 TOKEN_NUM_INITIALIZER(struct cmd_set_mplsogre_encap_result
, label
,
15742 cmdline_parse_token_string_t cmd_set_mplsogre_encap_ip_src
=
15743 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result
,
15744 pos_token
, "ip-src");
15745 cmdline_parse_token_ipaddr_t cmd_set_mplsogre_encap_ip_src_value
=
15746 TOKEN_IPADDR_INITIALIZER(struct cmd_set_mplsogre_encap_result
, ip_src
);
15747 cmdline_parse_token_string_t cmd_set_mplsogre_encap_ip_dst
=
15748 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result
,
15749 pos_token
, "ip-dst");
15750 cmdline_parse_token_ipaddr_t cmd_set_mplsogre_encap_ip_dst_value
=
15751 TOKEN_IPADDR_INITIALIZER(struct cmd_set_mplsogre_encap_result
, ip_dst
);
15752 cmdline_parse_token_string_t cmd_set_mplsogre_encap_vlan
=
15753 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result
,
15754 pos_token
, "vlan-tci");
15755 cmdline_parse_token_num_t cmd_set_mplsogre_encap_vlan_value
=
15756 TOKEN_NUM_INITIALIZER(struct cmd_set_mplsogre_encap_result
, tci
,
15758 cmdline_parse_token_string_t cmd_set_mplsogre_encap_eth_src
=
15759 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result
,
15760 pos_token
, "eth-src");
15761 cmdline_parse_token_etheraddr_t cmd_set_mplsogre_encap_eth_src_value
=
15762 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_mplsogre_encap_result
,
15764 cmdline_parse_token_string_t cmd_set_mplsogre_encap_eth_dst
=
15765 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result
,
15766 pos_token
, "eth-dst");
15767 cmdline_parse_token_etheraddr_t cmd_set_mplsogre_encap_eth_dst_value
=
15768 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_mplsogre_encap_result
,
15771 static void cmd_set_mplsogre_encap_parsed(void *parsed_result
,
15772 __attribute__((unused
)) struct cmdline
*cl
,
15773 __attribute__((unused
)) void *data
)
15775 struct cmd_set_mplsogre_encap_result
*res
= parsed_result
;
15777 uint32_t mplsogre_label
;
15780 .mplsogre_label
= rte_cpu_to_be_32(res
->label
<<12),
15783 if (strcmp(res
->mplsogre
, "mplsogre_encap") == 0)
15784 mplsogre_encap_conf
.select_vlan
= 0;
15785 else if (strcmp(res
->mplsogre
, "mplsogre_encap-with-vlan") == 0)
15786 mplsogre_encap_conf
.select_vlan
= 1;
15787 if (strcmp(res
->ip_version
, "ipv4") == 0)
15788 mplsogre_encap_conf
.select_ipv4
= 1;
15789 else if (strcmp(res
->ip_version
, "ipv6") == 0)
15790 mplsogre_encap_conf
.select_ipv4
= 0;
15793 rte_memcpy(mplsogre_encap_conf
.label
, &id
.label
, 3);
15794 if (mplsogre_encap_conf
.select_ipv4
) {
15795 IPV4_ADDR_TO_UINT(res
->ip_src
, mplsogre_encap_conf
.ipv4_src
);
15796 IPV4_ADDR_TO_UINT(res
->ip_dst
, mplsogre_encap_conf
.ipv4_dst
);
15798 IPV6_ADDR_TO_ARRAY(res
->ip_src
, mplsogre_encap_conf
.ipv6_src
);
15799 IPV6_ADDR_TO_ARRAY(res
->ip_dst
, mplsogre_encap_conf
.ipv6_dst
);
15801 if (mplsogre_encap_conf
.select_vlan
)
15802 mplsogre_encap_conf
.vlan_tci
= rte_cpu_to_be_16(res
->tci
);
15803 rte_memcpy(mplsogre_encap_conf
.eth_src
, res
->eth_src
.addr_bytes
,
15805 rte_memcpy(mplsogre_encap_conf
.eth_dst
, res
->eth_dst
.addr_bytes
,
15809 cmdline_parse_inst_t cmd_set_mplsogre_encap
= {
15810 .f
= cmd_set_mplsogre_encap_parsed
,
15812 .help_str
= "set mplsogre_encap ip-version ipv4|ipv6 label <label>"
15813 " ip-src <ip-src> ip-dst <ip-dst> eth-src <eth-src>"
15814 " eth-dst <eth-dst>",
15816 (void *)&cmd_set_mplsogre_encap_set
,
15817 (void *)&cmd_set_mplsogre_encap_mplsogre_encap
,
15818 (void *)&cmd_set_mplsogre_encap_ip_version
,
15819 (void *)&cmd_set_mplsogre_encap_ip_version_value
,
15820 (void *)&cmd_set_mplsogre_encap_label
,
15821 (void *)&cmd_set_mplsogre_encap_label_value
,
15822 (void *)&cmd_set_mplsogre_encap_ip_src
,
15823 (void *)&cmd_set_mplsogre_encap_ip_src_value
,
15824 (void *)&cmd_set_mplsogre_encap_ip_dst
,
15825 (void *)&cmd_set_mplsogre_encap_ip_dst_value
,
15826 (void *)&cmd_set_mplsogre_encap_eth_src
,
15827 (void *)&cmd_set_mplsogre_encap_eth_src_value
,
15828 (void *)&cmd_set_mplsogre_encap_eth_dst
,
15829 (void *)&cmd_set_mplsogre_encap_eth_dst_value
,
15834 cmdline_parse_inst_t cmd_set_mplsogre_encap_with_vlan
= {
15835 .f
= cmd_set_mplsogre_encap_parsed
,
15837 .help_str
= "set mplsogre_encap-with-vlan ip-version ipv4|ipv6"
15838 " label <label> ip-src <ip-src> ip-dst <ip-dst>"
15839 " vlan-tci <vlan-tci> eth-src <eth-src> eth-dst <eth-dst>",
15841 (void *)&cmd_set_mplsogre_encap_set
,
15842 (void *)&cmd_set_mplsogre_encap_mplsogre_encap_with_vlan
,
15843 (void *)&cmd_set_mplsogre_encap_ip_version
,
15844 (void *)&cmd_set_mplsogre_encap_ip_version_value
,
15845 (void *)&cmd_set_mplsogre_encap_label
,
15846 (void *)&cmd_set_mplsogre_encap_label_value
,
15847 (void *)&cmd_set_mplsogre_encap_ip_src
,
15848 (void *)&cmd_set_mplsogre_encap_ip_src_value
,
15849 (void *)&cmd_set_mplsogre_encap_ip_dst
,
15850 (void *)&cmd_set_mplsogre_encap_ip_dst_value
,
15851 (void *)&cmd_set_mplsogre_encap_vlan
,
15852 (void *)&cmd_set_mplsogre_encap_vlan_value
,
15853 (void *)&cmd_set_mplsogre_encap_eth_src
,
15854 (void *)&cmd_set_mplsogre_encap_eth_src_value
,
15855 (void *)&cmd_set_mplsogre_encap_eth_dst
,
15856 (void *)&cmd_set_mplsogre_encap_eth_dst_value
,
15861 /** Set MPLSoGRE decapsulation details */
15862 struct cmd_set_mplsogre_decap_result
{
15863 cmdline_fixed_string_t set
;
15864 cmdline_fixed_string_t mplsogre
;
15865 cmdline_fixed_string_t pos_token
;
15866 cmdline_fixed_string_t ip_version
;
15867 uint32_t vlan_present
:1;
15870 cmdline_parse_token_string_t cmd_set_mplsogre_decap_set
=
15871 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result
, set
,
15873 cmdline_parse_token_string_t cmd_set_mplsogre_decap_mplsogre_decap
=
15874 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result
, mplsogre
,
15876 cmdline_parse_token_string_t cmd_set_mplsogre_decap_mplsogre_decap_with_vlan
=
15877 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result
,
15878 mplsogre
, "mplsogre_decap-with-vlan");
15879 cmdline_parse_token_string_t cmd_set_mplsogre_decap_ip_version
=
15880 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result
,
15881 pos_token
, "ip-version");
15882 cmdline_parse_token_string_t cmd_set_mplsogre_decap_ip_version_value
=
15883 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result
,
15884 ip_version
, "ipv4#ipv6");
15886 static void cmd_set_mplsogre_decap_parsed(void *parsed_result
,
15887 __attribute__((unused
)) struct cmdline
*cl
,
15888 __attribute__((unused
)) void *data
)
15890 struct cmd_set_mplsogre_decap_result
*res
= parsed_result
;
15892 if (strcmp(res
->mplsogre
, "mplsogre_decap") == 0)
15893 mplsogre_decap_conf
.select_vlan
= 0;
15894 else if (strcmp(res
->mplsogre
, "mplsogre_decap-with-vlan") == 0)
15895 mplsogre_decap_conf
.select_vlan
= 1;
15896 if (strcmp(res
->ip_version
, "ipv4") == 0)
15897 mplsogre_decap_conf
.select_ipv4
= 1;
15898 else if (strcmp(res
->ip_version
, "ipv6") == 0)
15899 mplsogre_decap_conf
.select_ipv4
= 0;
15902 cmdline_parse_inst_t cmd_set_mplsogre_decap
= {
15903 .f
= cmd_set_mplsogre_decap_parsed
,
15905 .help_str
= "set mplsogre_decap ip-version ipv4|ipv6",
15907 (void *)&cmd_set_mplsogre_decap_set
,
15908 (void *)&cmd_set_mplsogre_decap_mplsogre_decap
,
15909 (void *)&cmd_set_mplsogre_decap_ip_version
,
15910 (void *)&cmd_set_mplsogre_decap_ip_version_value
,
15915 cmdline_parse_inst_t cmd_set_mplsogre_decap_with_vlan
= {
15916 .f
= cmd_set_mplsogre_decap_parsed
,
15918 .help_str
= "set mplsogre_decap-with-vlan ip-version ipv4|ipv6",
15920 (void *)&cmd_set_mplsogre_decap_set
,
15921 (void *)&cmd_set_mplsogre_decap_mplsogre_decap_with_vlan
,
15922 (void *)&cmd_set_mplsogre_decap_ip_version
,
15923 (void *)&cmd_set_mplsogre_decap_ip_version_value
,
15928 /** Set MPLSoUDP encapsulation details */
15929 struct cmd_set_mplsoudp_encap_result
{
15930 cmdline_fixed_string_t set
;
15931 cmdline_fixed_string_t mplsoudp
;
15932 cmdline_fixed_string_t pos_token
;
15933 cmdline_fixed_string_t ip_version
;
15934 uint32_t vlan_present
:1;
15938 cmdline_ipaddr_t ip_src
;
15939 cmdline_ipaddr_t ip_dst
;
15941 struct ether_addr eth_src
;
15942 struct ether_addr eth_dst
;
15945 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_set
=
15946 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
, set
,
15948 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_mplsoudp_encap
=
15949 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
, mplsoudp
,
15951 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_mplsoudp_encap_with_vlan
=
15952 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
15953 mplsoudp
, "mplsoudp_encap-with-vlan");
15954 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_ip_version
=
15955 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
15956 pos_token
, "ip-version");
15957 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_ip_version_value
=
15958 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
15959 ip_version
, "ipv4#ipv6");
15960 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_label
=
15961 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
15962 pos_token
, "label");
15963 cmdline_parse_token_num_t cmd_set_mplsoudp_encap_label_value
=
15964 TOKEN_NUM_INITIALIZER(struct cmd_set_mplsoudp_encap_result
, label
,
15966 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_udp_src
=
15967 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
15968 pos_token
, "udp-src");
15969 cmdline_parse_token_num_t cmd_set_mplsoudp_encap_udp_src_value
=
15970 TOKEN_NUM_INITIALIZER(struct cmd_set_mplsoudp_encap_result
, udp_src
,
15972 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_udp_dst
=
15973 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
15974 pos_token
, "udp-dst");
15975 cmdline_parse_token_num_t cmd_set_mplsoudp_encap_udp_dst_value
=
15976 TOKEN_NUM_INITIALIZER(struct cmd_set_mplsoudp_encap_result
, udp_dst
,
15978 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_ip_src
=
15979 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
15980 pos_token
, "ip-src");
15981 cmdline_parse_token_ipaddr_t cmd_set_mplsoudp_encap_ip_src_value
=
15982 TOKEN_IPADDR_INITIALIZER(struct cmd_set_mplsoudp_encap_result
, ip_src
);
15983 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_ip_dst
=
15984 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
15985 pos_token
, "ip-dst");
15986 cmdline_parse_token_ipaddr_t cmd_set_mplsoudp_encap_ip_dst_value
=
15987 TOKEN_IPADDR_INITIALIZER(struct cmd_set_mplsoudp_encap_result
, ip_dst
);
15988 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_vlan
=
15989 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
15990 pos_token
, "vlan-tci");
15991 cmdline_parse_token_num_t cmd_set_mplsoudp_encap_vlan_value
=
15992 TOKEN_NUM_INITIALIZER(struct cmd_set_mplsoudp_encap_result
, tci
,
15994 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_eth_src
=
15995 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
15996 pos_token
, "eth-src");
15997 cmdline_parse_token_etheraddr_t cmd_set_mplsoudp_encap_eth_src_value
=
15998 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
16000 cmdline_parse_token_string_t cmd_set_mplsoudp_encap_eth_dst
=
16001 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
16002 pos_token
, "eth-dst");
16003 cmdline_parse_token_etheraddr_t cmd_set_mplsoudp_encap_eth_dst_value
=
16004 TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_mplsoudp_encap_result
,
16007 static void cmd_set_mplsoudp_encap_parsed(void *parsed_result
,
16008 __attribute__((unused
)) struct cmdline
*cl
,
16009 __attribute__((unused
)) void *data
)
16011 struct cmd_set_mplsoudp_encap_result
*res
= parsed_result
;
16013 uint32_t mplsoudp_label
;
16016 .mplsoudp_label
= rte_cpu_to_be_32(res
->label
<<12),
16019 if (strcmp(res
->mplsoudp
, "mplsoudp_encap") == 0)
16020 mplsoudp_encap_conf
.select_vlan
= 0;
16021 else if (strcmp(res
->mplsoudp
, "mplsoudp_encap-with-vlan") == 0)
16022 mplsoudp_encap_conf
.select_vlan
= 1;
16023 if (strcmp(res
->ip_version
, "ipv4") == 0)
16024 mplsoudp_encap_conf
.select_ipv4
= 1;
16025 else if (strcmp(res
->ip_version
, "ipv6") == 0)
16026 mplsoudp_encap_conf
.select_ipv4
= 0;
16029 rte_memcpy(mplsoudp_encap_conf
.label
, &id
.label
, 3);
16030 mplsoudp_encap_conf
.udp_src
= rte_cpu_to_be_16(res
->udp_src
);
16031 mplsoudp_encap_conf
.udp_dst
= rte_cpu_to_be_16(res
->udp_dst
);
16032 if (mplsoudp_encap_conf
.select_ipv4
) {
16033 IPV4_ADDR_TO_UINT(res
->ip_src
, mplsoudp_encap_conf
.ipv4_src
);
16034 IPV4_ADDR_TO_UINT(res
->ip_dst
, mplsoudp_encap_conf
.ipv4_dst
);
16036 IPV6_ADDR_TO_ARRAY(res
->ip_src
, mplsoudp_encap_conf
.ipv6_src
);
16037 IPV6_ADDR_TO_ARRAY(res
->ip_dst
, mplsoudp_encap_conf
.ipv6_dst
);
16039 if (mplsoudp_encap_conf
.select_vlan
)
16040 mplsoudp_encap_conf
.vlan_tci
= rte_cpu_to_be_16(res
->tci
);
16041 rte_memcpy(mplsoudp_encap_conf
.eth_src
, res
->eth_src
.addr_bytes
,
16043 rte_memcpy(mplsoudp_encap_conf
.eth_dst
, res
->eth_dst
.addr_bytes
,
16047 cmdline_parse_inst_t cmd_set_mplsoudp_encap
= {
16048 .f
= cmd_set_mplsoudp_encap_parsed
,
16050 .help_str
= "set mplsoudp_encap ip-version ipv4|ipv6 label <label>"
16051 " udp-src <udp-src> udp-dst <udp-dst> ip-src <ip-src>"
16052 " ip-dst <ip-dst> eth-src <eth-src> eth-dst <eth-dst>",
16054 (void *)&cmd_set_mplsoudp_encap_set
,
16055 (void *)&cmd_set_mplsoudp_encap_mplsoudp_encap
,
16056 (void *)&cmd_set_mplsoudp_encap_ip_version
,
16057 (void *)&cmd_set_mplsoudp_encap_ip_version_value
,
16058 (void *)&cmd_set_mplsoudp_encap_label
,
16059 (void *)&cmd_set_mplsoudp_encap_label_value
,
16060 (void *)&cmd_set_mplsoudp_encap_udp_src
,
16061 (void *)&cmd_set_mplsoudp_encap_udp_src_value
,
16062 (void *)&cmd_set_mplsoudp_encap_udp_dst
,
16063 (void *)&cmd_set_mplsoudp_encap_udp_dst_value
,
16064 (void *)&cmd_set_mplsoudp_encap_ip_src
,
16065 (void *)&cmd_set_mplsoudp_encap_ip_src_value
,
16066 (void *)&cmd_set_mplsoudp_encap_ip_dst
,
16067 (void *)&cmd_set_mplsoudp_encap_ip_dst_value
,
16068 (void *)&cmd_set_mplsoudp_encap_eth_src
,
16069 (void *)&cmd_set_mplsoudp_encap_eth_src_value
,
16070 (void *)&cmd_set_mplsoudp_encap_eth_dst
,
16071 (void *)&cmd_set_mplsoudp_encap_eth_dst_value
,
16076 cmdline_parse_inst_t cmd_set_mplsoudp_encap_with_vlan
= {
16077 .f
= cmd_set_mplsoudp_encap_parsed
,
16079 .help_str
= "set mplsoudp_encap-with-vlan ip-version ipv4|ipv6"
16080 " label <label> udp-src <udp-src> udp-dst <udp-dst>"
16081 " ip-src <ip-src> ip-dst <ip-dst> vlan-tci <vlan-tci>"
16082 " eth-src <eth-src> eth-dst <eth-dst>",
16084 (void *)&cmd_set_mplsoudp_encap_set
,
16085 (void *)&cmd_set_mplsoudp_encap_mplsoudp_encap_with_vlan
,
16086 (void *)&cmd_set_mplsoudp_encap_ip_version
,
16087 (void *)&cmd_set_mplsoudp_encap_ip_version_value
,
16088 (void *)&cmd_set_mplsoudp_encap_label
,
16089 (void *)&cmd_set_mplsoudp_encap_label_value
,
16090 (void *)&cmd_set_mplsoudp_encap_udp_src
,
16091 (void *)&cmd_set_mplsoudp_encap_udp_src_value
,
16092 (void *)&cmd_set_mplsoudp_encap_udp_dst
,
16093 (void *)&cmd_set_mplsoudp_encap_udp_dst_value
,
16094 (void *)&cmd_set_mplsoudp_encap_ip_src
,
16095 (void *)&cmd_set_mplsoudp_encap_ip_src_value
,
16096 (void *)&cmd_set_mplsoudp_encap_ip_dst
,
16097 (void *)&cmd_set_mplsoudp_encap_ip_dst_value
,
16098 (void *)&cmd_set_mplsoudp_encap_vlan
,
16099 (void *)&cmd_set_mplsoudp_encap_vlan_value
,
16100 (void *)&cmd_set_mplsoudp_encap_eth_src
,
16101 (void *)&cmd_set_mplsoudp_encap_eth_src_value
,
16102 (void *)&cmd_set_mplsoudp_encap_eth_dst
,
16103 (void *)&cmd_set_mplsoudp_encap_eth_dst_value
,
16108 /** Set MPLSoUDP decapsulation details */
16109 struct cmd_set_mplsoudp_decap_result
{
16110 cmdline_fixed_string_t set
;
16111 cmdline_fixed_string_t mplsoudp
;
16112 cmdline_fixed_string_t pos_token
;
16113 cmdline_fixed_string_t ip_version
;
16114 uint32_t vlan_present
:1;
16117 cmdline_parse_token_string_t cmd_set_mplsoudp_decap_set
=
16118 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result
, set
,
16120 cmdline_parse_token_string_t cmd_set_mplsoudp_decap_mplsoudp_decap
=
16121 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result
, mplsoudp
,
16123 cmdline_parse_token_string_t cmd_set_mplsoudp_decap_mplsoudp_decap_with_vlan
=
16124 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result
,
16125 mplsoudp
, "mplsoudp_decap-with-vlan");
16126 cmdline_parse_token_string_t cmd_set_mplsoudp_decap_ip_version
=
16127 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result
,
16128 pos_token
, "ip-version");
16129 cmdline_parse_token_string_t cmd_set_mplsoudp_decap_ip_version_value
=
16130 TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result
,
16131 ip_version
, "ipv4#ipv6");
16133 static void cmd_set_mplsoudp_decap_parsed(void *parsed_result
,
16134 __attribute__((unused
)) struct cmdline
*cl
,
16135 __attribute__((unused
)) void *data
)
16137 struct cmd_set_mplsoudp_decap_result
*res
= parsed_result
;
16139 if (strcmp(res
->mplsoudp
, "mplsoudp_decap") == 0)
16140 mplsoudp_decap_conf
.select_vlan
= 0;
16141 else if (strcmp(res
->mplsoudp
, "mplsoudp_decap-with-vlan") == 0)
16142 mplsoudp_decap_conf
.select_vlan
= 1;
16143 if (strcmp(res
->ip_version
, "ipv4") == 0)
16144 mplsoudp_decap_conf
.select_ipv4
= 1;
16145 else if (strcmp(res
->ip_version
, "ipv6") == 0)
16146 mplsoudp_decap_conf
.select_ipv4
= 0;
16149 cmdline_parse_inst_t cmd_set_mplsoudp_decap
= {
16150 .f
= cmd_set_mplsoudp_decap_parsed
,
16152 .help_str
= "set mplsoudp_decap ip-version ipv4|ipv6",
16154 (void *)&cmd_set_mplsoudp_decap_set
,
16155 (void *)&cmd_set_mplsoudp_decap_mplsoudp_decap
,
16156 (void *)&cmd_set_mplsoudp_decap_ip_version
,
16157 (void *)&cmd_set_mplsoudp_decap_ip_version_value
,
16162 cmdline_parse_inst_t cmd_set_mplsoudp_decap_with_vlan
= {
16163 .f
= cmd_set_mplsoudp_decap_parsed
,
16165 .help_str
= "set mplsoudp_decap-with-vlan ip-version ipv4|ipv6",
16167 (void *)&cmd_set_mplsoudp_decap_set
,
16168 (void *)&cmd_set_mplsoudp_decap_mplsoudp_decap_with_vlan
,
16169 (void *)&cmd_set_mplsoudp_decap_ip_version
,
16170 (void *)&cmd_set_mplsoudp_decap_ip_version_value
,
16175 /* Strict link priority scheduling mode setting */
16177 cmd_strict_link_prio_parsed(
16178 void *parsed_result
,
16179 __attribute__((unused
)) struct cmdline
*cl
,
16180 __attribute__((unused
)) void *data
)
16182 struct cmd_vf_tc_bw_result
*res
= parsed_result
;
16183 int ret
= -ENOTSUP
;
16185 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
16188 #ifdef RTE_LIBRTE_I40E_PMD
16189 ret
= rte_pmd_i40e_set_tc_strict_prio(res
->port_id
, res
->tc_map
);
16196 printf("invalid tc_bitmap 0x%x\n", res
->tc_map
);
16199 printf("invalid port_id %d\n", res
->port_id
);
16202 printf("function not implemented\n");
16205 printf("programming error: (%s)\n", strerror(-ret
));
16209 cmdline_parse_inst_t cmd_strict_link_prio
= {
16210 .f
= cmd_strict_link_prio_parsed
,
16212 .help_str
= "set tx strict-link-priority <port_id> <tc_bitmap>",
16214 (void *)&cmd_vf_tc_bw_set
,
16215 (void *)&cmd_vf_tc_bw_tx
,
16216 (void *)&cmd_vf_tc_bw_strict_link_prio
,
16217 (void *)&cmd_vf_tc_bw_port_id
,
16218 (void *)&cmd_vf_tc_bw_tc_map
,
16223 /* Load dynamic device personalization*/
16224 struct cmd_ddp_add_result
{
16225 cmdline_fixed_string_t ddp
;
16226 cmdline_fixed_string_t add
;
16231 cmdline_parse_token_string_t cmd_ddp_add_ddp
=
16232 TOKEN_STRING_INITIALIZER(struct cmd_ddp_add_result
, ddp
, "ddp");
16233 cmdline_parse_token_string_t cmd_ddp_add_add
=
16234 TOKEN_STRING_INITIALIZER(struct cmd_ddp_add_result
, add
, "add");
16235 cmdline_parse_token_num_t cmd_ddp_add_port_id
=
16236 TOKEN_NUM_INITIALIZER(struct cmd_ddp_add_result
, port_id
, UINT16
);
16237 cmdline_parse_token_string_t cmd_ddp_add_filepath
=
16238 TOKEN_STRING_INITIALIZER(struct cmd_ddp_add_result
, filepath
, NULL
);
16241 cmd_ddp_add_parsed(
16242 void *parsed_result
,
16243 __attribute__((unused
)) struct cmdline
*cl
,
16244 __attribute__((unused
)) void *data
)
16246 struct cmd_ddp_add_result
*res
= parsed_result
;
16252 int ret
= -ENOTSUP
;
16254 if (!all_ports_stopped()) {
16255 printf("Please stop all ports first\n");
16259 filepath
= strdup(res
->filepath
);
16260 if (filepath
== NULL
) {
16261 printf("Failed to allocate memory\n");
16264 file_num
= rte_strsplit(filepath
, strlen(filepath
), file_fld
, 2, ',');
16266 buff
= open_file(file_fld
[0], &size
);
16268 free((void *)filepath
);
16272 #ifdef RTE_LIBRTE_I40E_PMD
16273 if (ret
== -ENOTSUP
)
16274 ret
= rte_pmd_i40e_process_ddp_package(res
->port_id
,
16276 RTE_PMD_I40E_PKG_OP_WR_ADD
);
16279 if (ret
== -EEXIST
)
16280 printf("Profile has already existed.\n");
16282 printf("Failed to load profile.\n");
16283 else if (file_num
== 2)
16284 save_file(file_fld
[1], buff
, size
);
16287 free((void *)filepath
);
16290 cmdline_parse_inst_t cmd_ddp_add
= {
16291 .f
= cmd_ddp_add_parsed
,
16293 .help_str
= "ddp add <port_id> <profile_path[,backup_profile_path]>",
16295 (void *)&cmd_ddp_add_ddp
,
16296 (void *)&cmd_ddp_add_add
,
16297 (void *)&cmd_ddp_add_port_id
,
16298 (void *)&cmd_ddp_add_filepath
,
16303 /* Delete dynamic device personalization*/
16304 struct cmd_ddp_del_result
{
16305 cmdline_fixed_string_t ddp
;
16306 cmdline_fixed_string_t del
;
16311 cmdline_parse_token_string_t cmd_ddp_del_ddp
=
16312 TOKEN_STRING_INITIALIZER(struct cmd_ddp_del_result
, ddp
, "ddp");
16313 cmdline_parse_token_string_t cmd_ddp_del_del
=
16314 TOKEN_STRING_INITIALIZER(struct cmd_ddp_del_result
, del
, "del");
16315 cmdline_parse_token_num_t cmd_ddp_del_port_id
=
16316 TOKEN_NUM_INITIALIZER(struct cmd_ddp_del_result
, port_id
, UINT16
);
16317 cmdline_parse_token_string_t cmd_ddp_del_filepath
=
16318 TOKEN_STRING_INITIALIZER(struct cmd_ddp_del_result
, filepath
, NULL
);
16321 cmd_ddp_del_parsed(
16322 void *parsed_result
,
16323 __attribute__((unused
)) struct cmdline
*cl
,
16324 __attribute__((unused
)) void *data
)
16326 struct cmd_ddp_del_result
*res
= parsed_result
;
16329 int ret
= -ENOTSUP
;
16331 if (!all_ports_stopped()) {
16332 printf("Please stop all ports first\n");
16336 buff
= open_file(res
->filepath
, &size
);
16340 #ifdef RTE_LIBRTE_I40E_PMD
16341 if (ret
== -ENOTSUP
)
16342 ret
= rte_pmd_i40e_process_ddp_package(res
->port_id
,
16344 RTE_PMD_I40E_PKG_OP_WR_DEL
);
16347 if (ret
== -EACCES
)
16348 printf("Profile does not exist.\n");
16350 printf("Failed to delete profile.\n");
16355 cmdline_parse_inst_t cmd_ddp_del
= {
16356 .f
= cmd_ddp_del_parsed
,
16358 .help_str
= "ddp del <port_id> <backup_profile_path>",
16360 (void *)&cmd_ddp_del_ddp
,
16361 (void *)&cmd_ddp_del_del
,
16362 (void *)&cmd_ddp_del_port_id
,
16363 (void *)&cmd_ddp_del_filepath
,
16368 /* Get dynamic device personalization profile info */
16369 struct cmd_ddp_info_result
{
16370 cmdline_fixed_string_t ddp
;
16371 cmdline_fixed_string_t get
;
16372 cmdline_fixed_string_t info
;
16376 cmdline_parse_token_string_t cmd_ddp_info_ddp
=
16377 TOKEN_STRING_INITIALIZER(struct cmd_ddp_info_result
, ddp
, "ddp");
16378 cmdline_parse_token_string_t cmd_ddp_info_get
=
16379 TOKEN_STRING_INITIALIZER(struct cmd_ddp_info_result
, get
, "get");
16380 cmdline_parse_token_string_t cmd_ddp_info_info
=
16381 TOKEN_STRING_INITIALIZER(struct cmd_ddp_info_result
, info
, "info");
16382 cmdline_parse_token_string_t cmd_ddp_info_filepath
=
16383 TOKEN_STRING_INITIALIZER(struct cmd_ddp_info_result
, filepath
, NULL
);
16386 cmd_ddp_info_parsed(
16387 void *parsed_result
,
16388 __attribute__((unused
)) struct cmdline
*cl
,
16389 __attribute__((unused
)) void *data
)
16391 struct cmd_ddp_info_result
*res
= parsed_result
;
16394 int ret
= -ENOTSUP
;
16395 #ifdef RTE_LIBRTE_I40E_PMD
16398 uint32_t buff_size
= 0;
16399 struct rte_pmd_i40e_profile_info info
;
16400 uint32_t dev_num
= 0;
16401 struct rte_pmd_i40e_ddp_device_id
*devs
;
16402 uint32_t proto_num
= 0;
16403 struct rte_pmd_i40e_proto_info
*proto
= NULL
;
16404 uint32_t pctype_num
= 0;
16405 struct rte_pmd_i40e_ptype_info
*pctype
;
16406 uint32_t ptype_num
= 0;
16407 struct rte_pmd_i40e_ptype_info
*ptype
;
16412 pkg
= open_file(res
->filepath
, &pkg_size
);
16416 #ifdef RTE_LIBRTE_I40E_PMD
16417 ret
= rte_pmd_i40e_get_ddp_info(pkg
, pkg_size
,
16418 (uint8_t *)&info
, sizeof(info
),
16419 RTE_PMD_I40E_PKG_INFO_GLOBAL_HEADER
);
16421 printf("Global Track id: 0x%x\n", info
.track_id
);
16422 printf("Global Version: %d.%d.%d.%d\n",
16423 info
.version
.major
,
16424 info
.version
.minor
,
16425 info
.version
.update
,
16426 info
.version
.draft
);
16427 printf("Global Package name: %s\n\n", info
.name
);
16430 ret
= rte_pmd_i40e_get_ddp_info(pkg
, pkg_size
,
16431 (uint8_t *)&info
, sizeof(info
),
16432 RTE_PMD_I40E_PKG_INFO_HEADER
);
16434 printf("i40e Profile Track id: 0x%x\n", info
.track_id
);
16435 printf("i40e Profile Version: %d.%d.%d.%d\n",
16436 info
.version
.major
,
16437 info
.version
.minor
,
16438 info
.version
.update
,
16439 info
.version
.draft
);
16440 printf("i40e Profile name: %s\n\n", info
.name
);
16443 ret
= rte_pmd_i40e_get_ddp_info(pkg
, pkg_size
,
16444 (uint8_t *)&buff_size
, sizeof(buff_size
),
16445 RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES_SIZE
);
16446 if (!ret
&& buff_size
) {
16447 buff
= (uint8_t *)malloc(buff_size
);
16449 ret
= rte_pmd_i40e_get_ddp_info(pkg
, pkg_size
,
16451 RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES
);
16453 printf("Package Notes:\n%s\n\n", buff
);
16458 ret
= rte_pmd_i40e_get_ddp_info(pkg
, pkg_size
,
16459 (uint8_t *)&dev_num
, sizeof(dev_num
),
16460 RTE_PMD_I40E_PKG_INFO_DEVID_NUM
);
16461 if (!ret
&& dev_num
) {
16462 buff_size
= dev_num
* sizeof(struct rte_pmd_i40e_ddp_device_id
);
16463 devs
= (struct rte_pmd_i40e_ddp_device_id
*)malloc(buff_size
);
16465 ret
= rte_pmd_i40e_get_ddp_info(pkg
, pkg_size
,
16466 (uint8_t *)devs
, buff_size
,
16467 RTE_PMD_I40E_PKG_INFO_DEVID_LIST
);
16469 printf("List of supported devices:\n");
16470 for (i
= 0; i
< dev_num
; i
++) {
16471 printf(" %04X:%04X %04X:%04X\n",
16472 devs
[i
].vendor_dev_id
>> 16,
16473 devs
[i
].vendor_dev_id
& 0xFFFF,
16474 devs
[i
].sub_vendor_dev_id
>> 16,
16475 devs
[i
].sub_vendor_dev_id
& 0xFFFF);
16483 /* get information about protocols and packet types */
16484 ret
= rte_pmd_i40e_get_ddp_info(pkg
, pkg_size
,
16485 (uint8_t *)&proto_num
, sizeof(proto_num
),
16486 RTE_PMD_I40E_PKG_INFO_PROTOCOL_NUM
);
16487 if (ret
|| !proto_num
)
16488 goto no_print_return
;
16490 buff_size
= proto_num
* sizeof(struct rte_pmd_i40e_proto_info
);
16491 proto
= (struct rte_pmd_i40e_proto_info
*)malloc(buff_size
);
16493 goto no_print_return
;
16495 ret
= rte_pmd_i40e_get_ddp_info(pkg
, pkg_size
, (uint8_t *)proto
,
16497 RTE_PMD_I40E_PKG_INFO_PROTOCOL_LIST
);
16499 printf("List of used protocols:\n");
16500 for (i
= 0; i
< proto_num
; i
++)
16501 printf(" %2u: %s\n", proto
[i
].proto_id
,
16505 ret
= rte_pmd_i40e_get_ddp_info(pkg
, pkg_size
,
16506 (uint8_t *)&pctype_num
, sizeof(pctype_num
),
16507 RTE_PMD_I40E_PKG_INFO_PCTYPE_NUM
);
16508 if (ret
|| !pctype_num
)
16509 goto no_print_pctypes
;
16511 buff_size
= pctype_num
* sizeof(struct rte_pmd_i40e_ptype_info
);
16512 pctype
= (struct rte_pmd_i40e_ptype_info
*)malloc(buff_size
);
16514 goto no_print_pctypes
;
16516 ret
= rte_pmd_i40e_get_ddp_info(pkg
, pkg_size
, (uint8_t *)pctype
,
16518 RTE_PMD_I40E_PKG_INFO_PCTYPE_LIST
);
16521 goto no_print_pctypes
;
16524 printf("List of defined packet classification types:\n");
16525 for (i
= 0; i
< pctype_num
; i
++) {
16526 printf(" %2u:", pctype
[i
].ptype_id
);
16527 for (j
= 0; j
< RTE_PMD_I40E_PROTO_NUM
; j
++) {
16528 proto_id
= pctype
[i
].protocols
[j
];
16529 if (proto_id
!= RTE_PMD_I40E_PROTO_UNUSED
) {
16530 for (n
= 0; n
< proto_num
; n
++) {
16531 if (proto
[n
].proto_id
== proto_id
) {
16532 printf(" %s", proto
[n
].name
);
16545 ret
= rte_pmd_i40e_get_ddp_info(pkg
, pkg_size
, (uint8_t *)&ptype_num
,
16547 RTE_PMD_I40E_PKG_INFO_PTYPE_NUM
);
16548 if (ret
|| !ptype_num
)
16549 goto no_print_return
;
16551 buff_size
= ptype_num
* sizeof(struct rte_pmd_i40e_ptype_info
);
16552 ptype
= (struct rte_pmd_i40e_ptype_info
*)malloc(buff_size
);
16554 goto no_print_return
;
16556 ret
= rte_pmd_i40e_get_ddp_info(pkg
, pkg_size
, (uint8_t *)ptype
,
16558 RTE_PMD_I40E_PKG_INFO_PTYPE_LIST
);
16561 goto no_print_return
;
16563 printf("List of defined packet types:\n");
16564 for (i
= 0; i
< ptype_num
; i
++) {
16565 printf(" %2u:", ptype
[i
].ptype_id
);
16566 for (j
= 0; j
< RTE_PMD_I40E_PROTO_NUM
; j
++) {
16567 proto_id
= ptype
[i
].protocols
[j
];
16568 if (proto_id
!= RTE_PMD_I40E_PROTO_UNUSED
) {
16569 for (n
= 0; n
< proto_num
; n
++) {
16570 if (proto
[n
].proto_id
== proto_id
) {
16571 printf(" %s", proto
[n
].name
);
16587 if (ret
== -ENOTSUP
)
16588 printf("Function not supported in PMD driver\n");
16592 cmdline_parse_inst_t cmd_ddp_get_info
= {
16593 .f
= cmd_ddp_info_parsed
,
16595 .help_str
= "ddp get info <profile_path>",
16597 (void *)&cmd_ddp_info_ddp
,
16598 (void *)&cmd_ddp_info_get
,
16599 (void *)&cmd_ddp_info_info
,
16600 (void *)&cmd_ddp_info_filepath
,
16605 /* Get dynamic device personalization profile info list*/
16606 #define PROFILE_INFO_SIZE 48
16607 #define MAX_PROFILE_NUM 16
16609 struct cmd_ddp_get_list_result
{
16610 cmdline_fixed_string_t ddp
;
16611 cmdline_fixed_string_t get
;
16612 cmdline_fixed_string_t list
;
16616 cmdline_parse_token_string_t cmd_ddp_get_list_ddp
=
16617 TOKEN_STRING_INITIALIZER(struct cmd_ddp_get_list_result
, ddp
, "ddp");
16618 cmdline_parse_token_string_t cmd_ddp_get_list_get
=
16619 TOKEN_STRING_INITIALIZER(struct cmd_ddp_get_list_result
, get
, "get");
16620 cmdline_parse_token_string_t cmd_ddp_get_list_list
=
16621 TOKEN_STRING_INITIALIZER(struct cmd_ddp_get_list_result
, list
, "list");
16622 cmdline_parse_token_num_t cmd_ddp_get_list_port_id
=
16623 TOKEN_NUM_INITIALIZER(struct cmd_ddp_get_list_result
, port_id
, UINT16
);
16626 cmd_ddp_get_list_parsed(
16627 __attribute__((unused
)) void *parsed_result
,
16628 __attribute__((unused
)) struct cmdline
*cl
,
16629 __attribute__((unused
)) void *data
)
16631 #ifdef RTE_LIBRTE_I40E_PMD
16632 struct cmd_ddp_get_list_result
*res
= parsed_result
;
16633 struct rte_pmd_i40e_profile_list
*p_list
;
16634 struct rte_pmd_i40e_profile_info
*p_info
;
16639 int ret
= -ENOTSUP
;
16641 #ifdef RTE_LIBRTE_I40E_PMD
16642 size
= PROFILE_INFO_SIZE
* MAX_PROFILE_NUM
+ 4;
16643 p_list
= (struct rte_pmd_i40e_profile_list
*)malloc(size
);
16645 printf("%s: Failed to malloc buffer\n", __func__
);
16647 if (ret
== -ENOTSUP
)
16648 ret
= rte_pmd_i40e_get_ddp_list(res
->port_id
,
16649 (uint8_t *)p_list
, size
);
16652 p_num
= p_list
->p_count
;
16653 printf("Profile number is: %d\n\n", p_num
);
16655 for (i
= 0; i
< p_num
; i
++) {
16656 p_info
= &p_list
->p_info
[i
];
16657 printf("Profile %d:\n", i
);
16658 printf("Track id: 0x%x\n", p_info
->track_id
);
16659 printf("Version: %d.%d.%d.%d\n",
16660 p_info
->version
.major
,
16661 p_info
->version
.minor
,
16662 p_info
->version
.update
,
16663 p_info
->version
.draft
);
16664 printf("Profile name: %s\n\n", p_info
->name
);
16672 printf("Failed to get ddp list\n");
16675 cmdline_parse_inst_t cmd_ddp_get_list
= {
16676 .f
= cmd_ddp_get_list_parsed
,
16678 .help_str
= "ddp get list <port_id>",
16680 (void *)&cmd_ddp_get_list_ddp
,
16681 (void *)&cmd_ddp_get_list_get
,
16682 (void *)&cmd_ddp_get_list_list
,
16683 (void *)&cmd_ddp_get_list_port_id
,
16688 /* Configure input set */
16689 struct cmd_cfg_input_set_result
{
16690 cmdline_fixed_string_t port
;
16691 cmdline_fixed_string_t cfg
;
16693 cmdline_fixed_string_t pctype
;
16695 cmdline_fixed_string_t inset_type
;
16696 cmdline_fixed_string_t opt
;
16697 cmdline_fixed_string_t field
;
16702 cmd_cfg_input_set_parsed(
16703 __attribute__((unused
)) void *parsed_result
,
16704 __attribute__((unused
)) struct cmdline
*cl
,
16705 __attribute__((unused
)) void *data
)
16707 #ifdef RTE_LIBRTE_I40E_PMD
16708 struct cmd_cfg_input_set_result
*res
= parsed_result
;
16709 enum rte_pmd_i40e_inset_type inset_type
= INSET_NONE
;
16710 struct rte_pmd_i40e_inset inset
;
16712 int ret
= -ENOTSUP
;
16714 if (!all_ports_stopped()) {
16715 printf("Please stop all ports first\n");
16719 #ifdef RTE_LIBRTE_I40E_PMD
16720 if (!strcmp(res
->inset_type
, "hash_inset"))
16721 inset_type
= INSET_HASH
;
16722 else if (!strcmp(res
->inset_type
, "fdir_inset"))
16723 inset_type
= INSET_FDIR
;
16724 else if (!strcmp(res
->inset_type
, "fdir_flx_inset"))
16725 inset_type
= INSET_FDIR_FLX
;
16726 ret
= rte_pmd_i40e_inset_get(res
->port_id
, res
->pctype_id
,
16727 &inset
, inset_type
);
16729 printf("Failed to get input set.\n");
16733 if (!strcmp(res
->opt
, "get")) {
16734 ret
= rte_pmd_i40e_inset_field_get(inset
.inset
,
16737 printf("Field index %d is enabled.\n", res
->field_idx
);
16739 printf("Field index %d is disabled.\n", res
->field_idx
);
16741 } else if (!strcmp(res
->opt
, "set"))
16742 ret
= rte_pmd_i40e_inset_field_set(&inset
.inset
,
16744 else if (!strcmp(res
->opt
, "clear"))
16745 ret
= rte_pmd_i40e_inset_field_clear(&inset
.inset
,
16748 printf("Failed to configure input set field.\n");
16752 ret
= rte_pmd_i40e_inset_set(res
->port_id
, res
->pctype_id
,
16753 &inset
, inset_type
);
16755 printf("Failed to set input set.\n");
16760 if (ret
== -ENOTSUP
)
16761 printf("Function not supported\n");
16764 cmdline_parse_token_string_t cmd_cfg_input_set_port
=
16765 TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result
,
16767 cmdline_parse_token_string_t cmd_cfg_input_set_cfg
=
16768 TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result
,
16770 cmdline_parse_token_num_t cmd_cfg_input_set_port_id
=
16771 TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result
,
16773 cmdline_parse_token_string_t cmd_cfg_input_set_pctype
=
16774 TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result
,
16776 cmdline_parse_token_num_t cmd_cfg_input_set_pctype_id
=
16777 TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result
,
16779 cmdline_parse_token_string_t cmd_cfg_input_set_inset_type
=
16780 TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result
,
16782 "hash_inset#fdir_inset#fdir_flx_inset");
16783 cmdline_parse_token_string_t cmd_cfg_input_set_opt
=
16784 TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result
,
16785 opt
, "get#set#clear");
16786 cmdline_parse_token_string_t cmd_cfg_input_set_field
=
16787 TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result
,
16789 cmdline_parse_token_num_t cmd_cfg_input_set_field_idx
=
16790 TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result
,
16793 cmdline_parse_inst_t cmd_cfg_input_set
= {
16794 .f
= cmd_cfg_input_set_parsed
,
16796 .help_str
= "port config <port_id> pctype <pctype_id> hash_inset|"
16797 "fdir_inset|fdir_flx_inset get|set|clear field <field_idx>",
16799 (void *)&cmd_cfg_input_set_port
,
16800 (void *)&cmd_cfg_input_set_cfg
,
16801 (void *)&cmd_cfg_input_set_port_id
,
16802 (void *)&cmd_cfg_input_set_pctype
,
16803 (void *)&cmd_cfg_input_set_pctype_id
,
16804 (void *)&cmd_cfg_input_set_inset_type
,
16805 (void *)&cmd_cfg_input_set_opt
,
16806 (void *)&cmd_cfg_input_set_field
,
16807 (void *)&cmd_cfg_input_set_field_idx
,
16812 /* Clear input set */
16813 struct cmd_clear_input_set_result
{
16814 cmdline_fixed_string_t port
;
16815 cmdline_fixed_string_t cfg
;
16817 cmdline_fixed_string_t pctype
;
16819 cmdline_fixed_string_t inset_type
;
16820 cmdline_fixed_string_t clear
;
16821 cmdline_fixed_string_t all
;
16825 cmd_clear_input_set_parsed(
16826 __attribute__((unused
)) void *parsed_result
,
16827 __attribute__((unused
)) struct cmdline
*cl
,
16828 __attribute__((unused
)) void *data
)
16830 #ifdef RTE_LIBRTE_I40E_PMD
16831 struct cmd_clear_input_set_result
*res
= parsed_result
;
16832 enum rte_pmd_i40e_inset_type inset_type
= INSET_NONE
;
16833 struct rte_pmd_i40e_inset inset
;
16835 int ret
= -ENOTSUP
;
16837 if (!all_ports_stopped()) {
16838 printf("Please stop all ports first\n");
16842 #ifdef RTE_LIBRTE_I40E_PMD
16843 if (!strcmp(res
->inset_type
, "hash_inset"))
16844 inset_type
= INSET_HASH
;
16845 else if (!strcmp(res
->inset_type
, "fdir_inset"))
16846 inset_type
= INSET_FDIR
;
16847 else if (!strcmp(res
->inset_type
, "fdir_flx_inset"))
16848 inset_type
= INSET_FDIR_FLX
;
16850 memset(&inset
, 0, sizeof(inset
));
16852 ret
= rte_pmd_i40e_inset_set(res
->port_id
, res
->pctype_id
,
16853 &inset
, inset_type
);
16855 printf("Failed to clear input set.\n");
16861 if (ret
== -ENOTSUP
)
16862 printf("Function not supported\n");
16865 cmdline_parse_token_string_t cmd_clear_input_set_port
=
16866 TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result
,
16868 cmdline_parse_token_string_t cmd_clear_input_set_cfg
=
16869 TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result
,
16871 cmdline_parse_token_num_t cmd_clear_input_set_port_id
=
16872 TOKEN_NUM_INITIALIZER(struct cmd_clear_input_set_result
,
16874 cmdline_parse_token_string_t cmd_clear_input_set_pctype
=
16875 TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result
,
16877 cmdline_parse_token_num_t cmd_clear_input_set_pctype_id
=
16878 TOKEN_NUM_INITIALIZER(struct cmd_clear_input_set_result
,
16880 cmdline_parse_token_string_t cmd_clear_input_set_inset_type
=
16881 TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result
,
16883 "hash_inset#fdir_inset#fdir_flx_inset");
16884 cmdline_parse_token_string_t cmd_clear_input_set_clear
=
16885 TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result
,
16887 cmdline_parse_token_string_t cmd_clear_input_set_all
=
16888 TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result
,
16891 cmdline_parse_inst_t cmd_clear_input_set
= {
16892 .f
= cmd_clear_input_set_parsed
,
16894 .help_str
= "port config <port_id> pctype <pctype_id> hash_inset|"
16895 "fdir_inset|fdir_flx_inset clear all",
16897 (void *)&cmd_clear_input_set_port
,
16898 (void *)&cmd_clear_input_set_cfg
,
16899 (void *)&cmd_clear_input_set_port_id
,
16900 (void *)&cmd_clear_input_set_pctype
,
16901 (void *)&cmd_clear_input_set_pctype_id
,
16902 (void *)&cmd_clear_input_set_inset_type
,
16903 (void *)&cmd_clear_input_set_clear
,
16904 (void *)&cmd_clear_input_set_all
,
16909 /* show vf stats */
16911 /* Common result structure for show vf stats */
16912 struct cmd_show_vf_stats_result
{
16913 cmdline_fixed_string_t show
;
16914 cmdline_fixed_string_t vf
;
16915 cmdline_fixed_string_t stats
;
16920 /* Common CLI fields show vf stats*/
16921 cmdline_parse_token_string_t cmd_show_vf_stats_show
=
16922 TOKEN_STRING_INITIALIZER
16923 (struct cmd_show_vf_stats_result
,
16925 cmdline_parse_token_string_t cmd_show_vf_stats_vf
=
16926 TOKEN_STRING_INITIALIZER
16927 (struct cmd_show_vf_stats_result
,
16929 cmdline_parse_token_string_t cmd_show_vf_stats_stats
=
16930 TOKEN_STRING_INITIALIZER
16931 (struct cmd_show_vf_stats_result
,
16933 cmdline_parse_token_num_t cmd_show_vf_stats_port_id
=
16934 TOKEN_NUM_INITIALIZER
16935 (struct cmd_show_vf_stats_result
,
16937 cmdline_parse_token_num_t cmd_show_vf_stats_vf_id
=
16938 TOKEN_NUM_INITIALIZER
16939 (struct cmd_show_vf_stats_result
,
16943 cmd_show_vf_stats_parsed(
16944 void *parsed_result
,
16945 __attribute__((unused
)) struct cmdline
*cl
,
16946 __attribute__((unused
)) void *data
)
16948 struct cmd_show_vf_stats_result
*res
= parsed_result
;
16949 struct rte_eth_stats stats
;
16950 int ret
= -ENOTSUP
;
16951 static const char *nic_stats_border
= "########################";
16953 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
16956 memset(&stats
, 0, sizeof(stats
));
16958 #ifdef RTE_LIBRTE_I40E_PMD
16959 if (ret
== -ENOTSUP
)
16960 ret
= rte_pmd_i40e_get_vf_stats(res
->port_id
,
16964 #ifdef RTE_LIBRTE_BNXT_PMD
16965 if (ret
== -ENOTSUP
)
16966 ret
= rte_pmd_bnxt_get_vf_stats(res
->port_id
,
16975 printf("invalid vf_id %d\n", res
->vf_id
);
16978 printf("invalid port_id %d\n", res
->port_id
);
16981 printf("function not implemented\n");
16984 printf("programming error: (%s)\n", strerror(-ret
));
16987 printf("\n %s NIC statistics for port %-2d vf %-2d %s\n",
16988 nic_stats_border
, res
->port_id
, res
->vf_id
, nic_stats_border
);
16990 printf(" RX-packets: %-10"PRIu64
" RX-missed: %-10"PRIu64
" RX-bytes: "
16992 stats
.ipackets
, stats
.imissed
, stats
.ibytes
);
16993 printf(" RX-errors: %-"PRIu64
"\n", stats
.ierrors
);
16994 printf(" RX-nombuf: %-10"PRIu64
"\n",
16996 printf(" TX-packets: %-10"PRIu64
" TX-errors: %-10"PRIu64
" TX-bytes: "
16998 stats
.opackets
, stats
.oerrors
, stats
.obytes
);
17000 printf(" %s############################%s\n",
17001 nic_stats_border
, nic_stats_border
);
17004 cmdline_parse_inst_t cmd_show_vf_stats
= {
17005 .f
= cmd_show_vf_stats_parsed
,
17007 .help_str
= "show vf stats <port_id> <vf_id>",
17009 (void *)&cmd_show_vf_stats_show
,
17010 (void *)&cmd_show_vf_stats_vf
,
17011 (void *)&cmd_show_vf_stats_stats
,
17012 (void *)&cmd_show_vf_stats_port_id
,
17013 (void *)&cmd_show_vf_stats_vf_id
,
17018 /* clear vf stats */
17020 /* Common result structure for clear vf stats */
17021 struct cmd_clear_vf_stats_result
{
17022 cmdline_fixed_string_t clear
;
17023 cmdline_fixed_string_t vf
;
17024 cmdline_fixed_string_t stats
;
17029 /* Common CLI fields clear vf stats*/
17030 cmdline_parse_token_string_t cmd_clear_vf_stats_clear
=
17031 TOKEN_STRING_INITIALIZER
17032 (struct cmd_clear_vf_stats_result
,
17034 cmdline_parse_token_string_t cmd_clear_vf_stats_vf
=
17035 TOKEN_STRING_INITIALIZER
17036 (struct cmd_clear_vf_stats_result
,
17038 cmdline_parse_token_string_t cmd_clear_vf_stats_stats
=
17039 TOKEN_STRING_INITIALIZER
17040 (struct cmd_clear_vf_stats_result
,
17042 cmdline_parse_token_num_t cmd_clear_vf_stats_port_id
=
17043 TOKEN_NUM_INITIALIZER
17044 (struct cmd_clear_vf_stats_result
,
17046 cmdline_parse_token_num_t cmd_clear_vf_stats_vf_id
=
17047 TOKEN_NUM_INITIALIZER
17048 (struct cmd_clear_vf_stats_result
,
17052 cmd_clear_vf_stats_parsed(
17053 void *parsed_result
,
17054 __attribute__((unused
)) struct cmdline
*cl
,
17055 __attribute__((unused
)) void *data
)
17057 struct cmd_clear_vf_stats_result
*res
= parsed_result
;
17058 int ret
= -ENOTSUP
;
17060 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
17063 #ifdef RTE_LIBRTE_I40E_PMD
17064 if (ret
== -ENOTSUP
)
17065 ret
= rte_pmd_i40e_reset_vf_stats(res
->port_id
,
17068 #ifdef RTE_LIBRTE_BNXT_PMD
17069 if (ret
== -ENOTSUP
)
17070 ret
= rte_pmd_bnxt_reset_vf_stats(res
->port_id
,
17078 printf("invalid vf_id %d\n", res
->vf_id
);
17081 printf("invalid port_id %d\n", res
->port_id
);
17084 printf("function not implemented\n");
17087 printf("programming error: (%s)\n", strerror(-ret
));
17091 cmdline_parse_inst_t cmd_clear_vf_stats
= {
17092 .f
= cmd_clear_vf_stats_parsed
,
17094 .help_str
= "clear vf stats <port_id> <vf_id>",
17096 (void *)&cmd_clear_vf_stats_clear
,
17097 (void *)&cmd_clear_vf_stats_vf
,
17098 (void *)&cmd_clear_vf_stats_stats
,
17099 (void *)&cmd_clear_vf_stats_port_id
,
17100 (void *)&cmd_clear_vf_stats_vf_id
,
17105 /* port config pctype mapping reset */
17107 /* Common result structure for port config pctype mapping reset */
17108 struct cmd_pctype_mapping_reset_result
{
17109 cmdline_fixed_string_t port
;
17110 cmdline_fixed_string_t config
;
17112 cmdline_fixed_string_t pctype
;
17113 cmdline_fixed_string_t mapping
;
17114 cmdline_fixed_string_t reset
;
17117 /* Common CLI fields for port config pctype mapping reset*/
17118 cmdline_parse_token_string_t cmd_pctype_mapping_reset_port
=
17119 TOKEN_STRING_INITIALIZER
17120 (struct cmd_pctype_mapping_reset_result
,
17122 cmdline_parse_token_string_t cmd_pctype_mapping_reset_config
=
17123 TOKEN_STRING_INITIALIZER
17124 (struct cmd_pctype_mapping_reset_result
,
17126 cmdline_parse_token_num_t cmd_pctype_mapping_reset_port_id
=
17127 TOKEN_NUM_INITIALIZER
17128 (struct cmd_pctype_mapping_reset_result
,
17130 cmdline_parse_token_string_t cmd_pctype_mapping_reset_pctype
=
17131 TOKEN_STRING_INITIALIZER
17132 (struct cmd_pctype_mapping_reset_result
,
17134 cmdline_parse_token_string_t cmd_pctype_mapping_reset_mapping
=
17135 TOKEN_STRING_INITIALIZER
17136 (struct cmd_pctype_mapping_reset_result
,
17137 mapping
, "mapping");
17138 cmdline_parse_token_string_t cmd_pctype_mapping_reset_reset
=
17139 TOKEN_STRING_INITIALIZER
17140 (struct cmd_pctype_mapping_reset_result
,
17144 cmd_pctype_mapping_reset_parsed(
17145 void *parsed_result
,
17146 __attribute__((unused
)) struct cmdline
*cl
,
17147 __attribute__((unused
)) void *data
)
17149 struct cmd_pctype_mapping_reset_result
*res
= parsed_result
;
17150 int ret
= -ENOTSUP
;
17152 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
17155 #ifdef RTE_LIBRTE_I40E_PMD
17156 ret
= rte_pmd_i40e_flow_type_mapping_reset(res
->port_id
);
17163 printf("invalid port_id %d\n", res
->port_id
);
17166 printf("function not implemented\n");
17169 printf("programming error: (%s)\n", strerror(-ret
));
17173 cmdline_parse_inst_t cmd_pctype_mapping_reset
= {
17174 .f
= cmd_pctype_mapping_reset_parsed
,
17176 .help_str
= "port config <port_id> pctype mapping reset",
17178 (void *)&cmd_pctype_mapping_reset_port
,
17179 (void *)&cmd_pctype_mapping_reset_config
,
17180 (void *)&cmd_pctype_mapping_reset_port_id
,
17181 (void *)&cmd_pctype_mapping_reset_pctype
,
17182 (void *)&cmd_pctype_mapping_reset_mapping
,
17183 (void *)&cmd_pctype_mapping_reset_reset
,
17188 /* show port pctype mapping */
17190 /* Common result structure for show port pctype mapping */
17191 struct cmd_pctype_mapping_get_result
{
17192 cmdline_fixed_string_t show
;
17193 cmdline_fixed_string_t port
;
17195 cmdline_fixed_string_t pctype
;
17196 cmdline_fixed_string_t mapping
;
17199 /* Common CLI fields for pctype mapping get */
17200 cmdline_parse_token_string_t cmd_pctype_mapping_get_show
=
17201 TOKEN_STRING_INITIALIZER
17202 (struct cmd_pctype_mapping_get_result
,
17204 cmdline_parse_token_string_t cmd_pctype_mapping_get_port
=
17205 TOKEN_STRING_INITIALIZER
17206 (struct cmd_pctype_mapping_get_result
,
17208 cmdline_parse_token_num_t cmd_pctype_mapping_get_port_id
=
17209 TOKEN_NUM_INITIALIZER
17210 (struct cmd_pctype_mapping_get_result
,
17212 cmdline_parse_token_string_t cmd_pctype_mapping_get_pctype
=
17213 TOKEN_STRING_INITIALIZER
17214 (struct cmd_pctype_mapping_get_result
,
17216 cmdline_parse_token_string_t cmd_pctype_mapping_get_mapping
=
17217 TOKEN_STRING_INITIALIZER
17218 (struct cmd_pctype_mapping_get_result
,
17219 mapping
, "mapping");
17222 cmd_pctype_mapping_get_parsed(
17223 void *parsed_result
,
17224 __attribute__((unused
)) struct cmdline
*cl
,
17225 __attribute__((unused
)) void *data
)
17227 struct cmd_pctype_mapping_get_result
*res
= parsed_result
;
17228 int ret
= -ENOTSUP
;
17229 #ifdef RTE_LIBRTE_I40E_PMD
17230 struct rte_pmd_i40e_flow_type_mapping
17231 mapping
[RTE_PMD_I40E_FLOW_TYPE_MAX
];
17232 int i
, j
, first_pctype
;
17235 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
17238 #ifdef RTE_LIBRTE_I40E_PMD
17239 ret
= rte_pmd_i40e_flow_type_mapping_get(res
->port_id
, mapping
);
17246 printf("invalid port_id %d\n", res
->port_id
);
17249 printf("function not implemented\n");
17252 printf("programming error: (%s)\n", strerror(-ret
));
17256 #ifdef RTE_LIBRTE_I40E_PMD
17257 for (i
= 0; i
< RTE_PMD_I40E_FLOW_TYPE_MAX
; i
++) {
17258 if (mapping
[i
].pctype
!= 0ULL) {
17261 printf("pctype: ");
17262 for (j
= 0; j
< RTE_PMD_I40E_PCTYPE_MAX
; j
++) {
17263 if (mapping
[i
].pctype
& (1ULL << j
)) {
17264 printf(first_pctype
?
17265 "%02d" : ",%02d", j
);
17269 printf(" -> flowtype: %02d\n", mapping
[i
].flow_type
);
17275 cmdline_parse_inst_t cmd_pctype_mapping_get
= {
17276 .f
= cmd_pctype_mapping_get_parsed
,
17278 .help_str
= "show port <port_id> pctype mapping",
17280 (void *)&cmd_pctype_mapping_get_show
,
17281 (void *)&cmd_pctype_mapping_get_port
,
17282 (void *)&cmd_pctype_mapping_get_port_id
,
17283 (void *)&cmd_pctype_mapping_get_pctype
,
17284 (void *)&cmd_pctype_mapping_get_mapping
,
17289 /* port config pctype mapping update */
17291 /* Common result structure for port config pctype mapping update */
17292 struct cmd_pctype_mapping_update_result
{
17293 cmdline_fixed_string_t port
;
17294 cmdline_fixed_string_t config
;
17296 cmdline_fixed_string_t pctype
;
17297 cmdline_fixed_string_t mapping
;
17298 cmdline_fixed_string_t update
;
17299 cmdline_fixed_string_t pctype_list
;
17300 uint16_t flow_type
;
17303 /* Common CLI fields for pctype mapping update*/
17304 cmdline_parse_token_string_t cmd_pctype_mapping_update_port
=
17305 TOKEN_STRING_INITIALIZER
17306 (struct cmd_pctype_mapping_update_result
,
17308 cmdline_parse_token_string_t cmd_pctype_mapping_update_config
=
17309 TOKEN_STRING_INITIALIZER
17310 (struct cmd_pctype_mapping_update_result
,
17312 cmdline_parse_token_num_t cmd_pctype_mapping_update_port_id
=
17313 TOKEN_NUM_INITIALIZER
17314 (struct cmd_pctype_mapping_update_result
,
17316 cmdline_parse_token_string_t cmd_pctype_mapping_update_pctype
=
17317 TOKEN_STRING_INITIALIZER
17318 (struct cmd_pctype_mapping_update_result
,
17320 cmdline_parse_token_string_t cmd_pctype_mapping_update_mapping
=
17321 TOKEN_STRING_INITIALIZER
17322 (struct cmd_pctype_mapping_update_result
,
17323 mapping
, "mapping");
17324 cmdline_parse_token_string_t cmd_pctype_mapping_update_update
=
17325 TOKEN_STRING_INITIALIZER
17326 (struct cmd_pctype_mapping_update_result
,
17328 cmdline_parse_token_string_t cmd_pctype_mapping_update_pc_type
=
17329 TOKEN_STRING_INITIALIZER
17330 (struct cmd_pctype_mapping_update_result
,
17331 pctype_list
, NULL
);
17332 cmdline_parse_token_num_t cmd_pctype_mapping_update_flow_type
=
17333 TOKEN_NUM_INITIALIZER
17334 (struct cmd_pctype_mapping_update_result
,
17335 flow_type
, UINT16
);
17338 cmd_pctype_mapping_update_parsed(
17339 void *parsed_result
,
17340 __attribute__((unused
)) struct cmdline
*cl
,
17341 __attribute__((unused
)) void *data
)
17343 struct cmd_pctype_mapping_update_result
*res
= parsed_result
;
17344 int ret
= -ENOTSUP
;
17345 #ifdef RTE_LIBRTE_I40E_PMD
17346 struct rte_pmd_i40e_flow_type_mapping mapping
;
17348 unsigned int nb_item
;
17349 unsigned int pctype_list
[RTE_PMD_I40E_PCTYPE_MAX
];
17352 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
17355 #ifdef RTE_LIBRTE_I40E_PMD
17356 nb_item
= parse_item_list(res
->pctype_list
, "pctypes",
17357 RTE_PMD_I40E_PCTYPE_MAX
, pctype_list
, 1);
17358 mapping
.flow_type
= res
->flow_type
;
17359 for (i
= 0, mapping
.pctype
= 0ULL; i
< nb_item
; i
++)
17360 mapping
.pctype
|= (1ULL << pctype_list
[i
]);
17361 ret
= rte_pmd_i40e_flow_type_mapping_update(res
->port_id
,
17371 printf("invalid pctype or flow type\n");
17374 printf("invalid port_id %d\n", res
->port_id
);
17377 printf("function not implemented\n");
17380 printf("programming error: (%s)\n", strerror(-ret
));
17384 cmdline_parse_inst_t cmd_pctype_mapping_update
= {
17385 .f
= cmd_pctype_mapping_update_parsed
,
17387 .help_str
= "port config <port_id> pctype mapping update"
17388 " <pctype_id_0,[pctype_id_1]*> <flowtype_id>",
17390 (void *)&cmd_pctype_mapping_update_port
,
17391 (void *)&cmd_pctype_mapping_update_config
,
17392 (void *)&cmd_pctype_mapping_update_port_id
,
17393 (void *)&cmd_pctype_mapping_update_pctype
,
17394 (void *)&cmd_pctype_mapping_update_mapping
,
17395 (void *)&cmd_pctype_mapping_update_update
,
17396 (void *)&cmd_pctype_mapping_update_pc_type
,
17397 (void *)&cmd_pctype_mapping_update_flow_type
,
17402 /* ptype mapping get */
17404 /* Common result structure for ptype mapping get */
17405 struct cmd_ptype_mapping_get_result
{
17406 cmdline_fixed_string_t ptype
;
17407 cmdline_fixed_string_t mapping
;
17408 cmdline_fixed_string_t get
;
17410 uint8_t valid_only
;
17413 /* Common CLI fields for ptype mapping get */
17414 cmdline_parse_token_string_t cmd_ptype_mapping_get_ptype
=
17415 TOKEN_STRING_INITIALIZER
17416 (struct cmd_ptype_mapping_get_result
,
17418 cmdline_parse_token_string_t cmd_ptype_mapping_get_mapping
=
17419 TOKEN_STRING_INITIALIZER
17420 (struct cmd_ptype_mapping_get_result
,
17421 mapping
, "mapping");
17422 cmdline_parse_token_string_t cmd_ptype_mapping_get_get
=
17423 TOKEN_STRING_INITIALIZER
17424 (struct cmd_ptype_mapping_get_result
,
17426 cmdline_parse_token_num_t cmd_ptype_mapping_get_port_id
=
17427 TOKEN_NUM_INITIALIZER
17428 (struct cmd_ptype_mapping_get_result
,
17430 cmdline_parse_token_num_t cmd_ptype_mapping_get_valid_only
=
17431 TOKEN_NUM_INITIALIZER
17432 (struct cmd_ptype_mapping_get_result
,
17433 valid_only
, UINT8
);
17436 cmd_ptype_mapping_get_parsed(
17437 void *parsed_result
,
17438 __attribute__((unused
)) struct cmdline
*cl
,
17439 __attribute__((unused
)) void *data
)
17441 struct cmd_ptype_mapping_get_result
*res
= parsed_result
;
17442 int ret
= -ENOTSUP
;
17443 #ifdef RTE_LIBRTE_I40E_PMD
17444 int max_ptype_num
= 256;
17445 struct rte_pmd_i40e_ptype_mapping mapping
[max_ptype_num
];
17450 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
17453 #ifdef RTE_LIBRTE_I40E_PMD
17454 ret
= rte_pmd_i40e_ptype_mapping_get(res
->port_id
,
17465 printf("invalid port_id %d\n", res
->port_id
);
17468 printf("function not implemented\n");
17471 printf("programming error: (%s)\n", strerror(-ret
));
17474 #ifdef RTE_LIBRTE_I40E_PMD
17476 for (i
= 0; i
< count
; i
++)
17477 printf("%3d\t0x%08x\n",
17478 mapping
[i
].hw_ptype
, mapping
[i
].sw_ptype
);
17483 cmdline_parse_inst_t cmd_ptype_mapping_get
= {
17484 .f
= cmd_ptype_mapping_get_parsed
,
17486 .help_str
= "ptype mapping get <port_id> <valid_only>",
17488 (void *)&cmd_ptype_mapping_get_ptype
,
17489 (void *)&cmd_ptype_mapping_get_mapping
,
17490 (void *)&cmd_ptype_mapping_get_get
,
17491 (void *)&cmd_ptype_mapping_get_port_id
,
17492 (void *)&cmd_ptype_mapping_get_valid_only
,
17497 /* ptype mapping replace */
17499 /* Common result structure for ptype mapping replace */
17500 struct cmd_ptype_mapping_replace_result
{
17501 cmdline_fixed_string_t ptype
;
17502 cmdline_fixed_string_t mapping
;
17503 cmdline_fixed_string_t replace
;
17510 /* Common CLI fields for ptype mapping replace */
17511 cmdline_parse_token_string_t cmd_ptype_mapping_replace_ptype
=
17512 TOKEN_STRING_INITIALIZER
17513 (struct cmd_ptype_mapping_replace_result
,
17515 cmdline_parse_token_string_t cmd_ptype_mapping_replace_mapping
=
17516 TOKEN_STRING_INITIALIZER
17517 (struct cmd_ptype_mapping_replace_result
,
17518 mapping
, "mapping");
17519 cmdline_parse_token_string_t cmd_ptype_mapping_replace_replace
=
17520 TOKEN_STRING_INITIALIZER
17521 (struct cmd_ptype_mapping_replace_result
,
17522 replace
, "replace");
17523 cmdline_parse_token_num_t cmd_ptype_mapping_replace_port_id
=
17524 TOKEN_NUM_INITIALIZER
17525 (struct cmd_ptype_mapping_replace_result
,
17527 cmdline_parse_token_num_t cmd_ptype_mapping_replace_target
=
17528 TOKEN_NUM_INITIALIZER
17529 (struct cmd_ptype_mapping_replace_result
,
17531 cmdline_parse_token_num_t cmd_ptype_mapping_replace_mask
=
17532 TOKEN_NUM_INITIALIZER
17533 (struct cmd_ptype_mapping_replace_result
,
17535 cmdline_parse_token_num_t cmd_ptype_mapping_replace_pkt_type
=
17536 TOKEN_NUM_INITIALIZER
17537 (struct cmd_ptype_mapping_replace_result
,
17541 cmd_ptype_mapping_replace_parsed(
17542 void *parsed_result
,
17543 __attribute__((unused
)) struct cmdline
*cl
,
17544 __attribute__((unused
)) void *data
)
17546 struct cmd_ptype_mapping_replace_result
*res
= parsed_result
;
17547 int ret
= -ENOTSUP
;
17549 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
17552 #ifdef RTE_LIBRTE_I40E_PMD
17553 ret
= rte_pmd_i40e_ptype_mapping_replace(res
->port_id
,
17563 printf("invalid ptype 0x%8x or 0x%8x\n",
17564 res
->target
, res
->pkt_type
);
17567 printf("invalid port_id %d\n", res
->port_id
);
17570 printf("function not implemented\n");
17573 printf("programming error: (%s)\n", strerror(-ret
));
17577 cmdline_parse_inst_t cmd_ptype_mapping_replace
= {
17578 .f
= cmd_ptype_mapping_replace_parsed
,
17581 "ptype mapping replace <port_id> <target> <mask> <pkt_type>",
17583 (void *)&cmd_ptype_mapping_replace_ptype
,
17584 (void *)&cmd_ptype_mapping_replace_mapping
,
17585 (void *)&cmd_ptype_mapping_replace_replace
,
17586 (void *)&cmd_ptype_mapping_replace_port_id
,
17587 (void *)&cmd_ptype_mapping_replace_target
,
17588 (void *)&cmd_ptype_mapping_replace_mask
,
17589 (void *)&cmd_ptype_mapping_replace_pkt_type
,
17594 /* ptype mapping reset */
17596 /* Common result structure for ptype mapping reset */
17597 struct cmd_ptype_mapping_reset_result
{
17598 cmdline_fixed_string_t ptype
;
17599 cmdline_fixed_string_t mapping
;
17600 cmdline_fixed_string_t reset
;
17604 /* Common CLI fields for ptype mapping reset*/
17605 cmdline_parse_token_string_t cmd_ptype_mapping_reset_ptype
=
17606 TOKEN_STRING_INITIALIZER
17607 (struct cmd_ptype_mapping_reset_result
,
17609 cmdline_parse_token_string_t cmd_ptype_mapping_reset_mapping
=
17610 TOKEN_STRING_INITIALIZER
17611 (struct cmd_ptype_mapping_reset_result
,
17612 mapping
, "mapping");
17613 cmdline_parse_token_string_t cmd_ptype_mapping_reset_reset
=
17614 TOKEN_STRING_INITIALIZER
17615 (struct cmd_ptype_mapping_reset_result
,
17617 cmdline_parse_token_num_t cmd_ptype_mapping_reset_port_id
=
17618 TOKEN_NUM_INITIALIZER
17619 (struct cmd_ptype_mapping_reset_result
,
17623 cmd_ptype_mapping_reset_parsed(
17624 void *parsed_result
,
17625 __attribute__((unused
)) struct cmdline
*cl
,
17626 __attribute__((unused
)) void *data
)
17628 struct cmd_ptype_mapping_reset_result
*res
= parsed_result
;
17629 int ret
= -ENOTSUP
;
17631 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
17634 #ifdef RTE_LIBRTE_I40E_PMD
17635 ret
= rte_pmd_i40e_ptype_mapping_reset(res
->port_id
);
17642 printf("invalid port_id %d\n", res
->port_id
);
17645 printf("function not implemented\n");
17648 printf("programming error: (%s)\n", strerror(-ret
));
17652 cmdline_parse_inst_t cmd_ptype_mapping_reset
= {
17653 .f
= cmd_ptype_mapping_reset_parsed
,
17655 .help_str
= "ptype mapping reset <port_id>",
17657 (void *)&cmd_ptype_mapping_reset_ptype
,
17658 (void *)&cmd_ptype_mapping_reset_mapping
,
17659 (void *)&cmd_ptype_mapping_reset_reset
,
17660 (void *)&cmd_ptype_mapping_reset_port_id
,
17665 /* ptype mapping update */
17667 /* Common result structure for ptype mapping update */
17668 struct cmd_ptype_mapping_update_result
{
17669 cmdline_fixed_string_t ptype
;
17670 cmdline_fixed_string_t mapping
;
17671 cmdline_fixed_string_t reset
;
17677 /* Common CLI fields for ptype mapping update*/
17678 cmdline_parse_token_string_t cmd_ptype_mapping_update_ptype
=
17679 TOKEN_STRING_INITIALIZER
17680 (struct cmd_ptype_mapping_update_result
,
17682 cmdline_parse_token_string_t cmd_ptype_mapping_update_mapping
=
17683 TOKEN_STRING_INITIALIZER
17684 (struct cmd_ptype_mapping_update_result
,
17685 mapping
, "mapping");
17686 cmdline_parse_token_string_t cmd_ptype_mapping_update_update
=
17687 TOKEN_STRING_INITIALIZER
17688 (struct cmd_ptype_mapping_update_result
,
17690 cmdline_parse_token_num_t cmd_ptype_mapping_update_port_id
=
17691 TOKEN_NUM_INITIALIZER
17692 (struct cmd_ptype_mapping_update_result
,
17694 cmdline_parse_token_num_t cmd_ptype_mapping_update_hw_ptype
=
17695 TOKEN_NUM_INITIALIZER
17696 (struct cmd_ptype_mapping_update_result
,
17698 cmdline_parse_token_num_t cmd_ptype_mapping_update_sw_ptype
=
17699 TOKEN_NUM_INITIALIZER
17700 (struct cmd_ptype_mapping_update_result
,
17704 cmd_ptype_mapping_update_parsed(
17705 void *parsed_result
,
17706 __attribute__((unused
)) struct cmdline
*cl
,
17707 __attribute__((unused
)) void *data
)
17709 struct cmd_ptype_mapping_update_result
*res
= parsed_result
;
17710 int ret
= -ENOTSUP
;
17711 #ifdef RTE_LIBRTE_I40E_PMD
17712 struct rte_pmd_i40e_ptype_mapping mapping
;
17714 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
17717 #ifdef RTE_LIBRTE_I40E_PMD
17718 mapping
.hw_ptype
= res
->hw_ptype
;
17719 mapping
.sw_ptype
= res
->sw_ptype
;
17720 ret
= rte_pmd_i40e_ptype_mapping_update(res
->port_id
,
17730 printf("invalid ptype 0x%8x\n", res
->sw_ptype
);
17733 printf("invalid port_id %d\n", res
->port_id
);
17736 printf("function not implemented\n");
17739 printf("programming error: (%s)\n", strerror(-ret
));
17743 cmdline_parse_inst_t cmd_ptype_mapping_update
= {
17744 .f
= cmd_ptype_mapping_update_parsed
,
17746 .help_str
= "ptype mapping update <port_id> <hw_ptype> <sw_ptype>",
17748 (void *)&cmd_ptype_mapping_update_ptype
,
17749 (void *)&cmd_ptype_mapping_update_mapping
,
17750 (void *)&cmd_ptype_mapping_update_update
,
17751 (void *)&cmd_ptype_mapping_update_port_id
,
17752 (void *)&cmd_ptype_mapping_update_hw_ptype
,
17753 (void *)&cmd_ptype_mapping_update_sw_ptype
,
17758 /* Common result structure for file commands */
17759 struct cmd_cmdfile_result
{
17760 cmdline_fixed_string_t load
;
17761 cmdline_fixed_string_t filename
;
17764 /* Common CLI fields for file commands */
17765 cmdline_parse_token_string_t cmd_load_cmdfile
=
17766 TOKEN_STRING_INITIALIZER(struct cmd_cmdfile_result
, load
, "load");
17767 cmdline_parse_token_string_t cmd_load_cmdfile_filename
=
17768 TOKEN_STRING_INITIALIZER(struct cmd_cmdfile_result
, filename
, NULL
);
17771 cmd_load_from_file_parsed(
17772 void *parsed_result
,
17773 __attribute__((unused
)) struct cmdline
*cl
,
17774 __attribute__((unused
)) void *data
)
17776 struct cmd_cmdfile_result
*res
= parsed_result
;
17778 cmdline_read_from_file(res
->filename
);
17781 cmdline_parse_inst_t cmd_load_from_file
= {
17782 .f
= cmd_load_from_file_parsed
,
17784 .help_str
= "load <filename>",
17786 (void *)&cmd_load_cmdfile
,
17787 (void *)&cmd_load_cmdfile_filename
,
17792 /* Get Rx offloads capabilities */
17793 struct cmd_rx_offload_get_capa_result
{
17794 cmdline_fixed_string_t show
;
17795 cmdline_fixed_string_t port
;
17797 cmdline_fixed_string_t rx_offload
;
17798 cmdline_fixed_string_t capabilities
;
17801 cmdline_parse_token_string_t cmd_rx_offload_get_capa_show
=
17802 TOKEN_STRING_INITIALIZER
17803 (struct cmd_rx_offload_get_capa_result
,
17805 cmdline_parse_token_string_t cmd_rx_offload_get_capa_port
=
17806 TOKEN_STRING_INITIALIZER
17807 (struct cmd_rx_offload_get_capa_result
,
17809 cmdline_parse_token_num_t cmd_rx_offload_get_capa_port_id
=
17810 TOKEN_NUM_INITIALIZER
17811 (struct cmd_rx_offload_get_capa_result
,
17813 cmdline_parse_token_string_t cmd_rx_offload_get_capa_rx_offload
=
17814 TOKEN_STRING_INITIALIZER
17815 (struct cmd_rx_offload_get_capa_result
,
17816 rx_offload
, "rx_offload");
17817 cmdline_parse_token_string_t cmd_rx_offload_get_capa_capabilities
=
17818 TOKEN_STRING_INITIALIZER
17819 (struct cmd_rx_offload_get_capa_result
,
17820 capabilities
, "capabilities");
17823 print_rx_offloads(uint64_t offloads
)
17825 uint64_t single_offload
;
17833 begin
= __builtin_ctzll(offloads
);
17834 end
= sizeof(offloads
) * CHAR_BIT
- __builtin_clzll(offloads
);
17836 single_offload
= 1ULL << begin
;
17837 for (bit
= begin
; bit
< end
; bit
++) {
17838 if (offloads
& single_offload
)
17840 rte_eth_dev_rx_offload_name(single_offload
));
17841 single_offload
<<= 1;
17846 cmd_rx_offload_get_capa_parsed(
17847 void *parsed_result
,
17848 __attribute__((unused
)) struct cmdline
*cl
,
17849 __attribute__((unused
)) void *data
)
17851 struct cmd_rx_offload_get_capa_result
*res
= parsed_result
;
17852 struct rte_eth_dev_info dev_info
;
17853 portid_t port_id
= res
->port_id
;
17854 uint64_t queue_offloads
;
17855 uint64_t port_offloads
;
17857 rte_eth_dev_info_get(port_id
, &dev_info
);
17858 queue_offloads
= dev_info
.rx_queue_offload_capa
;
17859 port_offloads
= dev_info
.rx_offload_capa
^ queue_offloads
;
17861 printf("Rx Offloading Capabilities of port %d :\n", port_id
);
17862 printf(" Per Queue :");
17863 print_rx_offloads(queue_offloads
);
17866 printf(" Per Port :");
17867 print_rx_offloads(port_offloads
);
17871 cmdline_parse_inst_t cmd_rx_offload_get_capa
= {
17872 .f
= cmd_rx_offload_get_capa_parsed
,
17874 .help_str
= "show port <port_id> rx_offload capabilities",
17876 (void *)&cmd_rx_offload_get_capa_show
,
17877 (void *)&cmd_rx_offload_get_capa_port
,
17878 (void *)&cmd_rx_offload_get_capa_port_id
,
17879 (void *)&cmd_rx_offload_get_capa_rx_offload
,
17880 (void *)&cmd_rx_offload_get_capa_capabilities
,
17885 /* Get Rx offloads configuration */
17886 struct cmd_rx_offload_get_configuration_result
{
17887 cmdline_fixed_string_t show
;
17888 cmdline_fixed_string_t port
;
17890 cmdline_fixed_string_t rx_offload
;
17891 cmdline_fixed_string_t configuration
;
17894 cmdline_parse_token_string_t cmd_rx_offload_get_configuration_show
=
17895 TOKEN_STRING_INITIALIZER
17896 (struct cmd_rx_offload_get_configuration_result
,
17898 cmdline_parse_token_string_t cmd_rx_offload_get_configuration_port
=
17899 TOKEN_STRING_INITIALIZER
17900 (struct cmd_rx_offload_get_configuration_result
,
17902 cmdline_parse_token_num_t cmd_rx_offload_get_configuration_port_id
=
17903 TOKEN_NUM_INITIALIZER
17904 (struct cmd_rx_offload_get_configuration_result
,
17906 cmdline_parse_token_string_t cmd_rx_offload_get_configuration_rx_offload
=
17907 TOKEN_STRING_INITIALIZER
17908 (struct cmd_rx_offload_get_configuration_result
,
17909 rx_offload
, "rx_offload");
17910 cmdline_parse_token_string_t cmd_rx_offload_get_configuration_configuration
=
17911 TOKEN_STRING_INITIALIZER
17912 (struct cmd_rx_offload_get_configuration_result
,
17913 configuration
, "configuration");
17916 cmd_rx_offload_get_configuration_parsed(
17917 void *parsed_result
,
17918 __attribute__((unused
)) struct cmdline
*cl
,
17919 __attribute__((unused
)) void *data
)
17921 struct cmd_rx_offload_get_configuration_result
*res
= parsed_result
;
17922 struct rte_eth_dev_info dev_info
;
17923 portid_t port_id
= res
->port_id
;
17924 struct rte_port
*port
= &ports
[port_id
];
17925 uint64_t port_offloads
;
17926 uint64_t queue_offloads
;
17927 uint16_t nb_rx_queues
;
17930 printf("Rx Offloading Configuration of port %d :\n", port_id
);
17932 port_offloads
= port
->dev_conf
.rxmode
.offloads
;
17934 print_rx_offloads(port_offloads
);
17937 rte_eth_dev_info_get(port_id
, &dev_info
);
17938 nb_rx_queues
= dev_info
.nb_rx_queues
;
17939 for (q
= 0; q
< nb_rx_queues
; q
++) {
17940 queue_offloads
= port
->rx_conf
[q
].offloads
;
17941 printf(" Queue[%2d] :", q
);
17942 print_rx_offloads(queue_offloads
);
17948 cmdline_parse_inst_t cmd_rx_offload_get_configuration
= {
17949 .f
= cmd_rx_offload_get_configuration_parsed
,
17951 .help_str
= "show port <port_id> rx_offload configuration",
17953 (void *)&cmd_rx_offload_get_configuration_show
,
17954 (void *)&cmd_rx_offload_get_configuration_port
,
17955 (void *)&cmd_rx_offload_get_configuration_port_id
,
17956 (void *)&cmd_rx_offload_get_configuration_rx_offload
,
17957 (void *)&cmd_rx_offload_get_configuration_configuration
,
17962 /* Enable/Disable a per port offloading */
17963 struct cmd_config_per_port_rx_offload_result
{
17964 cmdline_fixed_string_t port
;
17965 cmdline_fixed_string_t config
;
17967 cmdline_fixed_string_t rx_offload
;
17968 cmdline_fixed_string_t offload
;
17969 cmdline_fixed_string_t on_off
;
17972 cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_port
=
17973 TOKEN_STRING_INITIALIZER
17974 (struct cmd_config_per_port_rx_offload_result
,
17976 cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_config
=
17977 TOKEN_STRING_INITIALIZER
17978 (struct cmd_config_per_port_rx_offload_result
,
17980 cmdline_parse_token_num_t cmd_config_per_port_rx_offload_result_port_id
=
17981 TOKEN_NUM_INITIALIZER
17982 (struct cmd_config_per_port_rx_offload_result
,
17984 cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_rx_offload
=
17985 TOKEN_STRING_INITIALIZER
17986 (struct cmd_config_per_port_rx_offload_result
,
17987 rx_offload
, "rx_offload");
17988 cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_offload
=
17989 TOKEN_STRING_INITIALIZER
17990 (struct cmd_config_per_port_rx_offload_result
,
17991 offload
, "vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#"
17992 "qinq_strip#outer_ipv4_cksum#macsec_strip#"
17993 "header_split#vlan_filter#vlan_extend#jumbo_frame#"
17994 "crc_strip#scatter#timestamp#security#keep_crc");
17995 cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off
=
17996 TOKEN_STRING_INITIALIZER
17997 (struct cmd_config_per_port_rx_offload_result
,
18001 search_rx_offload(const char *name
)
18003 uint64_t single_offload
;
18004 const char *single_name
;
18008 single_offload
= 1;
18009 for (bit
= 0; bit
< sizeof(single_offload
) * CHAR_BIT
; bit
++) {
18010 single_name
= rte_eth_dev_rx_offload_name(single_offload
);
18011 if (!strcasecmp(single_name
, name
)) {
18015 single_offload
<<= 1;
18019 return single_offload
;
18025 cmd_config_per_port_rx_offload_parsed(void *parsed_result
,
18026 __attribute__((unused
)) struct cmdline
*cl
,
18027 __attribute__((unused
)) void *data
)
18029 struct cmd_config_per_port_rx_offload_result
*res
= parsed_result
;
18030 portid_t port_id
= res
->port_id
;
18031 struct rte_eth_dev_info dev_info
;
18032 struct rte_port
*port
= &ports
[port_id
];
18033 uint64_t single_offload
;
18034 uint16_t nb_rx_queues
;
18037 if (port
->port_status
!= RTE_PORT_STOPPED
) {
18038 printf("Error: Can't config offload when Port %d "
18039 "is not stopped\n", port_id
);
18043 single_offload
= search_rx_offload(res
->offload
);
18044 if (single_offload
== 0) {
18045 printf("Unknown offload name: %s\n", res
->offload
);
18049 rte_eth_dev_info_get(port_id
, &dev_info
);
18050 nb_rx_queues
= dev_info
.nb_rx_queues
;
18051 if (!strcmp(res
->on_off
, "on")) {
18052 port
->dev_conf
.rxmode
.offloads
|= single_offload
;
18053 for (q
= 0; q
< nb_rx_queues
; q
++)
18054 port
->rx_conf
[q
].offloads
|= single_offload
;
18056 port
->dev_conf
.rxmode
.offloads
&= ~single_offload
;
18057 for (q
= 0; q
< nb_rx_queues
; q
++)
18058 port
->rx_conf
[q
].offloads
&= ~single_offload
;
18061 cmd_reconfig_device_queue(port_id
, 1, 1);
18064 cmdline_parse_inst_t cmd_config_per_port_rx_offload
= {
18065 .f
= cmd_config_per_port_rx_offload_parsed
,
18067 .help_str
= "port config <port_id> rx_offload vlan_strip|ipv4_cksum|"
18068 "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|"
18069 "macsec_strip|header_split|vlan_filter|vlan_extend|"
18070 "jumbo_frame|crc_strip|scatter|timestamp|security|keep_crc "
18073 (void *)&cmd_config_per_port_rx_offload_result_port
,
18074 (void *)&cmd_config_per_port_rx_offload_result_config
,
18075 (void *)&cmd_config_per_port_rx_offload_result_port_id
,
18076 (void *)&cmd_config_per_port_rx_offload_result_rx_offload
,
18077 (void *)&cmd_config_per_port_rx_offload_result_offload
,
18078 (void *)&cmd_config_per_port_rx_offload_result_on_off
,
18083 /* Enable/Disable a per queue offloading */
18084 struct cmd_config_per_queue_rx_offload_result
{
18085 cmdline_fixed_string_t port
;
18087 cmdline_fixed_string_t rxq
;
18089 cmdline_fixed_string_t rx_offload
;
18090 cmdline_fixed_string_t offload
;
18091 cmdline_fixed_string_t on_off
;
18094 cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_port
=
18095 TOKEN_STRING_INITIALIZER
18096 (struct cmd_config_per_queue_rx_offload_result
,
18098 cmdline_parse_token_num_t cmd_config_per_queue_rx_offload_result_port_id
=
18099 TOKEN_NUM_INITIALIZER
18100 (struct cmd_config_per_queue_rx_offload_result
,
18102 cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_rxq
=
18103 TOKEN_STRING_INITIALIZER
18104 (struct cmd_config_per_queue_rx_offload_result
,
18106 cmdline_parse_token_num_t cmd_config_per_queue_rx_offload_result_queue_id
=
18107 TOKEN_NUM_INITIALIZER
18108 (struct cmd_config_per_queue_rx_offload_result
,
18110 cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_rxoffload
=
18111 TOKEN_STRING_INITIALIZER
18112 (struct cmd_config_per_queue_rx_offload_result
,
18113 rx_offload
, "rx_offload");
18114 cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_offload
=
18115 TOKEN_STRING_INITIALIZER
18116 (struct cmd_config_per_queue_rx_offload_result
,
18117 offload
, "vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#"
18118 "qinq_strip#outer_ipv4_cksum#macsec_strip#"
18119 "header_split#vlan_filter#vlan_extend#jumbo_frame#"
18120 "crc_strip#scatter#timestamp#security#keep_crc");
18121 cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off
=
18122 TOKEN_STRING_INITIALIZER
18123 (struct cmd_config_per_queue_rx_offload_result
,
18127 cmd_config_per_queue_rx_offload_parsed(void *parsed_result
,
18128 __attribute__((unused
)) struct cmdline
*cl
,
18129 __attribute__((unused
)) void *data
)
18131 struct cmd_config_per_queue_rx_offload_result
*res
= parsed_result
;
18132 struct rte_eth_dev_info dev_info
;
18133 portid_t port_id
= res
->port_id
;
18134 uint16_t queue_id
= res
->queue_id
;
18135 struct rte_port
*port
= &ports
[port_id
];
18136 uint64_t single_offload
;
18138 if (port
->port_status
!= RTE_PORT_STOPPED
) {
18139 printf("Error: Can't config offload when Port %d "
18140 "is not stopped\n", port_id
);
18144 rte_eth_dev_info_get(port_id
, &dev_info
);
18145 if (queue_id
>= dev_info
.nb_rx_queues
) {
18146 printf("Error: input queue_id should be 0 ... "
18147 "%d\n", dev_info
.nb_rx_queues
- 1);
18151 single_offload
= search_rx_offload(res
->offload
);
18152 if (single_offload
== 0) {
18153 printf("Unknown offload name: %s\n", res
->offload
);
18157 if (!strcmp(res
->on_off
, "on"))
18158 port
->rx_conf
[queue_id
].offloads
|= single_offload
;
18160 port
->rx_conf
[queue_id
].offloads
&= ~single_offload
;
18162 cmd_reconfig_device_queue(port_id
, 1, 1);
18165 cmdline_parse_inst_t cmd_config_per_queue_rx_offload
= {
18166 .f
= cmd_config_per_queue_rx_offload_parsed
,
18168 .help_str
= "port <port_id> rxq <queue_id> rx_offload "
18169 "vlan_strip|ipv4_cksum|"
18170 "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|"
18171 "macsec_strip|header_split|vlan_filter|vlan_extend|"
18172 "jumbo_frame|crc_strip|scatter|timestamp|security|keep_crc "
18175 (void *)&cmd_config_per_queue_rx_offload_result_port
,
18176 (void *)&cmd_config_per_queue_rx_offload_result_port_id
,
18177 (void *)&cmd_config_per_queue_rx_offload_result_rxq
,
18178 (void *)&cmd_config_per_queue_rx_offload_result_queue_id
,
18179 (void *)&cmd_config_per_queue_rx_offload_result_rxoffload
,
18180 (void *)&cmd_config_per_queue_rx_offload_result_offload
,
18181 (void *)&cmd_config_per_queue_rx_offload_result_on_off
,
18186 /* Get Tx offloads capabilities */
18187 struct cmd_tx_offload_get_capa_result
{
18188 cmdline_fixed_string_t show
;
18189 cmdline_fixed_string_t port
;
18191 cmdline_fixed_string_t tx_offload
;
18192 cmdline_fixed_string_t capabilities
;
18195 cmdline_parse_token_string_t cmd_tx_offload_get_capa_show
=
18196 TOKEN_STRING_INITIALIZER
18197 (struct cmd_tx_offload_get_capa_result
,
18199 cmdline_parse_token_string_t cmd_tx_offload_get_capa_port
=
18200 TOKEN_STRING_INITIALIZER
18201 (struct cmd_tx_offload_get_capa_result
,
18203 cmdline_parse_token_num_t cmd_tx_offload_get_capa_port_id
=
18204 TOKEN_NUM_INITIALIZER
18205 (struct cmd_tx_offload_get_capa_result
,
18207 cmdline_parse_token_string_t cmd_tx_offload_get_capa_tx_offload
=
18208 TOKEN_STRING_INITIALIZER
18209 (struct cmd_tx_offload_get_capa_result
,
18210 tx_offload
, "tx_offload");
18211 cmdline_parse_token_string_t cmd_tx_offload_get_capa_capabilities
=
18212 TOKEN_STRING_INITIALIZER
18213 (struct cmd_tx_offload_get_capa_result
,
18214 capabilities
, "capabilities");
18217 print_tx_offloads(uint64_t offloads
)
18219 uint64_t single_offload
;
18227 begin
= __builtin_ctzll(offloads
);
18228 end
= sizeof(offloads
) * CHAR_BIT
- __builtin_clzll(offloads
);
18230 single_offload
= 1ULL << begin
;
18231 for (bit
= begin
; bit
< end
; bit
++) {
18232 if (offloads
& single_offload
)
18234 rte_eth_dev_tx_offload_name(single_offload
));
18235 single_offload
<<= 1;
18240 cmd_tx_offload_get_capa_parsed(
18241 void *parsed_result
,
18242 __attribute__((unused
)) struct cmdline
*cl
,
18243 __attribute__((unused
)) void *data
)
18245 struct cmd_tx_offload_get_capa_result
*res
= parsed_result
;
18246 struct rte_eth_dev_info dev_info
;
18247 portid_t port_id
= res
->port_id
;
18248 uint64_t queue_offloads
;
18249 uint64_t port_offloads
;
18251 rte_eth_dev_info_get(port_id
, &dev_info
);
18252 queue_offloads
= dev_info
.tx_queue_offload_capa
;
18253 port_offloads
= dev_info
.tx_offload_capa
^ queue_offloads
;
18255 printf("Tx Offloading Capabilities of port %d :\n", port_id
);
18256 printf(" Per Queue :");
18257 print_tx_offloads(queue_offloads
);
18260 printf(" Per Port :");
18261 print_tx_offloads(port_offloads
);
18265 cmdline_parse_inst_t cmd_tx_offload_get_capa
= {
18266 .f
= cmd_tx_offload_get_capa_parsed
,
18268 .help_str
= "show port <port_id> tx_offload capabilities",
18270 (void *)&cmd_tx_offload_get_capa_show
,
18271 (void *)&cmd_tx_offload_get_capa_port
,
18272 (void *)&cmd_tx_offload_get_capa_port_id
,
18273 (void *)&cmd_tx_offload_get_capa_tx_offload
,
18274 (void *)&cmd_tx_offload_get_capa_capabilities
,
18279 /* Get Tx offloads configuration */
18280 struct cmd_tx_offload_get_configuration_result
{
18281 cmdline_fixed_string_t show
;
18282 cmdline_fixed_string_t port
;
18284 cmdline_fixed_string_t tx_offload
;
18285 cmdline_fixed_string_t configuration
;
18288 cmdline_parse_token_string_t cmd_tx_offload_get_configuration_show
=
18289 TOKEN_STRING_INITIALIZER
18290 (struct cmd_tx_offload_get_configuration_result
,
18292 cmdline_parse_token_string_t cmd_tx_offload_get_configuration_port
=
18293 TOKEN_STRING_INITIALIZER
18294 (struct cmd_tx_offload_get_configuration_result
,
18296 cmdline_parse_token_num_t cmd_tx_offload_get_configuration_port_id
=
18297 TOKEN_NUM_INITIALIZER
18298 (struct cmd_tx_offload_get_configuration_result
,
18300 cmdline_parse_token_string_t cmd_tx_offload_get_configuration_tx_offload
=
18301 TOKEN_STRING_INITIALIZER
18302 (struct cmd_tx_offload_get_configuration_result
,
18303 tx_offload
, "tx_offload");
18304 cmdline_parse_token_string_t cmd_tx_offload_get_configuration_configuration
=
18305 TOKEN_STRING_INITIALIZER
18306 (struct cmd_tx_offload_get_configuration_result
,
18307 configuration
, "configuration");
18310 cmd_tx_offload_get_configuration_parsed(
18311 void *parsed_result
,
18312 __attribute__((unused
)) struct cmdline
*cl
,
18313 __attribute__((unused
)) void *data
)
18315 struct cmd_tx_offload_get_configuration_result
*res
= parsed_result
;
18316 struct rte_eth_dev_info dev_info
;
18317 portid_t port_id
= res
->port_id
;
18318 struct rte_port
*port
= &ports
[port_id
];
18319 uint64_t port_offloads
;
18320 uint64_t queue_offloads
;
18321 uint16_t nb_tx_queues
;
18324 printf("Tx Offloading Configuration of port %d :\n", port_id
);
18326 port_offloads
= port
->dev_conf
.txmode
.offloads
;
18328 print_tx_offloads(port_offloads
);
18331 rte_eth_dev_info_get(port_id
, &dev_info
);
18332 nb_tx_queues
= dev_info
.nb_tx_queues
;
18333 for (q
= 0; q
< nb_tx_queues
; q
++) {
18334 queue_offloads
= port
->tx_conf
[q
].offloads
;
18335 printf(" Queue[%2d] :", q
);
18336 print_tx_offloads(queue_offloads
);
18342 cmdline_parse_inst_t cmd_tx_offload_get_configuration
= {
18343 .f
= cmd_tx_offload_get_configuration_parsed
,
18345 .help_str
= "show port <port_id> tx_offload configuration",
18347 (void *)&cmd_tx_offload_get_configuration_show
,
18348 (void *)&cmd_tx_offload_get_configuration_port
,
18349 (void *)&cmd_tx_offload_get_configuration_port_id
,
18350 (void *)&cmd_tx_offload_get_configuration_tx_offload
,
18351 (void *)&cmd_tx_offload_get_configuration_configuration
,
18356 /* Enable/Disable a per port offloading */
18357 struct cmd_config_per_port_tx_offload_result
{
18358 cmdline_fixed_string_t port
;
18359 cmdline_fixed_string_t config
;
18361 cmdline_fixed_string_t tx_offload
;
18362 cmdline_fixed_string_t offload
;
18363 cmdline_fixed_string_t on_off
;
18366 cmdline_parse_token_string_t cmd_config_per_port_tx_offload_result_port
=
18367 TOKEN_STRING_INITIALIZER
18368 (struct cmd_config_per_port_tx_offload_result
,
18370 cmdline_parse_token_string_t cmd_config_per_port_tx_offload_result_config
=
18371 TOKEN_STRING_INITIALIZER
18372 (struct cmd_config_per_port_tx_offload_result
,
18374 cmdline_parse_token_num_t cmd_config_per_port_tx_offload_result_port_id
=
18375 TOKEN_NUM_INITIALIZER
18376 (struct cmd_config_per_port_tx_offload_result
,
18378 cmdline_parse_token_string_t cmd_config_per_port_tx_offload_result_tx_offload
=
18379 TOKEN_STRING_INITIALIZER
18380 (struct cmd_config_per_port_tx_offload_result
,
18381 tx_offload
, "tx_offload");
18382 cmdline_parse_token_string_t cmd_config_per_port_tx_offload_result_offload
=
18383 TOKEN_STRING_INITIALIZER
18384 (struct cmd_config_per_port_tx_offload_result
,
18385 offload
, "vlan_insert#ipv4_cksum#udp_cksum#tcp_cksum#"
18386 "sctp_cksum#tcp_tso#udp_tso#outer_ipv4_cksum#"
18387 "qinq_insert#vxlan_tnl_tso#gre_tnl_tso#"
18388 "ipip_tnl_tso#geneve_tnl_tso#macsec_insert#"
18389 "mt_lockfree#multi_segs#mbuf_fast_free#security#"
18391 cmdline_parse_token_string_t cmd_config_per_port_tx_offload_result_on_off
=
18392 TOKEN_STRING_INITIALIZER
18393 (struct cmd_config_per_port_tx_offload_result
,
18397 search_tx_offload(const char *name
)
18399 uint64_t single_offload
;
18400 const char *single_name
;
18404 single_offload
= 1;
18405 for (bit
= 0; bit
< sizeof(single_offload
) * CHAR_BIT
; bit
++) {
18406 single_name
= rte_eth_dev_tx_offload_name(single_offload
);
18407 if (single_name
== NULL
)
18409 if (!strcasecmp(single_name
, name
)) {
18412 } else if (!strcasecmp(single_name
, "UNKNOWN"))
18414 single_offload
<<= 1;
18418 return single_offload
;
18424 cmd_config_per_port_tx_offload_parsed(void *parsed_result
,
18425 __attribute__((unused
)) struct cmdline
*cl
,
18426 __attribute__((unused
)) void *data
)
18428 struct cmd_config_per_port_tx_offload_result
*res
= parsed_result
;
18429 portid_t port_id
= res
->port_id
;
18430 struct rte_eth_dev_info dev_info
;
18431 struct rte_port
*port
= &ports
[port_id
];
18432 uint64_t single_offload
;
18433 uint16_t nb_tx_queues
;
18436 if (port
->port_status
!= RTE_PORT_STOPPED
) {
18437 printf("Error: Can't config offload when Port %d "
18438 "is not stopped\n", port_id
);
18442 single_offload
= search_tx_offload(res
->offload
);
18443 if (single_offload
== 0) {
18444 printf("Unknown offload name: %s\n", res
->offload
);
18448 rte_eth_dev_info_get(port_id
, &dev_info
);
18449 nb_tx_queues
= dev_info
.nb_tx_queues
;
18450 if (!strcmp(res
->on_off
, "on")) {
18451 port
->dev_conf
.txmode
.offloads
|= single_offload
;
18452 for (q
= 0; q
< nb_tx_queues
; q
++)
18453 port
->tx_conf
[q
].offloads
|= single_offload
;
18455 port
->dev_conf
.txmode
.offloads
&= ~single_offload
;
18456 for (q
= 0; q
< nb_tx_queues
; q
++)
18457 port
->tx_conf
[q
].offloads
&= ~single_offload
;
18460 cmd_reconfig_device_queue(port_id
, 1, 1);
18463 cmdline_parse_inst_t cmd_config_per_port_tx_offload
= {
18464 .f
= cmd_config_per_port_tx_offload_parsed
,
18466 .help_str
= "port config <port_id> tx_offload "
18467 "vlan_insert|ipv4_cksum|udp_cksum|tcp_cksum|"
18468 "sctp_cksum|tcp_tso|udp_tso|outer_ipv4_cksum|"
18469 "qinq_insert|vxlan_tnl_tso|gre_tnl_tso|"
18470 "ipip_tnl_tso|geneve_tnl_tso|macsec_insert|"
18471 "mt_lockfree|multi_segs|mbuf_fast_free|security|"
18472 "match_metadata on|off",
18474 (void *)&cmd_config_per_port_tx_offload_result_port
,
18475 (void *)&cmd_config_per_port_tx_offload_result_config
,
18476 (void *)&cmd_config_per_port_tx_offload_result_port_id
,
18477 (void *)&cmd_config_per_port_tx_offload_result_tx_offload
,
18478 (void *)&cmd_config_per_port_tx_offload_result_offload
,
18479 (void *)&cmd_config_per_port_tx_offload_result_on_off
,
18484 /* Enable/Disable a per queue offloading */
18485 struct cmd_config_per_queue_tx_offload_result
{
18486 cmdline_fixed_string_t port
;
18488 cmdline_fixed_string_t txq
;
18490 cmdline_fixed_string_t tx_offload
;
18491 cmdline_fixed_string_t offload
;
18492 cmdline_fixed_string_t on_off
;
18495 cmdline_parse_token_string_t cmd_config_per_queue_tx_offload_result_port
=
18496 TOKEN_STRING_INITIALIZER
18497 (struct cmd_config_per_queue_tx_offload_result
,
18499 cmdline_parse_token_num_t cmd_config_per_queue_tx_offload_result_port_id
=
18500 TOKEN_NUM_INITIALIZER
18501 (struct cmd_config_per_queue_tx_offload_result
,
18503 cmdline_parse_token_string_t cmd_config_per_queue_tx_offload_result_txq
=
18504 TOKEN_STRING_INITIALIZER
18505 (struct cmd_config_per_queue_tx_offload_result
,
18507 cmdline_parse_token_num_t cmd_config_per_queue_tx_offload_result_queue_id
=
18508 TOKEN_NUM_INITIALIZER
18509 (struct cmd_config_per_queue_tx_offload_result
,
18511 cmdline_parse_token_string_t cmd_config_per_queue_tx_offload_result_txoffload
=
18512 TOKEN_STRING_INITIALIZER
18513 (struct cmd_config_per_queue_tx_offload_result
,
18514 tx_offload
, "tx_offload");
18515 cmdline_parse_token_string_t cmd_config_per_queue_tx_offload_result_offload
=
18516 TOKEN_STRING_INITIALIZER
18517 (struct cmd_config_per_queue_tx_offload_result
,
18518 offload
, "vlan_insert#ipv4_cksum#udp_cksum#tcp_cksum#"
18519 "sctp_cksum#tcp_tso#udp_tso#outer_ipv4_cksum#"
18520 "qinq_insert#vxlan_tnl_tso#gre_tnl_tso#"
18521 "ipip_tnl_tso#geneve_tnl_tso#macsec_insert#"
18522 "mt_lockfree#multi_segs#mbuf_fast_free#security");
18523 cmdline_parse_token_string_t cmd_config_per_queue_tx_offload_result_on_off
=
18524 TOKEN_STRING_INITIALIZER
18525 (struct cmd_config_per_queue_tx_offload_result
,
18529 cmd_config_per_queue_tx_offload_parsed(void *parsed_result
,
18530 __attribute__((unused
)) struct cmdline
*cl
,
18531 __attribute__((unused
)) void *data
)
18533 struct cmd_config_per_queue_tx_offload_result
*res
= parsed_result
;
18534 struct rte_eth_dev_info dev_info
;
18535 portid_t port_id
= res
->port_id
;
18536 uint16_t queue_id
= res
->queue_id
;
18537 struct rte_port
*port
= &ports
[port_id
];
18538 uint64_t single_offload
;
18540 if (port
->port_status
!= RTE_PORT_STOPPED
) {
18541 printf("Error: Can't config offload when Port %d "
18542 "is not stopped\n", port_id
);
18546 rte_eth_dev_info_get(port_id
, &dev_info
);
18547 if (queue_id
>= dev_info
.nb_tx_queues
) {
18548 printf("Error: input queue_id should be 0 ... "
18549 "%d\n", dev_info
.nb_tx_queues
- 1);
18553 single_offload
= search_tx_offload(res
->offload
);
18554 if (single_offload
== 0) {
18555 printf("Unknown offload name: %s\n", res
->offload
);
18559 if (!strcmp(res
->on_off
, "on"))
18560 port
->tx_conf
[queue_id
].offloads
|= single_offload
;
18562 port
->tx_conf
[queue_id
].offloads
&= ~single_offload
;
18564 cmd_reconfig_device_queue(port_id
, 1, 1);
18567 cmdline_parse_inst_t cmd_config_per_queue_tx_offload
= {
18568 .f
= cmd_config_per_queue_tx_offload_parsed
,
18570 .help_str
= "port <port_id> txq <queue_id> tx_offload "
18571 "vlan_insert|ipv4_cksum|udp_cksum|tcp_cksum|"
18572 "sctp_cksum|tcp_tso|udp_tso|outer_ipv4_cksum|"
18573 "qinq_insert|vxlan_tnl_tso|gre_tnl_tso|"
18574 "ipip_tnl_tso|geneve_tnl_tso|macsec_insert|"
18575 "mt_lockfree|multi_segs|mbuf_fast_free|security "
18578 (void *)&cmd_config_per_queue_tx_offload_result_port
,
18579 (void *)&cmd_config_per_queue_tx_offload_result_port_id
,
18580 (void *)&cmd_config_per_queue_tx_offload_result_txq
,
18581 (void *)&cmd_config_per_queue_tx_offload_result_queue_id
,
18582 (void *)&cmd_config_per_queue_tx_offload_result_txoffload
,
18583 (void *)&cmd_config_per_queue_tx_offload_result_offload
,
18584 (void *)&cmd_config_per_queue_tx_offload_result_on_off
,
18589 /* *** configure tx_metadata for specific port *** */
18590 struct cmd_config_tx_metadata_specific_result
{
18591 cmdline_fixed_string_t port
;
18592 cmdline_fixed_string_t keyword
;
18594 cmdline_fixed_string_t item
;
18599 cmd_config_tx_metadata_specific_parsed(void *parsed_result
,
18600 __attribute__((unused
)) struct cmdline
*cl
,
18601 __attribute__((unused
)) void *data
)
18603 struct cmd_config_tx_metadata_specific_result
*res
= parsed_result
;
18605 if (port_id_is_invalid(res
->port_id
, ENABLED_WARN
))
18607 ports
[res
->port_id
].tx_metadata
= rte_cpu_to_be_32(res
->value
);
18608 /* Add/remove callback to insert valid metadata in every Tx packet. */
18609 if (ports
[res
->port_id
].tx_metadata
)
18610 add_tx_md_callback(res
->port_id
);
18612 remove_tx_md_callback(res
->port_id
);
18615 cmdline_parse_token_string_t cmd_config_tx_metadata_specific_port
=
18616 TOKEN_STRING_INITIALIZER(struct cmd_config_tx_metadata_specific_result
,
18618 cmdline_parse_token_string_t cmd_config_tx_metadata_specific_keyword
=
18619 TOKEN_STRING_INITIALIZER(struct cmd_config_tx_metadata_specific_result
,
18620 keyword
, "config");
18621 cmdline_parse_token_num_t cmd_config_tx_metadata_specific_id
=
18622 TOKEN_NUM_INITIALIZER(struct cmd_config_tx_metadata_specific_result
,
18624 cmdline_parse_token_string_t cmd_config_tx_metadata_specific_item
=
18625 TOKEN_STRING_INITIALIZER(struct cmd_config_tx_metadata_specific_result
,
18626 item
, "tx_metadata");
18627 cmdline_parse_token_num_t cmd_config_tx_metadata_specific_value
=
18628 TOKEN_NUM_INITIALIZER(struct cmd_config_tx_metadata_specific_result
,
18631 cmdline_parse_inst_t cmd_config_tx_metadata_specific
= {
18632 .f
= cmd_config_tx_metadata_specific_parsed
,
18634 .help_str
= "port config <port_id> tx_metadata <value>",
18636 (void *)&cmd_config_tx_metadata_specific_port
,
18637 (void *)&cmd_config_tx_metadata_specific_keyword
,
18638 (void *)&cmd_config_tx_metadata_specific_id
,
18639 (void *)&cmd_config_tx_metadata_specific_item
,
18640 (void *)&cmd_config_tx_metadata_specific_value
,
18645 /* *** display tx_metadata per port configuration *** */
18646 struct cmd_show_tx_metadata_result
{
18647 cmdline_fixed_string_t cmd_show
;
18648 cmdline_fixed_string_t cmd_port
;
18649 cmdline_fixed_string_t cmd_keyword
;
18654 cmd_show_tx_metadata_parsed(void *parsed_result
,
18655 __attribute__((unused
)) struct cmdline
*cl
,
18656 __attribute__((unused
)) void *data
)
18658 struct cmd_show_tx_metadata_result
*res
= parsed_result
;
18660 if (!rte_eth_dev_is_valid_port(res
->cmd_pid
)) {
18661 printf("invalid port id %u\n", res
->cmd_pid
);
18664 if (!strcmp(res
->cmd_keyword
, "tx_metadata")) {
18665 printf("Port %u tx_metadata: %u\n", res
->cmd_pid
,
18666 rte_be_to_cpu_32(ports
[res
->cmd_pid
].tx_metadata
));
18670 cmdline_parse_token_string_t cmd_show_tx_metadata_show
=
18671 TOKEN_STRING_INITIALIZER(struct cmd_show_tx_metadata_result
,
18673 cmdline_parse_token_string_t cmd_show_tx_metadata_port
=
18674 TOKEN_STRING_INITIALIZER(struct cmd_show_tx_metadata_result
,
18676 cmdline_parse_token_num_t cmd_show_tx_metadata_pid
=
18677 TOKEN_NUM_INITIALIZER(struct cmd_show_tx_metadata_result
,
18679 cmdline_parse_token_string_t cmd_show_tx_metadata_keyword
=
18680 TOKEN_STRING_INITIALIZER(struct cmd_show_tx_metadata_result
,
18681 cmd_keyword
, "tx_metadata");
18683 cmdline_parse_inst_t cmd_show_tx_metadata
= {
18684 .f
= cmd_show_tx_metadata_parsed
,
18686 .help_str
= "show port <port_id> tx_metadata",
18688 (void *)&cmd_show_tx_metadata_show
,
18689 (void *)&cmd_show_tx_metadata_port
,
18690 (void *)&cmd_show_tx_metadata_pid
,
18691 (void *)&cmd_show_tx_metadata_keyword
,
18696 /* ******************************************************************************** */
18698 /* list of instructions */
18699 cmdline_parse_ctx_t main_ctx
[] = {
18700 (cmdline_parse_inst_t
*)&cmd_help_brief
,
18701 (cmdline_parse_inst_t
*)&cmd_help_long
,
18702 (cmdline_parse_inst_t
*)&cmd_quit
,
18703 (cmdline_parse_inst_t
*)&cmd_load_from_file
,
18704 (cmdline_parse_inst_t
*)&cmd_showport
,
18705 (cmdline_parse_inst_t
*)&cmd_showqueue
,
18706 (cmdline_parse_inst_t
*)&cmd_showportall
,
18707 (cmdline_parse_inst_t
*)&cmd_showcfg
,
18708 (cmdline_parse_inst_t
*)&cmd_showfwdall
,
18709 (cmdline_parse_inst_t
*)&cmd_start
,
18710 (cmdline_parse_inst_t
*)&cmd_start_tx_first
,
18711 (cmdline_parse_inst_t
*)&cmd_start_tx_first_n
,
18712 (cmdline_parse_inst_t
*)&cmd_set_link_up
,
18713 (cmdline_parse_inst_t
*)&cmd_set_link_down
,
18714 (cmdline_parse_inst_t
*)&cmd_reset
,
18715 (cmdline_parse_inst_t
*)&cmd_set_numbers
,
18716 (cmdline_parse_inst_t
*)&cmd_set_log
,
18717 (cmdline_parse_inst_t
*)&cmd_set_txpkts
,
18718 (cmdline_parse_inst_t
*)&cmd_set_txsplit
,
18719 (cmdline_parse_inst_t
*)&cmd_set_fwd_list
,
18720 (cmdline_parse_inst_t
*)&cmd_set_fwd_mask
,
18721 (cmdline_parse_inst_t
*)&cmd_set_fwd_mode
,
18722 (cmdline_parse_inst_t
*)&cmd_set_fwd_retry_mode
,
18723 (cmdline_parse_inst_t
*)&cmd_set_burst_tx_retry
,
18724 (cmdline_parse_inst_t
*)&cmd_set_promisc_mode_one
,
18725 (cmdline_parse_inst_t
*)&cmd_set_promisc_mode_all
,
18726 (cmdline_parse_inst_t
*)&cmd_set_allmulti_mode_one
,
18727 (cmdline_parse_inst_t
*)&cmd_set_allmulti_mode_all
,
18728 (cmdline_parse_inst_t
*)&cmd_set_flush_rx
,
18729 (cmdline_parse_inst_t
*)&cmd_set_link_check
,
18730 (cmdline_parse_inst_t
*)&cmd_set_bypass_mode
,
18731 (cmdline_parse_inst_t
*)&cmd_set_bypass_event
,
18732 (cmdline_parse_inst_t
*)&cmd_set_bypass_timeout
,
18733 (cmdline_parse_inst_t
*)&cmd_show_bypass_config
,
18734 #ifdef RTE_LIBRTE_PMD_BOND
18735 (cmdline_parse_inst_t
*) &cmd_set_bonding_mode
,
18736 (cmdline_parse_inst_t
*) &cmd_show_bonding_config
,
18737 (cmdline_parse_inst_t
*) &cmd_set_bonding_primary
,
18738 (cmdline_parse_inst_t
*) &cmd_add_bonding_slave
,
18739 (cmdline_parse_inst_t
*) &cmd_remove_bonding_slave
,
18740 (cmdline_parse_inst_t
*) &cmd_create_bonded_device
,
18741 (cmdline_parse_inst_t
*) &cmd_set_bond_mac_addr
,
18742 (cmdline_parse_inst_t
*) &cmd_set_balance_xmit_policy
,
18743 (cmdline_parse_inst_t
*) &cmd_set_bond_mon_period
,
18744 (cmdline_parse_inst_t
*) &cmd_set_lacp_dedicated_queues
,
18745 (cmdline_parse_inst_t
*) &cmd_set_bonding_agg_mode_policy
,
18747 (cmdline_parse_inst_t
*)&cmd_vlan_offload
,
18748 (cmdline_parse_inst_t
*)&cmd_vlan_tpid
,
18749 (cmdline_parse_inst_t
*)&cmd_rx_vlan_filter_all
,
18750 (cmdline_parse_inst_t
*)&cmd_rx_vlan_filter
,
18751 (cmdline_parse_inst_t
*)&cmd_tx_vlan_set
,
18752 (cmdline_parse_inst_t
*)&cmd_tx_vlan_set_qinq
,
18753 (cmdline_parse_inst_t
*)&cmd_tx_vlan_reset
,
18754 (cmdline_parse_inst_t
*)&cmd_tx_vlan_set_pvid
,
18755 (cmdline_parse_inst_t
*)&cmd_csum_set
,
18756 (cmdline_parse_inst_t
*)&cmd_csum_show
,
18757 (cmdline_parse_inst_t
*)&cmd_csum_tunnel
,
18758 (cmdline_parse_inst_t
*)&cmd_tso_set
,
18759 (cmdline_parse_inst_t
*)&cmd_tso_show
,
18760 (cmdline_parse_inst_t
*)&cmd_tunnel_tso_set
,
18761 (cmdline_parse_inst_t
*)&cmd_tunnel_tso_show
,
18762 (cmdline_parse_inst_t
*)&cmd_gro_enable
,
18763 (cmdline_parse_inst_t
*)&cmd_gro_flush
,
18764 (cmdline_parse_inst_t
*)&cmd_gro_show
,
18765 (cmdline_parse_inst_t
*)&cmd_gso_enable
,
18766 (cmdline_parse_inst_t
*)&cmd_gso_size
,
18767 (cmdline_parse_inst_t
*)&cmd_gso_show
,
18768 (cmdline_parse_inst_t
*)&cmd_link_flow_control_set
,
18769 (cmdline_parse_inst_t
*)&cmd_link_flow_control_set_rx
,
18770 (cmdline_parse_inst_t
*)&cmd_link_flow_control_set_tx
,
18771 (cmdline_parse_inst_t
*)&cmd_link_flow_control_set_hw
,
18772 (cmdline_parse_inst_t
*)&cmd_link_flow_control_set_lw
,
18773 (cmdline_parse_inst_t
*)&cmd_link_flow_control_set_pt
,
18774 (cmdline_parse_inst_t
*)&cmd_link_flow_control_set_xon
,
18775 (cmdline_parse_inst_t
*)&cmd_link_flow_control_set_macfwd
,
18776 (cmdline_parse_inst_t
*)&cmd_link_flow_control_set_autoneg
,
18777 (cmdline_parse_inst_t
*)&cmd_priority_flow_control_set
,
18778 (cmdline_parse_inst_t
*)&cmd_config_dcb
,
18779 (cmdline_parse_inst_t
*)&cmd_read_reg
,
18780 (cmdline_parse_inst_t
*)&cmd_read_reg_bit_field
,
18781 (cmdline_parse_inst_t
*)&cmd_read_reg_bit
,
18782 (cmdline_parse_inst_t
*)&cmd_write_reg
,
18783 (cmdline_parse_inst_t
*)&cmd_write_reg_bit_field
,
18784 (cmdline_parse_inst_t
*)&cmd_write_reg_bit
,
18785 (cmdline_parse_inst_t
*)&cmd_read_rxd_txd
,
18786 (cmdline_parse_inst_t
*)&cmd_stop
,
18787 (cmdline_parse_inst_t
*)&cmd_mac_addr
,
18788 (cmdline_parse_inst_t
*)&cmd_set_fwd_eth_peer
,
18789 (cmdline_parse_inst_t
*)&cmd_set_qmap
,
18790 (cmdline_parse_inst_t
*)&cmd_set_xstats_hide_zero
,
18791 (cmdline_parse_inst_t
*)&cmd_operate_port
,
18792 (cmdline_parse_inst_t
*)&cmd_operate_specific_port
,
18793 (cmdline_parse_inst_t
*)&cmd_operate_attach_port
,
18794 (cmdline_parse_inst_t
*)&cmd_operate_detach_port
,
18795 (cmdline_parse_inst_t
*)&cmd_set_port_setup_on
,
18796 (cmdline_parse_inst_t
*)&cmd_config_speed_all
,
18797 (cmdline_parse_inst_t
*)&cmd_config_speed_specific
,
18798 (cmdline_parse_inst_t
*)&cmd_config_loopback_all
,
18799 (cmdline_parse_inst_t
*)&cmd_config_loopback_specific
,
18800 (cmdline_parse_inst_t
*)&cmd_config_rx_tx
,
18801 (cmdline_parse_inst_t
*)&cmd_config_mtu
,
18802 (cmdline_parse_inst_t
*)&cmd_config_max_pkt_len
,
18803 (cmdline_parse_inst_t
*)&cmd_config_rx_mode_flag
,
18804 (cmdline_parse_inst_t
*)&cmd_config_rss
,
18805 (cmdline_parse_inst_t
*)&cmd_config_rxtx_ring_size
,
18806 (cmdline_parse_inst_t
*)&cmd_config_rxtx_queue
,
18807 (cmdline_parse_inst_t
*)&cmd_config_deferred_start_rxtx_queue
,
18808 (cmdline_parse_inst_t
*)&cmd_setup_rxtx_queue
,
18809 (cmdline_parse_inst_t
*)&cmd_config_rss_reta
,
18810 (cmdline_parse_inst_t
*)&cmd_showport_reta
,
18811 (cmdline_parse_inst_t
*)&cmd_config_burst
,
18812 (cmdline_parse_inst_t
*)&cmd_config_thresh
,
18813 (cmdline_parse_inst_t
*)&cmd_config_threshold
,
18814 (cmdline_parse_inst_t
*)&cmd_set_uc_hash_filter
,
18815 (cmdline_parse_inst_t
*)&cmd_set_uc_all_hash_filter
,
18816 (cmdline_parse_inst_t
*)&cmd_vf_mac_addr_filter
,
18817 (cmdline_parse_inst_t
*)&cmd_set_vf_macvlan_filter
,
18818 (cmdline_parse_inst_t
*)&cmd_queue_rate_limit
,
18819 (cmdline_parse_inst_t
*)&cmd_tunnel_filter
,
18820 (cmdline_parse_inst_t
*)&cmd_tunnel_udp_config
,
18821 (cmdline_parse_inst_t
*)&cmd_global_config
,
18822 (cmdline_parse_inst_t
*)&cmd_set_mirror_mask
,
18823 (cmdline_parse_inst_t
*)&cmd_set_mirror_link
,
18824 (cmdline_parse_inst_t
*)&cmd_reset_mirror_rule
,
18825 (cmdline_parse_inst_t
*)&cmd_showport_rss_hash
,
18826 (cmdline_parse_inst_t
*)&cmd_showport_rss_hash_key
,
18827 (cmdline_parse_inst_t
*)&cmd_config_rss_hash_key
,
18828 (cmdline_parse_inst_t
*)&cmd_dump
,
18829 (cmdline_parse_inst_t
*)&cmd_dump_one
,
18830 (cmdline_parse_inst_t
*)&cmd_ethertype_filter
,
18831 (cmdline_parse_inst_t
*)&cmd_syn_filter
,
18832 (cmdline_parse_inst_t
*)&cmd_2tuple_filter
,
18833 (cmdline_parse_inst_t
*)&cmd_5tuple_filter
,
18834 (cmdline_parse_inst_t
*)&cmd_flex_filter
,
18835 (cmdline_parse_inst_t
*)&cmd_add_del_ip_flow_director
,
18836 (cmdline_parse_inst_t
*)&cmd_add_del_udp_flow_director
,
18837 (cmdline_parse_inst_t
*)&cmd_add_del_sctp_flow_director
,
18838 (cmdline_parse_inst_t
*)&cmd_add_del_l2_flow_director
,
18839 (cmdline_parse_inst_t
*)&cmd_add_del_mac_vlan_flow_director
,
18840 (cmdline_parse_inst_t
*)&cmd_add_del_tunnel_flow_director
,
18841 (cmdline_parse_inst_t
*)&cmd_add_del_raw_flow_director
,
18842 (cmdline_parse_inst_t
*)&cmd_flush_flow_director
,
18843 (cmdline_parse_inst_t
*)&cmd_set_flow_director_ip_mask
,
18844 (cmdline_parse_inst_t
*)&cmd_set_flow_director_mac_vlan_mask
,
18845 (cmdline_parse_inst_t
*)&cmd_set_flow_director_tunnel_mask
,
18846 (cmdline_parse_inst_t
*)&cmd_set_flow_director_flex_mask
,
18847 (cmdline_parse_inst_t
*)&cmd_set_flow_director_flex_payload
,
18848 (cmdline_parse_inst_t
*)&cmd_get_sym_hash_ena_per_port
,
18849 (cmdline_parse_inst_t
*)&cmd_set_sym_hash_ena_per_port
,
18850 (cmdline_parse_inst_t
*)&cmd_get_hash_global_config
,
18851 (cmdline_parse_inst_t
*)&cmd_set_hash_global_config
,
18852 (cmdline_parse_inst_t
*)&cmd_set_hash_input_set
,
18853 (cmdline_parse_inst_t
*)&cmd_set_fdir_input_set
,
18854 (cmdline_parse_inst_t
*)&cmd_flow
,
18855 (cmdline_parse_inst_t
*)&cmd_show_port_meter_cap
,
18856 (cmdline_parse_inst_t
*)&cmd_add_port_meter_profile_srtcm
,
18857 (cmdline_parse_inst_t
*)&cmd_add_port_meter_profile_trtcm
,
18858 (cmdline_parse_inst_t
*)&cmd_del_port_meter_profile
,
18859 (cmdline_parse_inst_t
*)&cmd_create_port_meter
,
18860 (cmdline_parse_inst_t
*)&cmd_enable_port_meter
,
18861 (cmdline_parse_inst_t
*)&cmd_disable_port_meter
,
18862 (cmdline_parse_inst_t
*)&cmd_del_port_meter
,
18863 (cmdline_parse_inst_t
*)&cmd_set_port_meter_profile
,
18864 (cmdline_parse_inst_t
*)&cmd_set_port_meter_dscp_table
,
18865 (cmdline_parse_inst_t
*)&cmd_set_port_meter_policer_action
,
18866 (cmdline_parse_inst_t
*)&cmd_set_port_meter_stats_mask
,
18867 (cmdline_parse_inst_t
*)&cmd_show_port_meter_stats
,
18868 (cmdline_parse_inst_t
*)&cmd_mcast_addr
,
18869 (cmdline_parse_inst_t
*)&cmd_config_l2_tunnel_eth_type_all
,
18870 (cmdline_parse_inst_t
*)&cmd_config_l2_tunnel_eth_type_specific
,
18871 (cmdline_parse_inst_t
*)&cmd_config_l2_tunnel_en_dis_all
,
18872 (cmdline_parse_inst_t
*)&cmd_config_l2_tunnel_en_dis_specific
,
18873 (cmdline_parse_inst_t
*)&cmd_config_e_tag_insertion_en
,
18874 (cmdline_parse_inst_t
*)&cmd_config_e_tag_insertion_dis
,
18875 (cmdline_parse_inst_t
*)&cmd_config_e_tag_stripping_en_dis
,
18876 (cmdline_parse_inst_t
*)&cmd_config_e_tag_forwarding_en_dis
,
18877 (cmdline_parse_inst_t
*)&cmd_config_e_tag_filter_add
,
18878 (cmdline_parse_inst_t
*)&cmd_config_e_tag_filter_del
,
18879 (cmdline_parse_inst_t
*)&cmd_set_vf_vlan_anti_spoof
,
18880 (cmdline_parse_inst_t
*)&cmd_set_vf_mac_anti_spoof
,
18881 (cmdline_parse_inst_t
*)&cmd_set_vf_vlan_stripq
,
18882 (cmdline_parse_inst_t
*)&cmd_set_vf_vlan_insert
,
18883 (cmdline_parse_inst_t
*)&cmd_set_tx_loopback
,
18884 (cmdline_parse_inst_t
*)&cmd_set_all_queues_drop_en
,
18885 (cmdline_parse_inst_t
*)&cmd_set_vf_split_drop_en
,
18886 (cmdline_parse_inst_t
*)&cmd_set_macsec_offload_on
,
18887 (cmdline_parse_inst_t
*)&cmd_set_macsec_offload_off
,
18888 (cmdline_parse_inst_t
*)&cmd_set_macsec_sc
,
18889 (cmdline_parse_inst_t
*)&cmd_set_macsec_sa
,
18890 (cmdline_parse_inst_t
*)&cmd_set_vf_traffic
,
18891 (cmdline_parse_inst_t
*)&cmd_set_vf_rxmode
,
18892 (cmdline_parse_inst_t
*)&cmd_vf_rate_limit
,
18893 (cmdline_parse_inst_t
*)&cmd_vf_rxvlan_filter
,
18894 (cmdline_parse_inst_t
*)&cmd_set_vf_mac_addr
,
18895 (cmdline_parse_inst_t
*)&cmd_set_vf_promisc
,
18896 (cmdline_parse_inst_t
*)&cmd_set_vf_allmulti
,
18897 (cmdline_parse_inst_t
*)&cmd_set_vf_broadcast
,
18898 (cmdline_parse_inst_t
*)&cmd_set_vf_vlan_tag
,
18899 (cmdline_parse_inst_t
*)&cmd_vf_max_bw
,
18900 (cmdline_parse_inst_t
*)&cmd_vf_tc_min_bw
,
18901 (cmdline_parse_inst_t
*)&cmd_vf_tc_max_bw
,
18902 (cmdline_parse_inst_t
*)&cmd_strict_link_prio
,
18903 (cmdline_parse_inst_t
*)&cmd_tc_min_bw
,
18904 #if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED
18905 (cmdline_parse_inst_t
*)&cmd_set_port_tm_hierarchy_default
,
18907 (cmdline_parse_inst_t
*)&cmd_set_vxlan
,
18908 (cmdline_parse_inst_t
*)&cmd_set_vxlan_tos_ttl
,
18909 (cmdline_parse_inst_t
*)&cmd_set_vxlan_with_vlan
,
18910 (cmdline_parse_inst_t
*)&cmd_set_nvgre
,
18911 (cmdline_parse_inst_t
*)&cmd_set_nvgre_with_vlan
,
18912 (cmdline_parse_inst_t
*)&cmd_set_l2_encap
,
18913 (cmdline_parse_inst_t
*)&cmd_set_l2_encap_with_vlan
,
18914 (cmdline_parse_inst_t
*)&cmd_set_l2_decap
,
18915 (cmdline_parse_inst_t
*)&cmd_set_l2_decap_with_vlan
,
18916 (cmdline_parse_inst_t
*)&cmd_set_mplsogre_encap
,
18917 (cmdline_parse_inst_t
*)&cmd_set_mplsogre_encap_with_vlan
,
18918 (cmdline_parse_inst_t
*)&cmd_set_mplsogre_decap
,
18919 (cmdline_parse_inst_t
*)&cmd_set_mplsogre_decap_with_vlan
,
18920 (cmdline_parse_inst_t
*)&cmd_set_mplsoudp_encap
,
18921 (cmdline_parse_inst_t
*)&cmd_set_mplsoudp_encap_with_vlan
,
18922 (cmdline_parse_inst_t
*)&cmd_set_mplsoudp_decap
,
18923 (cmdline_parse_inst_t
*)&cmd_set_mplsoudp_decap_with_vlan
,
18924 (cmdline_parse_inst_t
*)&cmd_ddp_add
,
18925 (cmdline_parse_inst_t
*)&cmd_ddp_del
,
18926 (cmdline_parse_inst_t
*)&cmd_ddp_get_list
,
18927 (cmdline_parse_inst_t
*)&cmd_ddp_get_info
,
18928 (cmdline_parse_inst_t
*)&cmd_cfg_input_set
,
18929 (cmdline_parse_inst_t
*)&cmd_clear_input_set
,
18930 (cmdline_parse_inst_t
*)&cmd_show_vf_stats
,
18931 (cmdline_parse_inst_t
*)&cmd_clear_vf_stats
,
18932 (cmdline_parse_inst_t
*)&cmd_ptype_mapping_get
,
18933 (cmdline_parse_inst_t
*)&cmd_ptype_mapping_replace
,
18934 (cmdline_parse_inst_t
*)&cmd_ptype_mapping_reset
,
18935 (cmdline_parse_inst_t
*)&cmd_ptype_mapping_update
,
18937 (cmdline_parse_inst_t
*)&cmd_pctype_mapping_get
,
18938 (cmdline_parse_inst_t
*)&cmd_pctype_mapping_reset
,
18939 (cmdline_parse_inst_t
*)&cmd_pctype_mapping_update
,
18940 (cmdline_parse_inst_t
*)&cmd_queue_region
,
18941 (cmdline_parse_inst_t
*)&cmd_region_flowtype
,
18942 (cmdline_parse_inst_t
*)&cmd_user_priority_region
,
18943 (cmdline_parse_inst_t
*)&cmd_flush_queue_region
,
18944 (cmdline_parse_inst_t
*)&cmd_show_queue_region_info_all
,
18945 (cmdline_parse_inst_t
*)&cmd_show_port_tm_cap
,
18946 (cmdline_parse_inst_t
*)&cmd_show_port_tm_level_cap
,
18947 (cmdline_parse_inst_t
*)&cmd_show_port_tm_node_cap
,
18948 (cmdline_parse_inst_t
*)&cmd_show_port_tm_node_type
,
18949 (cmdline_parse_inst_t
*)&cmd_show_port_tm_node_stats
,
18950 (cmdline_parse_inst_t
*)&cmd_add_port_tm_node_shaper_profile
,
18951 (cmdline_parse_inst_t
*)&cmd_del_port_tm_node_shaper_profile
,
18952 (cmdline_parse_inst_t
*)&cmd_add_port_tm_node_shared_shaper
,
18953 (cmdline_parse_inst_t
*)&cmd_del_port_tm_node_shared_shaper
,
18954 (cmdline_parse_inst_t
*)&cmd_add_port_tm_node_wred_profile
,
18955 (cmdline_parse_inst_t
*)&cmd_del_port_tm_node_wred_profile
,
18956 (cmdline_parse_inst_t
*)&cmd_set_port_tm_node_shaper_profile
,
18957 (cmdline_parse_inst_t
*)&cmd_add_port_tm_nonleaf_node
,
18958 (cmdline_parse_inst_t
*)&cmd_add_port_tm_leaf_node
,
18959 (cmdline_parse_inst_t
*)&cmd_del_port_tm_node
,
18960 (cmdline_parse_inst_t
*)&cmd_set_port_tm_node_parent
,
18961 (cmdline_parse_inst_t
*)&cmd_suspend_port_tm_node
,
18962 (cmdline_parse_inst_t
*)&cmd_resume_port_tm_node
,
18963 (cmdline_parse_inst_t
*)&cmd_port_tm_hierarchy_commit
,
18964 (cmdline_parse_inst_t
*)&cmd_port_tm_mark_ip_ecn
,
18965 (cmdline_parse_inst_t
*)&cmd_port_tm_mark_ip_dscp
,
18966 (cmdline_parse_inst_t
*)&cmd_port_tm_mark_vlan_dei
,
18967 (cmdline_parse_inst_t
*)&cmd_cfg_tunnel_udp_port
,
18968 (cmdline_parse_inst_t
*)&cmd_rx_offload_get_capa
,
18969 (cmdline_parse_inst_t
*)&cmd_rx_offload_get_configuration
,
18970 (cmdline_parse_inst_t
*)&cmd_config_per_port_rx_offload
,
18971 (cmdline_parse_inst_t
*)&cmd_config_per_queue_rx_offload
,
18972 (cmdline_parse_inst_t
*)&cmd_tx_offload_get_capa
,
18973 (cmdline_parse_inst_t
*)&cmd_tx_offload_get_configuration
,
18974 (cmdline_parse_inst_t
*)&cmd_config_per_port_tx_offload
,
18975 (cmdline_parse_inst_t
*)&cmd_config_per_queue_tx_offload
,
18976 #ifdef RTE_LIBRTE_BPF
18977 (cmdline_parse_inst_t
*)&cmd_operate_bpf_ld_parse
,
18978 (cmdline_parse_inst_t
*)&cmd_operate_bpf_unld_parse
,
18980 (cmdline_parse_inst_t
*)&cmd_config_tx_metadata_specific
,
18981 (cmdline_parse_inst_t
*)&cmd_show_tx_metadata
,
18985 /* read cmdline commands from file */
18987 cmdline_read_from_file(const char *filename
)
18989 struct cmdline
*cl
;
18991 cl
= cmdline_file_new(main_ctx
, "testpmd> ", filename
);
18993 printf("Failed to create file based cmdline context: %s\n",
18998 cmdline_interact(cl
);
19003 printf("Read CLI commands from %s\n", filename
);
19006 /* prompt function, called from main on MASTER lcore */
19010 /* initialize non-constant commands */
19011 cmd_set_fwd_mode_init();
19012 cmd_set_fwd_retry_mode_init();
19014 testpmd_cl
= cmdline_stdin_new(main_ctx
, "testpmd> ");
19015 if (testpmd_cl
== NULL
)
19017 cmdline_interact(testpmd_cl
);
19018 cmdline_stdin_exit(testpmd_cl
);
19024 if (testpmd_cl
!= NULL
)
19025 cmdline_quit(testpmd_cl
);
19029 cmd_reconfig_device_queue(portid_t id
, uint8_t dev
, uint8_t queue
)
19031 if (id
== (portid_t
)RTE_PORT_ALL
) {
19034 RTE_ETH_FOREACH_DEV(pid
) {
19035 /* check if need_reconfig has been set to 1 */
19036 if (ports
[pid
].need_reconfig
== 0)
19037 ports
[pid
].need_reconfig
= dev
;
19038 /* check if need_reconfig_queues has been set to 1 */
19039 if (ports
[pid
].need_reconfig_queues
== 0)
19040 ports
[pid
].need_reconfig_queues
= queue
;
19042 } else if (!port_id_is_invalid(id
, DISABLED_WARN
)) {
19043 /* check if need_reconfig has been set to 1 */
19044 if (ports
[id
].need_reconfig
== 0)
19045 ports
[id
].need_reconfig
= dev
;
19046 /* check if need_reconfig_queues has been set to 1 */
19047 if (ports
[id
].need_reconfig_queues
== 0)
19048 ports
[id
].need_reconfig_queues
= queue
;