1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2017 Intel Corporation
12 #include <sys/queue.h>
19 #include <rte_common.h>
20 #include <rte_debug.h>
21 #include <rte_ethdev.h>
22 #include <rte_malloc.h>
23 #include <rte_memory.h>
24 #include <rte_memzone.h>
25 #include <rte_launch.h>
26 #include <rte_tailq.h>
27 #include <rte_per_lcore.h>
28 #include <rte_lcore.h>
30 #include <rte_branch_prediction.h>
31 #include <rte_string_fns.h>
32 #ifdef RTE_LIB_METRICS
33 #include <rte_metrics.h>
35 #include <rte_cycles.h>
36 #ifdef RTE_LIB_SECURITY
37 #include <rte_security.h>
39 #include <rte_cryptodev.h>
41 #include <rte_hexdump.h>
43 /* Maximum long option length for option parsing. */
44 #define MAX_LONG_OPT_SZ 64
45 #define MAX_STRING_LEN 256
47 #define STATS_BDR_FMT "========================================"
48 #define STATS_BDR_STR(w, s) printf("%.*s%s%.*s\n", w, \
49 STATS_BDR_FMT, s, w, STATS_BDR_FMT)
51 /**< mask of enabled ports */
52 static unsigned long enabled_port_mask;
54 static uint32_t enable_stats;
55 /**< Enable xstats. */
56 static uint32_t enable_xstats;
57 /**< Enable collectd format*/
58 static uint32_t enable_collectd_format;
59 /**< FD to send collectd format messages to STDOUT*/
61 /**< Host id process is running on */
62 static char host_id[MAX_LONG_OPT_SZ];
63 #ifdef RTE_LIB_METRICS
64 /**< Enable metrics. */
65 static uint32_t enable_metrics;
67 /**< Enable stats reset. */
68 static uint32_t reset_stats;
69 /**< Enable xstats reset. */
70 static uint32_t reset_xstats;
71 /**< Enable memory info. */
72 static uint32_t mem_info;
73 /**< Enable displaying xstat name. */
74 static uint32_t enable_xstats_name;
75 static char *xstats_name;
77 /**< Enable xstats by ids. */
78 #define MAX_NB_XSTATS_IDS 1024
79 static uint32_t nb_xstats_ids;
80 static uint64_t xstats_ids[MAX_NB_XSTATS_IDS];
83 static char bdr_str[MAX_STRING_LEN];
85 /**< Enable show port. */
86 static uint32_t enable_shw_port;
87 /**< Enable show tm. */
88 static uint32_t enable_shw_tm;
89 /**< Enable show crypto. */
90 static uint32_t enable_shw_crypto;
91 /**< Enable show ring. */
92 static uint32_t enable_shw_ring;
93 static char *ring_name;
94 /**< Enable show mempool. */
95 static uint32_t enable_shw_mempool;
96 static char *mempool_name;
97 /**< Enable iter mempool. */
98 static uint32_t enable_iter_mempool;
99 static char *mempool_iter_name;
100 /**< Enable dump regs. */
101 static uint32_t enable_dump_regs;
102 static char *dump_regs_file_prefix;
104 /**< display usage */
106 proc_info_usage(const char *prgname)
108 printf("%s [EAL options] -- -p PORTMASK\n"
109 " -m to display DPDK memory zones, segments and TAILQ information\n"
110 " -p PORTMASK: hexadecimal bitmask of ports to retrieve stats for\n"
111 " --stats: to display port statistics, enabled by default\n"
112 " --xstats: to display extended port statistics, disabled by "
114 #ifdef RTE_LIB_METRICS
115 " --metrics: to display derived metrics of the ports, disabled by "
118 " --xstats-name NAME: to display single xstat id by NAME\n"
119 " --xstats-ids IDLIST: to display xstat values by id. "
120 "The argument is comma-separated list of xstat ids to print out.\n"
121 " --stats-reset: to reset port statistics\n"
122 " --xstats-reset: to reset port extended statistics\n"
123 " --collectd-format: to print statistics to STDOUT in expected by collectd format\n"
124 " --host-id STRING: host id used to identify the system process is running on\n"
125 " --show-port: to display ports information\n"
126 " --show-tm: to display traffic manager information for ports\n"
127 " --show-crypto: to display crypto information\n"
128 " --show-ring[=name]: to display ring information\n"
129 " --show-mempool[=name]: to display mempool information\n"
130 " --iter-mempool=name: iterate mempool elements to display content\n"
131 " --dump-regs=file-prefix: dump registers to file with the file-prefix\n",
136 * Parse the portmask provided at run time.
139 parse_portmask(const char *portmask)
145 /* parse hexadecimal string */
146 enabled_port_mask = strtoul(portmask, &end, 16);
147 if (portmask[0] == '\0' || end == NULL || *end != '\0' || errno != 0) {
148 fprintf(stderr, "Invalid portmask '%s'\n", portmask);
156 * Parse ids value list into array
159 parse_xstats_ids(char *list, uint64_t *ids, int limit) {
166 token = strtok_r(list, ",", &ctx);
167 while (token != NULL) {
168 ids[length] = strtoull(token, &endptr, 10);
176 token = strtok_r(NULL, ",", &ctx);
183 proc_info_preparse_args(int argc, char **argv)
185 char *prgname = argv[0];
188 for (i = 0; i < argc; i++) {
189 /* Print stats or xstats to STDOUT in collectd format */
190 if (!strncmp(argv[i], "--collectd-format", MAX_LONG_OPT_SZ)) {
191 enable_collectd_format = 1;
192 stdout_fd = dup(STDOUT_FILENO);
193 close(STDOUT_FILENO);
195 if (!strncmp(argv[i], "--host-id", MAX_LONG_OPT_SZ)) {
196 if ((i + 1) == argc) {
197 printf("Invalid host id or not specified\n");
198 proc_info_usage(prgname);
201 strlcpy(host_id, argv[i + 1], sizeof(host_id));
205 if (!strlen(host_id)) {
206 int err = gethostname(host_id, MAX_LONG_OPT_SZ-1);
209 strlcpy(host_id, "unknown", sizeof(host_id));
215 /* Parse the argument given in the command line of the application */
217 proc_info_parse_args(int argc, char **argv)
221 char *prgname = argv[0];
222 static struct option long_option[] = {
223 {"stats", 0, NULL, 0},
224 {"stats-reset", 0, NULL, 0},
225 {"xstats", 0, NULL, 0},
226 #ifdef RTE_LIB_METRICS
227 {"metrics", 0, NULL, 0},
229 {"xstats-reset", 0, NULL, 0},
230 {"xstats-name", required_argument, NULL, 1},
231 {"collectd-format", 0, NULL, 0},
232 {"xstats-ids", 1, NULL, 1},
233 {"host-id", 0, NULL, 0},
234 {"show-port", 0, NULL, 0},
235 {"show-tm", 0, NULL, 0},
236 {"show-crypto", 0, NULL, 0},
237 {"show-ring", optional_argument, NULL, 0},
238 {"show-mempool", optional_argument, NULL, 0},
239 {"iter-mempool", required_argument, NULL, 0},
240 {"dump-regs", required_argument, NULL, 0},
245 proc_info_usage(prgname);
247 /* Parse command line */
248 while ((opt = getopt_long(argc, argv, "p:m",
249 long_option, &option_index)) != EOF) {
253 if (parse_portmask(optarg) < 0) {
254 proc_info_usage(prgname);
263 if (!strncmp(long_option[option_index].name, "stats",
267 else if (!strncmp(long_option[option_index].name, "xstats",
270 #ifdef RTE_LIB_METRICS
271 else if (!strncmp(long_option[option_index].name,
277 if (!strncmp(long_option[option_index].name, "stats-reset",
281 else if (!strncmp(long_option[option_index].name, "xstats-reset",
284 else if (!strncmp(long_option[option_index].name,
285 "show-port", MAX_LONG_OPT_SZ))
287 else if (!strncmp(long_option[option_index].name,
288 "show-tm", MAX_LONG_OPT_SZ))
290 else if (!strncmp(long_option[option_index].name,
291 "show-crypto", MAX_LONG_OPT_SZ))
292 enable_shw_crypto = 1;
293 else if (!strncmp(long_option[option_index].name,
294 "show-ring", MAX_LONG_OPT_SZ)) {
297 } else if (!strncmp(long_option[option_index].name,
298 "show-mempool", MAX_LONG_OPT_SZ)) {
299 enable_shw_mempool = 1;
300 mempool_name = optarg;
301 } else if (!strncmp(long_option[option_index].name,
302 "iter-mempool", MAX_LONG_OPT_SZ)) {
303 enable_iter_mempool = 1;
304 mempool_iter_name = optarg;
305 } else if (!strncmp(long_option[option_index].name,
306 "dump-regs", MAX_LONG_OPT_SZ)) {
307 enable_dump_regs = 1;
308 dump_regs_file_prefix = optarg;
312 /* Print xstat single value given by name*/
313 if (!strncmp(long_option[option_index].name,
314 "xstats-name", MAX_LONG_OPT_SZ)) {
315 enable_xstats_name = 1;
316 xstats_name = optarg;
317 printf("name:%s:%s\n",
318 long_option[option_index].name,
320 } else if (!strncmp(long_option[option_index].name,
323 int ret = parse_xstats_ids(optarg,
324 xstats_ids, MAX_NB_XSTATS_IDS);
326 printf("xstats-id list parse error.\n");
333 proc_info_usage(prgname);
341 meminfo_display(void)
343 printf("----------- MEMORY_SEGMENTS -----------\n");
344 rte_dump_physmem_layout(stdout);
345 printf("--------- END_MEMORY_SEGMENTS ---------\n");
347 printf("------------ MEMORY_ZONES -------------\n");
348 rte_memzone_dump(stdout);
349 printf("---------- END_MEMORY_ZONES -----------\n");
351 printf("------------- TAIL_QUEUES -------------\n");
352 rte_dump_tailq(stdout);
353 printf("---------- END_TAIL_QUEUES ------------\n");
357 nic_stats_display(uint16_t port_id)
359 struct rte_eth_stats stats;
362 static const char *nic_stats_border = "########################";
364 rte_eth_stats_get(port_id, &stats);
365 printf("\n %s NIC statistics for port %-2d %s\n",
366 nic_stats_border, port_id, nic_stats_border);
368 printf(" RX-packets: %-10"PRIu64" RX-errors: %-10"PRIu64
369 " RX-bytes: %-10"PRIu64"\n", stats.ipackets, stats.ierrors,
371 printf(" RX-nombuf: %-10"PRIu64"\n", stats.rx_nombuf);
372 printf(" TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64
373 " TX-bytes: %-10"PRIu64"\n", stats.opackets, stats.oerrors,
377 for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
378 printf(" Stats reg %2d RX-packets: %-10"PRIu64
379 " RX-errors: %-10"PRIu64
380 " RX-bytes: %-10"PRIu64"\n",
381 i, stats.q_ipackets[i], stats.q_errors[i], stats.q_ibytes[i]);
385 for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
386 printf(" Stats reg %2d TX-packets: %-10"PRIu64
387 " TX-bytes: %-10"PRIu64"\n",
388 i, stats.q_opackets[i], stats.q_obytes[i]);
391 printf(" %s############################%s\n",
392 nic_stats_border, nic_stats_border);
396 nic_stats_clear(uint16_t port_id)
398 printf("\n Clearing NIC stats for port %d\n", port_id);
399 rte_eth_stats_reset(port_id);
400 printf("\n NIC statistics for port %d cleared\n", port_id);
403 static void collectd_resolve_cnt_type(char *cnt_type, size_t cnt_type_len,
404 const char *cnt_name) {
405 char *type_end = strrchr(cnt_name, '_');
407 if ((type_end != NULL) &&
408 (strncmp(cnt_name, "rx_", strlen("rx_")) == 0)) {
409 if (strncmp(type_end, "_errors", strlen("_errors")) == 0)
410 strlcpy(cnt_type, "if_rx_errors", cnt_type_len);
411 else if (strncmp(type_end, "_dropped", strlen("_dropped")) == 0)
412 strlcpy(cnt_type, "if_rx_dropped", cnt_type_len);
413 else if (strncmp(type_end, "_bytes", strlen("_bytes")) == 0)
414 strlcpy(cnt_type, "if_rx_octets", cnt_type_len);
415 else if (strncmp(type_end, "_packets", strlen("_packets")) == 0)
416 strlcpy(cnt_type, "if_rx_packets", cnt_type_len);
417 else if (strncmp(type_end, "_placement",
418 strlen("_placement")) == 0)
419 strlcpy(cnt_type, "if_rx_errors", cnt_type_len);
420 else if (strncmp(type_end, "_buff", strlen("_buff")) == 0)
421 strlcpy(cnt_type, "if_rx_errors", cnt_type_len);
423 /* Does not fit obvious type: use a more generic one */
424 strlcpy(cnt_type, "derive", cnt_type_len);
425 } else if ((type_end != NULL) &&
426 (strncmp(cnt_name, "tx_", strlen("tx_"))) == 0) {
427 if (strncmp(type_end, "_errors", strlen("_errors")) == 0)
428 strlcpy(cnt_type, "if_tx_errors", cnt_type_len);
429 else if (strncmp(type_end, "_dropped", strlen("_dropped")) == 0)
430 strlcpy(cnt_type, "if_tx_dropped", cnt_type_len);
431 else if (strncmp(type_end, "_bytes", strlen("_bytes")) == 0)
432 strlcpy(cnt_type, "if_tx_octets", cnt_type_len);
433 else if (strncmp(type_end, "_packets", strlen("_packets")) == 0)
434 strlcpy(cnt_type, "if_tx_packets", cnt_type_len);
436 /* Does not fit obvious type: use a more generic one */
437 strlcpy(cnt_type, "derive", cnt_type_len);
438 } else if ((type_end != NULL) &&
439 (strncmp(cnt_name, "flow_", strlen("flow_"))) == 0) {
440 if (strncmp(type_end, "_filters", strlen("_filters")) == 0)
441 strlcpy(cnt_type, "filter_result", cnt_type_len);
442 else if (strncmp(type_end, "_errors", strlen("_errors")) == 0)
443 strlcpy(cnt_type, "errors", cnt_type_len);
444 } else if ((type_end != NULL) &&
445 (strncmp(cnt_name, "mac_", strlen("mac_"))) == 0) {
446 if (strncmp(type_end, "_errors", strlen("_errors")) == 0)
447 strlcpy(cnt_type, "errors", cnt_type_len);
449 /* Does not fit obvious type, or strrchr error: */
450 /* use a more generic type */
451 strlcpy(cnt_type, "derive", cnt_type_len);
456 nic_xstats_by_name_display(uint16_t port_id, char *name)
460 printf("###### NIC statistics for port %-2d, statistic name '%s':\n",
463 if (rte_eth_xstats_get_id_by_name(port_id, name, &id) == 0)
464 printf("%s: %"PRIu64"\n", name, id);
466 printf("Statistic not found...\n");
471 nic_xstats_by_ids_display(uint16_t port_id, uint64_t *ids, int len)
473 struct rte_eth_xstat_name *xstats_names;
476 static const char *nic_stats_border = "########################";
478 values = malloc(sizeof(*values) * len);
479 if (values == NULL) {
480 printf("Cannot allocate memory for xstats\n");
484 xstats_names = malloc(sizeof(struct rte_eth_xstat_name) * len);
485 if (xstats_names == NULL) {
486 printf("Cannot allocate memory for xstat names\n");
491 if (len != rte_eth_xstats_get_names_by_id(
492 port_id, xstats_names, len, ids)) {
493 printf("Cannot get xstat names\n");
497 printf("###### NIC extended statistics for port %-2d #########\n",
499 printf("%s############################\n", nic_stats_border);
500 ret = rte_eth_xstats_get_by_id(port_id, ids, values, len);
501 if (ret < 0 || ret > len) {
502 printf("Cannot get xstats\n");
506 for (i = 0; i < len; i++)
507 printf("%s: %"PRIu64"\n",
508 xstats_names[i].name,
511 printf("%s############################\n", nic_stats_border);
518 nic_xstats_display(uint16_t port_id)
520 struct rte_eth_xstat_name *xstats_names;
523 static const char *nic_stats_border = "########################";
525 len = rte_eth_xstats_get_names_by_id(port_id, NULL, 0, NULL);
527 printf("Cannot get xstats count\n");
530 values = malloc(sizeof(*values) * len);
531 if (values == NULL) {
532 printf("Cannot allocate memory for xstats\n");
536 xstats_names = malloc(sizeof(struct rte_eth_xstat_name) * len);
537 if (xstats_names == NULL) {
538 printf("Cannot allocate memory for xstat names\n");
542 if (len != rte_eth_xstats_get_names_by_id(
543 port_id, xstats_names, len, NULL)) {
544 printf("Cannot get xstat names\n");
548 printf("###### NIC extended statistics for port %-2d #########\n",
550 printf("%s############################\n",
552 ret = rte_eth_xstats_get_by_id(port_id, NULL, values, len);
553 if (ret < 0 || ret > len) {
554 printf("Cannot get xstats\n");
558 for (i = 0; i < len; i++) {
559 if (enable_collectd_format) {
560 char counter_type[MAX_STRING_LEN];
561 char buf[MAX_STRING_LEN];
564 collectd_resolve_cnt_type(counter_type,
565 sizeof(counter_type),
566 xstats_names[i].name);
567 n = snprintf(buf, MAX_STRING_LEN,
568 "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%"
569 PRIu64"\n", host_id, port_id, counter_type,
570 xstats_names[i].name, values[i]);
571 if (n > sizeof(buf) - 1)
573 ret = write(stdout_fd, buf, n);
577 printf("%s: %"PRIu64"\n", xstats_names[i].name,
582 printf("%s############################\n",
590 nic_xstats_clear(uint16_t port_id)
594 printf("\n Clearing NIC xstats for port %d\n", port_id);
595 ret = rte_eth_xstats_reset(port_id);
597 printf("\n Error clearing xstats for port %d: %s\n", port_id,
602 printf("\n NIC extended statistics for port %d cleared\n", port_id);
605 #ifdef RTE_LIB_METRICS
607 metrics_display(int port_id)
609 struct rte_metric_value *metrics;
610 struct rte_metric_name *names;
612 static const char *nic_stats_border = "########################";
614 len = rte_metrics_get_names(NULL, 0);
616 printf("Cannot get metrics count\n");
620 printf("No metrics to display (none have been registered)\n");
624 metrics = rte_malloc("proc_info_metrics",
625 sizeof(struct rte_metric_value) * len, 0);
626 if (metrics == NULL) {
627 printf("Cannot allocate memory for metrics\n");
631 names = rte_malloc(NULL, sizeof(struct rte_metric_name) * len, 0);
633 printf("Cannot allocate memory for metrics names\n");
638 if (len != rte_metrics_get_names(names, len)) {
639 printf("Cannot get metrics names\n");
645 if (port_id == RTE_METRICS_GLOBAL)
646 printf("###### Non port specific metrics #########\n");
648 printf("###### metrics for port %-2d #########\n", port_id);
649 printf("%s############################\n", nic_stats_border);
650 ret = rte_metrics_get_values(port_id, metrics, len);
651 if (ret < 0 || ret > len) {
652 printf("Cannot get metrics values\n");
659 for (i = 0; i < len; i++)
660 printf("%s: %"PRIu64"\n", names[i].name, metrics[i].value);
662 printf("%s############################\n", nic_stats_border);
669 show_security_context(uint16_t portid, bool inline_offload)
672 const struct rte_security_capability *s_cap;
675 p_ctx = rte_eth_dev_get_sec_ctx(portid);
677 p_ctx = rte_cryptodev_get_sec_ctx(portid);
682 printf(" - crypto context\n");
683 printf("\t -- security context - %p\n", p_ctx);
684 printf("\t -- size %u\n",
685 rte_security_session_get_size(p_ctx));
687 s_cap = rte_security_capabilities_get(p_ctx);
689 printf("\t -- action (0x%x), protocol (0x%x),"
690 " offload flags (0x%x)\n",
694 printf("\t -- capabilities - oper type %x\n",
695 s_cap->crypto_capabilities->op);
700 show_offloads(uint64_t offloads,
701 const char *(show_offload)(uint64_t))
703 printf(" offloads :");
704 while (offloads != 0) {
705 uint64_t offload_flag = 1ULL << __builtin_ctzll(offloads);
706 printf(" %s", show_offload(offload_flag));
707 offloads &= ~offload_flag;
716 snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD ");
717 STATS_BDR_STR(10, bdr_str);
719 for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
721 struct rte_eth_link link;
722 struct rte_eth_dev_info dev_info;
723 struct rte_eth_rss_conf rss_conf;
724 char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
725 struct rte_eth_fc_conf fc_conf;
726 struct rte_ether_addr mac;
727 struct rte_eth_dev_owner owner;
729 /* Skip if port is not in mask */
730 if ((enabled_port_mask & (1ul << i)) == 0)
733 /* Skip if port is unused */
734 if (!rte_eth_dev_is_valid_port(i))
737 memset(&rss_conf, 0, sizeof(rss_conf));
739 snprintf(bdr_str, MAX_STRING_LEN, " Port %u ", i);
740 STATS_BDR_STR(5, bdr_str);
741 printf(" - generic config\n");
743 ret = rte_eth_dev_info_get(i, &dev_info);
745 printf("Error during getting device info: %s\n",
750 printf("\t -- driver %s device %s socket %d\n",
751 dev_info.driver_name, dev_info.device->name,
752 rte_eth_dev_socket_id(i));
754 ret = rte_eth_dev_owner_get(i, &owner);
755 if (ret == 0 && owner.id != RTE_ETH_DEV_NO_OWNER)
756 printf("\t -- owner %#"PRIx64":%s\n",
757 owner.id, owner.name);
759 ret = rte_eth_link_get(i, &link);
761 printf("Link get failed (port %u): %s\n",
762 i, rte_strerror(-ret));
764 rte_eth_link_to_str(link_status_text,
765 sizeof(link_status_text),
767 printf("\t%s\n", link_status_text);
770 ret = rte_eth_dev_flow_ctrl_get(i, &fc_conf);
771 if (ret == 0 && fc_conf.mode != RTE_ETH_FC_NONE) {
772 printf("\t -- flow control mode %s%s high %u low %u pause %u%s%s\n",
773 fc_conf.mode == RTE_ETH_FC_RX_PAUSE ? "rx " :
774 fc_conf.mode == RTE_ETH_FC_TX_PAUSE ? "tx " :
775 fc_conf.mode == RTE_ETH_FC_FULL ? "full" : "???",
776 fc_conf.autoneg ? " auto" : "",
780 fc_conf.send_xon ? " xon" : "",
781 fc_conf.mac_ctrl_frame_fwd ? " mac_ctrl" : "");
784 ret = rte_eth_macaddr_get(i, &mac);
786 char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
788 rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
789 printf("\t -- mac %s\n", ebuf);
792 ret = rte_eth_promiscuous_get(i);
794 printf("\t -- promiscuous mode %s\n",
795 ret > 0 ? "enabled" : "disabled");
797 ret = rte_eth_allmulticast_get(i);
799 printf("\t -- all multicast mode %s\n",
800 ret > 0 ? "enabled" : "disabled");
802 ret = rte_eth_dev_get_mtu(i, &mtu);
804 printf("\t -- mtu (%d)\n", mtu);
806 for (j = 0; j < dev_info.nb_rx_queues; j++) {
807 struct rte_eth_rxq_info queue_info;
810 ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
815 printf(" - rx queue\n");
817 printf("\t -- %d descriptors ", j);
818 count = rte_eth_rx_queue_count(i, j);
820 printf("%d/", count);
821 printf("%u", queue_info.nb_desc);
823 if (queue_info.scattered_rx)
824 printf(" scattered");
826 if (queue_info.conf.rx_drop_en)
829 if (queue_info.conf.rx_deferred_start)
830 printf(" deferred_start");
832 if (queue_info.rx_buf_size != 0)
833 printf(" rx buffer size %u",
834 queue_info.rx_buf_size);
836 printf(" mempool %s socket %d",
838 queue_info.mp->socket_id);
840 if (queue_info.conf.offloads != 0)
841 show_offloads(queue_info.conf.offloads, rte_eth_dev_rx_offload_name);
846 for (j = 0; j < dev_info.nb_tx_queues; j++) {
847 struct rte_eth_txq_info queue_info;
849 ret = rte_eth_tx_queue_info_get(i, j, &queue_info);
854 printf(" - tx queue\n");
856 printf("\t -- %d descriptors %d",
857 j, queue_info.nb_desc);
859 printf(" thresh %u/%u",
860 queue_info.conf.tx_rs_thresh,
861 queue_info.conf.tx_free_thresh);
863 if (queue_info.conf.tx_deferred_start)
864 printf(" deferred_start");
866 if (queue_info.conf.offloads != 0)
867 show_offloads(queue_info.conf.offloads, rte_eth_dev_tx_offload_name);
871 ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf);
873 if (rss_conf.rss_key) {
875 printf("\t -- RSS len %u key (hex):",
876 rss_conf.rss_key_len);
877 for (k = 0; k < rss_conf.rss_key_len; k++)
878 printf(" %x", rss_conf.rss_key[k]);
879 printf("\t -- hf 0x%"PRIx64"\n",
884 #ifdef RTE_LIB_SECURITY
885 show_security_context(i, true);
891 display_nodecap_info(int is_leaf, struct rte_tm_node_capabilities *cap)
897 printf("\t -- nonleaf sched max:\n"
898 "\t\t + children (%u)\n"
899 "\t\t + sp priorities (%u)\n"
900 "\t\t + wfq children per group (%u)\n"
901 "\t\t + wfq groups (%u)\n"
902 "\t\t + wfq weight (%u)\n",
903 cap->nonleaf.sched_n_children_max,
904 cap->nonleaf.sched_sp_n_priorities_max,
905 cap->nonleaf.sched_wfq_n_children_per_group_max,
906 cap->nonleaf.sched_wfq_n_groups_max,
907 cap->nonleaf.sched_wfq_weight_max);
909 printf("\t -- leaf cman support:\n"
910 "\t\t + wred pkt mode (%d)\n"
911 "\t\t + wred byte mode (%d)\n"
912 "\t\t + head drop (%d)\n"
913 "\t\t + wred context private (%d)\n"
914 "\t\t + wred context shared (%u)\n",
915 cap->leaf.cman_wred_packet_mode_supported,
916 cap->leaf.cman_wred_byte_mode_supported,
917 cap->leaf.cman_head_drop_supported,
918 cap->leaf.cman_wred_context_private_supported,
919 cap->leaf.cman_wred_context_shared_n_max);
924 display_levelcap_info(int is_leaf, struct rte_tm_level_capabilities *cap)
930 printf("\t -- shaper private: (%d) dual rate (%d)\n",
931 cap->nonleaf.shaper_private_supported,
932 cap->nonleaf.shaper_private_dual_rate_supported);
933 printf("\t -- shaper share: (%u)\n",
934 cap->nonleaf.shaper_shared_n_max);
935 printf("\t -- non leaf sched MAX:\n"
936 "\t\t + children (%u)\n"
938 "\t\t + wfq children per group (%u)\n"
939 "\t\t + wfq groups (%u)\n"
940 "\t\t + wfq weight (%u)\n",
941 cap->nonleaf.sched_n_children_max,
942 cap->nonleaf.sched_sp_n_priorities_max,
943 cap->nonleaf.sched_wfq_n_children_per_group_max,
944 cap->nonleaf.sched_wfq_n_groups_max,
945 cap->nonleaf.sched_wfq_weight_max);
947 printf("\t -- shaper private: (%d) dual rate (%d)\n",
948 cap->leaf.shaper_private_supported,
949 cap->leaf.shaper_private_dual_rate_supported);
950 printf("\t -- shaper share: (%u)\n",
951 cap->leaf.shaper_shared_n_max);
952 printf(" -- leaf cman support:\n"
953 "\t\t + wred pkt mode (%d)\n"
954 "\t\t + wred byte mode (%d)\n"
955 "\t\t + head drop (%d)\n"
956 "\t\t + wred context private (%d)\n"
957 "\t\t + wred context shared (%u)\n",
958 cap->leaf.cman_wred_packet_mode_supported,
959 cap->leaf.cman_wred_byte_mode_supported,
960 cap->leaf.cman_head_drop_supported,
961 cap->leaf.cman_wred_context_private_supported,
962 cap->leaf.cman_wred_context_shared_n_max);
969 int ret = 0, check_for_leaf = 0, is_leaf = 0;
973 snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD ");
974 STATS_BDR_STR(10, bdr_str);
976 RTE_ETH_FOREACH_DEV(i) {
977 struct rte_eth_dev_info dev_info;
978 struct rte_tm_capabilities cap;
979 struct rte_tm_error error;
980 struct rte_tm_node_capabilities capnode;
981 struct rte_tm_level_capabilities caplevel;
982 uint32_t n_leaf_nodes = 0;
984 memset(&cap, 0, sizeof(cap));
985 memset(&error, 0, sizeof(error));
987 ret = rte_eth_dev_info_get(i, &dev_info);
989 printf("Error during getting device (port %u) info: %s\n",
994 printf(" - Generic for port (%u)\n"
995 "\t -- driver name %s\n"
996 "\t -- max vf (%u)\n"
997 "\t -- max tx queues (%u)\n"
998 "\t -- number of tx queues (%u)\n",
1000 dev_info.driver_name,
1002 dev_info.max_tx_queues,
1003 dev_info.nb_tx_queues);
1005 ret = rte_tm_capabilities_get(i, &cap, &error);
1009 printf(" - MAX: nodes (%u) levels (%u) children (%u)\n",
1012 cap.sched_n_children_max);
1014 printf(" - identical nodes: non leaf (%d) leaf (%d)\n",
1015 cap.non_leaf_nodes_identical,
1016 cap.leaf_nodes_identical);
1018 printf(" - Shaper MAX:\n"
1019 "\t -- total (%u)\n"
1020 "\t -- private (%u) private dual (%d)\n"
1021 "\t -- shared (%u) shared dual (%u)\n",
1023 cap.shaper_private_n_max,
1024 cap.shaper_private_dual_rate_n_max,
1025 cap.shaper_shared_n_max,
1026 cap.shaper_shared_dual_rate_n_max);
1028 printf(" - mark support:\n");
1029 printf("\t -- vlan dei: GREEN (%d) YELLOW (%d) RED (%d)\n",
1030 cap.mark_vlan_dei_supported[RTE_COLOR_GREEN],
1031 cap.mark_vlan_dei_supported[RTE_COLOR_YELLOW],
1032 cap.mark_vlan_dei_supported[RTE_COLOR_RED]);
1033 printf("\t -- ip ecn tcp: GREEN (%d) YELLOW (%d) RED (%d)\n",
1034 cap.mark_ip_ecn_tcp_supported[RTE_COLOR_GREEN],
1035 cap.mark_ip_ecn_tcp_supported[RTE_COLOR_YELLOW],
1036 cap.mark_ip_ecn_tcp_supported[RTE_COLOR_RED]);
1037 printf("\t -- ip ecn sctp: GREEN (%d) YELLOW (%d) RED (%d)\n",
1038 cap.mark_ip_ecn_sctp_supported[RTE_COLOR_GREEN],
1039 cap.mark_ip_ecn_sctp_supported[RTE_COLOR_YELLOW],
1040 cap.mark_ip_ecn_sctp_supported[RTE_COLOR_RED]);
1041 printf("\t -- ip dscp: GREEN (%d) YELLOW (%d) RED (%d)\n",
1042 cap.mark_ip_dscp_supported[RTE_COLOR_GREEN],
1043 cap.mark_ip_dscp_supported[RTE_COLOR_YELLOW],
1044 cap.mark_ip_dscp_supported[RTE_COLOR_RED]);
1046 printf(" - mask stats (0x%"PRIx64")"
1047 " dynamic update (0x%"PRIx64")\n",
1049 cap.dynamic_update_mask);
1051 printf(" - sched MAX:\n"
1052 "\t -- total (%u)\n"
1053 "\t -- sp levels (%u)\n"
1054 "\t -- wfq children per group (%u)\n"
1055 "\t -- wfq groups (%u)\n"
1056 "\t -- wfq weight (%u)\n",
1057 cap.sched_sp_n_priorities_max,
1058 cap.sched_sp_n_priorities_max,
1059 cap.sched_wfq_n_children_per_group_max,
1060 cap.sched_wfq_n_groups_max,
1061 cap.sched_wfq_weight_max);
1063 printf(" - CMAN support:\n"
1064 "\t -- WRED mode: pkt (%d) byte (%d)\n"
1065 "\t -- head drop (%d)\n",
1066 cap.cman_wred_packet_mode_supported,
1067 cap.cman_wred_byte_mode_supported,
1068 cap.cman_head_drop_supported);
1069 printf("\t -- MAX WRED CONTEXT:"
1070 " total (%u) private (%u) shared (%u)\n",
1071 cap.cman_wred_context_n_max,
1072 cap.cman_wred_context_private_n_max,
1073 cap.cman_wred_context_shared_n_max);
1075 for (j = 0; j < cap.n_nodes_max; j++) {
1076 memset(&capnode, 0, sizeof(capnode));
1077 ret = rte_tm_node_capabilities_get(i, j,
1084 printf(" NODE %u\n", j);
1085 printf("\t - shaper private: (%d) dual rate (%d)\n",
1086 capnode.shaper_private_supported,
1087 capnode.shaper_private_dual_rate_supported);
1088 printf("\t - shaper shared max: (%u)\n",
1089 capnode.shaper_shared_n_max);
1090 printf("\t - stats mask %"PRIx64"\n",
1091 capnode.stats_mask);
1093 ret = rte_tm_node_type_get(i, j, &is_leaf, &error);
1097 display_nodecap_info(is_leaf, &capnode);
1100 for (j = 0; j < cap.n_levels_max; j++) {
1101 memset(&caplevel, 0, sizeof(caplevel));
1102 ret = rte_tm_level_capabilities_get(i, j,
1107 printf(" - Level %u\n", j);
1108 printf("\t -- node MAX: %u non leaf %u leaf %u\n",
1109 caplevel.n_nodes_max,
1110 caplevel.n_nodes_nonleaf_max,
1111 caplevel.n_nodes_leaf_max);
1112 printf("\t -- identical: non leaf %u leaf %u\n",
1113 caplevel.non_leaf_nodes_identical,
1114 caplevel.leaf_nodes_identical);
1116 for (k = 0; k < caplevel.n_nodes_max; k++) {
1117 ret = rte_tm_node_type_get(i, k,
1122 display_levelcap_info(is_leaf, &caplevel);
1126 if (check_for_leaf) {
1127 ret = rte_tm_get_number_of_leaf_nodes(i,
1128 &n_leaf_nodes, &error);
1130 printf(" - leaf nodes (%u)\n", n_leaf_nodes);
1133 for (j = 0; j < n_leaf_nodes; j++) {
1134 struct rte_tm_node_stats stats;
1135 memset(&stats, 0, sizeof(stats));
1137 ret = rte_tm_node_stats_read(i, j,
1138 &stats, &cap.stats_mask, 0, &error);
1142 printf(" - STATS for node (%u)\n", j);
1143 printf(" -- pkts (%"PRIu64") bytes (%"PRIu64")\n",
1144 stats.n_pkts, stats.n_bytes);
1146 ret = rte_tm_node_type_get(i, j, &is_leaf, &error);
1147 if (ret || (!is_leaf))
1150 printf(" -- leaf queued:"
1151 " pkts (%"PRIu64") bytes (%"PRIu64")\n",
1152 stats.leaf.n_pkts_queued,
1153 stats.leaf.n_bytes_queued);
1154 printf(" - dropped:\n"
1156 " pkts (%"PRIu64") bytes (%"PRIu64")\n"
1158 " pkts (%"PRIu64") bytes (%"PRIu64")\n"
1160 " pkts (%"PRIu64") bytes (%"PRIu64")\n",
1161 stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN],
1162 stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN],
1163 stats.leaf.n_pkts_dropped[RTE_COLOR_YELLOW],
1164 stats.leaf.n_bytes_dropped[RTE_COLOR_YELLOW],
1165 stats.leaf.n_pkts_dropped[RTE_COLOR_RED],
1166 stats.leaf.n_bytes_dropped[RTE_COLOR_RED]);
1172 display_crypto_feature_info(uint64_t x)
1177 printf("\t -- feature flags\n");
1178 printf("\t\t + symmetric (%c), asymmetric (%c)\n"
1179 "\t\t + symmetric operation chaining (%c)\n",
1180 (x & RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO) ? 'y' : 'n',
1181 (x & RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO) ? 'y' : 'n',
1182 (x & RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING) ? 'y' : 'n');
1183 printf("\t\t + CPU: SSE (%c), AVX (%c), AVX2 (%c), AVX512 (%c)\n",
1184 (x & RTE_CRYPTODEV_FF_CPU_SSE) ? 'y' : 'n',
1185 (x & RTE_CRYPTODEV_FF_CPU_AVX) ? 'y' : 'n',
1186 (x & RTE_CRYPTODEV_FF_CPU_AVX2) ? 'y' : 'n',
1187 (x & RTE_CRYPTODEV_FF_CPU_AVX512) ? 'y' : 'n');
1188 printf("\t\t + AESNI: CPU (%c), HW (%c)\n",
1189 (x & RTE_CRYPTODEV_FF_CPU_AESNI) ? 'y' : 'n',
1190 (x & RTE_CRYPTODEV_FF_HW_ACCELERATED) ? 'y' : 'n');
1191 printf("\t\t + SECURITY OFFLOAD (%c)\n",
1192 (x & RTE_CRYPTODEV_FF_SECURITY) ? 'y' : 'n');
1193 printf("\t\t + ARM: NEON (%c), CE (%c)\n",
1194 (x & RTE_CRYPTODEV_FF_CPU_NEON) ? 'y' : 'n',
1195 (x & RTE_CRYPTODEV_FF_CPU_ARM_CE) ? 'y' : 'n');
1196 printf("\t -- buffer offload\n");
1197 printf("\t\t + IN_PLACE_SGL (%c)\n",
1198 (x & RTE_CRYPTODEV_FF_IN_PLACE_SGL) ? 'y' : 'n');
1199 printf("\t\t + OOP_SGL_IN_SGL_OUT (%c)\n",
1200 (x & RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT) ? 'y' : 'n');
1201 printf("\t\t + OOP_SGL_IN_LB_OUT (%c)\n",
1202 (x & RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT) ? 'y' : 'n');
1203 printf("\t\t + OOP_LB_IN_SGL_OUT (%c)\n",
1204 (x & RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT) ? 'y' : 'n');
1205 printf("\t\t + OOP_LB_IN_LB_OUT (%c)\n",
1206 (x & RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT) ? 'y' : 'n');
1212 uint8_t crypto_dev_count = rte_cryptodev_count(), i;
1214 snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD ");
1215 STATS_BDR_STR(10, bdr_str);
1217 for (i = 0; i < crypto_dev_count; i++) {
1218 struct rte_cryptodev_info dev_info;
1219 struct rte_cryptodev_stats stats;
1221 rte_cryptodev_info_get(i, &dev_info);
1223 printf(" - device (%u)\n", i);
1224 printf("\t -- name (%s)\n"
1225 "\t -- driver (%s)\n"
1226 "\t -- id (%u) on socket (%d)\n"
1227 "\t -- queue pairs (%d)\n",
1228 rte_cryptodev_name_get(i),
1229 dev_info.driver_name,
1231 dev_info.device->numa_node,
1232 rte_cryptodev_queue_pair_count(i));
1234 display_crypto_feature_info(dev_info.feature_flags);
1236 if (rte_cryptodev_stats_get(i, &stats) == 0) {
1237 printf("\t -- stats\n");
1238 printf("\t\t + enqueue count (%"PRIu64")"
1239 " error (%"PRIu64")\n",
1240 stats.enqueued_count,
1241 stats.enqueue_err_count);
1242 printf("\t\t + dequeue count (%"PRIu64")"
1243 " error (%"PRIu64")\n",
1244 stats.dequeued_count,
1245 stats.dequeue_err_count);
1248 #ifdef RTE_LIB_SECURITY
1249 show_security_context(i, false);
1255 show_ring(char *name)
1257 snprintf(bdr_str, MAX_STRING_LEN, " show - RING ");
1258 STATS_BDR_STR(10, bdr_str);
1261 struct rte_ring *ptr = rte_ring_lookup(name);
1263 printf(" - Name (%s) on socket (%d)\n"
1265 "\t -- Single Producer Enqueue (%u)\n"
1266 "\t -- Single Consumer Dequeue (%u)\n",
1268 ptr->memzone->socket_id,
1269 ptr->flags & RING_F_SP_ENQ,
1270 ptr->flags & RING_F_SC_DEQ);
1271 printf(" - size (%u) mask (0x%x) capacity (%u)\n",
1275 printf(" - count (%u) free count (%u)\n",
1276 rte_ring_count(ptr),
1277 rte_ring_free_count(ptr));
1278 printf(" - full (%d) empty (%d)\n",
1280 rte_ring_empty(ptr));
1282 STATS_BDR_STR(50, "");
1287 rte_ring_list_dump(stdout);
1291 show_mempool(char *name)
1293 snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL ");
1294 STATS_BDR_STR(10, bdr_str);
1297 struct rte_mempool *ptr = rte_mempool_lookup(name);
1299 struct rte_mempool_ops *ops;
1300 uint64_t flags = ptr->flags;
1302 ops = rte_mempool_get_ops(ptr->ops_index);
1303 printf(" - Name: %s on socket %d\n"
1305 "\t -- No spread (%c)\n"
1306 "\t -- No cache align (%c)\n"
1307 "\t -- SP put (%c), SC get (%c)\n"
1308 "\t -- Pool created (%c)\n"
1309 "\t -- No IOVA config (%c)\n"
1310 "\t -- Not used for IO (%c)\n",
1313 (flags & RTE_MEMPOOL_F_NO_SPREAD) ? 'y' : 'n',
1314 (flags & RTE_MEMPOOL_F_NO_CACHE_ALIGN) ? 'y' : 'n',
1315 (flags & RTE_MEMPOOL_F_SP_PUT) ? 'y' : 'n',
1316 (flags & RTE_MEMPOOL_F_SC_GET) ? 'y' : 'n',
1317 (flags & RTE_MEMPOOL_F_POOL_CREATED) ? 'y' : 'n',
1318 (flags & RTE_MEMPOOL_F_NO_IOVA_CONTIG) ? 'y' : 'n',
1319 (flags & RTE_MEMPOOL_F_NON_IO) ? 'y' : 'n');
1320 printf(" - Size %u Cache %u element %u\n"
1321 " - header %u trailer %u\n"
1322 " - private data size %u\n",
1328 ptr->private_data_size);
1329 printf(" - memezone - socket %d\n",
1330 ptr->mz->socket_id);
1331 printf(" - Count: avail (%u), in use (%u)\n",
1332 rte_mempool_avail_count(ptr),
1333 rte_mempool_in_use_count(ptr));
1334 printf(" - ops_index %d ops_name %s\n",
1335 ptr->ops_index, ops ? ops->name : "NA");
1341 rte_mempool_list_dump(stdout);
1345 mempool_itr_obj(struct rte_mempool *mp, void *opaque,
1346 void *obj, unsigned int obj_idx)
1348 printf(" - obj_idx %u opaque %p obj %p\n",
1349 obj_idx, opaque, obj);
1352 rte_hexdump(stdout, " Obj Content",
1353 obj, (mp->elt_size > 256)?256:mp->elt_size);
1357 iter_mempool(char *name)
1359 snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL ");
1360 STATS_BDR_STR(10, bdr_str);
1363 struct rte_mempool *ptr = rte_mempool_lookup(name);
1365 /* iterate each object */
1366 uint32_t ret = rte_mempool_obj_iter(ptr,
1367 mempool_itr_obj, NULL);
1368 printf("\n - iterated %u objects\n", ret);
1375 dump_regs(char *file_prefix)
1377 #define MAX_FILE_NAME_SZ (MAX_LONG_OPT_SZ + 10)
1378 char file_name[MAX_FILE_NAME_SZ];
1379 struct rte_dev_reg_info reg_info;
1380 struct rte_eth_dev_info dev_info;
1381 unsigned char *buf_data;
1387 snprintf(bdr_str, MAX_STRING_LEN, " dump - Port REG");
1388 STATS_BDR_STR(10, bdr_str);
1390 RTE_ETH_FOREACH_DEV(i) {
1391 /* Skip if port is not in mask */
1392 if ((enabled_port_mask & (1ul << i)) == 0)
1395 snprintf(bdr_str, MAX_STRING_LEN, " Port (%u)", i);
1396 STATS_BDR_STR(5, bdr_str);
1398 ret = rte_eth_dev_info_get(i, &dev_info);
1400 printf("Error getting device info: %d\n", ret);
1404 memset(®_info, 0, sizeof(reg_info));
1405 ret = rte_eth_dev_get_reg_info(i, ®_info);
1407 printf("Error getting device reg info: %d\n", ret);
1411 buf_size = reg_info.length * reg_info.width;
1412 buf_data = malloc(buf_size);
1413 if (buf_data == NULL) {
1414 printf("Error allocating %zu bytes buffer\n", buf_size);
1418 reg_info.data = buf_data;
1419 reg_info.length = 0;
1420 ret = rte_eth_dev_get_reg_info(i, ®_info);
1422 printf("Error getting regs from device: %d\n", ret);
1427 snprintf(file_name, MAX_FILE_NAME_SZ, "%s-port%u",
1429 fp_regs = fopen(file_name, "wb");
1430 if (fp_regs == NULL) {
1431 printf("Error during opening '%s' for writing: %s\n",
1432 file_name, strerror(errno));
1436 nr_written = fwrite(buf_data, 1, buf_size, fp_regs);
1437 if (nr_written != buf_size)
1438 printf("Error during writing %s: %s\n",
1439 file_prefix, strerror(errno));
1441 printf("Device (%s) regs dumped successfully, "
1442 "driver:%s version:0X%08X\n",
1443 dev_info.device->name,
1444 dev_info.driver_name, reg_info.version);
1454 main(int argc, char **argv)
1458 char c_flag[] = "-c1";
1459 char n_flag[] = "-n4";
1460 char mp_flag[] = "--proc-type=secondary";
1461 char log_flag[] = "--log-level=6";
1462 char *argp[argc + 4];
1465 /* preparse app arguments */
1466 ret = proc_info_preparse_args(argc, argv);
1468 printf("Failed to parse arguments\n");
1478 for (i = 1; i < argc; i++)
1479 argp[i + 4] = argv[i];
1483 ret = rte_eal_init(argc, argp);
1485 rte_panic("Cannot init EAL\n");
1490 if (!rte_eal_primary_proc_alive(NULL))
1491 rte_exit(EXIT_FAILURE, "No primary DPDK process is running.\n");
1493 /* parse app arguments */
1494 ret = proc_info_parse_args(argc, argv);
1496 rte_exit(EXIT_FAILURE, "Invalid argument\n");
1503 nb_ports = rte_eth_dev_count_avail();
1505 rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
1507 /* If no port mask was specified, then show non-owned ports */
1508 if (enabled_port_mask == 0) {
1509 RTE_ETH_FOREACH_DEV(i)
1510 enabled_port_mask = 1ul << i;
1513 for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
1515 /* Skip if port is not in mask */
1516 if ((enabled_port_mask & (1ul << i)) == 0)
1519 /* Skip if port is unused */
1520 if (!rte_eth_dev_is_valid_port(i))
1524 nic_stats_display(i);
1525 else if (enable_xstats)
1526 nic_xstats_display(i);
1527 else if (reset_stats)
1529 else if (reset_xstats)
1530 nic_xstats_clear(i);
1531 else if (enable_xstats_name)
1532 nic_xstats_by_name_display(i, xstats_name);
1533 else if (nb_xstats_ids > 0)
1534 nic_xstats_by_ids_display(i, xstats_ids,
1536 #ifdef RTE_LIB_METRICS
1537 else if (enable_metrics)
1543 #ifdef RTE_LIB_METRICS
1544 /* print port independent stats */
1546 metrics_display(RTE_METRICS_GLOBAL);
1549 /* show information for PMD */
1550 if (enable_shw_port)
1554 if (enable_shw_crypto)
1556 if (enable_shw_ring)
1557 show_ring(ring_name);
1558 if (enable_shw_mempool)
1559 show_mempool(mempool_name);
1560 if (enable_iter_mempool)
1561 iter_mempool(mempool_iter_name);
1562 if (enable_dump_regs)
1563 dump_regs(dump_regs_file_prefix);
1565 RTE_ETH_FOREACH_DEV(i)
1566 rte_eth_dev_close(i);
1568 ret = rte_eal_cleanup();
1570 printf("Error from rte_eal_cleanup(), %d\n", ret);