1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2016 Intel Corporation.
3 * Copyright 2013-2014 6WIND S.A.
13 #include <sys/queue.h>
14 #include <sys/types.h>
19 #include <rte_common.h>
20 #include <rte_byteorder.h>
21 #include <rte_debug.h>
23 #include <rte_memory.h>
24 #include <rte_memcpy.h>
25 #include <rte_memzone.h>
26 #include <rte_launch.h>
28 #include <rte_per_lcore.h>
29 #include <rte_lcore.h>
30 #include <rte_atomic.h>
31 #include <rte_branch_prediction.h>
32 #include <rte_mempool.h>
34 #include <rte_interrupts.h>
36 #include <rte_ether.h>
37 #include <rte_ethdev.h>
38 #include <rte_string_fns.h>
39 #include <rte_cycles.h>
41 #include <rte_errno.h>
42 #ifdef RTE_LIBRTE_IXGBE_PMD
43 #include <rte_pmd_ixgbe.h>
45 #ifdef RTE_LIBRTE_I40E_PMD
46 #include <rte_pmd_i40e.h>
48 #ifdef RTE_LIBRTE_BNXT_PMD
49 #include <rte_pmd_bnxt.h>
52 #include <rte_config.h>
56 static char *flowtype_to_str(uint16_t flow_type);
59 enum tx_pkt_split split;
63 .split = TX_PKT_SPLIT_OFF,
67 .split = TX_PKT_SPLIT_ON,
71 .split = TX_PKT_SPLIT_RND,
76 const struct rss_type_info rss_type_table[] = {
77 { "all", ETH_RSS_IP | ETH_RSS_TCP |
78 ETH_RSS_UDP | ETH_RSS_SCTP |
81 { "ipv4", ETH_RSS_IPV4 },
82 { "ipv4-frag", ETH_RSS_FRAG_IPV4 },
83 { "ipv4-tcp", ETH_RSS_NONFRAG_IPV4_TCP },
84 { "ipv4-udp", ETH_RSS_NONFRAG_IPV4_UDP },
85 { "ipv4-sctp", ETH_RSS_NONFRAG_IPV4_SCTP },
86 { "ipv4-other", ETH_RSS_NONFRAG_IPV4_OTHER },
87 { "ipv6", ETH_RSS_IPV6 },
88 { "ipv6-frag", ETH_RSS_FRAG_IPV6 },
89 { "ipv6-tcp", ETH_RSS_NONFRAG_IPV6_TCP },
90 { "ipv6-udp", ETH_RSS_NONFRAG_IPV6_UDP },
91 { "ipv6-sctp", ETH_RSS_NONFRAG_IPV6_SCTP },
92 { "ipv6-other", ETH_RSS_NONFRAG_IPV6_OTHER },
93 { "l2-payload", ETH_RSS_L2_PAYLOAD },
94 { "ipv6-ex", ETH_RSS_IPV6_EX },
95 { "ipv6-tcp-ex", ETH_RSS_IPV6_TCP_EX },
96 { "ipv6-udp-ex", ETH_RSS_IPV6_UDP_EX },
97 { "port", ETH_RSS_PORT },
98 { "vxlan", ETH_RSS_VXLAN },
99 { "geneve", ETH_RSS_GENEVE },
100 { "nvgre", ETH_RSS_NVGRE },
101 { "ip", ETH_RSS_IP },
102 { "udp", ETH_RSS_UDP },
103 { "tcp", ETH_RSS_TCP },
104 { "sctp", ETH_RSS_SCTP },
105 { "tunnel", ETH_RSS_TUNNEL },
110 print_ethaddr(const char *name, struct rte_ether_addr *eth_addr)
112 char buf[RTE_ETHER_ADDR_FMT_SIZE];
113 rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr);
114 printf("%s%s", name, buf);
118 nic_stats_display(portid_t port_id)
120 static uint64_t prev_pkts_rx[RTE_MAX_ETHPORTS];
121 static uint64_t prev_pkts_tx[RTE_MAX_ETHPORTS];
122 static uint64_t prev_cycles[RTE_MAX_ETHPORTS];
123 uint64_t diff_pkts_rx, diff_pkts_tx, diff_cycles;
124 uint64_t mpps_rx, mpps_tx;
125 struct rte_eth_stats stats;
126 struct rte_port *port = &ports[port_id];
129 static const char *nic_stats_border = "########################";
131 if (port_id_is_invalid(port_id, ENABLED_WARN)) {
135 rte_eth_stats_get(port_id, &stats);
136 printf("\n %s NIC statistics for port %-2d %s\n",
137 nic_stats_border, port_id, nic_stats_border);
139 if ((!port->rx_queue_stats_mapping_enabled) && (!port->tx_queue_stats_mapping_enabled)) {
140 printf(" RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" RX-bytes: "
142 stats.ipackets, stats.imissed, stats.ibytes);
143 printf(" RX-errors: %-"PRIu64"\n", stats.ierrors);
144 printf(" RX-nombuf: %-10"PRIu64"\n",
146 printf(" TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" TX-bytes: "
148 stats.opackets, stats.oerrors, stats.obytes);
151 printf(" RX-packets: %10"PRIu64" RX-errors: %10"PRIu64
152 " RX-bytes: %10"PRIu64"\n",
153 stats.ipackets, stats.ierrors, stats.ibytes);
154 printf(" RX-errors: %10"PRIu64"\n", stats.ierrors);
155 printf(" RX-nombuf: %10"PRIu64"\n",
157 printf(" TX-packets: %10"PRIu64" TX-errors: %10"PRIu64
158 " TX-bytes: %10"PRIu64"\n",
159 stats.opackets, stats.oerrors, stats.obytes);
162 if (port->rx_queue_stats_mapping_enabled) {
164 for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
165 printf(" Stats reg %2d RX-packets: %10"PRIu64
166 " RX-errors: %10"PRIu64
167 " RX-bytes: %10"PRIu64"\n",
168 i, stats.q_ipackets[i], stats.q_errors[i], stats.q_ibytes[i]);
171 if (port->tx_queue_stats_mapping_enabled) {
173 for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
174 printf(" Stats reg %2d TX-packets: %10"PRIu64
175 " TX-bytes: %10"PRIu64"\n",
176 i, stats.q_opackets[i], stats.q_obytes[i]);
180 diff_cycles = prev_cycles[port_id];
181 prev_cycles[port_id] = rte_rdtsc();
183 diff_cycles = prev_cycles[port_id] - diff_cycles;
185 diff_pkts_rx = (stats.ipackets > prev_pkts_rx[port_id]) ?
186 (stats.ipackets - prev_pkts_rx[port_id]) : 0;
187 diff_pkts_tx = (stats.opackets > prev_pkts_tx[port_id]) ?
188 (stats.opackets - prev_pkts_tx[port_id]) : 0;
189 prev_pkts_rx[port_id] = stats.ipackets;
190 prev_pkts_tx[port_id] = stats.opackets;
191 mpps_rx = diff_cycles > 0 ?
192 diff_pkts_rx * rte_get_tsc_hz() / diff_cycles : 0;
193 mpps_tx = diff_cycles > 0 ?
194 diff_pkts_tx * rte_get_tsc_hz() / diff_cycles : 0;
195 printf("\n Throughput (since last show)\n");
196 printf(" Rx-pps: %12"PRIu64"\n Tx-pps: %12"PRIu64"\n",
199 printf(" %s############################%s\n",
200 nic_stats_border, nic_stats_border);
204 nic_stats_clear(portid_t port_id)
206 if (port_id_is_invalid(port_id, ENABLED_WARN)) {
210 rte_eth_stats_reset(port_id);
211 printf("\n NIC statistics for port %d cleared\n", port_id);
215 nic_xstats_display(portid_t port_id)
217 struct rte_eth_xstat *xstats;
218 int cnt_xstats, idx_xstat;
219 struct rte_eth_xstat_name *xstats_names;
221 printf("###### NIC extended statistics for port %-2d\n", port_id);
222 if (!rte_eth_dev_is_valid_port(port_id)) {
223 printf("Error: Invalid port number %i\n", port_id);
228 cnt_xstats = rte_eth_xstats_get_names(port_id, NULL, 0);
229 if (cnt_xstats < 0) {
230 printf("Error: Cannot get count of xstats\n");
234 /* Get id-name lookup table */
235 xstats_names = malloc(sizeof(struct rte_eth_xstat_name) * cnt_xstats);
236 if (xstats_names == NULL) {
237 printf("Cannot allocate memory for xstats lookup\n");
240 if (cnt_xstats != rte_eth_xstats_get_names(
241 port_id, xstats_names, cnt_xstats)) {
242 printf("Error: Cannot get xstats lookup\n");
247 /* Get stats themselves */
248 xstats = malloc(sizeof(struct rte_eth_xstat) * cnt_xstats);
249 if (xstats == NULL) {
250 printf("Cannot allocate memory for xstats\n");
254 if (cnt_xstats != rte_eth_xstats_get(port_id, xstats, cnt_xstats)) {
255 printf("Error: Unable to get xstats\n");
262 for (idx_xstat = 0; idx_xstat < cnt_xstats; idx_xstat++) {
263 if (xstats_hide_zero && !xstats[idx_xstat].value)
265 printf("%s: %"PRIu64"\n",
266 xstats_names[idx_xstat].name,
267 xstats[idx_xstat].value);
274 nic_xstats_clear(portid_t port_id)
276 rte_eth_xstats_reset(port_id);
280 nic_stats_mapping_display(portid_t port_id)
282 struct rte_port *port = &ports[port_id];
285 static const char *nic_stats_mapping_border = "########################";
287 if (port_id_is_invalid(port_id, ENABLED_WARN)) {
292 if ((!port->rx_queue_stats_mapping_enabled) && (!port->tx_queue_stats_mapping_enabled)) {
293 printf("Port id %d - either does not support queue statistic mapping or"
294 " no queue statistic mapping set\n", port_id);
298 printf("\n %s NIC statistics mapping for port %-2d %s\n",
299 nic_stats_mapping_border, port_id, nic_stats_mapping_border);
301 if (port->rx_queue_stats_mapping_enabled) {
302 for (i = 0; i < nb_rx_queue_stats_mappings; i++) {
303 if (rx_queue_stats_mappings[i].port_id == port_id) {
304 printf(" RX-queue %2d mapped to Stats Reg %2d\n",
305 rx_queue_stats_mappings[i].queue_id,
306 rx_queue_stats_mappings[i].stats_counter_id);
313 if (port->tx_queue_stats_mapping_enabled) {
314 for (i = 0; i < nb_tx_queue_stats_mappings; i++) {
315 if (tx_queue_stats_mappings[i].port_id == port_id) {
316 printf(" TX-queue %2d mapped to Stats Reg %2d\n",
317 tx_queue_stats_mappings[i].queue_id,
318 tx_queue_stats_mappings[i].stats_counter_id);
323 printf(" %s####################################%s\n",
324 nic_stats_mapping_border, nic_stats_mapping_border);
328 rx_queue_infos_display(portid_t port_id, uint16_t queue_id)
330 struct rte_eth_rxq_info qinfo;
332 static const char *info_border = "*********************";
334 rc = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo);
336 printf("Failed to retrieve information for port: %u, "
337 "RX queue: %hu\nerror desc: %s(%d)\n",
338 port_id, queue_id, strerror(-rc), rc);
342 printf("\n%s Infos for port %-2u, RX queue %-2u %s",
343 info_border, port_id, queue_id, info_border);
345 printf("\nMempool: %s", (qinfo.mp == NULL) ? "NULL" : qinfo.mp->name);
346 printf("\nRX prefetch threshold: %hhu", qinfo.conf.rx_thresh.pthresh);
347 printf("\nRX host threshold: %hhu", qinfo.conf.rx_thresh.hthresh);
348 printf("\nRX writeback threshold: %hhu", qinfo.conf.rx_thresh.wthresh);
349 printf("\nRX free threshold: %hu", qinfo.conf.rx_free_thresh);
350 printf("\nRX drop packets: %s",
351 (qinfo.conf.rx_drop_en != 0) ? "on" : "off");
352 printf("\nRX deferred start: %s",
353 (qinfo.conf.rx_deferred_start != 0) ? "on" : "off");
354 printf("\nRX scattered packets: %s",
355 (qinfo.scattered_rx != 0) ? "on" : "off");
356 printf("\nNumber of RXDs: %hu", qinfo.nb_desc);
361 tx_queue_infos_display(portid_t port_id, uint16_t queue_id)
363 struct rte_eth_txq_info qinfo;
365 static const char *info_border = "*********************";
367 rc = rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo);
369 printf("Failed to retrieve information for port: %u, "
370 "TX queue: %hu\nerror desc: %s(%d)\n",
371 port_id, queue_id, strerror(-rc), rc);
375 printf("\n%s Infos for port %-2u, TX queue %-2u %s",
376 info_border, port_id, queue_id, info_border);
378 printf("\nTX prefetch threshold: %hhu", qinfo.conf.tx_thresh.pthresh);
379 printf("\nTX host threshold: %hhu", qinfo.conf.tx_thresh.hthresh);
380 printf("\nTX writeback threshold: %hhu", qinfo.conf.tx_thresh.wthresh);
381 printf("\nTX RS threshold: %hu", qinfo.conf.tx_rs_thresh);
382 printf("\nTX free threshold: %hu", qinfo.conf.tx_free_thresh);
383 printf("\nTX deferred start: %s",
384 (qinfo.conf.tx_deferred_start != 0) ? "on" : "off");
385 printf("\nNumber of TXDs: %hu", qinfo.nb_desc);
390 port_infos_display(portid_t port_id)
392 struct rte_port *port;
393 struct rte_ether_addr mac_addr;
394 struct rte_eth_link link;
395 struct rte_eth_dev_info dev_info;
397 struct rte_mempool * mp;
398 static const char *info_border = "*********************";
400 char name[RTE_ETH_NAME_MAX_LEN];
402 if (port_id_is_invalid(port_id, ENABLED_WARN)) {
406 port = &ports[port_id];
407 rte_eth_link_get_nowait(port_id, &link);
408 memset(&dev_info, 0, sizeof(dev_info));
409 rte_eth_dev_info_get(port_id, &dev_info);
410 printf("\n%s Infos for port %-2d %s\n",
411 info_border, port_id, info_border);
412 rte_eth_macaddr_get(port_id, &mac_addr);
413 print_ethaddr("MAC address: ", &mac_addr);
414 rte_eth_dev_get_name_by_port(port_id, name);
415 printf("\nDevice name: %s", name);
416 printf("\nDriver name: %s", dev_info.driver_name);
417 if (dev_info.device->devargs && dev_info.device->devargs->args)
418 printf("\nDevargs: %s", dev_info.device->devargs->args);
419 printf("\nConnect to socket: %u", port->socket_id);
421 if (port_numa[port_id] != NUMA_NO_CONFIG) {
422 mp = mbuf_pool_find(port_numa[port_id]);
424 printf("\nmemory allocation on the socket: %d",
427 printf("\nmemory allocation on the socket: %u",port->socket_id);
429 printf("\nLink status: %s\n", (link.link_status) ? ("up") : ("down"));
430 printf("Link speed: %u Mbps\n", (unsigned) link.link_speed);
431 printf("Link duplex: %s\n", (link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
432 ("full-duplex") : ("half-duplex"));
434 if (!rte_eth_dev_get_mtu(port_id, &mtu))
435 printf("MTU: %u\n", mtu);
437 printf("Promiscuous mode: %s\n",
438 rte_eth_promiscuous_get(port_id) ? "enabled" : "disabled");
439 printf("Allmulticast mode: %s\n",
440 rte_eth_allmulticast_get(port_id) ? "enabled" : "disabled");
441 printf("Maximum number of MAC addresses: %u\n",
442 (unsigned int)(port->dev_info.max_mac_addrs));
443 printf("Maximum number of MAC addresses of hash filtering: %u\n",
444 (unsigned int)(port->dev_info.max_hash_mac_addrs));
446 vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
447 if (vlan_offload >= 0){
448 printf("VLAN offload: \n");
449 if (vlan_offload & ETH_VLAN_STRIP_OFFLOAD)
450 printf(" strip on \n");
452 printf(" strip off \n");
454 if (vlan_offload & ETH_VLAN_FILTER_OFFLOAD)
455 printf(" filter on \n");
457 printf(" filter off \n");
459 if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD)
460 printf(" qinq(extend) on \n");
462 printf(" qinq(extend) off \n");
465 if (dev_info.hash_key_size > 0)
466 printf("Hash key size in bytes: %u\n", dev_info.hash_key_size);
467 if (dev_info.reta_size > 0)
468 printf("Redirection table size: %u\n", dev_info.reta_size);
469 if (!dev_info.flow_type_rss_offloads)
470 printf("No RSS offload flow type is supported.\n");
475 printf("Supported RSS offload flow types:\n");
476 for (i = RTE_ETH_FLOW_UNKNOWN + 1;
477 i < sizeof(dev_info.flow_type_rss_offloads) * CHAR_BIT; i++) {
478 if (!(dev_info.flow_type_rss_offloads & (1ULL << i)))
480 p = flowtype_to_str(i);
484 printf(" user defined %d\n", i);
488 printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize);
489 printf("Maximum configurable length of RX packet: %u\n",
490 dev_info.max_rx_pktlen);
491 if (dev_info.max_vfs)
492 printf("Maximum number of VFs: %u\n", dev_info.max_vfs);
493 if (dev_info.max_vmdq_pools)
494 printf("Maximum number of VMDq pools: %u\n",
495 dev_info.max_vmdq_pools);
497 printf("Current number of RX queues: %u\n", dev_info.nb_rx_queues);
498 printf("Max possible RX queues: %u\n", dev_info.max_rx_queues);
499 printf("Max possible number of RXDs per queue: %hu\n",
500 dev_info.rx_desc_lim.nb_max);
501 printf("Min possible number of RXDs per queue: %hu\n",
502 dev_info.rx_desc_lim.nb_min);
503 printf("RXDs number alignment: %hu\n", dev_info.rx_desc_lim.nb_align);
505 printf("Current number of TX queues: %u\n", dev_info.nb_tx_queues);
506 printf("Max possible TX queues: %u\n", dev_info.max_tx_queues);
507 printf("Max possible number of TXDs per queue: %hu\n",
508 dev_info.tx_desc_lim.nb_max);
509 printf("Min possible number of TXDs per queue: %hu\n",
510 dev_info.tx_desc_lim.nb_min);
511 printf("TXDs number alignment: %hu\n", dev_info.tx_desc_lim.nb_align);
513 /* Show switch info only if valid switch domain and port id is set */
514 if (dev_info.switch_info.domain_id !=
515 RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID) {
516 if (dev_info.switch_info.name)
517 printf("Switch name: %s\n", dev_info.switch_info.name);
519 printf("Switch domain Id: %u\n",
520 dev_info.switch_info.domain_id);
521 printf("Switch Port Id: %u\n",
522 dev_info.switch_info.port_id);
527 port_summary_header_display(void)
529 uint16_t port_number;
531 port_number = rte_eth_dev_count_avail();
532 printf("Number of available ports: %i\n", port_number);
533 printf("%-4s %-17s %-12s %-14s %-8s %s\n", "Port", "MAC Address", "Name",
534 "Driver", "Status", "Link");
538 port_summary_display(portid_t port_id)
540 struct rte_ether_addr mac_addr;
541 struct rte_eth_link link;
542 struct rte_eth_dev_info dev_info;
543 char name[RTE_ETH_NAME_MAX_LEN];
545 if (port_id_is_invalid(port_id, ENABLED_WARN)) {
550 rte_eth_link_get_nowait(port_id, &link);
551 rte_eth_dev_info_get(port_id, &dev_info);
552 rte_eth_dev_get_name_by_port(port_id, name);
553 rte_eth_macaddr_get(port_id, &mac_addr);
555 printf("%-4d %02X:%02X:%02X:%02X:%02X:%02X %-12s %-14s %-8s %uMbps\n",
556 port_id, mac_addr.addr_bytes[0], mac_addr.addr_bytes[1],
557 mac_addr.addr_bytes[2], mac_addr.addr_bytes[3],
558 mac_addr.addr_bytes[4], mac_addr.addr_bytes[5], name,
559 dev_info.driver_name, (link.link_status) ? ("up") : ("down"),
560 (unsigned int) link.link_speed);
564 port_offload_cap_display(portid_t port_id)
566 struct rte_eth_dev_info dev_info;
567 static const char *info_border = "************";
569 if (port_id_is_invalid(port_id, ENABLED_WARN))
572 rte_eth_dev_info_get(port_id, &dev_info);
574 printf("\n%s Port %d supported offload features: %s\n",
575 info_border, port_id, info_border);
577 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) {
578 printf("VLAN stripped: ");
579 if (ports[port_id].dev_conf.rxmode.offloads &
580 DEV_RX_OFFLOAD_VLAN_STRIP)
586 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_QINQ_STRIP) {
587 printf("Double VLANs stripped: ");
588 if (ports[port_id].dev_conf.rxmode.offloads &
589 DEV_RX_OFFLOAD_QINQ_STRIP)
595 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) {
596 printf("RX IPv4 checksum: ");
597 if (ports[port_id].dev_conf.rxmode.offloads &
598 DEV_RX_OFFLOAD_IPV4_CKSUM)
604 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) {
605 printf("RX UDP checksum: ");
606 if (ports[port_id].dev_conf.rxmode.offloads &
607 DEV_RX_OFFLOAD_UDP_CKSUM)
613 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) {
614 printf("RX TCP checksum: ");
615 if (ports[port_id].dev_conf.rxmode.offloads &
616 DEV_RX_OFFLOAD_TCP_CKSUM)
622 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_SCTP_CKSUM) {
623 printf("RX SCTP checksum: ");
624 if (ports[port_id].dev_conf.rxmode.offloads &
625 DEV_RX_OFFLOAD_SCTP_CKSUM)
631 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) {
632 printf("RX Outer IPv4 checksum: ");
633 if (ports[port_id].dev_conf.rxmode.offloads &
634 DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM)
640 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_UDP_CKSUM) {
641 printf("RX Outer UDP checksum: ");
642 if (ports[port_id].dev_conf.rxmode.offloads &
643 DEV_RX_OFFLOAD_OUTER_UDP_CKSUM)
649 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_LRO) {
650 printf("Large receive offload: ");
651 if (ports[port_id].dev_conf.rxmode.offloads &
652 DEV_RX_OFFLOAD_TCP_LRO)
658 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) {
659 printf("HW timestamp: ");
660 if (ports[port_id].dev_conf.rxmode.offloads &
661 DEV_RX_OFFLOAD_TIMESTAMP)
667 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_KEEP_CRC) {
668 printf("Rx Keep CRC: ");
669 if (ports[port_id].dev_conf.rxmode.offloads &
670 DEV_RX_OFFLOAD_KEEP_CRC)
676 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_SECURITY) {
677 printf("RX offload security: ");
678 if (ports[port_id].dev_conf.rxmode.offloads &
679 DEV_RX_OFFLOAD_SECURITY)
685 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) {
686 printf("VLAN insert: ");
687 if (ports[port_id].dev_conf.txmode.offloads &
688 DEV_TX_OFFLOAD_VLAN_INSERT)
694 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) {
695 printf("Double VLANs insert: ");
696 if (ports[port_id].dev_conf.txmode.offloads &
697 DEV_TX_OFFLOAD_QINQ_INSERT)
703 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) {
704 printf("TX IPv4 checksum: ");
705 if (ports[port_id].dev_conf.txmode.offloads &
706 DEV_TX_OFFLOAD_IPV4_CKSUM)
712 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) {
713 printf("TX UDP checksum: ");
714 if (ports[port_id].dev_conf.txmode.offloads &
715 DEV_TX_OFFLOAD_UDP_CKSUM)
721 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) {
722 printf("TX TCP checksum: ");
723 if (ports[port_id].dev_conf.txmode.offloads &
724 DEV_TX_OFFLOAD_TCP_CKSUM)
730 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) {
731 printf("TX SCTP checksum: ");
732 if (ports[port_id].dev_conf.txmode.offloads &
733 DEV_TX_OFFLOAD_SCTP_CKSUM)
739 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) {
740 printf("TX Outer IPv4 checksum: ");
741 if (ports[port_id].dev_conf.txmode.offloads &
742 DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)
748 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) {
749 printf("TX TCP segmentation: ");
750 if (ports[port_id].dev_conf.txmode.offloads &
751 DEV_TX_OFFLOAD_TCP_TSO)
757 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TSO) {
758 printf("TX UDP segmentation: ");
759 if (ports[port_id].dev_conf.txmode.offloads &
760 DEV_TX_OFFLOAD_UDP_TSO)
766 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO) {
767 printf("TSO for VXLAN tunnel packet: ");
768 if (ports[port_id].dev_conf.txmode.offloads &
769 DEV_TX_OFFLOAD_VXLAN_TNL_TSO)
775 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO) {
776 printf("TSO for GRE tunnel packet: ");
777 if (ports[port_id].dev_conf.txmode.offloads &
778 DEV_TX_OFFLOAD_GRE_TNL_TSO)
784 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO) {
785 printf("TSO for IPIP tunnel packet: ");
786 if (ports[port_id].dev_conf.txmode.offloads &
787 DEV_TX_OFFLOAD_IPIP_TNL_TSO)
793 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO) {
794 printf("TSO for GENEVE tunnel packet: ");
795 if (ports[port_id].dev_conf.txmode.offloads &
796 DEV_TX_OFFLOAD_GENEVE_TNL_TSO)
802 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IP_TNL_TSO) {
803 printf("IP tunnel TSO: ");
804 if (ports[port_id].dev_conf.txmode.offloads &
805 DEV_TX_OFFLOAD_IP_TNL_TSO)
811 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TNL_TSO) {
812 printf("UDP tunnel TSO: ");
813 if (ports[port_id].dev_conf.txmode.offloads &
814 DEV_TX_OFFLOAD_UDP_TNL_TSO)
820 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) {
821 printf("TX Outer UDP checksum: ");
822 if (ports[port_id].dev_conf.txmode.offloads &
823 DEV_TX_OFFLOAD_OUTER_UDP_CKSUM)
832 port_id_is_invalid(portid_t port_id, enum print_warning warning)
836 if (port_id == (portid_t)RTE_PORT_ALL)
839 RTE_ETH_FOREACH_DEV(pid)
843 if (warning == ENABLED_WARN)
844 printf("Invalid port %d\n", port_id);
849 void print_valid_ports(void)
853 printf("The valid ports array is [");
854 RTE_ETH_FOREACH_DEV(pid) {
861 vlan_id_is_invalid(uint16_t vlan_id)
865 printf("Invalid vlan_id %d (must be < 4096)\n", vlan_id);
870 port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
872 const struct rte_pci_device *pci_dev;
873 const struct rte_bus *bus;
877 printf("Port register offset 0x%X not aligned on a 4-byte "
883 if (!ports[port_id].dev_info.device) {
884 printf("Invalid device\n");
888 bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
889 if (bus && !strcmp(bus->name, "pci")) {
890 pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
892 printf("Not a PCI device\n");
896 pci_len = pci_dev->mem_resource[0].len;
897 if (reg_off >= pci_len) {
898 printf("Port %d: register offset %u (0x%X) out of port PCI "
899 "resource (length=%"PRIu64")\n",
900 port_id, (unsigned)reg_off, (unsigned)reg_off, pci_len);
907 reg_bit_pos_is_invalid(uint8_t bit_pos)
911 printf("Invalid bit position %d (must be <= 31)\n", bit_pos);
915 #define display_port_and_reg_off(port_id, reg_off) \
916 printf("port %d PCI register at offset 0x%X: ", (port_id), (reg_off))
919 display_port_reg_value(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
921 display_port_and_reg_off(port_id, (unsigned)reg_off);
922 printf("0x%08X (%u)\n", (unsigned)reg_v, (unsigned)reg_v);
926 port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_x)
931 if (port_id_is_invalid(port_id, ENABLED_WARN))
933 if (port_reg_off_is_invalid(port_id, reg_off))
935 if (reg_bit_pos_is_invalid(bit_x))
937 reg_v = port_id_pci_reg_read(port_id, reg_off);
938 display_port_and_reg_off(port_id, (unsigned)reg_off);
939 printf("bit %d=%d\n", bit_x, (int) ((reg_v & (1 << bit_x)) >> bit_x));
943 port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
944 uint8_t bit1_pos, uint8_t bit2_pos)
950 if (port_id_is_invalid(port_id, ENABLED_WARN))
952 if (port_reg_off_is_invalid(port_id, reg_off))
954 if (reg_bit_pos_is_invalid(bit1_pos))
956 if (reg_bit_pos_is_invalid(bit2_pos))
958 if (bit1_pos > bit2_pos)
959 l_bit = bit2_pos, h_bit = bit1_pos;
961 l_bit = bit1_pos, h_bit = bit2_pos;
963 reg_v = port_id_pci_reg_read(port_id, reg_off);
966 reg_v &= ((1 << (h_bit - l_bit + 1)) - 1);
967 display_port_and_reg_off(port_id, (unsigned)reg_off);
968 printf("bits[%d, %d]=0x%0*X (%u)\n", l_bit, h_bit,
969 ((h_bit - l_bit) / 4) + 1, (unsigned)reg_v, (unsigned)reg_v);
973 port_reg_display(portid_t port_id, uint32_t reg_off)
977 if (port_id_is_invalid(port_id, ENABLED_WARN))
979 if (port_reg_off_is_invalid(port_id, reg_off))
981 reg_v = port_id_pci_reg_read(port_id, reg_off);
982 display_port_reg_value(port_id, reg_off, reg_v);
986 port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
991 if (port_id_is_invalid(port_id, ENABLED_WARN))
993 if (port_reg_off_is_invalid(port_id, reg_off))
995 if (reg_bit_pos_is_invalid(bit_pos))
998 printf("Invalid bit value %d (must be 0 or 1)\n", (int) bit_v);
1001 reg_v = port_id_pci_reg_read(port_id, reg_off);
1003 reg_v &= ~(1 << bit_pos);
1005 reg_v |= (1 << bit_pos);
1006 port_id_pci_reg_write(port_id, reg_off, reg_v);
1007 display_port_reg_value(port_id, reg_off, reg_v);
1011 port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
1012 uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value)
1019 if (port_id_is_invalid(port_id, ENABLED_WARN))
1021 if (port_reg_off_is_invalid(port_id, reg_off))
1023 if (reg_bit_pos_is_invalid(bit1_pos))
1025 if (reg_bit_pos_is_invalid(bit2_pos))
1027 if (bit1_pos > bit2_pos)
1028 l_bit = bit2_pos, h_bit = bit1_pos;
1030 l_bit = bit1_pos, h_bit = bit2_pos;
1032 if ((h_bit - l_bit) < 31)
1033 max_v = (1 << (h_bit - l_bit + 1)) - 1;
1037 if (value > max_v) {
1038 printf("Invalid value %u (0x%x) must be < %u (0x%x)\n",
1039 (unsigned)value, (unsigned)value,
1040 (unsigned)max_v, (unsigned)max_v);
1043 reg_v = port_id_pci_reg_read(port_id, reg_off);
1044 reg_v &= ~(max_v << l_bit); /* Keep unchanged bits */
1045 reg_v |= (value << l_bit); /* Set changed bits */
1046 port_id_pci_reg_write(port_id, reg_off, reg_v);
1047 display_port_reg_value(port_id, reg_off, reg_v);
1051 port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
1053 if (port_id_is_invalid(port_id, ENABLED_WARN))
1055 if (port_reg_off_is_invalid(port_id, reg_off))
1057 port_id_pci_reg_write(port_id, reg_off, reg_v);
1058 display_port_reg_value(port_id, reg_off, reg_v);
1062 port_mtu_set(portid_t port_id, uint16_t mtu)
1065 struct rte_eth_dev_info dev_info;
1067 if (port_id_is_invalid(port_id, ENABLED_WARN))
1069 rte_eth_dev_info_get(port_id, &dev_info);
1070 if (mtu > dev_info.max_mtu || mtu < dev_info.min_mtu) {
1071 printf("Set MTU failed. MTU:%u is not in valid range, min:%u - max:%u\n",
1072 mtu, dev_info.min_mtu, dev_info.max_mtu);
1075 diag = rte_eth_dev_set_mtu(port_id, mtu);
1078 printf("Set MTU failed. diag=%d\n", diag);
1081 /* Generic flow management functions. */
1083 /** Generate a port_flow entry from attributes/pattern/actions. */
1084 static struct port_flow *
1085 port_flow_new(const struct rte_flow_attr *attr,
1086 const struct rte_flow_item *pattern,
1087 const struct rte_flow_action *actions,
1088 struct rte_flow_error *error)
1090 const struct rte_flow_conv_rule rule = {
1092 .pattern_ro = pattern,
1093 .actions_ro = actions,
1095 struct port_flow *pf;
1098 ret = rte_flow_conv(RTE_FLOW_CONV_OP_RULE, NULL, 0, &rule, error);
1101 pf = calloc(1, offsetof(struct port_flow, rule) + ret);
1104 (error, errno, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
1108 if (rte_flow_conv(RTE_FLOW_CONV_OP_RULE, &pf->rule, ret, &rule,
1115 /** Print a message out of a flow error. */
1117 port_flow_complain(struct rte_flow_error *error)
1119 static const char *const errstrlist[] = {
1120 [RTE_FLOW_ERROR_TYPE_NONE] = "no error",
1121 [RTE_FLOW_ERROR_TYPE_UNSPECIFIED] = "cause unspecified",
1122 [RTE_FLOW_ERROR_TYPE_HANDLE] = "flow rule (handle)",
1123 [RTE_FLOW_ERROR_TYPE_ATTR_GROUP] = "group field",
1124 [RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY] = "priority field",
1125 [RTE_FLOW_ERROR_TYPE_ATTR_INGRESS] = "ingress field",
1126 [RTE_FLOW_ERROR_TYPE_ATTR_EGRESS] = "egress field",
1127 [RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER] = "transfer field",
1128 [RTE_FLOW_ERROR_TYPE_ATTR] = "attributes structure",
1129 [RTE_FLOW_ERROR_TYPE_ITEM_NUM] = "pattern length",
1130 [RTE_FLOW_ERROR_TYPE_ITEM_SPEC] = "item specification",
1131 [RTE_FLOW_ERROR_TYPE_ITEM_LAST] = "item specification range",
1132 [RTE_FLOW_ERROR_TYPE_ITEM_MASK] = "item specification mask",
1133 [RTE_FLOW_ERROR_TYPE_ITEM] = "specific pattern item",
1134 [RTE_FLOW_ERROR_TYPE_ACTION_NUM] = "number of actions",
1135 [RTE_FLOW_ERROR_TYPE_ACTION_CONF] = "action configuration",
1136 [RTE_FLOW_ERROR_TYPE_ACTION] = "specific action",
1140 int err = rte_errno;
1142 if ((unsigned int)error->type >= RTE_DIM(errstrlist) ||
1143 !errstrlist[error->type])
1144 errstr = "unknown type";
1146 errstr = errstrlist[error->type];
1147 printf("Caught error type %d (%s): %s%s: %s\n",
1148 error->type, errstr,
1149 error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
1150 error->cause), buf) : "",
1151 error->message ? error->message : "(no stated reason)",
1156 /** Validate flow rule. */
1158 port_flow_validate(portid_t port_id,
1159 const struct rte_flow_attr *attr,
1160 const struct rte_flow_item *pattern,
1161 const struct rte_flow_action *actions)
1163 struct rte_flow_error error;
1165 /* Poisoning to make sure PMDs update it in case of error. */
1166 memset(&error, 0x11, sizeof(error));
1167 if (rte_flow_validate(port_id, attr, pattern, actions, &error))
1168 return port_flow_complain(&error);
1169 printf("Flow rule validated\n");
1173 /** Create flow rule. */
1175 port_flow_create(portid_t port_id,
1176 const struct rte_flow_attr *attr,
1177 const struct rte_flow_item *pattern,
1178 const struct rte_flow_action *actions)
1180 struct rte_flow *flow;
1181 struct rte_port *port;
1182 struct port_flow *pf;
1184 struct rte_flow_error error;
1186 /* Poisoning to make sure PMDs update it in case of error. */
1187 memset(&error, 0x22, sizeof(error));
1188 flow = rte_flow_create(port_id, attr, pattern, actions, &error);
1190 return port_flow_complain(&error);
1191 port = &ports[port_id];
1192 if (port->flow_list) {
1193 if (port->flow_list->id == UINT32_MAX) {
1194 printf("Highest rule ID is already assigned, delete"
1196 rte_flow_destroy(port_id, flow, NULL);
1199 id = port->flow_list->id + 1;
1202 pf = port_flow_new(attr, pattern, actions, &error);
1204 rte_flow_destroy(port_id, flow, NULL);
1205 return port_flow_complain(&error);
1207 pf->next = port->flow_list;
1210 port->flow_list = pf;
1211 printf("Flow rule #%u created\n", pf->id);
1215 /** Destroy a number of flow rules. */
1217 port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule)
1219 struct rte_port *port;
1220 struct port_flow **tmp;
1224 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
1225 port_id == (portid_t)RTE_PORT_ALL)
1227 port = &ports[port_id];
1228 tmp = &port->flow_list;
1232 for (i = 0; i != n; ++i) {
1233 struct rte_flow_error error;
1234 struct port_flow *pf = *tmp;
1236 if (rule[i] != pf->id)
1239 * Poisoning to make sure PMDs update it in case
1242 memset(&error, 0x33, sizeof(error));
1243 if (rte_flow_destroy(port_id, pf->flow, &error)) {
1244 ret = port_flow_complain(&error);
1247 printf("Flow rule #%u destroyed\n", pf->id);
1253 tmp = &(*tmp)->next;
1259 /** Remove all flow rules. */
1261 port_flow_flush(portid_t port_id)
1263 struct rte_flow_error error;
1264 struct rte_port *port;
1267 /* Poisoning to make sure PMDs update it in case of error. */
1268 memset(&error, 0x44, sizeof(error));
1269 if (rte_flow_flush(port_id, &error)) {
1270 ret = port_flow_complain(&error);
1271 if (port_id_is_invalid(port_id, DISABLED_WARN) ||
1272 port_id == (portid_t)RTE_PORT_ALL)
1275 port = &ports[port_id];
1276 while (port->flow_list) {
1277 struct port_flow *pf = port->flow_list->next;
1279 free(port->flow_list);
1280 port->flow_list = pf;
1285 /** Query a flow rule. */
1287 port_flow_query(portid_t port_id, uint32_t rule,
1288 const struct rte_flow_action *action)
1290 struct rte_flow_error error;
1291 struct rte_port *port;
1292 struct port_flow *pf;
1295 struct rte_flow_query_count count;
1299 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
1300 port_id == (portid_t)RTE_PORT_ALL)
1302 port = &ports[port_id];
1303 for (pf = port->flow_list; pf; pf = pf->next)
1307 printf("Flow rule #%u not found\n", rule);
1310 ret = rte_flow_conv(RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
1311 &name, sizeof(name),
1312 (void *)(uintptr_t)action->type, &error);
1314 return port_flow_complain(&error);
1315 switch (action->type) {
1316 case RTE_FLOW_ACTION_TYPE_COUNT:
1319 printf("Cannot query action type %d (%s)\n",
1320 action->type, name);
1323 /* Poisoning to make sure PMDs update it in case of error. */
1324 memset(&error, 0x55, sizeof(error));
1325 memset(&query, 0, sizeof(query));
1326 if (rte_flow_query(port_id, pf->flow, action, &query, &error))
1327 return port_flow_complain(&error);
1328 switch (action->type) {
1329 case RTE_FLOW_ACTION_TYPE_COUNT:
1333 " hits: %" PRIu64 "\n"
1334 " bytes: %" PRIu64 "\n",
1336 query.count.hits_set,
1337 query.count.bytes_set,
1342 printf("Cannot display result for action type %d (%s)\n",
1343 action->type, name);
1349 /** List flow rules. */
1351 port_flow_list(portid_t port_id, uint32_t n, const uint32_t group[n])
1353 struct rte_port *port;
1354 struct port_flow *pf;
1355 struct port_flow *list = NULL;
1358 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
1359 port_id == (portid_t)RTE_PORT_ALL)
1361 port = &ports[port_id];
1362 if (!port->flow_list)
1364 /* Sort flows by group, priority and ID. */
1365 for (pf = port->flow_list; pf != NULL; pf = pf->next) {
1366 struct port_flow **tmp;
1367 const struct rte_flow_attr *curr = pf->rule.attr;
1370 /* Filter out unwanted groups. */
1371 for (i = 0; i != n; ++i)
1372 if (curr->group == group[i])
1377 for (tmp = &list; *tmp; tmp = &(*tmp)->tmp) {
1378 const struct rte_flow_attr *comp = (*tmp)->rule.attr;
1380 if (curr->group > comp->group ||
1381 (curr->group == comp->group &&
1382 curr->priority > comp->priority) ||
1383 (curr->group == comp->group &&
1384 curr->priority == comp->priority &&
1385 pf->id > (*tmp)->id))
1392 printf("ID\tGroup\tPrio\tAttr\tRule\n");
1393 for (pf = list; pf != NULL; pf = pf->tmp) {
1394 const struct rte_flow_item *item = pf->rule.pattern;
1395 const struct rte_flow_action *action = pf->rule.actions;
1398 printf("%" PRIu32 "\t%" PRIu32 "\t%" PRIu32 "\t%c%c%c\t",
1400 pf->rule.attr->group,
1401 pf->rule.attr->priority,
1402 pf->rule.attr->ingress ? 'i' : '-',
1403 pf->rule.attr->egress ? 'e' : '-',
1404 pf->rule.attr->transfer ? 't' : '-');
1405 while (item->type != RTE_FLOW_ITEM_TYPE_END) {
1406 if (rte_flow_conv(RTE_FLOW_CONV_OP_ITEM_NAME_PTR,
1407 &name, sizeof(name),
1408 (void *)(uintptr_t)item->type,
1411 if (item->type != RTE_FLOW_ITEM_TYPE_VOID)
1412 printf("%s ", name);
1416 while (action->type != RTE_FLOW_ACTION_TYPE_END) {
1417 if (rte_flow_conv(RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
1418 &name, sizeof(name),
1419 (void *)(uintptr_t)action->type,
1422 if (action->type != RTE_FLOW_ACTION_TYPE_VOID)
1423 printf(" %s", name);
1430 /** Restrict ingress traffic to the defined flow rules. */
1432 port_flow_isolate(portid_t port_id, int set)
1434 struct rte_flow_error error;
1436 /* Poisoning to make sure PMDs update it in case of error. */
1437 memset(&error, 0x66, sizeof(error));
1438 if (rte_flow_isolate(port_id, set, &error))
1439 return port_flow_complain(&error);
1440 printf("Ingress traffic on port %u is %s to the defined flow rules\n",
1442 set ? "now restricted" : "not restricted anymore");
1447 * RX/TX ring descriptors display functions.
1450 rx_queue_id_is_invalid(queueid_t rxq_id)
1452 if (rxq_id < nb_rxq)
1454 printf("Invalid RX queue %d (must be < nb_rxq=%d)\n", rxq_id, nb_rxq);
1459 tx_queue_id_is_invalid(queueid_t txq_id)
1461 if (txq_id < nb_txq)
1463 printf("Invalid TX queue %d (must be < nb_rxq=%d)\n", txq_id, nb_txq);
1468 rx_desc_id_is_invalid(uint16_t rxdesc_id)
1470 if (rxdesc_id < nb_rxd)
1472 printf("Invalid RX descriptor %d (must be < nb_rxd=%d)\n",
1478 tx_desc_id_is_invalid(uint16_t txdesc_id)
1480 if (txdesc_id < nb_txd)
1482 printf("Invalid TX descriptor %d (must be < nb_txd=%d)\n",
1487 static const struct rte_memzone *
1488 ring_dma_zone_lookup(const char *ring_name, portid_t port_id, uint16_t q_id)
1490 char mz_name[RTE_MEMZONE_NAMESIZE];
1491 const struct rte_memzone *mz;
1493 snprintf(mz_name, sizeof(mz_name), "eth_p%d_q%d_%s",
1494 port_id, q_id, ring_name);
1495 mz = rte_memzone_lookup(mz_name);
1497 printf("%s ring memory zoneof (port %d, queue %d) not"
1498 "found (zone name = %s\n",
1499 ring_name, port_id, q_id, mz_name);
1503 union igb_ring_dword {
1506 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
1516 struct igb_ring_desc_32_bytes {
1517 union igb_ring_dword lo_dword;
1518 union igb_ring_dword hi_dword;
1519 union igb_ring_dword resv1;
1520 union igb_ring_dword resv2;
1523 struct igb_ring_desc_16_bytes {
1524 union igb_ring_dword lo_dword;
1525 union igb_ring_dword hi_dword;
1529 ring_rxd_display_dword(union igb_ring_dword dword)
1531 printf(" 0x%08X - 0x%08X\n", (unsigned)dword.words.lo,
1532 (unsigned)dword.words.hi);
1536 ring_rx_descriptor_display(const struct rte_memzone *ring_mz,
1537 #ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
1540 __rte_unused portid_t port_id,
1544 struct igb_ring_desc_16_bytes *ring =
1545 (struct igb_ring_desc_16_bytes *)ring_mz->addr;
1546 #ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
1547 struct rte_eth_dev_info dev_info;
1549 memset(&dev_info, 0, sizeof(dev_info));
1550 rte_eth_dev_info_get(port_id, &dev_info);
1551 if (strstr(dev_info.driver_name, "i40e") != NULL) {
1552 /* 32 bytes RX descriptor, i40e only */
1553 struct igb_ring_desc_32_bytes *ring =
1554 (struct igb_ring_desc_32_bytes *)ring_mz->addr;
1555 ring[desc_id].lo_dword.dword =
1556 rte_le_to_cpu_64(ring[desc_id].lo_dword.dword);
1557 ring_rxd_display_dword(ring[desc_id].lo_dword);
1558 ring[desc_id].hi_dword.dword =
1559 rte_le_to_cpu_64(ring[desc_id].hi_dword.dword);
1560 ring_rxd_display_dword(ring[desc_id].hi_dword);
1561 ring[desc_id].resv1.dword =
1562 rte_le_to_cpu_64(ring[desc_id].resv1.dword);
1563 ring_rxd_display_dword(ring[desc_id].resv1);
1564 ring[desc_id].resv2.dword =
1565 rte_le_to_cpu_64(ring[desc_id].resv2.dword);
1566 ring_rxd_display_dword(ring[desc_id].resv2);
1571 /* 16 bytes RX descriptor */
1572 ring[desc_id].lo_dword.dword =
1573 rte_le_to_cpu_64(ring[desc_id].lo_dword.dword);
1574 ring_rxd_display_dword(ring[desc_id].lo_dword);
1575 ring[desc_id].hi_dword.dword =
1576 rte_le_to_cpu_64(ring[desc_id].hi_dword.dword);
1577 ring_rxd_display_dword(ring[desc_id].hi_dword);
1581 ring_tx_descriptor_display(const struct rte_memzone *ring_mz, uint16_t desc_id)
1583 struct igb_ring_desc_16_bytes *ring;
1584 struct igb_ring_desc_16_bytes txd;
1586 ring = (struct igb_ring_desc_16_bytes *)ring_mz->addr;
1587 txd.lo_dword.dword = rte_le_to_cpu_64(ring[desc_id].lo_dword.dword);
1588 txd.hi_dword.dword = rte_le_to_cpu_64(ring[desc_id].hi_dword.dword);
1589 printf(" 0x%08X - 0x%08X / 0x%08X - 0x%08X\n",
1590 (unsigned)txd.lo_dword.words.lo,
1591 (unsigned)txd.lo_dword.words.hi,
1592 (unsigned)txd.hi_dword.words.lo,
1593 (unsigned)txd.hi_dword.words.hi);
1597 rx_ring_desc_display(portid_t port_id, queueid_t rxq_id, uint16_t rxd_id)
1599 const struct rte_memzone *rx_mz;
1601 if (port_id_is_invalid(port_id, ENABLED_WARN))
1603 if (rx_queue_id_is_invalid(rxq_id))
1605 if (rx_desc_id_is_invalid(rxd_id))
1607 rx_mz = ring_dma_zone_lookup("rx_ring", port_id, rxq_id);
1610 ring_rx_descriptor_display(rx_mz, port_id, rxd_id);
1614 tx_ring_desc_display(portid_t port_id, queueid_t txq_id, uint16_t txd_id)
1616 const struct rte_memzone *tx_mz;
1618 if (port_id_is_invalid(port_id, ENABLED_WARN))
1620 if (tx_queue_id_is_invalid(txq_id))
1622 if (tx_desc_id_is_invalid(txd_id))
1624 tx_mz = ring_dma_zone_lookup("tx_ring", port_id, txq_id);
1627 ring_tx_descriptor_display(tx_mz, txd_id);
1631 fwd_lcores_config_display(void)
1635 printf("List of forwarding lcores:");
1636 for (lc_id = 0; lc_id < nb_cfg_lcores; lc_id++)
1637 printf(" %2u", fwd_lcores_cpuids[lc_id]);
1641 rxtx_config_display(void)
1646 printf(" %s packet forwarding%s packets/burst=%d\n",
1647 cur_fwd_eng->fwd_mode_name,
1648 retry_enabled == 0 ? "" : " with retry",
1651 if (cur_fwd_eng == &tx_only_engine || cur_fwd_eng == &flow_gen_engine)
1652 printf(" packet len=%u - nb packet segments=%d\n",
1653 (unsigned)tx_pkt_length, (int) tx_pkt_nb_segs);
1655 printf(" nb forwarding cores=%d - nb forwarding ports=%d\n",
1656 nb_fwd_lcores, nb_fwd_ports);
1658 RTE_ETH_FOREACH_DEV(pid) {
1659 struct rte_eth_rxconf *rx_conf = &ports[pid].rx_conf[0];
1660 struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf[0];
1661 uint16_t *nb_rx_desc = &ports[pid].nb_rx_desc[0];
1662 uint16_t *nb_tx_desc = &ports[pid].nb_tx_desc[0];
1663 uint16_t nb_rx_desc_tmp;
1664 uint16_t nb_tx_desc_tmp;
1665 struct rte_eth_rxq_info rx_qinfo;
1666 struct rte_eth_txq_info tx_qinfo;
1669 /* per port config */
1670 printf(" port %d: RX queue number: %d Tx queue number: %d\n",
1671 (unsigned int)pid, nb_rxq, nb_txq);
1673 printf(" Rx offloads=0x%"PRIx64" Tx offloads=0x%"PRIx64"\n",
1674 ports[pid].dev_conf.rxmode.offloads,
1675 ports[pid].dev_conf.txmode.offloads);
1677 /* per rx queue config only for first queue to be less verbose */
1678 for (qid = 0; qid < 1; qid++) {
1679 rc = rte_eth_rx_queue_info_get(pid, qid, &rx_qinfo);
1681 nb_rx_desc_tmp = nb_rx_desc[qid];
1683 nb_rx_desc_tmp = rx_qinfo.nb_desc;
1685 printf(" RX queue: %d\n", qid);
1686 printf(" RX desc=%d - RX free threshold=%d\n",
1687 nb_rx_desc_tmp, rx_conf[qid].rx_free_thresh);
1688 printf(" RX threshold registers: pthresh=%d hthresh=%d "
1690 rx_conf[qid].rx_thresh.pthresh,
1691 rx_conf[qid].rx_thresh.hthresh,
1692 rx_conf[qid].rx_thresh.wthresh);
1693 printf(" RX Offloads=0x%"PRIx64"\n",
1694 rx_conf[qid].offloads);
1697 /* per tx queue config only for first queue to be less verbose */
1698 for (qid = 0; qid < 1; qid++) {
1699 rc = rte_eth_tx_queue_info_get(pid, qid, &tx_qinfo);
1701 nb_tx_desc_tmp = nb_tx_desc[qid];
1703 nb_tx_desc_tmp = tx_qinfo.nb_desc;
1705 printf(" TX queue: %d\n", qid);
1706 printf(" TX desc=%d - TX free threshold=%d\n",
1707 nb_tx_desc_tmp, tx_conf[qid].tx_free_thresh);
1708 printf(" TX threshold registers: pthresh=%d hthresh=%d "
1710 tx_conf[qid].tx_thresh.pthresh,
1711 tx_conf[qid].tx_thresh.hthresh,
1712 tx_conf[qid].tx_thresh.wthresh);
1713 printf(" TX offloads=0x%"PRIx64" - TX RS bit threshold=%d\n",
1714 tx_conf[qid].offloads, tx_conf->tx_rs_thresh);
1720 port_rss_reta_info(portid_t port_id,
1721 struct rte_eth_rss_reta_entry64 *reta_conf,
1722 uint16_t nb_entries)
1724 uint16_t i, idx, shift;
1727 if (port_id_is_invalid(port_id, ENABLED_WARN))
1730 ret = rte_eth_dev_rss_reta_query(port_id, reta_conf, nb_entries);
1732 printf("Failed to get RSS RETA info, return code = %d\n", ret);
1736 for (i = 0; i < nb_entries; i++) {
1737 idx = i / RTE_RETA_GROUP_SIZE;
1738 shift = i % RTE_RETA_GROUP_SIZE;
1739 if (!(reta_conf[idx].mask & (1ULL << shift)))
1741 printf("RSS RETA configuration: hash index=%u, queue=%u\n",
1742 i, reta_conf[idx].reta[shift]);
1747 * Displays the RSS hash functions of a port, and, optionaly, the RSS hash
1751 port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
1753 struct rte_eth_rss_conf rss_conf = {0};
1754 uint8_t rss_key[RSS_HASH_KEY_LENGTH];
1758 struct rte_eth_dev_info dev_info;
1759 uint8_t hash_key_size;
1761 if (port_id_is_invalid(port_id, ENABLED_WARN))
1764 rte_eth_dev_info_get(port_id, &dev_info);
1765 if (dev_info.hash_key_size > 0 &&
1766 dev_info.hash_key_size <= sizeof(rss_key))
1767 hash_key_size = dev_info.hash_key_size;
1769 printf("dev_info did not provide a valid hash key size\n");
1773 /* Get RSS hash key if asked to display it */
1774 rss_conf.rss_key = (show_rss_key) ? rss_key : NULL;
1775 rss_conf.rss_key_len = hash_key_size;
1776 diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
1780 printf("port index %d invalid\n", port_id);
1783 printf("operation not supported by device\n");
1786 printf("operation failed - diag=%d\n", diag);
1791 rss_hf = rss_conf.rss_hf;
1793 printf("RSS disabled\n");
1796 printf("RSS functions:\n ");
1797 for (i = 0; rss_type_table[i].str; i++) {
1798 if (rss_hf & rss_type_table[i].rss_type)
1799 printf("%s ", rss_type_table[i].str);
1804 printf("RSS key:\n");
1805 for (i = 0; i < hash_key_size; i++)
1806 printf("%02X", rss_key[i]);
1811 port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key,
1814 struct rte_eth_rss_conf rss_conf;
1818 rss_conf.rss_key = NULL;
1819 rss_conf.rss_key_len = hash_key_len;
1820 rss_conf.rss_hf = 0;
1821 for (i = 0; rss_type_table[i].str; i++) {
1822 if (!strcmp(rss_type_table[i].str, rss_type))
1823 rss_conf.rss_hf = rss_type_table[i].rss_type;
1825 diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
1827 rss_conf.rss_key = hash_key;
1828 diag = rte_eth_dev_rss_hash_update(port_id, &rss_conf);
1835 printf("port index %d invalid\n", port_id);
1838 printf("operation not supported by device\n");
1841 printf("operation failed - diag=%d\n", diag);
1847 * Setup forwarding configuration for each logical core.
1850 setup_fwd_config_of_each_lcore(struct fwd_config *cfg)
1852 streamid_t nb_fs_per_lcore;
1860 nb_fs = cfg->nb_fwd_streams;
1861 nb_fc = cfg->nb_fwd_lcores;
1862 if (nb_fs <= nb_fc) {
1863 nb_fs_per_lcore = 1;
1866 nb_fs_per_lcore = (streamid_t) (nb_fs / nb_fc);
1867 nb_extra = (lcoreid_t) (nb_fs % nb_fc);
1870 nb_lc = (lcoreid_t) (nb_fc - nb_extra);
1872 for (lc_id = 0; lc_id < nb_lc; lc_id++) {
1873 fwd_lcores[lc_id]->stream_idx = sm_id;
1874 fwd_lcores[lc_id]->stream_nb = nb_fs_per_lcore;
1875 sm_id = (streamid_t) (sm_id + nb_fs_per_lcore);
1879 * Assign extra remaining streams, if any.
1881 nb_fs_per_lcore = (streamid_t) (nb_fs_per_lcore + 1);
1882 for (lc_id = 0; lc_id < nb_extra; lc_id++) {
1883 fwd_lcores[nb_lc + lc_id]->stream_idx = sm_id;
1884 fwd_lcores[nb_lc + lc_id]->stream_nb = nb_fs_per_lcore;
1885 sm_id = (streamid_t) (sm_id + nb_fs_per_lcore);
1890 fwd_topology_tx_port_get(portid_t rxp)
1892 static int warning_once = 1;
1894 RTE_ASSERT(rxp < cur_fwd_config.nb_fwd_ports);
1896 switch (port_topology) {
1898 case PORT_TOPOLOGY_PAIRED:
1899 if ((rxp & 0x1) == 0) {
1900 if (rxp + 1 < cur_fwd_config.nb_fwd_ports)
1903 printf("\nWarning! port-topology=paired"
1904 " and odd forward ports number,"
1905 " the last port will pair with"
1912 case PORT_TOPOLOGY_CHAINED:
1913 return (rxp + 1) % cur_fwd_config.nb_fwd_ports;
1914 case PORT_TOPOLOGY_LOOP:
1920 simple_fwd_config_setup(void)
1924 cur_fwd_config.nb_fwd_ports = (portid_t) nb_fwd_ports;
1925 cur_fwd_config.nb_fwd_streams =
1926 (streamid_t) cur_fwd_config.nb_fwd_ports;
1928 /* reinitialize forwarding streams */
1932 * In the simple forwarding test, the number of forwarding cores
1933 * must be lower or equal to the number of forwarding ports.
1935 cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
1936 if (cur_fwd_config.nb_fwd_lcores > cur_fwd_config.nb_fwd_ports)
1937 cur_fwd_config.nb_fwd_lcores =
1938 (lcoreid_t) cur_fwd_config.nb_fwd_ports;
1939 setup_fwd_config_of_each_lcore(&cur_fwd_config);
1941 for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
1942 fwd_streams[i]->rx_port = fwd_ports_ids[i];
1943 fwd_streams[i]->rx_queue = 0;
1944 fwd_streams[i]->tx_port =
1945 fwd_ports_ids[fwd_topology_tx_port_get(i)];
1946 fwd_streams[i]->tx_queue = 0;
1947 fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
1948 fwd_streams[i]->retry_enabled = retry_enabled;
1953 * For the RSS forwarding test all streams distributed over lcores. Each stream
1954 * being composed of a RX queue to poll on a RX port for input messages,
1955 * associated with a TX queue of a TX port where to send forwarded packets.
1958 rss_fwd_config_setup(void)
1969 cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
1970 cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
1971 cur_fwd_config.nb_fwd_streams =
1972 (streamid_t) (nb_q * cur_fwd_config.nb_fwd_ports);
1974 if (cur_fwd_config.nb_fwd_streams < cur_fwd_config.nb_fwd_lcores)
1975 cur_fwd_config.nb_fwd_lcores =
1976 (lcoreid_t)cur_fwd_config.nb_fwd_streams;
1978 /* reinitialize forwarding streams */
1981 setup_fwd_config_of_each_lcore(&cur_fwd_config);
1983 for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) {
1984 struct fwd_stream *fs;
1986 fs = fwd_streams[sm_id];
1987 txp = fwd_topology_tx_port_get(rxp);
1988 fs->rx_port = fwd_ports_ids[rxp];
1990 fs->tx_port = fwd_ports_ids[txp];
1992 fs->peer_addr = fs->tx_port;
1993 fs->retry_enabled = retry_enabled;
1995 if (rxp < nb_fwd_ports)
2003 * For the DCB forwarding test, each core is assigned on each traffic class.
2005 * Each core is assigned a multi-stream, each stream being composed of
2006 * a RX queue to poll on a RX port for input messages, associated with
2007 * a TX queue of a TX port where to send forwarded packets. All RX and
2008 * TX queues are mapping to the same traffic class.
2009 * If VMDQ and DCB co-exist, each traffic class on different POOLs share
2013 dcb_fwd_config_setup(void)
2015 struct rte_eth_dcb_info rxp_dcb_info, txp_dcb_info;
2016 portid_t txp, rxp = 0;
2017 queueid_t txq, rxq = 0;
2019 uint16_t nb_rx_queue, nb_tx_queue;
2020 uint16_t i, j, k, sm_id = 0;
2023 cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
2024 cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
2025 cur_fwd_config.nb_fwd_streams =
2026 (streamid_t) (nb_rxq * cur_fwd_config.nb_fwd_ports);
2028 /* reinitialize forwarding streams */
2032 /* get the dcb info on the first RX and TX ports */
2033 (void)rte_eth_dev_get_dcb_info(fwd_ports_ids[rxp], &rxp_dcb_info);
2034 (void)rte_eth_dev_get_dcb_info(fwd_ports_ids[txp], &txp_dcb_info);
2036 for (lc_id = 0; lc_id < cur_fwd_config.nb_fwd_lcores; lc_id++) {
2037 fwd_lcores[lc_id]->stream_nb = 0;
2038 fwd_lcores[lc_id]->stream_idx = sm_id;
2039 for (i = 0; i < ETH_MAX_VMDQ_POOL; i++) {
2040 /* if the nb_queue is zero, means this tc is
2041 * not enabled on the POOL
2043 if (rxp_dcb_info.tc_queue.tc_rxq[i][tc].nb_queue == 0)
2045 k = fwd_lcores[lc_id]->stream_nb +
2046 fwd_lcores[lc_id]->stream_idx;
2047 rxq = rxp_dcb_info.tc_queue.tc_rxq[i][tc].base;
2048 txq = txp_dcb_info.tc_queue.tc_txq[i][tc].base;
2049 nb_rx_queue = txp_dcb_info.tc_queue.tc_rxq[i][tc].nb_queue;
2050 nb_tx_queue = txp_dcb_info.tc_queue.tc_txq[i][tc].nb_queue;
2051 for (j = 0; j < nb_rx_queue; j++) {
2052 struct fwd_stream *fs;
2054 fs = fwd_streams[k + j];
2055 fs->rx_port = fwd_ports_ids[rxp];
2056 fs->rx_queue = rxq + j;
2057 fs->tx_port = fwd_ports_ids[txp];
2058 fs->tx_queue = txq + j % nb_tx_queue;
2059 fs->peer_addr = fs->tx_port;
2060 fs->retry_enabled = retry_enabled;
2062 fwd_lcores[lc_id]->stream_nb +=
2063 rxp_dcb_info.tc_queue.tc_rxq[i][tc].nb_queue;
2065 sm_id = (streamid_t) (sm_id + fwd_lcores[lc_id]->stream_nb);
2068 if (tc < rxp_dcb_info.nb_tcs)
2070 /* Restart from TC 0 on next RX port */
2072 if (numa_support && (nb_fwd_ports <= (nb_ports >> 1)))
2074 (rxp + ((nb_ports >> 1) / nb_fwd_ports));
2077 if (rxp >= nb_fwd_ports)
2079 /* get the dcb information on next RX and TX ports */
2080 if ((rxp & 0x1) == 0)
2081 txp = (portid_t) (rxp + 1);
2083 txp = (portid_t) (rxp - 1);
2084 rte_eth_dev_get_dcb_info(fwd_ports_ids[rxp], &rxp_dcb_info);
2085 rte_eth_dev_get_dcb_info(fwd_ports_ids[txp], &txp_dcb_info);
2090 icmp_echo_config_setup(void)
2097 if ((nb_txq * nb_fwd_ports) < nb_fwd_lcores)
2098 cur_fwd_config.nb_fwd_lcores = (lcoreid_t)
2099 (nb_txq * nb_fwd_ports);
2101 cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
2102 cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
2103 cur_fwd_config.nb_fwd_streams =
2104 (streamid_t) (nb_rxq * cur_fwd_config.nb_fwd_ports);
2105 if (cur_fwd_config.nb_fwd_streams < cur_fwd_config.nb_fwd_lcores)
2106 cur_fwd_config.nb_fwd_lcores =
2107 (lcoreid_t)cur_fwd_config.nb_fwd_streams;
2108 if (verbose_level > 0) {
2109 printf("%s fwd_cores=%d fwd_ports=%d fwd_streams=%d\n",
2111 cur_fwd_config.nb_fwd_lcores,
2112 cur_fwd_config.nb_fwd_ports,
2113 cur_fwd_config.nb_fwd_streams);
2116 /* reinitialize forwarding streams */
2118 setup_fwd_config_of_each_lcore(&cur_fwd_config);
2120 for (lc_id = 0; lc_id < cur_fwd_config.nb_fwd_lcores; lc_id++) {
2121 if (verbose_level > 0)
2122 printf(" core=%d: \n", lc_id);
2123 for (sm_id = 0; sm_id < fwd_lcores[lc_id]->stream_nb; sm_id++) {
2124 struct fwd_stream *fs;
2125 fs = fwd_streams[fwd_lcores[lc_id]->stream_idx + sm_id];
2126 fs->rx_port = fwd_ports_ids[rxp];
2128 fs->tx_port = fs->rx_port;
2130 fs->peer_addr = fs->tx_port;
2131 fs->retry_enabled = retry_enabled;
2132 if (verbose_level > 0)
2133 printf(" stream=%d port=%d rxq=%d txq=%d\n",
2134 sm_id, fs->rx_port, fs->rx_queue,
2136 rxq = (queueid_t) (rxq + 1);
2137 if (rxq == nb_rxq) {
2139 rxp = (portid_t) (rxp + 1);
2145 #if defined RTE_LIBRTE_PMD_SOFTNIC
2147 softnic_fwd_config_setup(void)
2149 struct rte_port *port;
2150 portid_t pid, softnic_portid;
2152 uint8_t softnic_enable = 0;
2154 RTE_ETH_FOREACH_DEV(pid) {
2156 const char *driver = port->dev_info.driver_name;
2158 if (strcmp(driver, "net_softnic") == 0) {
2159 softnic_portid = pid;
2165 if (softnic_enable == 0) {
2166 printf("Softnic mode not configured(%s)!\n", __func__);
2170 cur_fwd_config.nb_fwd_ports = 1;
2171 cur_fwd_config.nb_fwd_streams = (streamid_t) nb_rxq;
2173 /* Re-initialize forwarding streams */
2177 * In the softnic forwarding test, the number of forwarding cores
2178 * is set to one and remaining are used for softnic packet processing.
2180 cur_fwd_config.nb_fwd_lcores = 1;
2181 setup_fwd_config_of_each_lcore(&cur_fwd_config);
2183 for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) {
2184 fwd_streams[i]->rx_port = softnic_portid;
2185 fwd_streams[i]->rx_queue = i;
2186 fwd_streams[i]->tx_port = softnic_portid;
2187 fwd_streams[i]->tx_queue = i;
2188 fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
2189 fwd_streams[i]->retry_enabled = retry_enabled;
2195 fwd_config_setup(void)
2197 cur_fwd_config.fwd_eng = cur_fwd_eng;
2198 if (strcmp(cur_fwd_eng->fwd_mode_name, "icmpecho") == 0) {
2199 icmp_echo_config_setup();
2203 #if defined RTE_LIBRTE_PMD_SOFTNIC
2204 if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
2205 softnic_fwd_config_setup();
2210 if ((nb_rxq > 1) && (nb_txq > 1)){
2212 dcb_fwd_config_setup();
2214 rss_fwd_config_setup();
2217 simple_fwd_config_setup();
2221 mp_alloc_to_str(uint8_t mode)
2224 case MP_ALLOC_NATIVE:
2230 case MP_ALLOC_XMEM_HUGE:
2238 pkt_fwd_config_display(struct fwd_config *cfg)
2240 struct fwd_stream *fs;
2244 printf("%s packet forwarding%s - ports=%d - cores=%d - streams=%d - "
2245 "NUMA support %s, MP allocation mode: %s\n",
2246 cfg->fwd_eng->fwd_mode_name,
2247 retry_enabled == 0 ? "" : " with retry",
2248 cfg->nb_fwd_ports, cfg->nb_fwd_lcores, cfg->nb_fwd_streams,
2249 numa_support == 1 ? "enabled" : "disabled",
2250 mp_alloc_to_str(mp_alloc_type));
2253 printf("TX retry num: %u, delay between TX retries: %uus\n",
2254 burst_tx_retry_num, burst_tx_delay_time);
2255 for (lc_id = 0; lc_id < cfg->nb_fwd_lcores; lc_id++) {
2256 printf("Logical Core %u (socket %u) forwards packets on "
2258 fwd_lcores_cpuids[lc_id],
2259 rte_lcore_to_socket_id(fwd_lcores_cpuids[lc_id]),
2260 fwd_lcores[lc_id]->stream_nb);
2261 for (sm_id = 0; sm_id < fwd_lcores[lc_id]->stream_nb; sm_id++) {
2262 fs = fwd_streams[fwd_lcores[lc_id]->stream_idx + sm_id];
2263 printf("\n RX P=%d/Q=%d (socket %u) -> TX "
2264 "P=%d/Q=%d (socket %u) ",
2265 fs->rx_port, fs->rx_queue,
2266 ports[fs->rx_port].socket_id,
2267 fs->tx_port, fs->tx_queue,
2268 ports[fs->tx_port].socket_id);
2269 print_ethaddr("peer=",
2270 &peer_eth_addrs[fs->peer_addr]);
2278 set_fwd_eth_peer(portid_t port_id, char *peer_addr)
2280 struct rte_ether_addr new_peer_addr;
2281 if (!rte_eth_dev_is_valid_port(port_id)) {
2282 printf("Error: Invalid port number %i\n", port_id);
2285 if (rte_ether_unformat_addr(peer_addr, &new_peer_addr) < 0) {
2286 printf("Error: Invalid ethernet address: %s\n", peer_addr);
2289 peer_eth_addrs[port_id] = new_peer_addr;
2293 set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc)
2296 unsigned int lcore_cpuid;
2301 for (i = 0; i < nb_lc; i++) {
2302 lcore_cpuid = lcorelist[i];
2303 if (! rte_lcore_is_enabled(lcore_cpuid)) {
2304 printf("lcore %u not enabled\n", lcore_cpuid);
2307 if (lcore_cpuid == rte_get_master_lcore()) {
2308 printf("lcore %u cannot be masked on for running "
2309 "packet forwarding, which is the master lcore "
2310 "and reserved for command line parsing only\n",
2315 fwd_lcores_cpuids[i] = lcore_cpuid;
2317 if (record_now == 0) {
2321 nb_cfg_lcores = (lcoreid_t) nb_lc;
2322 if (nb_fwd_lcores != (lcoreid_t) nb_lc) {
2323 printf("previous number of forwarding cores %u - changed to "
2324 "number of configured cores %u\n",
2325 (unsigned int) nb_fwd_lcores, nb_lc);
2326 nb_fwd_lcores = (lcoreid_t) nb_lc;
2333 set_fwd_lcores_mask(uint64_t lcoremask)
2335 unsigned int lcorelist[64];
2339 if (lcoremask == 0) {
2340 printf("Invalid NULL mask of cores\n");
2344 for (i = 0; i < 64; i++) {
2345 if (! ((uint64_t)(1ULL << i) & lcoremask))
2347 lcorelist[nb_lc++] = i;
2349 return set_fwd_lcores_list(lcorelist, nb_lc);
2353 set_fwd_lcores_number(uint16_t nb_lc)
2355 if (nb_lc > nb_cfg_lcores) {
2356 printf("nb fwd cores %u > %u (max. number of configured "
2357 "lcores) - ignored\n",
2358 (unsigned int) nb_lc, (unsigned int) nb_cfg_lcores);
2361 nb_fwd_lcores = (lcoreid_t) nb_lc;
2362 printf("Number of forwarding cores set to %u\n",
2363 (unsigned int) nb_fwd_lcores);
2367 set_fwd_ports_list(unsigned int *portlist, unsigned int nb_pt)
2375 for (i = 0; i < nb_pt; i++) {
2376 port_id = (portid_t) portlist[i];
2377 if (port_id_is_invalid(port_id, ENABLED_WARN))
2380 fwd_ports_ids[i] = port_id;
2382 if (record_now == 0) {
2386 nb_cfg_ports = (portid_t) nb_pt;
2387 if (nb_fwd_ports != (portid_t) nb_pt) {
2388 printf("previous number of forwarding ports %u - changed to "
2389 "number of configured ports %u\n",
2390 (unsigned int) nb_fwd_ports, nb_pt);
2391 nb_fwd_ports = (portid_t) nb_pt;
2396 set_fwd_ports_mask(uint64_t portmask)
2398 unsigned int portlist[64];
2402 if (portmask == 0) {
2403 printf("Invalid NULL mask of ports\n");
2407 RTE_ETH_FOREACH_DEV(i) {
2408 if (! ((uint64_t)(1ULL << i) & portmask))
2410 portlist[nb_pt++] = i;
2412 set_fwd_ports_list(portlist, nb_pt);
2416 set_fwd_ports_number(uint16_t nb_pt)
2418 if (nb_pt > nb_cfg_ports) {
2419 printf("nb fwd ports %u > %u (number of configured "
2420 "ports) - ignored\n",
2421 (unsigned int) nb_pt, (unsigned int) nb_cfg_ports);
2424 nb_fwd_ports = (portid_t) nb_pt;
2425 printf("Number of forwarding ports set to %u\n",
2426 (unsigned int) nb_fwd_ports);
2430 port_is_forwarding(portid_t port_id)
2434 if (port_id_is_invalid(port_id, ENABLED_WARN))
2437 for (i = 0; i < nb_fwd_ports; i++) {
2438 if (fwd_ports_ids[i] == port_id)
2446 set_nb_pkt_per_burst(uint16_t nb)
2448 if (nb > MAX_PKT_BURST) {
2449 printf("nb pkt per burst: %u > %u (maximum packet per burst) "
2451 (unsigned int) nb, (unsigned int) MAX_PKT_BURST);
2454 nb_pkt_per_burst = nb;
2455 printf("Number of packets per burst set to %u\n",
2456 (unsigned int) nb_pkt_per_burst);
2460 tx_split_get_name(enum tx_pkt_split split)
2464 for (i = 0; i != RTE_DIM(tx_split_name); i++) {
2465 if (tx_split_name[i].split == split)
2466 return tx_split_name[i].name;
2472 set_tx_pkt_split(const char *name)
2476 for (i = 0; i != RTE_DIM(tx_split_name); i++) {
2477 if (strcmp(tx_split_name[i].name, name) == 0) {
2478 tx_pkt_split = tx_split_name[i].split;
2482 printf("unknown value: \"%s\"\n", name);
2486 show_tx_pkt_segments(void)
2492 split = tx_split_get_name(tx_pkt_split);
2494 printf("Number of segments: %u\n", n);
2495 printf("Segment sizes: ");
2496 for (i = 0; i != n - 1; i++)
2497 printf("%hu,", tx_pkt_seg_lengths[i]);
2498 printf("%hu\n", tx_pkt_seg_lengths[i]);
2499 printf("Split packet: %s\n", split);
2503 set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs)
2505 uint16_t tx_pkt_len;
2508 if (nb_segs >= (unsigned) nb_txd) {
2509 printf("nb segments per TX packets=%u >= nb_txd=%u - ignored\n",
2510 nb_segs, (unsigned int) nb_txd);
2515 * Check that each segment length is greater or equal than
2516 * the mbuf data sise.
2517 * Check also that the total packet length is greater or equal than the
2518 * size of an empty UDP/IP packet (sizeof(struct rte_ether_hdr) +
2522 for (i = 0; i < nb_segs; i++) {
2523 if (seg_lengths[i] > (unsigned) mbuf_data_size) {
2524 printf("length[%u]=%u > mbuf_data_size=%u - give up\n",
2525 i, seg_lengths[i], (unsigned) mbuf_data_size);
2528 tx_pkt_len = (uint16_t)(tx_pkt_len + seg_lengths[i]);
2530 if (tx_pkt_len < (sizeof(struct rte_ether_hdr) + 20 + 8)) {
2531 printf("total packet length=%u < %d - give up\n",
2532 (unsigned) tx_pkt_len,
2533 (int)(sizeof(struct rte_ether_hdr) + 20 + 8));
2537 for (i = 0; i < nb_segs; i++)
2538 tx_pkt_seg_lengths[i] = (uint16_t) seg_lengths[i];
2540 tx_pkt_length = tx_pkt_len;
2541 tx_pkt_nb_segs = (uint8_t) nb_segs;
2545 setup_gro(const char *onoff, portid_t port_id)
2547 if (!rte_eth_dev_is_valid_port(port_id)) {
2548 printf("invalid port id %u\n", port_id);
2551 if (test_done == 0) {
2552 printf("Before enable/disable GRO,"
2553 " please stop forwarding first\n");
2556 if (strcmp(onoff, "on") == 0) {
2557 if (gro_ports[port_id].enable != 0) {
2558 printf("Port %u has enabled GRO. Please"
2559 " disable GRO first\n", port_id);
2562 if (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) {
2563 gro_ports[port_id].param.gro_types = RTE_GRO_TCP_IPV4;
2564 gro_ports[port_id].param.max_flow_num =
2565 GRO_DEFAULT_FLOW_NUM;
2566 gro_ports[port_id].param.max_item_per_flow =
2567 GRO_DEFAULT_ITEM_NUM_PER_FLOW;
2569 gro_ports[port_id].enable = 1;
2571 if (gro_ports[port_id].enable == 0) {
2572 printf("Port %u has disabled GRO\n", port_id);
2575 gro_ports[port_id].enable = 0;
2580 setup_gro_flush_cycles(uint8_t cycles)
2582 if (test_done == 0) {
2583 printf("Before change flush interval for GRO,"
2584 " please stop forwarding first.\n");
2588 if (cycles > GRO_MAX_FLUSH_CYCLES || cycles <
2589 GRO_DEFAULT_FLUSH_CYCLES) {
2590 printf("The flushing cycle be in the range"
2591 " of 1 to %u. Revert to the default"
2593 GRO_MAX_FLUSH_CYCLES,
2594 GRO_DEFAULT_FLUSH_CYCLES);
2595 cycles = GRO_DEFAULT_FLUSH_CYCLES;
2598 gro_flush_cycles = cycles;
2602 show_gro(portid_t port_id)
2604 struct rte_gro_param *param;
2605 uint32_t max_pkts_num;
2607 param = &gro_ports[port_id].param;
2609 if (!rte_eth_dev_is_valid_port(port_id)) {
2610 printf("Invalid port id %u.\n", port_id);
2613 if (gro_ports[port_id].enable) {
2614 printf("GRO type: TCP/IPv4\n");
2615 if (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) {
2616 max_pkts_num = param->max_flow_num *
2617 param->max_item_per_flow;
2619 max_pkts_num = MAX_PKT_BURST * GRO_MAX_FLUSH_CYCLES;
2620 printf("Max number of packets to perform GRO: %u\n",
2622 printf("Flushing cycles: %u\n", gro_flush_cycles);
2624 printf("Port %u doesn't enable GRO.\n", port_id);
2628 setup_gso(const char *mode, portid_t port_id)
2630 if (!rte_eth_dev_is_valid_port(port_id)) {
2631 printf("invalid port id %u\n", port_id);
2634 if (strcmp(mode, "on") == 0) {
2635 if (test_done == 0) {
2636 printf("before enabling GSO,"
2637 " please stop forwarding first\n");
2640 gso_ports[port_id].enable = 1;
2641 } else if (strcmp(mode, "off") == 0) {
2642 if (test_done == 0) {
2643 printf("before disabling GSO,"
2644 " please stop forwarding first\n");
2647 gso_ports[port_id].enable = 0;
2652 list_pkt_forwarding_modes(void)
2654 static char fwd_modes[128] = "";
2655 const char *separator = "|";
2656 struct fwd_engine *fwd_eng;
2659 if (strlen (fwd_modes) == 0) {
2660 while ((fwd_eng = fwd_engines[i++]) != NULL) {
2661 strncat(fwd_modes, fwd_eng->fwd_mode_name,
2662 sizeof(fwd_modes) - strlen(fwd_modes) - 1);
2663 strncat(fwd_modes, separator,
2664 sizeof(fwd_modes) - strlen(fwd_modes) - 1);
2666 fwd_modes[strlen(fwd_modes) - strlen(separator)] = '\0';
2673 list_pkt_forwarding_retry_modes(void)
2675 static char fwd_modes[128] = "";
2676 const char *separator = "|";
2677 struct fwd_engine *fwd_eng;
2680 if (strlen(fwd_modes) == 0) {
2681 while ((fwd_eng = fwd_engines[i++]) != NULL) {
2682 if (fwd_eng == &rx_only_engine)
2684 strncat(fwd_modes, fwd_eng->fwd_mode_name,
2686 strlen(fwd_modes) - 1);
2687 strncat(fwd_modes, separator,
2689 strlen(fwd_modes) - 1);
2691 fwd_modes[strlen(fwd_modes) - strlen(separator)] = '\0';
2698 set_pkt_forwarding_mode(const char *fwd_mode_name)
2700 struct fwd_engine *fwd_eng;
2704 while ((fwd_eng = fwd_engines[i]) != NULL) {
2705 if (! strcmp(fwd_eng->fwd_mode_name, fwd_mode_name)) {
2706 printf("Set %s packet forwarding mode%s\n",
2708 retry_enabled == 0 ? "" : " with retry");
2709 cur_fwd_eng = fwd_eng;
2714 printf("Invalid %s packet forwarding mode\n", fwd_mode_name);
2718 add_rx_dump_callbacks(portid_t portid)
2720 struct rte_eth_dev_info dev_info;
2723 if (port_id_is_invalid(portid, ENABLED_WARN))
2726 rte_eth_dev_info_get(portid, &dev_info);
2727 for (queue = 0; queue < dev_info.nb_rx_queues; queue++)
2728 if (!ports[portid].rx_dump_cb[queue])
2729 ports[portid].rx_dump_cb[queue] =
2730 rte_eth_add_rx_callback(portid, queue,
2731 dump_rx_pkts, NULL);
2735 add_tx_dump_callbacks(portid_t portid)
2737 struct rte_eth_dev_info dev_info;
2740 if (port_id_is_invalid(portid, ENABLED_WARN))
2742 rte_eth_dev_info_get(portid, &dev_info);
2743 for (queue = 0; queue < dev_info.nb_tx_queues; queue++)
2744 if (!ports[portid].tx_dump_cb[queue])
2745 ports[portid].tx_dump_cb[queue] =
2746 rte_eth_add_tx_callback(portid, queue,
2747 dump_tx_pkts, NULL);
2751 remove_rx_dump_callbacks(portid_t portid)
2753 struct rte_eth_dev_info dev_info;
2756 if (port_id_is_invalid(portid, ENABLED_WARN))
2758 rte_eth_dev_info_get(portid, &dev_info);
2759 for (queue = 0; queue < dev_info.nb_rx_queues; queue++)
2760 if (ports[portid].rx_dump_cb[queue]) {
2761 rte_eth_remove_rx_callback(portid, queue,
2762 ports[portid].rx_dump_cb[queue]);
2763 ports[portid].rx_dump_cb[queue] = NULL;
2768 remove_tx_dump_callbacks(portid_t portid)
2770 struct rte_eth_dev_info dev_info;
2773 if (port_id_is_invalid(portid, ENABLED_WARN))
2775 rte_eth_dev_info_get(portid, &dev_info);
2776 for (queue = 0; queue < dev_info.nb_tx_queues; queue++)
2777 if (ports[portid].tx_dump_cb[queue]) {
2778 rte_eth_remove_tx_callback(portid, queue,
2779 ports[portid].tx_dump_cb[queue]);
2780 ports[portid].tx_dump_cb[queue] = NULL;
2785 configure_rxtx_dump_callbacks(uint16_t verbose)
2789 #ifndef RTE_ETHDEV_RXTX_CALLBACKS
2790 TESTPMD_LOG(ERR, "setting rxtx callbacks is not enabled\n");
2794 RTE_ETH_FOREACH_DEV(portid)
2796 if (verbose == 1 || verbose > 2)
2797 add_rx_dump_callbacks(portid);
2799 remove_rx_dump_callbacks(portid);
2801 add_tx_dump_callbacks(portid);
2803 remove_tx_dump_callbacks(portid);
2808 set_verbose_level(uint16_t vb_level)
2810 printf("Change verbose level from %u to %u\n",
2811 (unsigned int) verbose_level, (unsigned int) vb_level);
2812 verbose_level = vb_level;
2813 configure_rxtx_dump_callbacks(verbose_level);
2817 vlan_extend_set(portid_t port_id, int on)
2821 uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads;
2823 if (port_id_is_invalid(port_id, ENABLED_WARN))
2826 vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
2829 vlan_offload |= ETH_VLAN_EXTEND_OFFLOAD;
2830 port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
2832 vlan_offload &= ~ETH_VLAN_EXTEND_OFFLOAD;
2833 port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND;
2836 diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
2838 printf("rx_vlan_extend_set(port_pi=%d, on=%d) failed "
2839 "diag=%d\n", port_id, on, diag);
2840 ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
2844 rx_vlan_strip_set(portid_t port_id, int on)
2848 uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads;
2850 if (port_id_is_invalid(port_id, ENABLED_WARN))
2853 vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
2856 vlan_offload |= ETH_VLAN_STRIP_OFFLOAD;
2857 port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
2859 vlan_offload &= ~ETH_VLAN_STRIP_OFFLOAD;
2860 port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
2863 diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
2865 printf("rx_vlan_strip_set(port_pi=%d, on=%d) failed "
2866 "diag=%d\n", port_id, on, diag);
2867 ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
2871 rx_vlan_strip_set_on_queue(portid_t port_id, uint16_t queue_id, int on)
2875 if (port_id_is_invalid(port_id, ENABLED_WARN))
2878 diag = rte_eth_dev_set_vlan_strip_on_queue(port_id, queue_id, on);
2880 printf("rx_vlan_strip_set_on_queue(port_pi=%d, queue_id=%d, on=%d) failed "
2881 "diag=%d\n", port_id, queue_id, on, diag);
2885 rx_vlan_filter_set(portid_t port_id, int on)
2889 uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads;
2891 if (port_id_is_invalid(port_id, ENABLED_WARN))
2894 vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
2897 vlan_offload |= ETH_VLAN_FILTER_OFFLOAD;
2898 port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
2900 vlan_offload &= ~ETH_VLAN_FILTER_OFFLOAD;
2901 port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER;
2904 diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
2906 printf("rx_vlan_filter_set(port_pi=%d, on=%d) failed "
2907 "diag=%d\n", port_id, on, diag);
2908 ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
2912 rx_vft_set(portid_t port_id, uint16_t vlan_id, int on)
2916 if (port_id_is_invalid(port_id, ENABLED_WARN))
2918 if (vlan_id_is_invalid(vlan_id))
2920 diag = rte_eth_dev_vlan_filter(port_id, vlan_id, on);
2923 printf("rte_eth_dev_vlan_filter(port_pi=%d, vlan_id=%d, on=%d) failed "
2925 port_id, vlan_id, on, diag);
2930 rx_vlan_all_filter_set(portid_t port_id, int on)
2934 if (port_id_is_invalid(port_id, ENABLED_WARN))
2936 for (vlan_id = 0; vlan_id < 4096; vlan_id++) {
2937 if (rx_vft_set(port_id, vlan_id, on))
2943 vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type, uint16_t tp_id)
2947 if (port_id_is_invalid(port_id, ENABLED_WARN))
2950 diag = rte_eth_dev_set_vlan_ether_type(port_id, vlan_type, tp_id);
2954 printf("tx_vlan_tpid_set(port_pi=%d, vlan_type=%d, tpid=%d) failed "
2956 port_id, vlan_type, tp_id, diag);
2960 tx_vlan_set(portid_t port_id, uint16_t vlan_id)
2962 struct rte_eth_dev_info dev_info;
2964 if (port_id_is_invalid(port_id, ENABLED_WARN))
2966 if (vlan_id_is_invalid(vlan_id))
2969 if (ports[port_id].dev_conf.txmode.offloads &
2970 DEV_TX_OFFLOAD_QINQ_INSERT) {
2971 printf("Error, as QinQ has been enabled.\n");
2974 rte_eth_dev_info_get(port_id, &dev_info);
2975 if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) {
2976 printf("Error: vlan insert is not supported by port %d\n",
2981 tx_vlan_reset(port_id);
2982 ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT;
2983 ports[port_id].tx_vlan_id = vlan_id;
2987 tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
2989 struct rte_eth_dev_info dev_info;
2991 if (port_id_is_invalid(port_id, ENABLED_WARN))
2993 if (vlan_id_is_invalid(vlan_id))
2995 if (vlan_id_is_invalid(vlan_id_outer))
2998 rte_eth_dev_info_get(port_id, &dev_info);
2999 if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) {
3000 printf("Error: qinq insert not supported by port %d\n",
3005 tx_vlan_reset(port_id);
3006 ports[port_id].dev_conf.txmode.offloads |= (DEV_TX_OFFLOAD_VLAN_INSERT |
3007 DEV_TX_OFFLOAD_QINQ_INSERT);
3008 ports[port_id].tx_vlan_id = vlan_id;
3009 ports[port_id].tx_vlan_id_outer = vlan_id_outer;
3013 tx_vlan_reset(portid_t port_id)
3015 if (port_id_is_invalid(port_id, ENABLED_WARN))
3017 ports[port_id].dev_conf.txmode.offloads &=
3018 ~(DEV_TX_OFFLOAD_VLAN_INSERT |
3019 DEV_TX_OFFLOAD_QINQ_INSERT);
3020 ports[port_id].tx_vlan_id = 0;
3021 ports[port_id].tx_vlan_id_outer = 0;
3025 tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on)
3027 if (port_id_is_invalid(port_id, ENABLED_WARN))
3030 rte_eth_dev_set_vlan_pvid(port_id, vlan_id, on);
3034 set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
3037 uint8_t existing_mapping_found = 0;
3039 if (port_id_is_invalid(port_id, ENABLED_WARN))
3042 if (is_rx ? (rx_queue_id_is_invalid(queue_id)) : (tx_queue_id_is_invalid(queue_id)))
3045 if (map_value >= RTE_ETHDEV_QUEUE_STAT_CNTRS) {
3046 printf("map_value not in required range 0..%d\n",
3047 RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
3051 if (!is_rx) { /*then tx*/
3052 for (i = 0; i < nb_tx_queue_stats_mappings; i++) {
3053 if ((tx_queue_stats_mappings[i].port_id == port_id) &&
3054 (tx_queue_stats_mappings[i].queue_id == queue_id)) {
3055 tx_queue_stats_mappings[i].stats_counter_id = map_value;
3056 existing_mapping_found = 1;
3060 if (!existing_mapping_found) { /* A new additional mapping... */
3061 tx_queue_stats_mappings[nb_tx_queue_stats_mappings].port_id = port_id;
3062 tx_queue_stats_mappings[nb_tx_queue_stats_mappings].queue_id = queue_id;
3063 tx_queue_stats_mappings[nb_tx_queue_stats_mappings].stats_counter_id = map_value;
3064 nb_tx_queue_stats_mappings++;
3068 for (i = 0; i < nb_rx_queue_stats_mappings; i++) {
3069 if ((rx_queue_stats_mappings[i].port_id == port_id) &&
3070 (rx_queue_stats_mappings[i].queue_id == queue_id)) {
3071 rx_queue_stats_mappings[i].stats_counter_id = map_value;
3072 existing_mapping_found = 1;
3076 if (!existing_mapping_found) { /* A new additional mapping... */
3077 rx_queue_stats_mappings[nb_rx_queue_stats_mappings].port_id = port_id;
3078 rx_queue_stats_mappings[nb_rx_queue_stats_mappings].queue_id = queue_id;
3079 rx_queue_stats_mappings[nb_rx_queue_stats_mappings].stats_counter_id = map_value;
3080 nb_rx_queue_stats_mappings++;
3086 set_xstats_hide_zero(uint8_t on_off)
3088 xstats_hide_zero = on_off;
3092 print_fdir_mask(struct rte_eth_fdir_masks *mask)
3094 printf("\n vlan_tci: 0x%04x", rte_be_to_cpu_16(mask->vlan_tci_mask));
3096 if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
3097 printf(", mac_addr: 0x%02x, tunnel_type: 0x%01x,"
3098 " tunnel_id: 0x%08x",
3099 mask->mac_addr_byte_mask, mask->tunnel_type_mask,
3100 rte_be_to_cpu_32(mask->tunnel_id_mask));
3101 else if (fdir_conf.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
3102 printf(", src_ipv4: 0x%08x, dst_ipv4: 0x%08x",
3103 rte_be_to_cpu_32(mask->ipv4_mask.src_ip),
3104 rte_be_to_cpu_32(mask->ipv4_mask.dst_ip));
3106 printf("\n src_port: 0x%04x, dst_port: 0x%04x",
3107 rte_be_to_cpu_16(mask->src_port_mask),
3108 rte_be_to_cpu_16(mask->dst_port_mask));
3110 printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
3111 rte_be_to_cpu_32(mask->ipv6_mask.src_ip[0]),
3112 rte_be_to_cpu_32(mask->ipv6_mask.src_ip[1]),
3113 rte_be_to_cpu_32(mask->ipv6_mask.src_ip[2]),
3114 rte_be_to_cpu_32(mask->ipv6_mask.src_ip[3]));
3116 printf("\n dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
3117 rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[0]),
3118 rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[1]),
3119 rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[2]),
3120 rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[3]));
3127 print_fdir_flex_payload(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
3129 struct rte_eth_flex_payload_cfg *cfg;
3132 for (i = 0; i < flex_conf->nb_payloads; i++) {
3133 cfg = &flex_conf->flex_set[i];
3134 if (cfg->type == RTE_ETH_RAW_PAYLOAD)
3136 else if (cfg->type == RTE_ETH_L2_PAYLOAD)
3137 printf("\n L2_PAYLOAD: ");
3138 else if (cfg->type == RTE_ETH_L3_PAYLOAD)
3139 printf("\n L3_PAYLOAD: ");
3140 else if (cfg->type == RTE_ETH_L4_PAYLOAD)
3141 printf("\n L4_PAYLOAD: ");
3143 printf("\n UNKNOWN PAYLOAD(%u): ", cfg->type);
3144 for (j = 0; j < num; j++)
3145 printf(" %-5u", cfg->src_offset[j]);
3151 flowtype_to_str(uint16_t flow_type)
3153 struct flow_type_info {
3159 static struct flow_type_info flowtype_str_table[] = {
3160 {"raw", RTE_ETH_FLOW_RAW},
3161 {"ipv4", RTE_ETH_FLOW_IPV4},
3162 {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
3163 {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
3164 {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
3165 {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
3166 {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
3167 {"ipv6", RTE_ETH_FLOW_IPV6},
3168 {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
3169 {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
3170 {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
3171 {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
3172 {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
3173 {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
3174 {"port", RTE_ETH_FLOW_PORT},
3175 {"vxlan", RTE_ETH_FLOW_VXLAN},
3176 {"geneve", RTE_ETH_FLOW_GENEVE},
3177 {"nvgre", RTE_ETH_FLOW_NVGRE},
3178 {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
3181 for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
3182 if (flowtype_str_table[i].ftype == flow_type)
3183 return flowtype_str_table[i].str;
3190 print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
3192 struct rte_eth_fdir_flex_mask *mask;
3196 for (i = 0; i < flex_conf->nb_flexmasks; i++) {
3197 mask = &flex_conf->flex_mask[i];
3198 p = flowtype_to_str(mask->flow_type);
3199 printf("\n %s:\t", p ? p : "unknown");
3200 for (j = 0; j < num; j++)
3201 printf(" %02x", mask->mask[j]);
3207 print_fdir_flow_type(uint32_t flow_types_mask)
3212 for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
3213 if (!(flow_types_mask & (1 << i)))
3215 p = flowtype_to_str(i);
3225 fdir_get_infos(portid_t port_id)
3227 struct rte_eth_fdir_stats fdir_stat;
3228 struct rte_eth_fdir_info fdir_info;
3231 static const char *fdir_stats_border = "########################";
3233 if (port_id_is_invalid(port_id, ENABLED_WARN))
3235 ret = rte_eth_dev_filter_supported(port_id, RTE_ETH_FILTER_FDIR);
3237 printf("\n FDIR is not supported on port %-2d\n",
3242 memset(&fdir_info, 0, sizeof(fdir_info));
3243 rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,
3244 RTE_ETH_FILTER_INFO, &fdir_info);
3245 memset(&fdir_stat, 0, sizeof(fdir_stat));
3246 rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,
3247 RTE_ETH_FILTER_STATS, &fdir_stat);
3248 printf("\n %s FDIR infos for port %-2d %s\n",
3249 fdir_stats_border, port_id, fdir_stats_border);
3251 if (fdir_info.mode == RTE_FDIR_MODE_PERFECT)
3252 printf(" PERFECT\n");
3253 else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
3254 printf(" PERFECT-MAC-VLAN\n");
3255 else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
3256 printf(" PERFECT-TUNNEL\n");
3257 else if (fdir_info.mode == RTE_FDIR_MODE_SIGNATURE)
3258 printf(" SIGNATURE\n");
3260 printf(" DISABLE\n");
3261 if (fdir_info.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN
3262 && fdir_info.mode != RTE_FDIR_MODE_PERFECT_TUNNEL) {
3263 printf(" SUPPORTED FLOW TYPE: ");
3264 print_fdir_flow_type(fdir_info.flow_types_mask[0]);
3266 printf(" FLEX PAYLOAD INFO:\n");
3267 printf(" max_len: %-10"PRIu32" payload_limit: %-10"PRIu32"\n"
3268 " payload_unit: %-10"PRIu32" payload_seg: %-10"PRIu32"\n"
3269 " bitmask_unit: %-10"PRIu32" bitmask_num: %-10"PRIu32"\n",
3270 fdir_info.max_flexpayload, fdir_info.flex_payload_limit,
3271 fdir_info.flex_payload_unit,
3272 fdir_info.max_flex_payload_segment_num,
3273 fdir_info.flex_bitmask_unit, fdir_info.max_flex_bitmask_num);
3275 print_fdir_mask(&fdir_info.mask);
3276 if (fdir_info.flex_conf.nb_payloads > 0) {
3277 printf(" FLEX PAYLOAD SRC OFFSET:");
3278 print_fdir_flex_payload(&fdir_info.flex_conf, fdir_info.max_flexpayload);
3280 if (fdir_info.flex_conf.nb_flexmasks > 0) {
3281 printf(" FLEX MASK CFG:");
3282 print_fdir_flex_mask(&fdir_info.flex_conf, fdir_info.max_flexpayload);
3284 printf(" guarant_count: %-10"PRIu32" best_count: %"PRIu32"\n",
3285 fdir_stat.guarant_cnt, fdir_stat.best_cnt);
3286 printf(" guarant_space: %-10"PRIu32" best_space: %"PRIu32"\n",
3287 fdir_info.guarant_spc, fdir_info.best_spc);
3288 printf(" collision: %-10"PRIu32" free: %"PRIu32"\n"
3289 " maxhash: %-10"PRIu32" maxlen: %"PRIu32"\n"
3290 " add: %-10"PRIu64" remove: %"PRIu64"\n"
3291 " f_add: %-10"PRIu64" f_remove: %"PRIu64"\n",
3292 fdir_stat.collision, fdir_stat.free,
3293 fdir_stat.maxhash, fdir_stat.maxlen,
3294 fdir_stat.add, fdir_stat.remove,
3295 fdir_stat.f_add, fdir_stat.f_remove);
3296 printf(" %s############################%s\n",
3297 fdir_stats_border, fdir_stats_border);
3301 fdir_set_flex_mask(portid_t port_id, struct rte_eth_fdir_flex_mask *cfg)
3303 struct rte_port *port;
3304 struct rte_eth_fdir_flex_conf *flex_conf;
3307 port = &ports[port_id];
3308 flex_conf = &port->dev_conf.fdir_conf.flex_conf;
3309 for (i = 0; i < RTE_ETH_FLOW_MAX; i++) {
3310 if (cfg->flow_type == flex_conf->flex_mask[i].flow_type) {
3315 if (i >= RTE_ETH_FLOW_MAX) {
3316 if (flex_conf->nb_flexmasks < RTE_DIM(flex_conf->flex_mask)) {
3317 idx = flex_conf->nb_flexmasks;
3318 flex_conf->nb_flexmasks++;
3320 printf("The flex mask table is full. Can not set flex"
3321 " mask for flow_type(%u).", cfg->flow_type);
3325 rte_memcpy(&flex_conf->flex_mask[idx],
3327 sizeof(struct rte_eth_fdir_flex_mask));
3331 fdir_set_flex_payload(portid_t port_id, struct rte_eth_flex_payload_cfg *cfg)
3333 struct rte_port *port;
3334 struct rte_eth_fdir_flex_conf *flex_conf;
3337 port = &ports[port_id];
3338 flex_conf = &port->dev_conf.fdir_conf.flex_conf;
3339 for (i = 0; i < RTE_ETH_PAYLOAD_MAX; i++) {
3340 if (cfg->type == flex_conf->flex_set[i].type) {
3345 if (i >= RTE_ETH_PAYLOAD_MAX) {
3346 if (flex_conf->nb_payloads < RTE_DIM(flex_conf->flex_set)) {
3347 idx = flex_conf->nb_payloads;
3348 flex_conf->nb_payloads++;
3350 printf("The flex payload table is full. Can not set"
3351 " flex payload for type(%u).", cfg->type);
3355 rte_memcpy(&flex_conf->flex_set[idx],
3357 sizeof(struct rte_eth_flex_payload_cfg));
3362 set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
3364 #ifdef RTE_LIBRTE_IXGBE_PMD
3368 diag = rte_pmd_ixgbe_set_vf_rx(port_id, vf, on);
3370 diag = rte_pmd_ixgbe_set_vf_tx(port_id, vf, on);
3374 printf("rte_pmd_ixgbe_set_vf_%s for port_id=%d failed diag=%d\n",
3375 is_rx ? "rx" : "tx", port_id, diag);
3378 printf("VF %s setting not supported for port %d\n",
3379 is_rx ? "Rx" : "Tx", port_id);
3385 set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
3388 struct rte_eth_link link;
3390 if (port_id_is_invalid(port_id, ENABLED_WARN))
3392 rte_eth_link_get_nowait(port_id, &link);
3393 if (rate > link.link_speed) {
3394 printf("Invalid rate value:%u bigger than link speed: %u\n",
3395 rate, link.link_speed);
3398 diag = rte_eth_set_queue_rate_limit(port_id, queue_idx, rate);
3401 printf("rte_eth_set_queue_rate_limit for port_id=%d failed diag=%d\n",
3407 set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
3409 int diag = -ENOTSUP;
3413 RTE_SET_USED(q_msk);
3415 #ifdef RTE_LIBRTE_IXGBE_PMD
3416 if (diag == -ENOTSUP)
3417 diag = rte_pmd_ixgbe_set_vf_rate_limit(port_id, vf, rate,
3420 #ifdef RTE_LIBRTE_BNXT_PMD
3421 if (diag == -ENOTSUP)
3422 diag = rte_pmd_bnxt_set_vf_rate_limit(port_id, vf, rate, q_msk);
3427 printf("set_vf_rate_limit for port_id=%d failed diag=%d\n",
3433 * Functions to manage the set of filtered Multicast MAC addresses.
3435 * A pool of filtered multicast MAC addresses is associated with each port.
3436 * The pool is allocated in chunks of MCAST_POOL_INC multicast addresses.
3437 * The address of the pool and the number of valid multicast MAC addresses
3438 * recorded in the pool are stored in the fields "mc_addr_pool" and
3439 * "mc_addr_nb" of the "rte_port" data structure.
3441 * The function "rte_eth_dev_set_mc_addr_list" of the PMDs API imposes
3442 * to be supplied a contiguous array of multicast MAC addresses.
3443 * To comply with this constraint, the set of multicast addresses recorded
3444 * into the pool are systematically compacted at the beginning of the pool.
3445 * Hence, when a multicast address is removed from the pool, all following
3446 * addresses, if any, are copied back to keep the set contiguous.
3448 #define MCAST_POOL_INC 32
3451 mcast_addr_pool_extend(struct rte_port *port)
3453 struct rte_ether_addr *mc_pool;
3454 size_t mc_pool_size;
3457 * If a free entry is available at the end of the pool, just
3458 * increment the number of recorded multicast addresses.
3460 if ((port->mc_addr_nb % MCAST_POOL_INC) != 0) {
3466 * [re]allocate a pool with MCAST_POOL_INC more entries.
3467 * The previous test guarantees that port->mc_addr_nb is a multiple
3468 * of MCAST_POOL_INC.
3470 mc_pool_size = sizeof(struct rte_ether_addr) * (port->mc_addr_nb +
3472 mc_pool = (struct rte_ether_addr *) realloc(port->mc_addr_pool,
3474 if (mc_pool == NULL) {
3475 printf("allocation of pool of %u multicast addresses failed\n",
3476 port->mc_addr_nb + MCAST_POOL_INC);
3480 port->mc_addr_pool = mc_pool;
3487 mcast_addr_pool_remove(struct rte_port *port, uint32_t addr_idx)
3490 if (addr_idx == port->mc_addr_nb) {
3491 /* No need to recompact the set of multicast addressses. */
3492 if (port->mc_addr_nb == 0) {
3493 /* free the pool of multicast addresses. */
3494 free(port->mc_addr_pool);
3495 port->mc_addr_pool = NULL;
3499 memmove(&port->mc_addr_pool[addr_idx],
3500 &port->mc_addr_pool[addr_idx + 1],
3501 sizeof(struct rte_ether_addr) * (port->mc_addr_nb - addr_idx));
3505 eth_port_multicast_addr_list_set(portid_t port_id)
3507 struct rte_port *port;
3510 port = &ports[port_id];
3511 diag = rte_eth_dev_set_mc_addr_list(port_id, port->mc_addr_pool,
3515 printf("rte_eth_dev_set_mc_addr_list(port=%d, nb=%u) failed. diag=%d\n",
3516 port->mc_addr_nb, port_id, -diag);
3520 mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr)
3522 struct rte_port *port;
3525 if (port_id_is_invalid(port_id, ENABLED_WARN))
3528 port = &ports[port_id];
3531 * Check that the added multicast MAC address is not already recorded
3532 * in the pool of multicast addresses.
3534 for (i = 0; i < port->mc_addr_nb; i++) {
3535 if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) {
3536 printf("multicast address already filtered by port\n");
3541 if (mcast_addr_pool_extend(port) != 0)
3543 rte_ether_addr_copy(mc_addr, &port->mc_addr_pool[i]);
3544 eth_port_multicast_addr_list_set(port_id);
3548 mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr)
3550 struct rte_port *port;
3553 if (port_id_is_invalid(port_id, ENABLED_WARN))
3556 port = &ports[port_id];
3559 * Search the pool of multicast MAC addresses for the removed address.
3561 for (i = 0; i < port->mc_addr_nb; i++) {
3562 if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i]))
3565 if (i == port->mc_addr_nb) {
3566 printf("multicast address not filtered by port %d\n", port_id);
3570 mcast_addr_pool_remove(port, i);
3571 eth_port_multicast_addr_list_set(port_id);
3575 port_dcb_info_display(portid_t port_id)
3577 struct rte_eth_dcb_info dcb_info;
3580 static const char *border = "================";
3582 if (port_id_is_invalid(port_id, ENABLED_WARN))
3585 ret = rte_eth_dev_get_dcb_info(port_id, &dcb_info);
3587 printf("\n Failed to get dcb infos on port %-2d\n",
3591 printf("\n %s DCB infos for port %-2d %s\n", border, port_id, border);
3592 printf(" TC NUMBER: %d\n", dcb_info.nb_tcs);
3594 for (i = 0; i < dcb_info.nb_tcs; i++)
3596 printf("\n Priority : ");
3597 for (i = 0; i < dcb_info.nb_tcs; i++)
3598 printf("\t%4d", dcb_info.prio_tc[i]);
3599 printf("\n BW percent :");
3600 for (i = 0; i < dcb_info.nb_tcs; i++)
3601 printf("\t%4d%%", dcb_info.tc_bws[i]);
3602 printf("\n RXQ base : ");
3603 for (i = 0; i < dcb_info.nb_tcs; i++)
3604 printf("\t%4d", dcb_info.tc_queue.tc_rxq[0][i].base);
3605 printf("\n RXQ number :");
3606 for (i = 0; i < dcb_info.nb_tcs; i++)
3607 printf("\t%4d", dcb_info.tc_queue.tc_rxq[0][i].nb_queue);
3608 printf("\n TXQ base : ");
3609 for (i = 0; i < dcb_info.nb_tcs; i++)
3610 printf("\t%4d", dcb_info.tc_queue.tc_txq[0][i].base);
3611 printf("\n TXQ number :");
3612 for (i = 0; i < dcb_info.nb_tcs; i++)
3613 printf("\t%4d", dcb_info.tc_queue.tc_txq[0][i].nb_queue);
3618 open_file(const char *file_path, uint32_t *size)
3620 int fd = open(file_path, O_RDONLY);
3622 uint8_t *buf = NULL;
3630 printf("%s: Failed to open %s\n", __func__, file_path);
3634 if ((fstat(fd, &st_buf) != 0) || (!S_ISREG(st_buf.st_mode))) {
3636 printf("%s: File operations failed\n", __func__);
3640 pkg_size = st_buf.st_size;
3643 printf("%s: File operations failed\n", __func__);
3647 buf = (uint8_t *)malloc(pkg_size);
3650 printf("%s: Failed to malloc memory\n", __func__);
3654 ret = read(fd, buf, pkg_size);
3657 printf("%s: File read operation failed\n", __func__);
3671 save_file(const char *file_path, uint8_t *buf, uint32_t size)
3673 FILE *fh = fopen(file_path, "wb");
3676 printf("%s: Failed to open %s\n", __func__, file_path);
3680 if (fwrite(buf, 1, size, fh) != size) {
3682 printf("%s: File write operation failed\n", __func__);
3692 close_file(uint8_t *buf)
3703 port_queue_region_info_display(portid_t port_id, void *buf)
3705 #ifdef RTE_LIBRTE_I40E_PMD
3707 struct rte_pmd_i40e_queue_regions *info =
3708 (struct rte_pmd_i40e_queue_regions *)buf;
3709 static const char *queue_region_info_stats_border = "-------";
3711 if (!info->queue_region_number)
3712 printf("there is no region has been set before");
3714 printf("\n %s All queue region info for port=%2d %s",
3715 queue_region_info_stats_border, port_id,
3716 queue_region_info_stats_border);
3717 printf("\n queue_region_number: %-14u \n",
3718 info->queue_region_number);
3720 for (i = 0; i < info->queue_region_number; i++) {
3721 printf("\n region_id: %-14u queue_number: %-14u "
3722 "queue_start_index: %-14u \n",
3723 info->region[i].region_id,
3724 info->region[i].queue_num,
3725 info->region[i].queue_start_index);
3727 printf(" user_priority_num is %-14u :",
3728 info->region[i].user_priority_num);
3729 for (j = 0; j < info->region[i].user_priority_num; j++)
3730 printf(" %-14u ", info->region[i].user_priority[j]);
3732 printf("\n flowtype_num is %-14u :",
3733 info->region[i].flowtype_num);
3734 for (j = 0; j < info->region[i].flowtype_num; j++)
3735 printf(" %-14u ", info->region[i].hw_flowtype[j]);
3738 RTE_SET_USED(port_id);