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);
512 printf("Max segment number per packet: %hu\n",
513 dev_info.tx_desc_lim.nb_seg_max);
514 printf("Max segment number per MTU/TSO: %hu\n",
515 dev_info.tx_desc_lim.nb_mtu_seg_max);
517 /* Show switch info only if valid switch domain and port id is set */
518 if (dev_info.switch_info.domain_id !=
519 RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID) {
520 if (dev_info.switch_info.name)
521 printf("Switch name: %s\n", dev_info.switch_info.name);
523 printf("Switch domain Id: %u\n",
524 dev_info.switch_info.domain_id);
525 printf("Switch Port Id: %u\n",
526 dev_info.switch_info.port_id);
531 port_summary_header_display(void)
533 uint16_t port_number;
535 port_number = rte_eth_dev_count_avail();
536 printf("Number of available ports: %i\n", port_number);
537 printf("%-4s %-17s %-12s %-14s %-8s %s\n", "Port", "MAC Address", "Name",
538 "Driver", "Status", "Link");
542 port_summary_display(portid_t port_id)
544 struct rte_ether_addr mac_addr;
545 struct rte_eth_link link;
546 struct rte_eth_dev_info dev_info;
547 char name[RTE_ETH_NAME_MAX_LEN];
549 if (port_id_is_invalid(port_id, ENABLED_WARN)) {
554 rte_eth_link_get_nowait(port_id, &link);
555 rte_eth_dev_info_get(port_id, &dev_info);
556 rte_eth_dev_get_name_by_port(port_id, name);
557 rte_eth_macaddr_get(port_id, &mac_addr);
559 printf("%-4d %02X:%02X:%02X:%02X:%02X:%02X %-12s %-14s %-8s %uMbps\n",
560 port_id, mac_addr.addr_bytes[0], mac_addr.addr_bytes[1],
561 mac_addr.addr_bytes[2], mac_addr.addr_bytes[3],
562 mac_addr.addr_bytes[4], mac_addr.addr_bytes[5], name,
563 dev_info.driver_name, (link.link_status) ? ("up") : ("down"),
564 (unsigned int) link.link_speed);
568 port_offload_cap_display(portid_t port_id)
570 struct rte_eth_dev_info dev_info;
571 static const char *info_border = "************";
573 if (port_id_is_invalid(port_id, ENABLED_WARN))
576 rte_eth_dev_info_get(port_id, &dev_info);
578 printf("\n%s Port %d supported offload features: %s\n",
579 info_border, port_id, info_border);
581 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) {
582 printf("VLAN stripped: ");
583 if (ports[port_id].dev_conf.rxmode.offloads &
584 DEV_RX_OFFLOAD_VLAN_STRIP)
590 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_QINQ_STRIP) {
591 printf("Double VLANs stripped: ");
592 if (ports[port_id].dev_conf.rxmode.offloads &
593 DEV_RX_OFFLOAD_QINQ_STRIP)
599 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) {
600 printf("RX IPv4 checksum: ");
601 if (ports[port_id].dev_conf.rxmode.offloads &
602 DEV_RX_OFFLOAD_IPV4_CKSUM)
608 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) {
609 printf("RX UDP checksum: ");
610 if (ports[port_id].dev_conf.rxmode.offloads &
611 DEV_RX_OFFLOAD_UDP_CKSUM)
617 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) {
618 printf("RX TCP checksum: ");
619 if (ports[port_id].dev_conf.rxmode.offloads &
620 DEV_RX_OFFLOAD_TCP_CKSUM)
626 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_SCTP_CKSUM) {
627 printf("RX SCTP checksum: ");
628 if (ports[port_id].dev_conf.rxmode.offloads &
629 DEV_RX_OFFLOAD_SCTP_CKSUM)
635 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) {
636 printf("RX Outer IPv4 checksum: ");
637 if (ports[port_id].dev_conf.rxmode.offloads &
638 DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM)
644 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_UDP_CKSUM) {
645 printf("RX Outer UDP checksum: ");
646 if (ports[port_id].dev_conf.rxmode.offloads &
647 DEV_RX_OFFLOAD_OUTER_UDP_CKSUM)
653 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_LRO) {
654 printf("Large receive offload: ");
655 if (ports[port_id].dev_conf.rxmode.offloads &
656 DEV_RX_OFFLOAD_TCP_LRO)
662 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) {
663 printf("HW timestamp: ");
664 if (ports[port_id].dev_conf.rxmode.offloads &
665 DEV_RX_OFFLOAD_TIMESTAMP)
671 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_KEEP_CRC) {
672 printf("Rx Keep CRC: ");
673 if (ports[port_id].dev_conf.rxmode.offloads &
674 DEV_RX_OFFLOAD_KEEP_CRC)
680 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_SECURITY) {
681 printf("RX offload security: ");
682 if (ports[port_id].dev_conf.rxmode.offloads &
683 DEV_RX_OFFLOAD_SECURITY)
689 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) {
690 printf("VLAN insert: ");
691 if (ports[port_id].dev_conf.txmode.offloads &
692 DEV_TX_OFFLOAD_VLAN_INSERT)
698 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) {
699 printf("Double VLANs insert: ");
700 if (ports[port_id].dev_conf.txmode.offloads &
701 DEV_TX_OFFLOAD_QINQ_INSERT)
707 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) {
708 printf("TX IPv4 checksum: ");
709 if (ports[port_id].dev_conf.txmode.offloads &
710 DEV_TX_OFFLOAD_IPV4_CKSUM)
716 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) {
717 printf("TX UDP checksum: ");
718 if (ports[port_id].dev_conf.txmode.offloads &
719 DEV_TX_OFFLOAD_UDP_CKSUM)
725 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) {
726 printf("TX TCP checksum: ");
727 if (ports[port_id].dev_conf.txmode.offloads &
728 DEV_TX_OFFLOAD_TCP_CKSUM)
734 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) {
735 printf("TX SCTP checksum: ");
736 if (ports[port_id].dev_conf.txmode.offloads &
737 DEV_TX_OFFLOAD_SCTP_CKSUM)
743 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) {
744 printf("TX Outer IPv4 checksum: ");
745 if (ports[port_id].dev_conf.txmode.offloads &
746 DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)
752 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) {
753 printf("TX TCP segmentation: ");
754 if (ports[port_id].dev_conf.txmode.offloads &
755 DEV_TX_OFFLOAD_TCP_TSO)
761 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TSO) {
762 printf("TX UDP segmentation: ");
763 if (ports[port_id].dev_conf.txmode.offloads &
764 DEV_TX_OFFLOAD_UDP_TSO)
770 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO) {
771 printf("TSO for VXLAN tunnel packet: ");
772 if (ports[port_id].dev_conf.txmode.offloads &
773 DEV_TX_OFFLOAD_VXLAN_TNL_TSO)
779 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO) {
780 printf("TSO for GRE tunnel packet: ");
781 if (ports[port_id].dev_conf.txmode.offloads &
782 DEV_TX_OFFLOAD_GRE_TNL_TSO)
788 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO) {
789 printf("TSO for IPIP tunnel packet: ");
790 if (ports[port_id].dev_conf.txmode.offloads &
791 DEV_TX_OFFLOAD_IPIP_TNL_TSO)
797 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO) {
798 printf("TSO for GENEVE tunnel packet: ");
799 if (ports[port_id].dev_conf.txmode.offloads &
800 DEV_TX_OFFLOAD_GENEVE_TNL_TSO)
806 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IP_TNL_TSO) {
807 printf("IP tunnel TSO: ");
808 if (ports[port_id].dev_conf.txmode.offloads &
809 DEV_TX_OFFLOAD_IP_TNL_TSO)
815 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TNL_TSO) {
816 printf("UDP tunnel TSO: ");
817 if (ports[port_id].dev_conf.txmode.offloads &
818 DEV_TX_OFFLOAD_UDP_TNL_TSO)
824 if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) {
825 printf("TX Outer UDP checksum: ");
826 if (ports[port_id].dev_conf.txmode.offloads &
827 DEV_TX_OFFLOAD_OUTER_UDP_CKSUM)
836 port_id_is_invalid(portid_t port_id, enum print_warning warning)
840 if (port_id == (portid_t)RTE_PORT_ALL)
843 RTE_ETH_FOREACH_DEV(pid)
847 if (warning == ENABLED_WARN)
848 printf("Invalid port %d\n", port_id);
853 void print_valid_ports(void)
857 printf("The valid ports array is [");
858 RTE_ETH_FOREACH_DEV(pid) {
865 vlan_id_is_invalid(uint16_t vlan_id)
869 printf("Invalid vlan_id %d (must be < 4096)\n", vlan_id);
874 port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
876 const struct rte_pci_device *pci_dev;
877 const struct rte_bus *bus;
881 printf("Port register offset 0x%X not aligned on a 4-byte "
887 if (!ports[port_id].dev_info.device) {
888 printf("Invalid device\n");
892 bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
893 if (bus && !strcmp(bus->name, "pci")) {
894 pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
896 printf("Not a PCI device\n");
900 pci_len = pci_dev->mem_resource[0].len;
901 if (reg_off >= pci_len) {
902 printf("Port %d: register offset %u (0x%X) out of port PCI "
903 "resource (length=%"PRIu64")\n",
904 port_id, (unsigned)reg_off, (unsigned)reg_off, pci_len);
911 reg_bit_pos_is_invalid(uint8_t bit_pos)
915 printf("Invalid bit position %d (must be <= 31)\n", bit_pos);
919 #define display_port_and_reg_off(port_id, reg_off) \
920 printf("port %d PCI register at offset 0x%X: ", (port_id), (reg_off))
923 display_port_reg_value(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
925 display_port_and_reg_off(port_id, (unsigned)reg_off);
926 printf("0x%08X (%u)\n", (unsigned)reg_v, (unsigned)reg_v);
930 port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_x)
935 if (port_id_is_invalid(port_id, ENABLED_WARN))
937 if (port_reg_off_is_invalid(port_id, reg_off))
939 if (reg_bit_pos_is_invalid(bit_x))
941 reg_v = port_id_pci_reg_read(port_id, reg_off);
942 display_port_and_reg_off(port_id, (unsigned)reg_off);
943 printf("bit %d=%d\n", bit_x, (int) ((reg_v & (1 << bit_x)) >> bit_x));
947 port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
948 uint8_t bit1_pos, uint8_t bit2_pos)
954 if (port_id_is_invalid(port_id, ENABLED_WARN))
956 if (port_reg_off_is_invalid(port_id, reg_off))
958 if (reg_bit_pos_is_invalid(bit1_pos))
960 if (reg_bit_pos_is_invalid(bit2_pos))
962 if (bit1_pos > bit2_pos)
963 l_bit = bit2_pos, h_bit = bit1_pos;
965 l_bit = bit1_pos, h_bit = bit2_pos;
967 reg_v = port_id_pci_reg_read(port_id, reg_off);
970 reg_v &= ((1 << (h_bit - l_bit + 1)) - 1);
971 display_port_and_reg_off(port_id, (unsigned)reg_off);
972 printf("bits[%d, %d]=0x%0*X (%u)\n", l_bit, h_bit,
973 ((h_bit - l_bit) / 4) + 1, (unsigned)reg_v, (unsigned)reg_v);
977 port_reg_display(portid_t port_id, uint32_t reg_off)
981 if (port_id_is_invalid(port_id, ENABLED_WARN))
983 if (port_reg_off_is_invalid(port_id, reg_off))
985 reg_v = port_id_pci_reg_read(port_id, reg_off);
986 display_port_reg_value(port_id, reg_off, reg_v);
990 port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
995 if (port_id_is_invalid(port_id, ENABLED_WARN))
997 if (port_reg_off_is_invalid(port_id, reg_off))
999 if (reg_bit_pos_is_invalid(bit_pos))
1002 printf("Invalid bit value %d (must be 0 or 1)\n", (int) bit_v);
1005 reg_v = port_id_pci_reg_read(port_id, reg_off);
1007 reg_v &= ~(1 << bit_pos);
1009 reg_v |= (1 << bit_pos);
1010 port_id_pci_reg_write(port_id, reg_off, reg_v);
1011 display_port_reg_value(port_id, reg_off, reg_v);
1015 port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
1016 uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value)
1023 if (port_id_is_invalid(port_id, ENABLED_WARN))
1025 if (port_reg_off_is_invalid(port_id, reg_off))
1027 if (reg_bit_pos_is_invalid(bit1_pos))
1029 if (reg_bit_pos_is_invalid(bit2_pos))
1031 if (bit1_pos > bit2_pos)
1032 l_bit = bit2_pos, h_bit = bit1_pos;
1034 l_bit = bit1_pos, h_bit = bit2_pos;
1036 if ((h_bit - l_bit) < 31)
1037 max_v = (1 << (h_bit - l_bit + 1)) - 1;
1041 if (value > max_v) {
1042 printf("Invalid value %u (0x%x) must be < %u (0x%x)\n",
1043 (unsigned)value, (unsigned)value,
1044 (unsigned)max_v, (unsigned)max_v);
1047 reg_v = port_id_pci_reg_read(port_id, reg_off);
1048 reg_v &= ~(max_v << l_bit); /* Keep unchanged bits */
1049 reg_v |= (value << l_bit); /* Set changed bits */
1050 port_id_pci_reg_write(port_id, reg_off, reg_v);
1051 display_port_reg_value(port_id, reg_off, reg_v);
1055 port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t reg_v)
1057 if (port_id_is_invalid(port_id, ENABLED_WARN))
1059 if (port_reg_off_is_invalid(port_id, reg_off))
1061 port_id_pci_reg_write(port_id, reg_off, reg_v);
1062 display_port_reg_value(port_id, reg_off, reg_v);
1066 port_mtu_set(portid_t port_id, uint16_t mtu)
1069 struct rte_eth_dev_info dev_info;
1071 if (port_id_is_invalid(port_id, ENABLED_WARN))
1073 rte_eth_dev_info_get(port_id, &dev_info);
1074 if (mtu > dev_info.max_mtu || mtu < dev_info.min_mtu) {
1075 printf("Set MTU failed. MTU:%u is not in valid range, min:%u - max:%u\n",
1076 mtu, dev_info.min_mtu, dev_info.max_mtu);
1079 diag = rte_eth_dev_set_mtu(port_id, mtu);
1082 printf("Set MTU failed. diag=%d\n", diag);
1085 /* Generic flow management functions. */
1087 /** Generate a port_flow entry from attributes/pattern/actions. */
1088 static struct port_flow *
1089 port_flow_new(const struct rte_flow_attr *attr,
1090 const struct rte_flow_item *pattern,
1091 const struct rte_flow_action *actions,
1092 struct rte_flow_error *error)
1094 const struct rte_flow_conv_rule rule = {
1096 .pattern_ro = pattern,
1097 .actions_ro = actions,
1099 struct port_flow *pf;
1102 ret = rte_flow_conv(RTE_FLOW_CONV_OP_RULE, NULL, 0, &rule, error);
1105 pf = calloc(1, offsetof(struct port_flow, rule) + ret);
1108 (error, errno, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
1112 if (rte_flow_conv(RTE_FLOW_CONV_OP_RULE, &pf->rule, ret, &rule,
1119 /** Print a message out of a flow error. */
1121 port_flow_complain(struct rte_flow_error *error)
1123 static const char *const errstrlist[] = {
1124 [RTE_FLOW_ERROR_TYPE_NONE] = "no error",
1125 [RTE_FLOW_ERROR_TYPE_UNSPECIFIED] = "cause unspecified",
1126 [RTE_FLOW_ERROR_TYPE_HANDLE] = "flow rule (handle)",
1127 [RTE_FLOW_ERROR_TYPE_ATTR_GROUP] = "group field",
1128 [RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY] = "priority field",
1129 [RTE_FLOW_ERROR_TYPE_ATTR_INGRESS] = "ingress field",
1130 [RTE_FLOW_ERROR_TYPE_ATTR_EGRESS] = "egress field",
1131 [RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER] = "transfer field",
1132 [RTE_FLOW_ERROR_TYPE_ATTR] = "attributes structure",
1133 [RTE_FLOW_ERROR_TYPE_ITEM_NUM] = "pattern length",
1134 [RTE_FLOW_ERROR_TYPE_ITEM_SPEC] = "item specification",
1135 [RTE_FLOW_ERROR_TYPE_ITEM_LAST] = "item specification range",
1136 [RTE_FLOW_ERROR_TYPE_ITEM_MASK] = "item specification mask",
1137 [RTE_FLOW_ERROR_TYPE_ITEM] = "specific pattern item",
1138 [RTE_FLOW_ERROR_TYPE_ACTION_NUM] = "number of actions",
1139 [RTE_FLOW_ERROR_TYPE_ACTION_CONF] = "action configuration",
1140 [RTE_FLOW_ERROR_TYPE_ACTION] = "specific action",
1144 int err = rte_errno;
1146 if ((unsigned int)error->type >= RTE_DIM(errstrlist) ||
1147 !errstrlist[error->type])
1148 errstr = "unknown type";
1150 errstr = errstrlist[error->type];
1151 printf("Caught error type %d (%s): %s%s: %s\n",
1152 error->type, errstr,
1153 error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
1154 error->cause), buf) : "",
1155 error->message ? error->message : "(no stated reason)",
1160 /** Validate flow rule. */
1162 port_flow_validate(portid_t port_id,
1163 const struct rte_flow_attr *attr,
1164 const struct rte_flow_item *pattern,
1165 const struct rte_flow_action *actions)
1167 struct rte_flow_error error;
1169 /* Poisoning to make sure PMDs update it in case of error. */
1170 memset(&error, 0x11, sizeof(error));
1171 if (rte_flow_validate(port_id, attr, pattern, actions, &error))
1172 return port_flow_complain(&error);
1173 printf("Flow rule validated\n");
1177 /** Create flow rule. */
1179 port_flow_create(portid_t port_id,
1180 const struct rte_flow_attr *attr,
1181 const struct rte_flow_item *pattern,
1182 const struct rte_flow_action *actions)
1184 struct rte_flow *flow;
1185 struct rte_port *port;
1186 struct port_flow *pf;
1188 struct rte_flow_error error;
1190 /* Poisoning to make sure PMDs update it in case of error. */
1191 memset(&error, 0x22, sizeof(error));
1192 flow = rte_flow_create(port_id, attr, pattern, actions, &error);
1194 return port_flow_complain(&error);
1195 port = &ports[port_id];
1196 if (port->flow_list) {
1197 if (port->flow_list->id == UINT32_MAX) {
1198 printf("Highest rule ID is already assigned, delete"
1200 rte_flow_destroy(port_id, flow, NULL);
1203 id = port->flow_list->id + 1;
1206 pf = port_flow_new(attr, pattern, actions, &error);
1208 rte_flow_destroy(port_id, flow, NULL);
1209 return port_flow_complain(&error);
1211 pf->next = port->flow_list;
1214 port->flow_list = pf;
1215 printf("Flow rule #%u created\n", pf->id);
1219 /** Destroy a number of flow rules. */
1221 port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule)
1223 struct rte_port *port;
1224 struct port_flow **tmp;
1228 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
1229 port_id == (portid_t)RTE_PORT_ALL)
1231 port = &ports[port_id];
1232 tmp = &port->flow_list;
1236 for (i = 0; i != n; ++i) {
1237 struct rte_flow_error error;
1238 struct port_flow *pf = *tmp;
1240 if (rule[i] != pf->id)
1243 * Poisoning to make sure PMDs update it in case
1246 memset(&error, 0x33, sizeof(error));
1247 if (rte_flow_destroy(port_id, pf->flow, &error)) {
1248 ret = port_flow_complain(&error);
1251 printf("Flow rule #%u destroyed\n", pf->id);
1257 tmp = &(*tmp)->next;
1263 /** Remove all flow rules. */
1265 port_flow_flush(portid_t port_id)
1267 struct rte_flow_error error;
1268 struct rte_port *port;
1271 /* Poisoning to make sure PMDs update it in case of error. */
1272 memset(&error, 0x44, sizeof(error));
1273 if (rte_flow_flush(port_id, &error)) {
1274 ret = port_flow_complain(&error);
1275 if (port_id_is_invalid(port_id, DISABLED_WARN) ||
1276 port_id == (portid_t)RTE_PORT_ALL)
1279 port = &ports[port_id];
1280 while (port->flow_list) {
1281 struct port_flow *pf = port->flow_list->next;
1283 free(port->flow_list);
1284 port->flow_list = pf;
1289 /** Query a flow rule. */
1291 port_flow_query(portid_t port_id, uint32_t rule,
1292 const struct rte_flow_action *action)
1294 struct rte_flow_error error;
1295 struct rte_port *port;
1296 struct port_flow *pf;
1299 struct rte_flow_query_count count;
1303 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
1304 port_id == (portid_t)RTE_PORT_ALL)
1306 port = &ports[port_id];
1307 for (pf = port->flow_list; pf; pf = pf->next)
1311 printf("Flow rule #%u not found\n", rule);
1314 ret = rte_flow_conv(RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
1315 &name, sizeof(name),
1316 (void *)(uintptr_t)action->type, &error);
1318 return port_flow_complain(&error);
1319 switch (action->type) {
1320 case RTE_FLOW_ACTION_TYPE_COUNT:
1323 printf("Cannot query action type %d (%s)\n",
1324 action->type, name);
1327 /* Poisoning to make sure PMDs update it in case of error. */
1328 memset(&error, 0x55, sizeof(error));
1329 memset(&query, 0, sizeof(query));
1330 if (rte_flow_query(port_id, pf->flow, action, &query, &error))
1331 return port_flow_complain(&error);
1332 switch (action->type) {
1333 case RTE_FLOW_ACTION_TYPE_COUNT:
1337 " hits: %" PRIu64 "\n"
1338 " bytes: %" PRIu64 "\n",
1340 query.count.hits_set,
1341 query.count.bytes_set,
1346 printf("Cannot display result for action type %d (%s)\n",
1347 action->type, name);
1353 /** List flow rules. */
1355 port_flow_list(portid_t port_id, uint32_t n, const uint32_t group[n])
1357 struct rte_port *port;
1358 struct port_flow *pf;
1359 struct port_flow *list = NULL;
1362 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
1363 port_id == (portid_t)RTE_PORT_ALL)
1365 port = &ports[port_id];
1366 if (!port->flow_list)
1368 /* Sort flows by group, priority and ID. */
1369 for (pf = port->flow_list; pf != NULL; pf = pf->next) {
1370 struct port_flow **tmp;
1371 const struct rte_flow_attr *curr = pf->rule.attr;
1374 /* Filter out unwanted groups. */
1375 for (i = 0; i != n; ++i)
1376 if (curr->group == group[i])
1381 for (tmp = &list; *tmp; tmp = &(*tmp)->tmp) {
1382 const struct rte_flow_attr *comp = (*tmp)->rule.attr;
1384 if (curr->group > comp->group ||
1385 (curr->group == comp->group &&
1386 curr->priority > comp->priority) ||
1387 (curr->group == comp->group &&
1388 curr->priority == comp->priority &&
1389 pf->id > (*tmp)->id))
1396 printf("ID\tGroup\tPrio\tAttr\tRule\n");
1397 for (pf = list; pf != NULL; pf = pf->tmp) {
1398 const struct rte_flow_item *item = pf->rule.pattern;
1399 const struct rte_flow_action *action = pf->rule.actions;
1402 printf("%" PRIu32 "\t%" PRIu32 "\t%" PRIu32 "\t%c%c%c\t",
1404 pf->rule.attr->group,
1405 pf->rule.attr->priority,
1406 pf->rule.attr->ingress ? 'i' : '-',
1407 pf->rule.attr->egress ? 'e' : '-',
1408 pf->rule.attr->transfer ? 't' : '-');
1409 while (item->type != RTE_FLOW_ITEM_TYPE_END) {
1410 if (rte_flow_conv(RTE_FLOW_CONV_OP_ITEM_NAME_PTR,
1411 &name, sizeof(name),
1412 (void *)(uintptr_t)item->type,
1415 if (item->type != RTE_FLOW_ITEM_TYPE_VOID)
1416 printf("%s ", name);
1420 while (action->type != RTE_FLOW_ACTION_TYPE_END) {
1421 if (rte_flow_conv(RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
1422 &name, sizeof(name),
1423 (void *)(uintptr_t)action->type,
1426 if (action->type != RTE_FLOW_ACTION_TYPE_VOID)
1427 printf(" %s", name);
1434 /** Restrict ingress traffic to the defined flow rules. */
1436 port_flow_isolate(portid_t port_id, int set)
1438 struct rte_flow_error error;
1440 /* Poisoning to make sure PMDs update it in case of error. */
1441 memset(&error, 0x66, sizeof(error));
1442 if (rte_flow_isolate(port_id, set, &error))
1443 return port_flow_complain(&error);
1444 printf("Ingress traffic on port %u is %s to the defined flow rules\n",
1446 set ? "now restricted" : "not restricted anymore");
1451 * RX/TX ring descriptors display functions.
1454 rx_queue_id_is_invalid(queueid_t rxq_id)
1456 if (rxq_id < nb_rxq)
1458 printf("Invalid RX queue %d (must be < nb_rxq=%d)\n", rxq_id, nb_rxq);
1463 tx_queue_id_is_invalid(queueid_t txq_id)
1465 if (txq_id < nb_txq)
1467 printf("Invalid TX queue %d (must be < nb_rxq=%d)\n", txq_id, nb_txq);
1472 rx_desc_id_is_invalid(uint16_t rxdesc_id)
1474 if (rxdesc_id < nb_rxd)
1476 printf("Invalid RX descriptor %d (must be < nb_rxd=%d)\n",
1482 tx_desc_id_is_invalid(uint16_t txdesc_id)
1484 if (txdesc_id < nb_txd)
1486 printf("Invalid TX descriptor %d (must be < nb_txd=%d)\n",
1491 static const struct rte_memzone *
1492 ring_dma_zone_lookup(const char *ring_name, portid_t port_id, uint16_t q_id)
1494 char mz_name[RTE_MEMZONE_NAMESIZE];
1495 const struct rte_memzone *mz;
1497 snprintf(mz_name, sizeof(mz_name), "eth_p%d_q%d_%s",
1498 port_id, q_id, ring_name);
1499 mz = rte_memzone_lookup(mz_name);
1501 printf("%s ring memory zoneof (port %d, queue %d) not"
1502 "found (zone name = %s\n",
1503 ring_name, port_id, q_id, mz_name);
1507 union igb_ring_dword {
1510 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
1520 struct igb_ring_desc_32_bytes {
1521 union igb_ring_dword lo_dword;
1522 union igb_ring_dword hi_dword;
1523 union igb_ring_dword resv1;
1524 union igb_ring_dword resv2;
1527 struct igb_ring_desc_16_bytes {
1528 union igb_ring_dword lo_dword;
1529 union igb_ring_dword hi_dword;
1533 ring_rxd_display_dword(union igb_ring_dword dword)
1535 printf(" 0x%08X - 0x%08X\n", (unsigned)dword.words.lo,
1536 (unsigned)dword.words.hi);
1540 ring_rx_descriptor_display(const struct rte_memzone *ring_mz,
1541 #ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
1544 __rte_unused portid_t port_id,
1548 struct igb_ring_desc_16_bytes *ring =
1549 (struct igb_ring_desc_16_bytes *)ring_mz->addr;
1550 #ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
1551 struct rte_eth_dev_info dev_info;
1553 memset(&dev_info, 0, sizeof(dev_info));
1554 rte_eth_dev_info_get(port_id, &dev_info);
1555 if (strstr(dev_info.driver_name, "i40e") != NULL) {
1556 /* 32 bytes RX descriptor, i40e only */
1557 struct igb_ring_desc_32_bytes *ring =
1558 (struct igb_ring_desc_32_bytes *)ring_mz->addr;
1559 ring[desc_id].lo_dword.dword =
1560 rte_le_to_cpu_64(ring[desc_id].lo_dword.dword);
1561 ring_rxd_display_dword(ring[desc_id].lo_dword);
1562 ring[desc_id].hi_dword.dword =
1563 rte_le_to_cpu_64(ring[desc_id].hi_dword.dword);
1564 ring_rxd_display_dword(ring[desc_id].hi_dword);
1565 ring[desc_id].resv1.dword =
1566 rte_le_to_cpu_64(ring[desc_id].resv1.dword);
1567 ring_rxd_display_dword(ring[desc_id].resv1);
1568 ring[desc_id].resv2.dword =
1569 rte_le_to_cpu_64(ring[desc_id].resv2.dword);
1570 ring_rxd_display_dword(ring[desc_id].resv2);
1575 /* 16 bytes RX descriptor */
1576 ring[desc_id].lo_dword.dword =
1577 rte_le_to_cpu_64(ring[desc_id].lo_dword.dword);
1578 ring_rxd_display_dword(ring[desc_id].lo_dword);
1579 ring[desc_id].hi_dword.dword =
1580 rte_le_to_cpu_64(ring[desc_id].hi_dword.dword);
1581 ring_rxd_display_dword(ring[desc_id].hi_dword);
1585 ring_tx_descriptor_display(const struct rte_memzone *ring_mz, uint16_t desc_id)
1587 struct igb_ring_desc_16_bytes *ring;
1588 struct igb_ring_desc_16_bytes txd;
1590 ring = (struct igb_ring_desc_16_bytes *)ring_mz->addr;
1591 txd.lo_dword.dword = rte_le_to_cpu_64(ring[desc_id].lo_dword.dword);
1592 txd.hi_dword.dword = rte_le_to_cpu_64(ring[desc_id].hi_dword.dword);
1593 printf(" 0x%08X - 0x%08X / 0x%08X - 0x%08X\n",
1594 (unsigned)txd.lo_dword.words.lo,
1595 (unsigned)txd.lo_dword.words.hi,
1596 (unsigned)txd.hi_dword.words.lo,
1597 (unsigned)txd.hi_dword.words.hi);
1601 rx_ring_desc_display(portid_t port_id, queueid_t rxq_id, uint16_t rxd_id)
1603 const struct rte_memzone *rx_mz;
1605 if (port_id_is_invalid(port_id, ENABLED_WARN))
1607 if (rx_queue_id_is_invalid(rxq_id))
1609 if (rx_desc_id_is_invalid(rxd_id))
1611 rx_mz = ring_dma_zone_lookup("rx_ring", port_id, rxq_id);
1614 ring_rx_descriptor_display(rx_mz, port_id, rxd_id);
1618 tx_ring_desc_display(portid_t port_id, queueid_t txq_id, uint16_t txd_id)
1620 const struct rte_memzone *tx_mz;
1622 if (port_id_is_invalid(port_id, ENABLED_WARN))
1624 if (tx_queue_id_is_invalid(txq_id))
1626 if (tx_desc_id_is_invalid(txd_id))
1628 tx_mz = ring_dma_zone_lookup("tx_ring", port_id, txq_id);
1631 ring_tx_descriptor_display(tx_mz, txd_id);
1635 fwd_lcores_config_display(void)
1639 printf("List of forwarding lcores:");
1640 for (lc_id = 0; lc_id < nb_cfg_lcores; lc_id++)
1641 printf(" %2u", fwd_lcores_cpuids[lc_id]);
1645 rxtx_config_display(void)
1650 printf(" %s packet forwarding%s packets/burst=%d\n",
1651 cur_fwd_eng->fwd_mode_name,
1652 retry_enabled == 0 ? "" : " with retry",
1655 if (cur_fwd_eng == &tx_only_engine || cur_fwd_eng == &flow_gen_engine)
1656 printf(" packet len=%u - nb packet segments=%d\n",
1657 (unsigned)tx_pkt_length, (int) tx_pkt_nb_segs);
1659 printf(" nb forwarding cores=%d - nb forwarding ports=%d\n",
1660 nb_fwd_lcores, nb_fwd_ports);
1662 RTE_ETH_FOREACH_DEV(pid) {
1663 struct rte_eth_rxconf *rx_conf = &ports[pid].rx_conf[0];
1664 struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf[0];
1665 uint16_t *nb_rx_desc = &ports[pid].nb_rx_desc[0];
1666 uint16_t *nb_tx_desc = &ports[pid].nb_tx_desc[0];
1667 uint16_t nb_rx_desc_tmp;
1668 uint16_t nb_tx_desc_tmp;
1669 struct rte_eth_rxq_info rx_qinfo;
1670 struct rte_eth_txq_info tx_qinfo;
1673 /* per port config */
1674 printf(" port %d: RX queue number: %d Tx queue number: %d\n",
1675 (unsigned int)pid, nb_rxq, nb_txq);
1677 printf(" Rx offloads=0x%"PRIx64" Tx offloads=0x%"PRIx64"\n",
1678 ports[pid].dev_conf.rxmode.offloads,
1679 ports[pid].dev_conf.txmode.offloads);
1681 /* per rx queue config only for first queue to be less verbose */
1682 for (qid = 0; qid < 1; qid++) {
1683 rc = rte_eth_rx_queue_info_get(pid, qid, &rx_qinfo);
1685 nb_rx_desc_tmp = nb_rx_desc[qid];
1687 nb_rx_desc_tmp = rx_qinfo.nb_desc;
1689 printf(" RX queue: %d\n", qid);
1690 printf(" RX desc=%d - RX free threshold=%d\n",
1691 nb_rx_desc_tmp, rx_conf[qid].rx_free_thresh);
1692 printf(" RX threshold registers: pthresh=%d hthresh=%d "
1694 rx_conf[qid].rx_thresh.pthresh,
1695 rx_conf[qid].rx_thresh.hthresh,
1696 rx_conf[qid].rx_thresh.wthresh);
1697 printf(" RX Offloads=0x%"PRIx64"\n",
1698 rx_conf[qid].offloads);
1701 /* per tx queue config only for first queue to be less verbose */
1702 for (qid = 0; qid < 1; qid++) {
1703 rc = rte_eth_tx_queue_info_get(pid, qid, &tx_qinfo);
1705 nb_tx_desc_tmp = nb_tx_desc[qid];
1707 nb_tx_desc_tmp = tx_qinfo.nb_desc;
1709 printf(" TX queue: %d\n", qid);
1710 printf(" TX desc=%d - TX free threshold=%d\n",
1711 nb_tx_desc_tmp, tx_conf[qid].tx_free_thresh);
1712 printf(" TX threshold registers: pthresh=%d hthresh=%d "
1714 tx_conf[qid].tx_thresh.pthresh,
1715 tx_conf[qid].tx_thresh.hthresh,
1716 tx_conf[qid].tx_thresh.wthresh);
1717 printf(" TX offloads=0x%"PRIx64" - TX RS bit threshold=%d\n",
1718 tx_conf[qid].offloads, tx_conf->tx_rs_thresh);
1724 port_rss_reta_info(portid_t port_id,
1725 struct rte_eth_rss_reta_entry64 *reta_conf,
1726 uint16_t nb_entries)
1728 uint16_t i, idx, shift;
1731 if (port_id_is_invalid(port_id, ENABLED_WARN))
1734 ret = rte_eth_dev_rss_reta_query(port_id, reta_conf, nb_entries);
1736 printf("Failed to get RSS RETA info, return code = %d\n", ret);
1740 for (i = 0; i < nb_entries; i++) {
1741 idx = i / RTE_RETA_GROUP_SIZE;
1742 shift = i % RTE_RETA_GROUP_SIZE;
1743 if (!(reta_conf[idx].mask & (1ULL << shift)))
1745 printf("RSS RETA configuration: hash index=%u, queue=%u\n",
1746 i, reta_conf[idx].reta[shift]);
1751 * Displays the RSS hash functions of a port, and, optionaly, the RSS hash
1755 port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
1757 struct rte_eth_rss_conf rss_conf = {0};
1758 uint8_t rss_key[RSS_HASH_KEY_LENGTH];
1762 struct rte_eth_dev_info dev_info;
1763 uint8_t hash_key_size;
1765 if (port_id_is_invalid(port_id, ENABLED_WARN))
1768 rte_eth_dev_info_get(port_id, &dev_info);
1769 if (dev_info.hash_key_size > 0 &&
1770 dev_info.hash_key_size <= sizeof(rss_key))
1771 hash_key_size = dev_info.hash_key_size;
1773 printf("dev_info did not provide a valid hash key size\n");
1777 /* Get RSS hash key if asked to display it */
1778 rss_conf.rss_key = (show_rss_key) ? rss_key : NULL;
1779 rss_conf.rss_key_len = hash_key_size;
1780 diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
1784 printf("port index %d invalid\n", port_id);
1787 printf("operation not supported by device\n");
1790 printf("operation failed - diag=%d\n", diag);
1795 rss_hf = rss_conf.rss_hf;
1797 printf("RSS disabled\n");
1800 printf("RSS functions:\n ");
1801 for (i = 0; rss_type_table[i].str; i++) {
1802 if (rss_hf & rss_type_table[i].rss_type)
1803 printf("%s ", rss_type_table[i].str);
1808 printf("RSS key:\n");
1809 for (i = 0; i < hash_key_size; i++)
1810 printf("%02X", rss_key[i]);
1815 port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key,
1818 struct rte_eth_rss_conf rss_conf;
1822 rss_conf.rss_key = NULL;
1823 rss_conf.rss_key_len = hash_key_len;
1824 rss_conf.rss_hf = 0;
1825 for (i = 0; rss_type_table[i].str; i++) {
1826 if (!strcmp(rss_type_table[i].str, rss_type))
1827 rss_conf.rss_hf = rss_type_table[i].rss_type;
1829 diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
1831 rss_conf.rss_key = hash_key;
1832 diag = rte_eth_dev_rss_hash_update(port_id, &rss_conf);
1839 printf("port index %d invalid\n", port_id);
1842 printf("operation not supported by device\n");
1845 printf("operation failed - diag=%d\n", diag);
1851 * Setup forwarding configuration for each logical core.
1854 setup_fwd_config_of_each_lcore(struct fwd_config *cfg)
1856 streamid_t nb_fs_per_lcore;
1864 nb_fs = cfg->nb_fwd_streams;
1865 nb_fc = cfg->nb_fwd_lcores;
1866 if (nb_fs <= nb_fc) {
1867 nb_fs_per_lcore = 1;
1870 nb_fs_per_lcore = (streamid_t) (nb_fs / nb_fc);
1871 nb_extra = (lcoreid_t) (nb_fs % nb_fc);
1874 nb_lc = (lcoreid_t) (nb_fc - nb_extra);
1876 for (lc_id = 0; lc_id < nb_lc; lc_id++) {
1877 fwd_lcores[lc_id]->stream_idx = sm_id;
1878 fwd_lcores[lc_id]->stream_nb = nb_fs_per_lcore;
1879 sm_id = (streamid_t) (sm_id + nb_fs_per_lcore);
1883 * Assign extra remaining streams, if any.
1885 nb_fs_per_lcore = (streamid_t) (nb_fs_per_lcore + 1);
1886 for (lc_id = 0; lc_id < nb_extra; lc_id++) {
1887 fwd_lcores[nb_lc + lc_id]->stream_idx = sm_id;
1888 fwd_lcores[nb_lc + lc_id]->stream_nb = nb_fs_per_lcore;
1889 sm_id = (streamid_t) (sm_id + nb_fs_per_lcore);
1894 fwd_topology_tx_port_get(portid_t rxp)
1896 static int warning_once = 1;
1898 RTE_ASSERT(rxp < cur_fwd_config.nb_fwd_ports);
1900 switch (port_topology) {
1902 case PORT_TOPOLOGY_PAIRED:
1903 if ((rxp & 0x1) == 0) {
1904 if (rxp + 1 < cur_fwd_config.nb_fwd_ports)
1907 printf("\nWarning! port-topology=paired"
1908 " and odd forward ports number,"
1909 " the last port will pair with"
1916 case PORT_TOPOLOGY_CHAINED:
1917 return (rxp + 1) % cur_fwd_config.nb_fwd_ports;
1918 case PORT_TOPOLOGY_LOOP:
1924 simple_fwd_config_setup(void)
1928 cur_fwd_config.nb_fwd_ports = (portid_t) nb_fwd_ports;
1929 cur_fwd_config.nb_fwd_streams =
1930 (streamid_t) cur_fwd_config.nb_fwd_ports;
1932 /* reinitialize forwarding streams */
1936 * In the simple forwarding test, the number of forwarding cores
1937 * must be lower or equal to the number of forwarding ports.
1939 cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
1940 if (cur_fwd_config.nb_fwd_lcores > cur_fwd_config.nb_fwd_ports)
1941 cur_fwd_config.nb_fwd_lcores =
1942 (lcoreid_t) cur_fwd_config.nb_fwd_ports;
1943 setup_fwd_config_of_each_lcore(&cur_fwd_config);
1945 for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
1946 fwd_streams[i]->rx_port = fwd_ports_ids[i];
1947 fwd_streams[i]->rx_queue = 0;
1948 fwd_streams[i]->tx_port =
1949 fwd_ports_ids[fwd_topology_tx_port_get(i)];
1950 fwd_streams[i]->tx_queue = 0;
1951 fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
1952 fwd_streams[i]->retry_enabled = retry_enabled;
1957 * For the RSS forwarding test all streams distributed over lcores. Each stream
1958 * being composed of a RX queue to poll on a RX port for input messages,
1959 * associated with a TX queue of a TX port where to send forwarded packets.
1962 rss_fwd_config_setup(void)
1973 cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
1974 cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
1975 cur_fwd_config.nb_fwd_streams =
1976 (streamid_t) (nb_q * cur_fwd_config.nb_fwd_ports);
1978 if (cur_fwd_config.nb_fwd_streams < cur_fwd_config.nb_fwd_lcores)
1979 cur_fwd_config.nb_fwd_lcores =
1980 (lcoreid_t)cur_fwd_config.nb_fwd_streams;
1982 /* reinitialize forwarding streams */
1985 setup_fwd_config_of_each_lcore(&cur_fwd_config);
1987 for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) {
1988 struct fwd_stream *fs;
1990 fs = fwd_streams[sm_id];
1991 txp = fwd_topology_tx_port_get(rxp);
1992 fs->rx_port = fwd_ports_ids[rxp];
1994 fs->tx_port = fwd_ports_ids[txp];
1996 fs->peer_addr = fs->tx_port;
1997 fs->retry_enabled = retry_enabled;
1999 if (rxp < nb_fwd_ports)
2007 * For the DCB forwarding test, each core is assigned on each traffic class.
2009 * Each core is assigned a multi-stream, each stream being composed of
2010 * a RX queue to poll on a RX port for input messages, associated with
2011 * a TX queue of a TX port where to send forwarded packets. All RX and
2012 * TX queues are mapping to the same traffic class.
2013 * If VMDQ and DCB co-exist, each traffic class on different POOLs share
2017 dcb_fwd_config_setup(void)
2019 struct rte_eth_dcb_info rxp_dcb_info, txp_dcb_info;
2020 portid_t txp, rxp = 0;
2021 queueid_t txq, rxq = 0;
2023 uint16_t nb_rx_queue, nb_tx_queue;
2024 uint16_t i, j, k, sm_id = 0;
2027 cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
2028 cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
2029 cur_fwd_config.nb_fwd_streams =
2030 (streamid_t) (nb_rxq * cur_fwd_config.nb_fwd_ports);
2032 /* reinitialize forwarding streams */
2036 /* get the dcb info on the first RX and TX ports */
2037 (void)rte_eth_dev_get_dcb_info(fwd_ports_ids[rxp], &rxp_dcb_info);
2038 (void)rte_eth_dev_get_dcb_info(fwd_ports_ids[txp], &txp_dcb_info);
2040 for (lc_id = 0; lc_id < cur_fwd_config.nb_fwd_lcores; lc_id++) {
2041 fwd_lcores[lc_id]->stream_nb = 0;
2042 fwd_lcores[lc_id]->stream_idx = sm_id;
2043 for (i = 0; i < ETH_MAX_VMDQ_POOL; i++) {
2044 /* if the nb_queue is zero, means this tc is
2045 * not enabled on the POOL
2047 if (rxp_dcb_info.tc_queue.tc_rxq[i][tc].nb_queue == 0)
2049 k = fwd_lcores[lc_id]->stream_nb +
2050 fwd_lcores[lc_id]->stream_idx;
2051 rxq = rxp_dcb_info.tc_queue.tc_rxq[i][tc].base;
2052 txq = txp_dcb_info.tc_queue.tc_txq[i][tc].base;
2053 nb_rx_queue = txp_dcb_info.tc_queue.tc_rxq[i][tc].nb_queue;
2054 nb_tx_queue = txp_dcb_info.tc_queue.tc_txq[i][tc].nb_queue;
2055 for (j = 0; j < nb_rx_queue; j++) {
2056 struct fwd_stream *fs;
2058 fs = fwd_streams[k + j];
2059 fs->rx_port = fwd_ports_ids[rxp];
2060 fs->rx_queue = rxq + j;
2061 fs->tx_port = fwd_ports_ids[txp];
2062 fs->tx_queue = txq + j % nb_tx_queue;
2063 fs->peer_addr = fs->tx_port;
2064 fs->retry_enabled = retry_enabled;
2066 fwd_lcores[lc_id]->stream_nb +=
2067 rxp_dcb_info.tc_queue.tc_rxq[i][tc].nb_queue;
2069 sm_id = (streamid_t) (sm_id + fwd_lcores[lc_id]->stream_nb);
2072 if (tc < rxp_dcb_info.nb_tcs)
2074 /* Restart from TC 0 on next RX port */
2076 if (numa_support && (nb_fwd_ports <= (nb_ports >> 1)))
2078 (rxp + ((nb_ports >> 1) / nb_fwd_ports));
2081 if (rxp >= nb_fwd_ports)
2083 /* get the dcb information on next RX and TX ports */
2084 if ((rxp & 0x1) == 0)
2085 txp = (portid_t) (rxp + 1);
2087 txp = (portid_t) (rxp - 1);
2088 rte_eth_dev_get_dcb_info(fwd_ports_ids[rxp], &rxp_dcb_info);
2089 rte_eth_dev_get_dcb_info(fwd_ports_ids[txp], &txp_dcb_info);
2094 icmp_echo_config_setup(void)
2101 if ((nb_txq * nb_fwd_ports) < nb_fwd_lcores)
2102 cur_fwd_config.nb_fwd_lcores = (lcoreid_t)
2103 (nb_txq * nb_fwd_ports);
2105 cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
2106 cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
2107 cur_fwd_config.nb_fwd_streams =
2108 (streamid_t) (nb_rxq * cur_fwd_config.nb_fwd_ports);
2109 if (cur_fwd_config.nb_fwd_streams < cur_fwd_config.nb_fwd_lcores)
2110 cur_fwd_config.nb_fwd_lcores =
2111 (lcoreid_t)cur_fwd_config.nb_fwd_streams;
2112 if (verbose_level > 0) {
2113 printf("%s fwd_cores=%d fwd_ports=%d fwd_streams=%d\n",
2115 cur_fwd_config.nb_fwd_lcores,
2116 cur_fwd_config.nb_fwd_ports,
2117 cur_fwd_config.nb_fwd_streams);
2120 /* reinitialize forwarding streams */
2122 setup_fwd_config_of_each_lcore(&cur_fwd_config);
2124 for (lc_id = 0; lc_id < cur_fwd_config.nb_fwd_lcores; lc_id++) {
2125 if (verbose_level > 0)
2126 printf(" core=%d: \n", lc_id);
2127 for (sm_id = 0; sm_id < fwd_lcores[lc_id]->stream_nb; sm_id++) {
2128 struct fwd_stream *fs;
2129 fs = fwd_streams[fwd_lcores[lc_id]->stream_idx + sm_id];
2130 fs->rx_port = fwd_ports_ids[rxp];
2132 fs->tx_port = fs->rx_port;
2134 fs->peer_addr = fs->tx_port;
2135 fs->retry_enabled = retry_enabled;
2136 if (verbose_level > 0)
2137 printf(" stream=%d port=%d rxq=%d txq=%d\n",
2138 sm_id, fs->rx_port, fs->rx_queue,
2140 rxq = (queueid_t) (rxq + 1);
2141 if (rxq == nb_rxq) {
2143 rxp = (portid_t) (rxp + 1);
2149 #if defined RTE_LIBRTE_PMD_SOFTNIC
2151 softnic_fwd_config_setup(void)
2153 struct rte_port *port;
2154 portid_t pid, softnic_portid;
2156 uint8_t softnic_enable = 0;
2158 RTE_ETH_FOREACH_DEV(pid) {
2160 const char *driver = port->dev_info.driver_name;
2162 if (strcmp(driver, "net_softnic") == 0) {
2163 softnic_portid = pid;
2169 if (softnic_enable == 0) {
2170 printf("Softnic mode not configured(%s)!\n", __func__);
2174 cur_fwd_config.nb_fwd_ports = 1;
2175 cur_fwd_config.nb_fwd_streams = (streamid_t) nb_rxq;
2177 /* Re-initialize forwarding streams */
2181 * In the softnic forwarding test, the number of forwarding cores
2182 * is set to one and remaining are used for softnic packet processing.
2184 cur_fwd_config.nb_fwd_lcores = 1;
2185 setup_fwd_config_of_each_lcore(&cur_fwd_config);
2187 for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) {
2188 fwd_streams[i]->rx_port = softnic_portid;
2189 fwd_streams[i]->rx_queue = i;
2190 fwd_streams[i]->tx_port = softnic_portid;
2191 fwd_streams[i]->tx_queue = i;
2192 fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
2193 fwd_streams[i]->retry_enabled = retry_enabled;
2199 fwd_config_setup(void)
2201 cur_fwd_config.fwd_eng = cur_fwd_eng;
2202 if (strcmp(cur_fwd_eng->fwd_mode_name, "icmpecho") == 0) {
2203 icmp_echo_config_setup();
2207 #if defined RTE_LIBRTE_PMD_SOFTNIC
2208 if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
2209 softnic_fwd_config_setup();
2214 if ((nb_rxq > 1) && (nb_txq > 1)){
2216 dcb_fwd_config_setup();
2218 rss_fwd_config_setup();
2221 simple_fwd_config_setup();
2225 mp_alloc_to_str(uint8_t mode)
2228 case MP_ALLOC_NATIVE:
2234 case MP_ALLOC_XMEM_HUGE:
2242 pkt_fwd_config_display(struct fwd_config *cfg)
2244 struct fwd_stream *fs;
2248 printf("%s packet forwarding%s - ports=%d - cores=%d - streams=%d - "
2249 "NUMA support %s, MP allocation mode: %s\n",
2250 cfg->fwd_eng->fwd_mode_name,
2251 retry_enabled == 0 ? "" : " with retry",
2252 cfg->nb_fwd_ports, cfg->nb_fwd_lcores, cfg->nb_fwd_streams,
2253 numa_support == 1 ? "enabled" : "disabled",
2254 mp_alloc_to_str(mp_alloc_type));
2257 printf("TX retry num: %u, delay between TX retries: %uus\n",
2258 burst_tx_retry_num, burst_tx_delay_time);
2259 for (lc_id = 0; lc_id < cfg->nb_fwd_lcores; lc_id++) {
2260 printf("Logical Core %u (socket %u) forwards packets on "
2262 fwd_lcores_cpuids[lc_id],
2263 rte_lcore_to_socket_id(fwd_lcores_cpuids[lc_id]),
2264 fwd_lcores[lc_id]->stream_nb);
2265 for (sm_id = 0; sm_id < fwd_lcores[lc_id]->stream_nb; sm_id++) {
2266 fs = fwd_streams[fwd_lcores[lc_id]->stream_idx + sm_id];
2267 printf("\n RX P=%d/Q=%d (socket %u) -> TX "
2268 "P=%d/Q=%d (socket %u) ",
2269 fs->rx_port, fs->rx_queue,
2270 ports[fs->rx_port].socket_id,
2271 fs->tx_port, fs->tx_queue,
2272 ports[fs->tx_port].socket_id);
2273 print_ethaddr("peer=",
2274 &peer_eth_addrs[fs->peer_addr]);
2282 set_fwd_eth_peer(portid_t port_id, char *peer_addr)
2284 struct rte_ether_addr new_peer_addr;
2285 if (!rte_eth_dev_is_valid_port(port_id)) {
2286 printf("Error: Invalid port number %i\n", port_id);
2289 if (rte_ether_unformat_addr(peer_addr, &new_peer_addr) < 0) {
2290 printf("Error: Invalid ethernet address: %s\n", peer_addr);
2293 peer_eth_addrs[port_id] = new_peer_addr;
2297 set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc)
2300 unsigned int lcore_cpuid;
2305 for (i = 0; i < nb_lc; i++) {
2306 lcore_cpuid = lcorelist[i];
2307 if (! rte_lcore_is_enabled(lcore_cpuid)) {
2308 printf("lcore %u not enabled\n", lcore_cpuid);
2311 if (lcore_cpuid == rte_get_master_lcore()) {
2312 printf("lcore %u cannot be masked on for running "
2313 "packet forwarding, which is the master lcore "
2314 "and reserved for command line parsing only\n",
2319 fwd_lcores_cpuids[i] = lcore_cpuid;
2321 if (record_now == 0) {
2325 nb_cfg_lcores = (lcoreid_t) nb_lc;
2326 if (nb_fwd_lcores != (lcoreid_t) nb_lc) {
2327 printf("previous number of forwarding cores %u - changed to "
2328 "number of configured cores %u\n",
2329 (unsigned int) nb_fwd_lcores, nb_lc);
2330 nb_fwd_lcores = (lcoreid_t) nb_lc;
2337 set_fwd_lcores_mask(uint64_t lcoremask)
2339 unsigned int lcorelist[64];
2343 if (lcoremask == 0) {
2344 printf("Invalid NULL mask of cores\n");
2348 for (i = 0; i < 64; i++) {
2349 if (! ((uint64_t)(1ULL << i) & lcoremask))
2351 lcorelist[nb_lc++] = i;
2353 return set_fwd_lcores_list(lcorelist, nb_lc);
2357 set_fwd_lcores_number(uint16_t nb_lc)
2359 if (nb_lc > nb_cfg_lcores) {
2360 printf("nb fwd cores %u > %u (max. number of configured "
2361 "lcores) - ignored\n",
2362 (unsigned int) nb_lc, (unsigned int) nb_cfg_lcores);
2365 nb_fwd_lcores = (lcoreid_t) nb_lc;
2366 printf("Number of forwarding cores set to %u\n",
2367 (unsigned int) nb_fwd_lcores);
2371 set_fwd_ports_list(unsigned int *portlist, unsigned int nb_pt)
2379 for (i = 0; i < nb_pt; i++) {
2380 port_id = (portid_t) portlist[i];
2381 if (port_id_is_invalid(port_id, ENABLED_WARN))
2384 fwd_ports_ids[i] = port_id;
2386 if (record_now == 0) {
2390 nb_cfg_ports = (portid_t) nb_pt;
2391 if (nb_fwd_ports != (portid_t) nb_pt) {
2392 printf("previous number of forwarding ports %u - changed to "
2393 "number of configured ports %u\n",
2394 (unsigned int) nb_fwd_ports, nb_pt);
2395 nb_fwd_ports = (portid_t) nb_pt;
2400 set_fwd_ports_mask(uint64_t portmask)
2402 unsigned int portlist[64];
2406 if (portmask == 0) {
2407 printf("Invalid NULL mask of ports\n");
2411 RTE_ETH_FOREACH_DEV(i) {
2412 if (! ((uint64_t)(1ULL << i) & portmask))
2414 portlist[nb_pt++] = i;
2416 set_fwd_ports_list(portlist, nb_pt);
2420 set_fwd_ports_number(uint16_t nb_pt)
2422 if (nb_pt > nb_cfg_ports) {
2423 printf("nb fwd ports %u > %u (number of configured "
2424 "ports) - ignored\n",
2425 (unsigned int) nb_pt, (unsigned int) nb_cfg_ports);
2428 nb_fwd_ports = (portid_t) nb_pt;
2429 printf("Number of forwarding ports set to %u\n",
2430 (unsigned int) nb_fwd_ports);
2434 port_is_forwarding(portid_t port_id)
2438 if (port_id_is_invalid(port_id, ENABLED_WARN))
2441 for (i = 0; i < nb_fwd_ports; i++) {
2442 if (fwd_ports_ids[i] == port_id)
2450 set_nb_pkt_per_burst(uint16_t nb)
2452 if (nb > MAX_PKT_BURST) {
2453 printf("nb pkt per burst: %u > %u (maximum packet per burst) "
2455 (unsigned int) nb, (unsigned int) MAX_PKT_BURST);
2458 nb_pkt_per_burst = nb;
2459 printf("Number of packets per burst set to %u\n",
2460 (unsigned int) nb_pkt_per_burst);
2464 tx_split_get_name(enum tx_pkt_split split)
2468 for (i = 0; i != RTE_DIM(tx_split_name); i++) {
2469 if (tx_split_name[i].split == split)
2470 return tx_split_name[i].name;
2476 set_tx_pkt_split(const char *name)
2480 for (i = 0; i != RTE_DIM(tx_split_name); i++) {
2481 if (strcmp(tx_split_name[i].name, name) == 0) {
2482 tx_pkt_split = tx_split_name[i].split;
2486 printf("unknown value: \"%s\"\n", name);
2490 show_tx_pkt_segments(void)
2496 split = tx_split_get_name(tx_pkt_split);
2498 printf("Number of segments: %u\n", n);
2499 printf("Segment sizes: ");
2500 for (i = 0; i != n - 1; i++)
2501 printf("%hu,", tx_pkt_seg_lengths[i]);
2502 printf("%hu\n", tx_pkt_seg_lengths[i]);
2503 printf("Split packet: %s\n", split);
2507 set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs)
2509 uint16_t tx_pkt_len;
2512 if (nb_segs >= (unsigned) nb_txd) {
2513 printf("nb segments per TX packets=%u >= nb_txd=%u - ignored\n",
2514 nb_segs, (unsigned int) nb_txd);
2519 * Check that each segment length is greater or equal than
2520 * the mbuf data sise.
2521 * Check also that the total packet length is greater or equal than the
2522 * size of an empty UDP/IP packet (sizeof(struct rte_ether_hdr) +
2526 for (i = 0; i < nb_segs; i++) {
2527 if (seg_lengths[i] > (unsigned) mbuf_data_size) {
2528 printf("length[%u]=%u > mbuf_data_size=%u - give up\n",
2529 i, seg_lengths[i], (unsigned) mbuf_data_size);
2532 tx_pkt_len = (uint16_t)(tx_pkt_len + seg_lengths[i]);
2534 if (tx_pkt_len < (sizeof(struct rte_ether_hdr) + 20 + 8)) {
2535 printf("total packet length=%u < %d - give up\n",
2536 (unsigned) tx_pkt_len,
2537 (int)(sizeof(struct rte_ether_hdr) + 20 + 8));
2541 for (i = 0; i < nb_segs; i++)
2542 tx_pkt_seg_lengths[i] = (uint16_t) seg_lengths[i];
2544 tx_pkt_length = tx_pkt_len;
2545 tx_pkt_nb_segs = (uint8_t) nb_segs;
2549 setup_gro(const char *onoff, portid_t port_id)
2551 if (!rte_eth_dev_is_valid_port(port_id)) {
2552 printf("invalid port id %u\n", port_id);
2555 if (test_done == 0) {
2556 printf("Before enable/disable GRO,"
2557 " please stop forwarding first\n");
2560 if (strcmp(onoff, "on") == 0) {
2561 if (gro_ports[port_id].enable != 0) {
2562 printf("Port %u has enabled GRO. Please"
2563 " disable GRO first\n", port_id);
2566 if (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) {
2567 gro_ports[port_id].param.gro_types = RTE_GRO_TCP_IPV4;
2568 gro_ports[port_id].param.max_flow_num =
2569 GRO_DEFAULT_FLOW_NUM;
2570 gro_ports[port_id].param.max_item_per_flow =
2571 GRO_DEFAULT_ITEM_NUM_PER_FLOW;
2573 gro_ports[port_id].enable = 1;
2575 if (gro_ports[port_id].enable == 0) {
2576 printf("Port %u has disabled GRO\n", port_id);
2579 gro_ports[port_id].enable = 0;
2584 setup_gro_flush_cycles(uint8_t cycles)
2586 if (test_done == 0) {
2587 printf("Before change flush interval for GRO,"
2588 " please stop forwarding first.\n");
2592 if (cycles > GRO_MAX_FLUSH_CYCLES || cycles <
2593 GRO_DEFAULT_FLUSH_CYCLES) {
2594 printf("The flushing cycle be in the range"
2595 " of 1 to %u. Revert to the default"
2597 GRO_MAX_FLUSH_CYCLES,
2598 GRO_DEFAULT_FLUSH_CYCLES);
2599 cycles = GRO_DEFAULT_FLUSH_CYCLES;
2602 gro_flush_cycles = cycles;
2606 show_gro(portid_t port_id)
2608 struct rte_gro_param *param;
2609 uint32_t max_pkts_num;
2611 param = &gro_ports[port_id].param;
2613 if (!rte_eth_dev_is_valid_port(port_id)) {
2614 printf("Invalid port id %u.\n", port_id);
2617 if (gro_ports[port_id].enable) {
2618 printf("GRO type: TCP/IPv4\n");
2619 if (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) {
2620 max_pkts_num = param->max_flow_num *
2621 param->max_item_per_flow;
2623 max_pkts_num = MAX_PKT_BURST * GRO_MAX_FLUSH_CYCLES;
2624 printf("Max number of packets to perform GRO: %u\n",
2626 printf("Flushing cycles: %u\n", gro_flush_cycles);
2628 printf("Port %u doesn't enable GRO.\n", port_id);
2632 setup_gso(const char *mode, portid_t port_id)
2634 if (!rte_eth_dev_is_valid_port(port_id)) {
2635 printf("invalid port id %u\n", port_id);
2638 if (strcmp(mode, "on") == 0) {
2639 if (test_done == 0) {
2640 printf("before enabling GSO,"
2641 " please stop forwarding first\n");
2644 gso_ports[port_id].enable = 1;
2645 } else if (strcmp(mode, "off") == 0) {
2646 if (test_done == 0) {
2647 printf("before disabling GSO,"
2648 " please stop forwarding first\n");
2651 gso_ports[port_id].enable = 0;
2656 list_pkt_forwarding_modes(void)
2658 static char fwd_modes[128] = "";
2659 const char *separator = "|";
2660 struct fwd_engine *fwd_eng;
2663 if (strlen (fwd_modes) == 0) {
2664 while ((fwd_eng = fwd_engines[i++]) != NULL) {
2665 strncat(fwd_modes, fwd_eng->fwd_mode_name,
2666 sizeof(fwd_modes) - strlen(fwd_modes) - 1);
2667 strncat(fwd_modes, separator,
2668 sizeof(fwd_modes) - strlen(fwd_modes) - 1);
2670 fwd_modes[strlen(fwd_modes) - strlen(separator)] = '\0';
2677 list_pkt_forwarding_retry_modes(void)
2679 static char fwd_modes[128] = "";
2680 const char *separator = "|";
2681 struct fwd_engine *fwd_eng;
2684 if (strlen(fwd_modes) == 0) {
2685 while ((fwd_eng = fwd_engines[i++]) != NULL) {
2686 if (fwd_eng == &rx_only_engine)
2688 strncat(fwd_modes, fwd_eng->fwd_mode_name,
2690 strlen(fwd_modes) - 1);
2691 strncat(fwd_modes, separator,
2693 strlen(fwd_modes) - 1);
2695 fwd_modes[strlen(fwd_modes) - strlen(separator)] = '\0';
2702 set_pkt_forwarding_mode(const char *fwd_mode_name)
2704 struct fwd_engine *fwd_eng;
2708 while ((fwd_eng = fwd_engines[i]) != NULL) {
2709 if (! strcmp(fwd_eng->fwd_mode_name, fwd_mode_name)) {
2710 printf("Set %s packet forwarding mode%s\n",
2712 retry_enabled == 0 ? "" : " with retry");
2713 cur_fwd_eng = fwd_eng;
2718 printf("Invalid %s packet forwarding mode\n", fwd_mode_name);
2722 add_rx_dump_callbacks(portid_t portid)
2724 struct rte_eth_dev_info dev_info;
2727 if (port_id_is_invalid(portid, ENABLED_WARN))
2730 rte_eth_dev_info_get(portid, &dev_info);
2731 for (queue = 0; queue < dev_info.nb_rx_queues; queue++)
2732 if (!ports[portid].rx_dump_cb[queue])
2733 ports[portid].rx_dump_cb[queue] =
2734 rte_eth_add_rx_callback(portid, queue,
2735 dump_rx_pkts, NULL);
2739 add_tx_dump_callbacks(portid_t portid)
2741 struct rte_eth_dev_info dev_info;
2744 if (port_id_is_invalid(portid, ENABLED_WARN))
2746 rte_eth_dev_info_get(portid, &dev_info);
2747 for (queue = 0; queue < dev_info.nb_tx_queues; queue++)
2748 if (!ports[portid].tx_dump_cb[queue])
2749 ports[portid].tx_dump_cb[queue] =
2750 rte_eth_add_tx_callback(portid, queue,
2751 dump_tx_pkts, NULL);
2755 remove_rx_dump_callbacks(portid_t portid)
2757 struct rte_eth_dev_info dev_info;
2760 if (port_id_is_invalid(portid, ENABLED_WARN))
2762 rte_eth_dev_info_get(portid, &dev_info);
2763 for (queue = 0; queue < dev_info.nb_rx_queues; queue++)
2764 if (ports[portid].rx_dump_cb[queue]) {
2765 rte_eth_remove_rx_callback(portid, queue,
2766 ports[portid].rx_dump_cb[queue]);
2767 ports[portid].rx_dump_cb[queue] = NULL;
2772 remove_tx_dump_callbacks(portid_t portid)
2774 struct rte_eth_dev_info dev_info;
2777 if (port_id_is_invalid(portid, ENABLED_WARN))
2779 rte_eth_dev_info_get(portid, &dev_info);
2780 for (queue = 0; queue < dev_info.nb_tx_queues; queue++)
2781 if (ports[portid].tx_dump_cb[queue]) {
2782 rte_eth_remove_tx_callback(portid, queue,
2783 ports[portid].tx_dump_cb[queue]);
2784 ports[portid].tx_dump_cb[queue] = NULL;
2789 configure_rxtx_dump_callbacks(uint16_t verbose)
2793 #ifndef RTE_ETHDEV_RXTX_CALLBACKS
2794 TESTPMD_LOG(ERR, "setting rxtx callbacks is not enabled\n");
2798 RTE_ETH_FOREACH_DEV(portid)
2800 if (verbose == 1 || verbose > 2)
2801 add_rx_dump_callbacks(portid);
2803 remove_rx_dump_callbacks(portid);
2805 add_tx_dump_callbacks(portid);
2807 remove_tx_dump_callbacks(portid);
2812 set_verbose_level(uint16_t vb_level)
2814 printf("Change verbose level from %u to %u\n",
2815 (unsigned int) verbose_level, (unsigned int) vb_level);
2816 verbose_level = vb_level;
2817 configure_rxtx_dump_callbacks(verbose_level);
2821 vlan_extend_set(portid_t port_id, int on)
2825 uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads;
2827 if (port_id_is_invalid(port_id, ENABLED_WARN))
2830 vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
2833 vlan_offload |= ETH_VLAN_EXTEND_OFFLOAD;
2834 port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
2836 vlan_offload &= ~ETH_VLAN_EXTEND_OFFLOAD;
2837 port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND;
2840 diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
2842 printf("rx_vlan_extend_set(port_pi=%d, on=%d) failed "
2843 "diag=%d\n", port_id, on, diag);
2844 ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
2848 rx_vlan_strip_set(portid_t port_id, int on)
2852 uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads;
2854 if (port_id_is_invalid(port_id, ENABLED_WARN))
2857 vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
2860 vlan_offload |= ETH_VLAN_STRIP_OFFLOAD;
2861 port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
2863 vlan_offload &= ~ETH_VLAN_STRIP_OFFLOAD;
2864 port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
2867 diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
2869 printf("rx_vlan_strip_set(port_pi=%d, on=%d) failed "
2870 "diag=%d\n", port_id, on, diag);
2871 ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
2875 rx_vlan_strip_set_on_queue(portid_t port_id, uint16_t queue_id, int on)
2879 if (port_id_is_invalid(port_id, ENABLED_WARN))
2882 diag = rte_eth_dev_set_vlan_strip_on_queue(port_id, queue_id, on);
2884 printf("rx_vlan_strip_set_on_queue(port_pi=%d, queue_id=%d, on=%d) failed "
2885 "diag=%d\n", port_id, queue_id, on, diag);
2889 rx_vlan_filter_set(portid_t port_id, int on)
2893 uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads;
2895 if (port_id_is_invalid(port_id, ENABLED_WARN))
2898 vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
2901 vlan_offload |= ETH_VLAN_FILTER_OFFLOAD;
2902 port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
2904 vlan_offload &= ~ETH_VLAN_FILTER_OFFLOAD;
2905 port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER;
2908 diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
2910 printf("rx_vlan_filter_set(port_pi=%d, on=%d) failed "
2911 "diag=%d\n", port_id, on, diag);
2912 ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
2916 rx_vft_set(portid_t port_id, uint16_t vlan_id, int on)
2920 if (port_id_is_invalid(port_id, ENABLED_WARN))
2922 if (vlan_id_is_invalid(vlan_id))
2924 diag = rte_eth_dev_vlan_filter(port_id, vlan_id, on);
2927 printf("rte_eth_dev_vlan_filter(port_pi=%d, vlan_id=%d, on=%d) failed "
2929 port_id, vlan_id, on, diag);
2934 rx_vlan_all_filter_set(portid_t port_id, int on)
2938 if (port_id_is_invalid(port_id, ENABLED_WARN))
2940 for (vlan_id = 0; vlan_id < 4096; vlan_id++) {
2941 if (rx_vft_set(port_id, vlan_id, on))
2947 vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type, uint16_t tp_id)
2951 if (port_id_is_invalid(port_id, ENABLED_WARN))
2954 diag = rte_eth_dev_set_vlan_ether_type(port_id, vlan_type, tp_id);
2958 printf("tx_vlan_tpid_set(port_pi=%d, vlan_type=%d, tpid=%d) failed "
2960 port_id, vlan_type, tp_id, diag);
2964 tx_vlan_set(portid_t port_id, uint16_t vlan_id)
2966 struct rte_eth_dev_info dev_info;
2968 if (port_id_is_invalid(port_id, ENABLED_WARN))
2970 if (vlan_id_is_invalid(vlan_id))
2973 if (ports[port_id].dev_conf.txmode.offloads &
2974 DEV_TX_OFFLOAD_QINQ_INSERT) {
2975 printf("Error, as QinQ has been enabled.\n");
2978 rte_eth_dev_info_get(port_id, &dev_info);
2979 if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) {
2980 printf("Error: vlan insert is not supported by port %d\n",
2985 tx_vlan_reset(port_id);
2986 ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT;
2987 ports[port_id].tx_vlan_id = vlan_id;
2991 tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
2993 struct rte_eth_dev_info dev_info;
2995 if (port_id_is_invalid(port_id, ENABLED_WARN))
2997 if (vlan_id_is_invalid(vlan_id))
2999 if (vlan_id_is_invalid(vlan_id_outer))
3002 rte_eth_dev_info_get(port_id, &dev_info);
3003 if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) {
3004 printf("Error: qinq insert not supported by port %d\n",
3009 tx_vlan_reset(port_id);
3010 ports[port_id].dev_conf.txmode.offloads |= (DEV_TX_OFFLOAD_VLAN_INSERT |
3011 DEV_TX_OFFLOAD_QINQ_INSERT);
3012 ports[port_id].tx_vlan_id = vlan_id;
3013 ports[port_id].tx_vlan_id_outer = vlan_id_outer;
3017 tx_vlan_reset(portid_t port_id)
3019 if (port_id_is_invalid(port_id, ENABLED_WARN))
3021 ports[port_id].dev_conf.txmode.offloads &=
3022 ~(DEV_TX_OFFLOAD_VLAN_INSERT |
3023 DEV_TX_OFFLOAD_QINQ_INSERT);
3024 ports[port_id].tx_vlan_id = 0;
3025 ports[port_id].tx_vlan_id_outer = 0;
3029 tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on)
3031 if (port_id_is_invalid(port_id, ENABLED_WARN))
3034 rte_eth_dev_set_vlan_pvid(port_id, vlan_id, on);
3038 set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
3041 uint8_t existing_mapping_found = 0;
3043 if (port_id_is_invalid(port_id, ENABLED_WARN))
3046 if (is_rx ? (rx_queue_id_is_invalid(queue_id)) : (tx_queue_id_is_invalid(queue_id)))
3049 if (map_value >= RTE_ETHDEV_QUEUE_STAT_CNTRS) {
3050 printf("map_value not in required range 0..%d\n",
3051 RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
3055 if (!is_rx) { /*then tx*/
3056 for (i = 0; i < nb_tx_queue_stats_mappings; i++) {
3057 if ((tx_queue_stats_mappings[i].port_id == port_id) &&
3058 (tx_queue_stats_mappings[i].queue_id == queue_id)) {
3059 tx_queue_stats_mappings[i].stats_counter_id = map_value;
3060 existing_mapping_found = 1;
3064 if (!existing_mapping_found) { /* A new additional mapping... */
3065 tx_queue_stats_mappings[nb_tx_queue_stats_mappings].port_id = port_id;
3066 tx_queue_stats_mappings[nb_tx_queue_stats_mappings].queue_id = queue_id;
3067 tx_queue_stats_mappings[nb_tx_queue_stats_mappings].stats_counter_id = map_value;
3068 nb_tx_queue_stats_mappings++;
3072 for (i = 0; i < nb_rx_queue_stats_mappings; i++) {
3073 if ((rx_queue_stats_mappings[i].port_id == port_id) &&
3074 (rx_queue_stats_mappings[i].queue_id == queue_id)) {
3075 rx_queue_stats_mappings[i].stats_counter_id = map_value;
3076 existing_mapping_found = 1;
3080 if (!existing_mapping_found) { /* A new additional mapping... */
3081 rx_queue_stats_mappings[nb_rx_queue_stats_mappings].port_id = port_id;
3082 rx_queue_stats_mappings[nb_rx_queue_stats_mappings].queue_id = queue_id;
3083 rx_queue_stats_mappings[nb_rx_queue_stats_mappings].stats_counter_id = map_value;
3084 nb_rx_queue_stats_mappings++;
3090 set_xstats_hide_zero(uint8_t on_off)
3092 xstats_hide_zero = on_off;
3096 print_fdir_mask(struct rte_eth_fdir_masks *mask)
3098 printf("\n vlan_tci: 0x%04x", rte_be_to_cpu_16(mask->vlan_tci_mask));
3100 if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
3101 printf(", mac_addr: 0x%02x, tunnel_type: 0x%01x,"
3102 " tunnel_id: 0x%08x",
3103 mask->mac_addr_byte_mask, mask->tunnel_type_mask,
3104 rte_be_to_cpu_32(mask->tunnel_id_mask));
3105 else if (fdir_conf.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
3106 printf(", src_ipv4: 0x%08x, dst_ipv4: 0x%08x",
3107 rte_be_to_cpu_32(mask->ipv4_mask.src_ip),
3108 rte_be_to_cpu_32(mask->ipv4_mask.dst_ip));
3110 printf("\n src_port: 0x%04x, dst_port: 0x%04x",
3111 rte_be_to_cpu_16(mask->src_port_mask),
3112 rte_be_to_cpu_16(mask->dst_port_mask));
3114 printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
3115 rte_be_to_cpu_32(mask->ipv6_mask.src_ip[0]),
3116 rte_be_to_cpu_32(mask->ipv6_mask.src_ip[1]),
3117 rte_be_to_cpu_32(mask->ipv6_mask.src_ip[2]),
3118 rte_be_to_cpu_32(mask->ipv6_mask.src_ip[3]));
3120 printf("\n dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
3121 rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[0]),
3122 rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[1]),
3123 rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[2]),
3124 rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[3]));
3131 print_fdir_flex_payload(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
3133 struct rte_eth_flex_payload_cfg *cfg;
3136 for (i = 0; i < flex_conf->nb_payloads; i++) {
3137 cfg = &flex_conf->flex_set[i];
3138 if (cfg->type == RTE_ETH_RAW_PAYLOAD)
3140 else if (cfg->type == RTE_ETH_L2_PAYLOAD)
3141 printf("\n L2_PAYLOAD: ");
3142 else if (cfg->type == RTE_ETH_L3_PAYLOAD)
3143 printf("\n L3_PAYLOAD: ");
3144 else if (cfg->type == RTE_ETH_L4_PAYLOAD)
3145 printf("\n L4_PAYLOAD: ");
3147 printf("\n UNKNOWN PAYLOAD(%u): ", cfg->type);
3148 for (j = 0; j < num; j++)
3149 printf(" %-5u", cfg->src_offset[j]);
3155 flowtype_to_str(uint16_t flow_type)
3157 struct flow_type_info {
3163 static struct flow_type_info flowtype_str_table[] = {
3164 {"raw", RTE_ETH_FLOW_RAW},
3165 {"ipv4", RTE_ETH_FLOW_IPV4},
3166 {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
3167 {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
3168 {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
3169 {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
3170 {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
3171 {"ipv6", RTE_ETH_FLOW_IPV6},
3172 {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
3173 {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
3174 {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
3175 {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
3176 {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
3177 {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
3178 {"port", RTE_ETH_FLOW_PORT},
3179 {"vxlan", RTE_ETH_FLOW_VXLAN},
3180 {"geneve", RTE_ETH_FLOW_GENEVE},
3181 {"nvgre", RTE_ETH_FLOW_NVGRE},
3182 {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
3185 for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
3186 if (flowtype_str_table[i].ftype == flow_type)
3187 return flowtype_str_table[i].str;
3194 print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
3196 struct rte_eth_fdir_flex_mask *mask;
3200 for (i = 0; i < flex_conf->nb_flexmasks; i++) {
3201 mask = &flex_conf->flex_mask[i];
3202 p = flowtype_to_str(mask->flow_type);
3203 printf("\n %s:\t", p ? p : "unknown");
3204 for (j = 0; j < num; j++)
3205 printf(" %02x", mask->mask[j]);
3211 print_fdir_flow_type(uint32_t flow_types_mask)
3216 for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
3217 if (!(flow_types_mask & (1 << i)))
3219 p = flowtype_to_str(i);
3229 fdir_get_infos(portid_t port_id)
3231 struct rte_eth_fdir_stats fdir_stat;
3232 struct rte_eth_fdir_info fdir_info;
3235 static const char *fdir_stats_border = "########################";
3237 if (port_id_is_invalid(port_id, ENABLED_WARN))
3239 ret = rte_eth_dev_filter_supported(port_id, RTE_ETH_FILTER_FDIR);
3241 printf("\n FDIR is not supported on port %-2d\n",
3246 memset(&fdir_info, 0, sizeof(fdir_info));
3247 rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,
3248 RTE_ETH_FILTER_INFO, &fdir_info);
3249 memset(&fdir_stat, 0, sizeof(fdir_stat));
3250 rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,
3251 RTE_ETH_FILTER_STATS, &fdir_stat);
3252 printf("\n %s FDIR infos for port %-2d %s\n",
3253 fdir_stats_border, port_id, fdir_stats_border);
3255 if (fdir_info.mode == RTE_FDIR_MODE_PERFECT)
3256 printf(" PERFECT\n");
3257 else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
3258 printf(" PERFECT-MAC-VLAN\n");
3259 else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
3260 printf(" PERFECT-TUNNEL\n");
3261 else if (fdir_info.mode == RTE_FDIR_MODE_SIGNATURE)
3262 printf(" SIGNATURE\n");
3264 printf(" DISABLE\n");
3265 if (fdir_info.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN
3266 && fdir_info.mode != RTE_FDIR_MODE_PERFECT_TUNNEL) {
3267 printf(" SUPPORTED FLOW TYPE: ");
3268 print_fdir_flow_type(fdir_info.flow_types_mask[0]);
3270 printf(" FLEX PAYLOAD INFO:\n");
3271 printf(" max_len: %-10"PRIu32" payload_limit: %-10"PRIu32"\n"
3272 " payload_unit: %-10"PRIu32" payload_seg: %-10"PRIu32"\n"
3273 " bitmask_unit: %-10"PRIu32" bitmask_num: %-10"PRIu32"\n",
3274 fdir_info.max_flexpayload, fdir_info.flex_payload_limit,
3275 fdir_info.flex_payload_unit,
3276 fdir_info.max_flex_payload_segment_num,
3277 fdir_info.flex_bitmask_unit, fdir_info.max_flex_bitmask_num);
3279 print_fdir_mask(&fdir_info.mask);
3280 if (fdir_info.flex_conf.nb_payloads > 0) {
3281 printf(" FLEX PAYLOAD SRC OFFSET:");
3282 print_fdir_flex_payload(&fdir_info.flex_conf, fdir_info.max_flexpayload);
3284 if (fdir_info.flex_conf.nb_flexmasks > 0) {
3285 printf(" FLEX MASK CFG:");
3286 print_fdir_flex_mask(&fdir_info.flex_conf, fdir_info.max_flexpayload);
3288 printf(" guarant_count: %-10"PRIu32" best_count: %"PRIu32"\n",
3289 fdir_stat.guarant_cnt, fdir_stat.best_cnt);
3290 printf(" guarant_space: %-10"PRIu32" best_space: %"PRIu32"\n",
3291 fdir_info.guarant_spc, fdir_info.best_spc);
3292 printf(" collision: %-10"PRIu32" free: %"PRIu32"\n"
3293 " maxhash: %-10"PRIu32" maxlen: %"PRIu32"\n"
3294 " add: %-10"PRIu64" remove: %"PRIu64"\n"
3295 " f_add: %-10"PRIu64" f_remove: %"PRIu64"\n",
3296 fdir_stat.collision, fdir_stat.free,
3297 fdir_stat.maxhash, fdir_stat.maxlen,
3298 fdir_stat.add, fdir_stat.remove,
3299 fdir_stat.f_add, fdir_stat.f_remove);
3300 printf(" %s############################%s\n",
3301 fdir_stats_border, fdir_stats_border);
3305 fdir_set_flex_mask(portid_t port_id, struct rte_eth_fdir_flex_mask *cfg)
3307 struct rte_port *port;
3308 struct rte_eth_fdir_flex_conf *flex_conf;
3311 port = &ports[port_id];
3312 flex_conf = &port->dev_conf.fdir_conf.flex_conf;
3313 for (i = 0; i < RTE_ETH_FLOW_MAX; i++) {
3314 if (cfg->flow_type == flex_conf->flex_mask[i].flow_type) {
3319 if (i >= RTE_ETH_FLOW_MAX) {
3320 if (flex_conf->nb_flexmasks < RTE_DIM(flex_conf->flex_mask)) {
3321 idx = flex_conf->nb_flexmasks;
3322 flex_conf->nb_flexmasks++;
3324 printf("The flex mask table is full. Can not set flex"
3325 " mask for flow_type(%u).", cfg->flow_type);
3329 rte_memcpy(&flex_conf->flex_mask[idx],
3331 sizeof(struct rte_eth_fdir_flex_mask));
3335 fdir_set_flex_payload(portid_t port_id, struct rte_eth_flex_payload_cfg *cfg)
3337 struct rte_port *port;
3338 struct rte_eth_fdir_flex_conf *flex_conf;
3341 port = &ports[port_id];
3342 flex_conf = &port->dev_conf.fdir_conf.flex_conf;
3343 for (i = 0; i < RTE_ETH_PAYLOAD_MAX; i++) {
3344 if (cfg->type == flex_conf->flex_set[i].type) {
3349 if (i >= RTE_ETH_PAYLOAD_MAX) {
3350 if (flex_conf->nb_payloads < RTE_DIM(flex_conf->flex_set)) {
3351 idx = flex_conf->nb_payloads;
3352 flex_conf->nb_payloads++;
3354 printf("The flex payload table is full. Can not set"
3355 " flex payload for type(%u).", cfg->type);
3359 rte_memcpy(&flex_conf->flex_set[idx],
3361 sizeof(struct rte_eth_flex_payload_cfg));
3366 set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
3368 #ifdef RTE_LIBRTE_IXGBE_PMD
3372 diag = rte_pmd_ixgbe_set_vf_rx(port_id, vf, on);
3374 diag = rte_pmd_ixgbe_set_vf_tx(port_id, vf, on);
3378 printf("rte_pmd_ixgbe_set_vf_%s for port_id=%d failed diag=%d\n",
3379 is_rx ? "rx" : "tx", port_id, diag);
3382 printf("VF %s setting not supported for port %d\n",
3383 is_rx ? "Rx" : "Tx", port_id);
3389 set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
3392 struct rte_eth_link link;
3394 if (port_id_is_invalid(port_id, ENABLED_WARN))
3396 rte_eth_link_get_nowait(port_id, &link);
3397 if (rate > link.link_speed) {
3398 printf("Invalid rate value:%u bigger than link speed: %u\n",
3399 rate, link.link_speed);
3402 diag = rte_eth_set_queue_rate_limit(port_id, queue_idx, rate);
3405 printf("rte_eth_set_queue_rate_limit for port_id=%d failed diag=%d\n",
3411 set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
3413 int diag = -ENOTSUP;
3417 RTE_SET_USED(q_msk);
3419 #ifdef RTE_LIBRTE_IXGBE_PMD
3420 if (diag == -ENOTSUP)
3421 diag = rte_pmd_ixgbe_set_vf_rate_limit(port_id, vf, rate,
3424 #ifdef RTE_LIBRTE_BNXT_PMD
3425 if (diag == -ENOTSUP)
3426 diag = rte_pmd_bnxt_set_vf_rate_limit(port_id, vf, rate, q_msk);
3431 printf("set_vf_rate_limit for port_id=%d failed diag=%d\n",
3437 * Functions to manage the set of filtered Multicast MAC addresses.
3439 * A pool of filtered multicast MAC addresses is associated with each port.
3440 * The pool is allocated in chunks of MCAST_POOL_INC multicast addresses.
3441 * The address of the pool and the number of valid multicast MAC addresses
3442 * recorded in the pool are stored in the fields "mc_addr_pool" and
3443 * "mc_addr_nb" of the "rte_port" data structure.
3445 * The function "rte_eth_dev_set_mc_addr_list" of the PMDs API imposes
3446 * to be supplied a contiguous array of multicast MAC addresses.
3447 * To comply with this constraint, the set of multicast addresses recorded
3448 * into the pool are systematically compacted at the beginning of the pool.
3449 * Hence, when a multicast address is removed from the pool, all following
3450 * addresses, if any, are copied back to keep the set contiguous.
3452 #define MCAST_POOL_INC 32
3455 mcast_addr_pool_extend(struct rte_port *port)
3457 struct rte_ether_addr *mc_pool;
3458 size_t mc_pool_size;
3461 * If a free entry is available at the end of the pool, just
3462 * increment the number of recorded multicast addresses.
3464 if ((port->mc_addr_nb % MCAST_POOL_INC) != 0) {
3470 * [re]allocate a pool with MCAST_POOL_INC more entries.
3471 * The previous test guarantees that port->mc_addr_nb is a multiple
3472 * of MCAST_POOL_INC.
3474 mc_pool_size = sizeof(struct rte_ether_addr) * (port->mc_addr_nb +
3476 mc_pool = (struct rte_ether_addr *) realloc(port->mc_addr_pool,
3478 if (mc_pool == NULL) {
3479 printf("allocation of pool of %u multicast addresses failed\n",
3480 port->mc_addr_nb + MCAST_POOL_INC);
3484 port->mc_addr_pool = mc_pool;
3491 mcast_addr_pool_remove(struct rte_port *port, uint32_t addr_idx)
3494 if (addr_idx == port->mc_addr_nb) {
3495 /* No need to recompact the set of multicast addressses. */
3496 if (port->mc_addr_nb == 0) {
3497 /* free the pool of multicast addresses. */
3498 free(port->mc_addr_pool);
3499 port->mc_addr_pool = NULL;
3503 memmove(&port->mc_addr_pool[addr_idx],
3504 &port->mc_addr_pool[addr_idx + 1],
3505 sizeof(struct rte_ether_addr) * (port->mc_addr_nb - addr_idx));
3509 eth_port_multicast_addr_list_set(portid_t port_id)
3511 struct rte_port *port;
3514 port = &ports[port_id];
3515 diag = rte_eth_dev_set_mc_addr_list(port_id, port->mc_addr_pool,
3519 printf("rte_eth_dev_set_mc_addr_list(port=%d, nb=%u) failed. diag=%d\n",
3520 port->mc_addr_nb, port_id, -diag);
3524 mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr)
3526 struct rte_port *port;
3529 if (port_id_is_invalid(port_id, ENABLED_WARN))
3532 port = &ports[port_id];
3535 * Check that the added multicast MAC address is not already recorded
3536 * in the pool of multicast addresses.
3538 for (i = 0; i < port->mc_addr_nb; i++) {
3539 if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) {
3540 printf("multicast address already filtered by port\n");
3545 if (mcast_addr_pool_extend(port) != 0)
3547 rte_ether_addr_copy(mc_addr, &port->mc_addr_pool[i]);
3548 eth_port_multicast_addr_list_set(port_id);
3552 mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr)
3554 struct rte_port *port;
3557 if (port_id_is_invalid(port_id, ENABLED_WARN))
3560 port = &ports[port_id];
3563 * Search the pool of multicast MAC addresses for the removed address.
3565 for (i = 0; i < port->mc_addr_nb; i++) {
3566 if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i]))
3569 if (i == port->mc_addr_nb) {
3570 printf("multicast address not filtered by port %d\n", port_id);
3574 mcast_addr_pool_remove(port, i);
3575 eth_port_multicast_addr_list_set(port_id);
3579 port_dcb_info_display(portid_t port_id)
3581 struct rte_eth_dcb_info dcb_info;
3584 static const char *border = "================";
3586 if (port_id_is_invalid(port_id, ENABLED_WARN))
3589 ret = rte_eth_dev_get_dcb_info(port_id, &dcb_info);
3591 printf("\n Failed to get dcb infos on port %-2d\n",
3595 printf("\n %s DCB infos for port %-2d %s\n", border, port_id, border);
3596 printf(" TC NUMBER: %d\n", dcb_info.nb_tcs);
3598 for (i = 0; i < dcb_info.nb_tcs; i++)
3600 printf("\n Priority : ");
3601 for (i = 0; i < dcb_info.nb_tcs; i++)
3602 printf("\t%4d", dcb_info.prio_tc[i]);
3603 printf("\n BW percent :");
3604 for (i = 0; i < dcb_info.nb_tcs; i++)
3605 printf("\t%4d%%", dcb_info.tc_bws[i]);
3606 printf("\n RXQ base : ");
3607 for (i = 0; i < dcb_info.nb_tcs; i++)
3608 printf("\t%4d", dcb_info.tc_queue.tc_rxq[0][i].base);
3609 printf("\n RXQ number :");
3610 for (i = 0; i < dcb_info.nb_tcs; i++)
3611 printf("\t%4d", dcb_info.tc_queue.tc_rxq[0][i].nb_queue);
3612 printf("\n TXQ base : ");
3613 for (i = 0; i < dcb_info.nb_tcs; i++)
3614 printf("\t%4d", dcb_info.tc_queue.tc_txq[0][i].base);
3615 printf("\n TXQ number :");
3616 for (i = 0; i < dcb_info.nb_tcs; i++)
3617 printf("\t%4d", dcb_info.tc_queue.tc_txq[0][i].nb_queue);
3622 open_file(const char *file_path, uint32_t *size)
3624 int fd = open(file_path, O_RDONLY);
3626 uint8_t *buf = NULL;
3634 printf("%s: Failed to open %s\n", __func__, file_path);
3638 if ((fstat(fd, &st_buf) != 0) || (!S_ISREG(st_buf.st_mode))) {
3640 printf("%s: File operations failed\n", __func__);
3644 pkg_size = st_buf.st_size;
3647 printf("%s: File operations failed\n", __func__);
3651 buf = (uint8_t *)malloc(pkg_size);
3654 printf("%s: Failed to malloc memory\n", __func__);
3658 ret = read(fd, buf, pkg_size);
3661 printf("%s: File read operation failed\n", __func__);
3675 save_file(const char *file_path, uint8_t *buf, uint32_t size)
3677 FILE *fh = fopen(file_path, "wb");
3680 printf("%s: Failed to open %s\n", __func__, file_path);
3684 if (fwrite(buf, 1, size, fh) != size) {
3686 printf("%s: File write operation failed\n", __func__);
3696 close_file(uint8_t *buf)
3707 port_queue_region_info_display(portid_t port_id, void *buf)
3709 #ifdef RTE_LIBRTE_I40E_PMD
3711 struct rte_pmd_i40e_queue_regions *info =
3712 (struct rte_pmd_i40e_queue_regions *)buf;
3713 static const char *queue_region_info_stats_border = "-------";
3715 if (!info->queue_region_number)
3716 printf("there is no region has been set before");
3718 printf("\n %s All queue region info for port=%2d %s",
3719 queue_region_info_stats_border, port_id,
3720 queue_region_info_stats_border);
3721 printf("\n queue_region_number: %-14u \n",
3722 info->queue_region_number);
3724 for (i = 0; i < info->queue_region_number; i++) {
3725 printf("\n region_id: %-14u queue_number: %-14u "
3726 "queue_start_index: %-14u \n",
3727 info->region[i].region_id,
3728 info->region[i].queue_num,
3729 info->region[i].queue_start_index);
3731 printf(" user_priority_num is %-14u :",
3732 info->region[i].user_priority_num);
3733 for (j = 0; j < info->region[i].user_priority_num; j++)
3734 printf(" %-14u ", info->region[i].user_priority[j]);
3736 printf("\n flowtype_num is %-14u :",
3737 info->region[i].flowtype_num);
3738 for (j = 0; j < info->region[i].flowtype_num; j++)
3739 printf(" %-14u ", info->region[i].hw_flowtype[j]);
3742 RTE_SET_USED(port_id);