app/procinfo: add --show-ring
[dpdk.git] / app / proc-info / main.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2017 Intel Corporation
3  */
4
5 #include <stdio.h>
6 #include <string.h>
7 #include <stdint.h>
8 #include <errno.h>
9 #include <stdarg.h>
10 #include <inttypes.h>
11 #include <sys/queue.h>
12 #include <stdlib.h>
13 #include <getopt.h>
14 #include <unistd.h>
15
16 #include <rte_eal.h>
17 #include <rte_common.h>
18 #include <rte_debug.h>
19 #include <rte_ethdev.h>
20 #include <rte_malloc.h>
21 #include <rte_memory.h>
22 #include <rte_memzone.h>
23 #include <rte_launch.h>
24 #include <rte_tailq.h>
25 #include <rte_per_lcore.h>
26 #include <rte_lcore.h>
27 #include <rte_log.h>
28 #include <rte_atomic.h>
29 #include <rte_branch_prediction.h>
30 #include <rte_string_fns.h>
31 #include <rte_metrics.h>
32 #include <rte_cycles.h>
33 #include <rte_security.h>
34 #include <rte_cryptodev.h>
35 #include <rte_tm.h>
36
37 /* Maximum long option length for option parsing. */
38 #define MAX_LONG_OPT_SZ 64
39 #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
40
41 #define MAX_STRING_LEN 256
42
43 #define STATS_BDR_FMT "========================================"
44 #define STATS_BDR_STR(w, s) printf("%.*s%s%.*s\n", w, \
45         STATS_BDR_FMT, s, w, STATS_BDR_FMT)
46
47 /**< mask of enabled ports */
48 static uint32_t enabled_port_mask;
49 /**< Enable stats. */
50 static uint32_t enable_stats;
51 /**< Enable xstats. */
52 static uint32_t enable_xstats;
53 /**< Enable collectd format*/
54 static uint32_t enable_collectd_format;
55 /**< FD to send collectd format messages to STDOUT*/
56 static int stdout_fd;
57 /**< Host id process is running on */
58 static char host_id[MAX_LONG_OPT_SZ];
59 /**< Enable metrics. */
60 static uint32_t enable_metrics;
61 /**< Enable stats reset. */
62 static uint32_t reset_stats;
63 /**< Enable xstats reset. */
64 static uint32_t reset_xstats;
65 /**< Enable memory info. */
66 static uint32_t mem_info;
67 /**< Enable displaying xstat name. */
68 static uint32_t enable_xstats_name;
69 static char *xstats_name;
70
71 /**< Enable xstats by ids. */
72 #define MAX_NB_XSTATS_IDS 1024
73 static uint32_t nb_xstats_ids;
74 static uint64_t xstats_ids[MAX_NB_XSTATS_IDS];
75
76 /* show border */
77 static char bdr_str[MAX_STRING_LEN];
78
79 /**< Enable show port. */
80 static uint32_t enable_shw_port;
81 /**< Enable show tm. */
82 static uint32_t enable_shw_tm;
83 /**< Enable show crypto. */
84 static uint32_t enable_shw_crypto;
85 /**< Enable show ring. */
86 static uint32_t enable_shw_ring;
87 static char *ring_name;
88
89 /**< display usage */
90 static void
91 proc_info_usage(const char *prgname)
92 {
93         printf("%s [EAL options] -- -p PORTMASK\n"
94                 "  -m to display DPDK memory zones, segments and TAILQ information\n"
95                 "  -p PORTMASK: hexadecimal bitmask of ports to retrieve stats for\n"
96                 "  --stats: to display port statistics, enabled by default\n"
97                 "  --xstats: to display extended port statistics, disabled by "
98                         "default\n"
99                 "  --metrics: to display derived metrics of the ports, disabled by "
100                         "default\n"
101                 "  --xstats-name NAME: to display single xstat id by NAME\n"
102                 "  --xstats-ids IDLIST: to display xstat values by id. "
103                         "The argument is comma-separated list of xstat ids to print out.\n"
104                 "  --stats-reset: to reset port statistics\n"
105                 "  --xstats-reset: to reset port extended statistics\n"
106                 "  --collectd-format: to print statistics to STDOUT in expected by collectd format\n"
107                 "  --host-id STRING: host id used to identify the system process is running on\n"
108                 "  --show-port: to display ports information\n"
109                 "  --show-tm: to display traffic manager information for ports\n"
110                 "  --show-crypto: to display crypto information\n"
111                 "  --show-ring[=name]: to display ring information\n",
112                 prgname);
113 }
114
115 /*
116  * Parse the portmask provided at run time.
117  */
118 static int
119 parse_portmask(const char *portmask)
120 {
121         char *end = NULL;
122         unsigned long pm;
123
124         errno = 0;
125
126         /* parse hexadecimal string */
127         pm = strtoul(portmask, &end, 16);
128         if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0') ||
129                 (errno != 0)) {
130                 printf("%s ERROR parsing the port mask\n", __func__);
131                 return -1;
132         }
133
134         if (pm == 0)
135                 return -1;
136
137         return pm;
138
139 }
140
141 /*
142  * Parse ids value list into array
143  */
144 static int
145 parse_xstats_ids(char *list, uint64_t *ids, int limit) {
146         int length;
147         char *token;
148         char *ctx = NULL;
149         char *endptr;
150
151         length = 0;
152         token = strtok_r(list, ",", &ctx);
153         while (token != NULL) {
154                 ids[length] = strtoull(token, &endptr, 10);
155                 if (*endptr != '\0')
156                         return -EINVAL;
157
158                 length++;
159                 if (length >= limit)
160                         return -E2BIG;
161
162                 token = strtok_r(NULL, ",", &ctx);
163         }
164
165         return length;
166 }
167
168 static int
169 proc_info_preparse_args(int argc, char **argv)
170 {
171         char *prgname = argv[0];
172         int i;
173
174         for (i = 0; i < argc; i++) {
175                 /* Print stats or xstats to STDOUT in collectd format */
176                 if (!strncmp(argv[i], "--collectd-format", MAX_LONG_OPT_SZ)) {
177                         enable_collectd_format = 1;
178                         stdout_fd = dup(STDOUT_FILENO);
179                         close(STDOUT_FILENO);
180                 }
181                 if (!strncmp(argv[i], "--host-id", MAX_LONG_OPT_SZ)) {
182                         if ((i + 1) == argc) {
183                                 printf("Invalid host id or not specified\n");
184                                 proc_info_usage(prgname);
185                                 return -1;
186                         }
187                         snprintf(host_id, sizeof(host_id), "%s", argv[i+1]);
188                 }
189         }
190
191         if (!strlen(host_id)) {
192                 int err = gethostname(host_id, MAX_LONG_OPT_SZ-1);
193
194                 if (err)
195                         strcpy(host_id, "unknown");
196         }
197
198         return 0;
199 }
200
201 /* Parse the argument given in the command line of the application */
202 static int
203 proc_info_parse_args(int argc, char **argv)
204 {
205         int opt;
206         int option_index;
207         char *prgname = argv[0];
208         static struct option long_option[] = {
209                 {"stats", 0, NULL, 0},
210                 {"stats-reset", 0, NULL, 0},
211                 {"xstats", 0, NULL, 0},
212                 {"metrics", 0, NULL, 0},
213                 {"xstats-reset", 0, NULL, 0},
214                 {"xstats-name", required_argument, NULL, 1},
215                 {"collectd-format", 0, NULL, 0},
216                 {"xstats-ids", 1, NULL, 1},
217                 {"host-id", 0, NULL, 0},
218                 {"show-port", 0, NULL, 0},
219                 {"show-tm", 0, NULL, 0},
220                 {"show-crypto", 0, NULL, 0},
221                 {"show-ring", optional_argument, NULL, 0},
222                 {NULL, 0, 0, 0}
223         };
224
225         if (argc == 1)
226                 proc_info_usage(prgname);
227
228         /* Parse command line */
229         while ((opt = getopt_long(argc, argv, "p:m",
230                         long_option, &option_index)) != EOF) {
231                 switch (opt) {
232                 /* portmask */
233                 case 'p':
234                         enabled_port_mask = parse_portmask(optarg);
235                         if (enabled_port_mask == 0) {
236                                 printf("invalid portmask\n");
237                                 proc_info_usage(prgname);
238                                 return -1;
239                         }
240                         break;
241                 case 'm':
242                         mem_info = 1;
243                         break;
244                 case 0:
245                         /* Print stats */
246                         if (!strncmp(long_option[option_index].name, "stats",
247                                         MAX_LONG_OPT_SZ))
248                                 enable_stats = 1;
249                         /* Print xstats */
250                         else if (!strncmp(long_option[option_index].name, "xstats",
251                                         MAX_LONG_OPT_SZ))
252                                 enable_xstats = 1;
253                         else if (!strncmp(long_option[option_index].name,
254                                         "metrics",
255                                         MAX_LONG_OPT_SZ))
256                                 enable_metrics = 1;
257                         /* Reset stats */
258                         if (!strncmp(long_option[option_index].name, "stats-reset",
259                                         MAX_LONG_OPT_SZ))
260                                 reset_stats = 1;
261                         /* Reset xstats */
262                         else if (!strncmp(long_option[option_index].name, "xstats-reset",
263                                         MAX_LONG_OPT_SZ))
264                                 reset_xstats = 1;
265                         else if (!strncmp(long_option[option_index].name,
266                                         "show-port", MAX_LONG_OPT_SZ))
267                                 enable_shw_port = 1;
268                         else if (!strncmp(long_option[option_index].name,
269                                         "show-tm", MAX_LONG_OPT_SZ))
270                                 enable_shw_tm = 1;
271                         else if (!strncmp(long_option[option_index].name,
272                                         "show-crypto", MAX_LONG_OPT_SZ))
273                                 enable_shw_crypto = 1;
274                         else if (!strncmp(long_option[option_index].name,
275                                         "show-ring", MAX_LONG_OPT_SZ)) {
276                                 enable_shw_ring = 1;
277                                 ring_name = optarg;
278                         }
279                         break;
280                 case 1:
281                         /* Print xstat single value given by name*/
282                         if (!strncmp(long_option[option_index].name,
283                                         "xstats-name", MAX_LONG_OPT_SZ)) {
284                                 enable_xstats_name = 1;
285                                 xstats_name = optarg;
286                                 printf("name:%s:%s\n",
287                                                 long_option[option_index].name,
288                                                 optarg);
289                         } else if (!strncmp(long_option[option_index].name,
290                                         "xstats-ids",
291                                         MAX_LONG_OPT_SZ))       {
292                                 nb_xstats_ids = parse_xstats_ids(optarg,
293                                                 xstats_ids, MAX_NB_XSTATS_IDS);
294
295                                 if (nb_xstats_ids <= 0) {
296                                         printf("xstats-id list parse error.\n");
297                                         return -1;
298                                 }
299
300                         }
301                         break;
302                 default:
303                         proc_info_usage(prgname);
304                         return -1;
305                 }
306         }
307         return 0;
308 }
309
310 static void
311 meminfo_display(void)
312 {
313         printf("----------- MEMORY_SEGMENTS -----------\n");
314         rte_dump_physmem_layout(stdout);
315         printf("--------- END_MEMORY_SEGMENTS ---------\n");
316
317         printf("------------ MEMORY_ZONES -------------\n");
318         rte_memzone_dump(stdout);
319         printf("---------- END_MEMORY_ZONES -----------\n");
320
321         printf("------------- TAIL_QUEUES -------------\n");
322         rte_dump_tailq(stdout);
323         printf("---------- END_TAIL_QUEUES ------------\n");
324 }
325
326 static void
327 nic_stats_display(uint16_t port_id)
328 {
329         struct rte_eth_stats stats;
330         uint8_t i;
331
332         static const char *nic_stats_border = "########################";
333
334         rte_eth_stats_get(port_id, &stats);
335         printf("\n  %s NIC statistics for port %-2d %s\n",
336                    nic_stats_border, port_id, nic_stats_border);
337
338         printf("  RX-packets: %-10"PRIu64"  RX-errors:  %-10"PRIu64
339                "  RX-bytes:  %-10"PRIu64"\n", stats.ipackets, stats.ierrors,
340                stats.ibytes);
341         printf("  RX-nombuf:  %-10"PRIu64"\n", stats.rx_nombuf);
342         printf("  TX-packets: %-10"PRIu64"  TX-errors:  %-10"PRIu64
343                "  TX-bytes:  %-10"PRIu64"\n", stats.opackets, stats.oerrors,
344                stats.obytes);
345
346         printf("\n");
347         for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
348                 printf("  Stats reg %2d RX-packets: %-10"PRIu64
349                        "  RX-errors: %-10"PRIu64
350                        "  RX-bytes: %-10"PRIu64"\n",
351                        i, stats.q_ipackets[i], stats.q_errors[i], stats.q_ibytes[i]);
352         }
353
354         printf("\n");
355         for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
356                 printf("  Stats reg %2d TX-packets: %-10"PRIu64
357                        "  TX-bytes: %-10"PRIu64"\n",
358                        i, stats.q_opackets[i], stats.q_obytes[i]);
359         }
360
361         printf("  %s############################%s\n",
362                    nic_stats_border, nic_stats_border);
363 }
364
365 static void
366 nic_stats_clear(uint16_t port_id)
367 {
368         printf("\n Clearing NIC stats for port %d\n", port_id);
369         rte_eth_stats_reset(port_id);
370         printf("\n  NIC statistics for port %d cleared\n", port_id);
371 }
372
373 static void collectd_resolve_cnt_type(char *cnt_type, size_t cnt_type_len,
374                                       const char *cnt_name) {
375         char *type_end = strrchr(cnt_name, '_');
376
377         if ((type_end != NULL) &&
378             (strncmp(cnt_name, "rx_", strlen("rx_")) == 0)) {
379                 if (strncmp(type_end, "_errors", strlen("_errors")) == 0)
380                         strncpy(cnt_type, "if_rx_errors", cnt_type_len);
381                 else if (strncmp(type_end, "_dropped", strlen("_dropped")) == 0)
382                         strncpy(cnt_type, "if_rx_dropped", cnt_type_len);
383                 else if (strncmp(type_end, "_bytes", strlen("_bytes")) == 0)
384                         strncpy(cnt_type, "if_rx_octets", cnt_type_len);
385                 else if (strncmp(type_end, "_packets", strlen("_packets")) == 0)
386                         strncpy(cnt_type, "if_rx_packets", cnt_type_len);
387                 else if (strncmp(type_end, "_placement",
388                                  strlen("_placement")) == 0)
389                         strncpy(cnt_type, "if_rx_errors", cnt_type_len);
390                 else if (strncmp(type_end, "_buff", strlen("_buff")) == 0)
391                         strncpy(cnt_type, "if_rx_errors", cnt_type_len);
392                 else
393                         /* Does not fit obvious type: use a more generic one */
394                         strncpy(cnt_type, "derive", cnt_type_len);
395         } else if ((type_end != NULL) &&
396                 (strncmp(cnt_name, "tx_", strlen("tx_"))) == 0) {
397                 if (strncmp(type_end, "_errors", strlen("_errors")) == 0)
398                         strncpy(cnt_type, "if_tx_errors", cnt_type_len);
399                 else if (strncmp(type_end, "_dropped", strlen("_dropped")) == 0)
400                         strncpy(cnt_type, "if_tx_dropped", cnt_type_len);
401                 else if (strncmp(type_end, "_bytes", strlen("_bytes")) == 0)
402                         strncpy(cnt_type, "if_tx_octets", cnt_type_len);
403                 else if (strncmp(type_end, "_packets", strlen("_packets")) == 0)
404                         strncpy(cnt_type, "if_tx_packets", cnt_type_len);
405                 else
406                         /* Does not fit obvious type: use a more generic one */
407                         strncpy(cnt_type, "derive", cnt_type_len);
408         } else if ((type_end != NULL) &&
409                    (strncmp(cnt_name, "flow_", strlen("flow_"))) == 0) {
410                 if (strncmp(type_end, "_filters", strlen("_filters")) == 0)
411                         strncpy(cnt_type, "operations", cnt_type_len);
412                 else if (strncmp(type_end, "_errors", strlen("_errors")) == 0)
413                         strncpy(cnt_type, "errors", cnt_type_len);
414                 else if (strncmp(type_end, "_filters", strlen("_filters")) == 0)
415                         strncpy(cnt_type, "filter_result", cnt_type_len);
416         } else if ((type_end != NULL) &&
417                    (strncmp(cnt_name, "mac_", strlen("mac_"))) == 0) {
418                 if (strncmp(type_end, "_errors", strlen("_errors")) == 0)
419                         strncpy(cnt_type, "errors", cnt_type_len);
420         } else {
421                 /* Does not fit obvious type, or strrchr error: */
422                 /* use a more generic type */
423                 strncpy(cnt_type, "derive", cnt_type_len);
424         }
425 }
426
427 static void
428 nic_xstats_by_name_display(uint16_t port_id, char *name)
429 {
430         uint64_t id;
431
432         printf("###### NIC statistics for port %-2d, statistic name '%s':\n",
433                            port_id, name);
434
435         if (rte_eth_xstats_get_id_by_name(port_id, name, &id) == 0)
436                 printf("%s: %"PRIu64"\n", name, id);
437         else
438                 printf("Statistic not found...\n");
439
440 }
441
442 static void
443 nic_xstats_by_ids_display(uint16_t port_id, uint64_t *ids, int len)
444 {
445         struct rte_eth_xstat_name *xstats_names;
446         uint64_t *values;
447         int ret, i;
448         static const char *nic_stats_border = "########################";
449
450         values = malloc(sizeof(*values) * len);
451         if (values == NULL) {
452                 printf("Cannot allocate memory for xstats\n");
453                 return;
454         }
455
456         xstats_names = malloc(sizeof(struct rte_eth_xstat_name) * len);
457         if (xstats_names == NULL) {
458                 printf("Cannot allocate memory for xstat names\n");
459                 free(values);
460                 return;
461         }
462
463         if (len != rte_eth_xstats_get_names_by_id(
464                         port_id, xstats_names, len, ids)) {
465                 printf("Cannot get xstat names\n");
466                 goto err;
467         }
468
469         printf("###### NIC extended statistics for port %-2d #########\n",
470                            port_id);
471         printf("%s############################\n", nic_stats_border);
472         ret = rte_eth_xstats_get_by_id(port_id, ids, values, len);
473         if (ret < 0 || ret > len) {
474                 printf("Cannot get xstats\n");
475                 goto err;
476         }
477
478         for (i = 0; i < len; i++)
479                 printf("%s: %"PRIu64"\n",
480                         xstats_names[i].name,
481                         values[i]);
482
483         printf("%s############################\n", nic_stats_border);
484 err:
485         free(values);
486         free(xstats_names);
487 }
488
489 static void
490 nic_xstats_display(uint16_t port_id)
491 {
492         struct rte_eth_xstat_name *xstats_names;
493         uint64_t *values;
494         int len, ret, i;
495         static const char *nic_stats_border = "########################";
496
497         len = rte_eth_xstats_get_names_by_id(port_id, NULL, 0, NULL);
498         if (len < 0) {
499                 printf("Cannot get xstats count\n");
500                 return;
501         }
502         values = malloc(sizeof(*values) * len);
503         if (values == NULL) {
504                 printf("Cannot allocate memory for xstats\n");
505                 return;
506         }
507
508         xstats_names = malloc(sizeof(struct rte_eth_xstat_name) * len);
509         if (xstats_names == NULL) {
510                 printf("Cannot allocate memory for xstat names\n");
511                 free(values);
512                 return;
513         }
514         if (len != rte_eth_xstats_get_names_by_id(
515                         port_id, xstats_names, len, NULL)) {
516                 printf("Cannot get xstat names\n");
517                 goto err;
518         }
519
520         printf("###### NIC extended statistics for port %-2d #########\n",
521                            port_id);
522         printf("%s############################\n",
523                            nic_stats_border);
524         ret = rte_eth_xstats_get_by_id(port_id, NULL, values, len);
525         if (ret < 0 || ret > len) {
526                 printf("Cannot get xstats\n");
527                 goto err;
528         }
529
530         for (i = 0; i < len; i++) {
531                 if (enable_collectd_format) {
532                         char counter_type[MAX_STRING_LEN];
533                         char buf[MAX_STRING_LEN];
534                         size_t n;
535
536                         collectd_resolve_cnt_type(counter_type,
537                                                   sizeof(counter_type),
538                                                   xstats_names[i].name);
539                         n = snprintf(buf, MAX_STRING_LEN,
540                                 "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%"
541                                 PRIu64"\n", host_id, port_id, counter_type,
542                                 xstats_names[i].name, values[i]);
543                         if (n > sizeof(buf) - 1)
544                                 n = sizeof(buf) - 1;
545                         ret = write(stdout_fd, buf, n);
546                         if (ret < 0)
547                                 goto err;
548                 } else {
549                         printf("%s: %"PRIu64"\n", xstats_names[i].name,
550                                         values[i]);
551                 }
552         }
553
554         printf("%s############################\n",
555                            nic_stats_border);
556 err:
557         free(values);
558         free(xstats_names);
559 }
560
561 static void
562 nic_xstats_clear(uint16_t port_id)
563 {
564         printf("\n Clearing NIC xstats for port %d\n", port_id);
565         rte_eth_xstats_reset(port_id);
566         printf("\n  NIC extended statistics for port %d cleared\n", port_id);
567 }
568
569 static void
570 metrics_display(int port_id)
571 {
572         struct rte_metric_value *metrics;
573         struct rte_metric_name *names;
574         int len, ret;
575         static const char *nic_stats_border = "########################";
576
577         len = rte_metrics_get_names(NULL, 0);
578         if (len < 0) {
579                 printf("Cannot get metrics count\n");
580                 return;
581         }
582         if (len == 0) {
583                 printf("No metrics to display (none have been registered)\n");
584                 return;
585         }
586
587         metrics = rte_malloc("proc_info_metrics",
588                 sizeof(struct rte_metric_value) * len, 0);
589         if (metrics == NULL) {
590                 printf("Cannot allocate memory for metrics\n");
591                 return;
592         }
593
594         names =  rte_malloc(NULL, sizeof(struct rte_metric_name) * len, 0);
595         if (names == NULL) {
596                 printf("Cannot allocate memory for metrcis names\n");
597                 rte_free(metrics);
598                 return;
599         }
600
601         if (len != rte_metrics_get_names(names, len)) {
602                 printf("Cannot get metrics names\n");
603                 rte_free(metrics);
604                 rte_free(names);
605                 return;
606         }
607
608         if (port_id == RTE_METRICS_GLOBAL)
609                 printf("###### Non port specific metrics  #########\n");
610         else
611                 printf("###### metrics for port %-2d #########\n", port_id);
612         printf("%s############################\n", nic_stats_border);
613         ret = rte_metrics_get_values(port_id, metrics, len);
614         if (ret < 0 || ret > len) {
615                 printf("Cannot get metrics values\n");
616                 rte_free(metrics);
617                 rte_free(names);
618                 return;
619         }
620
621         int i;
622         for (i = 0; i < len; i++)
623                 printf("%s: %"PRIu64"\n", names[i].name, metrics[i].value);
624
625         printf("%s############################\n", nic_stats_border);
626         rte_free(metrics);
627         rte_free(names);
628 }
629
630 static void
631 show_port(void)
632 {
633         uint16_t i = 0;
634         int ret = 0, j, k;
635
636         snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD %"PRIu64,
637                         rte_get_tsc_hz());
638         STATS_BDR_STR(10, bdr_str);
639
640         RTE_ETH_FOREACH_DEV(i) {
641                 uint16_t mtu = 0;
642                 struct rte_eth_link link;
643                 struct rte_eth_dev_info dev_info;
644                 struct rte_eth_rxq_info queue_info;
645                 struct rte_eth_rss_conf rss_conf;
646
647                 memset(&rss_conf, 0, sizeof(rss_conf));
648
649                 snprintf(bdr_str, MAX_STRING_LEN, " Port (%u)", i);
650                 STATS_BDR_STR(5, bdr_str);
651                 printf("  - generic config\n");
652
653                 printf("\t  -- Socket %d\n", rte_eth_dev_socket_id(i));
654                 rte_eth_link_get(i, &link);
655                 printf("\t  -- link speed %d duplex %d,"
656                                 " auto neg %d status %d\n",
657                                 link.link_speed,
658                                 link.link_duplex,
659                                 link.link_autoneg,
660                                 link.link_status);
661                 printf("\t  -- promiscuous (%d)\n",
662                                 rte_eth_promiscuous_get(i));
663                 ret = rte_eth_dev_get_mtu(i, &mtu);
664                 if (ret == 0)
665                         printf("\t  -- mtu (%d)\n", mtu);
666
667                 rte_eth_dev_info_get(i, &dev_info);
668
669                 printf("  - queue\n");
670                 for (j = 0; j < dev_info.nb_rx_queues; j++) {
671                         ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
672                         if (ret == 0) {
673                                 printf("\t  -- queue %d rx scatter %d"
674                                                 " descriptors %d"
675                                                 " offloads 0x%"PRIx64
676                                                 " mempool socket %d\n",
677                                                 j,
678                                                 queue_info.scattered_rx,
679                                                 queue_info.nb_desc,
680                                                 queue_info.conf.offloads,
681                                                 queue_info.mp->socket_id);
682                         }
683                 }
684
685                 ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf);
686                 if (ret == 0) {
687                         if (rss_conf.rss_key) {
688                                 printf("  - RSS\n");
689                                 printf("\t  -- RSS len %u key (hex):",
690                                                 rss_conf.rss_key_len);
691                                 for (k = 0; k < rss_conf.rss_key_len; k++)
692                                         printf(" %x", rss_conf.rss_key[k]);
693                                 printf("\t  -- hf 0x%"PRIx64"\n",
694                                                 rss_conf.rss_hf);
695                         }
696                 }
697
698                 printf("  - cyrpto context\n");
699                 void *p_ctx = rte_eth_dev_get_sec_ctx(i);
700                 printf("\t  -- security context - %p\n", p_ctx);
701
702                 if (p_ctx) {
703                         printf("\t  -- size %u\n",
704                                         rte_security_session_get_size(p_ctx));
705                         const struct rte_security_capability *s_cap =
706                                 rte_security_capabilities_get(p_ctx);
707                         if (s_cap) {
708                                 printf("\t  -- action (0x%x), protocol (0x%x),"
709                                                 " offload flags (0x%x)\n",
710                                                 s_cap->action,
711                                                 s_cap->protocol,
712                                                 s_cap->ol_flags);
713                                 printf("\t  -- capabilities - oper type %x\n",
714                                                 s_cap->crypto_capabilities->op);
715                         }
716                 }
717         }
718
719         STATS_BDR_STR(50, "");
720 }
721
722 static void
723 display_nodecap_info(int is_leaf, struct rte_tm_node_capabilities *cap)
724 {
725         if (cap == NULL)
726                 return;
727
728         if (!is_leaf) {
729                 printf("\t  -- nonleaf sched max:\n"
730                         "\t\t  + children (%u)\n"
731                         "\t\t  + sp priorities (%u)\n"
732                         "\t\t  + wfq children per group (%u)\n"
733                         "\t\t  + wfq groups (%u)\n"
734                         "\t\t  + wfq weight (%u)\n",
735                         cap->nonleaf.sched_n_children_max,
736                         cap->nonleaf.sched_sp_n_priorities_max,
737                         cap->nonleaf.sched_wfq_n_children_per_group_max,
738                         cap->nonleaf.sched_wfq_n_groups_max,
739                         cap->nonleaf.sched_wfq_weight_max);
740         } else {
741                 printf("\t  -- leaf cman support:\n"
742                         "\t\t  + wred pkt mode (%d)\n"
743                         "\t\t  + wred byte mode (%d)\n"
744                         "\t\t  + head drop (%d)\n"
745                         "\t\t  + wred context private (%d)\n"
746                         "\t\t  + wred context shared (%u)\n",
747                         cap->leaf.cman_wred_packet_mode_supported,
748                         cap->leaf.cman_wred_byte_mode_supported,
749                         cap->leaf.cman_head_drop_supported,
750                         cap->leaf.cman_wred_context_private_supported,
751                         cap->leaf.cman_wred_context_shared_n_max);
752         }
753 }
754
755 static void
756 display_levelcap_info(int is_leaf, struct rte_tm_level_capabilities *cap)
757 {
758         if (cap == NULL)
759                 return;
760
761         if (!is_leaf) {
762                 printf("\t  -- shaper private: (%d) dual rate (%d)\n",
763                         cap->nonleaf.shaper_private_supported,
764                         cap->nonleaf.shaper_private_dual_rate_supported);
765                 printf("\t  -- shaper share: (%u)\n",
766                         cap->nonleaf.shaper_shared_n_max);
767                 printf("\t  -- non leaf sched MAX:\n"
768                         "\t\t  + children (%u)\n"
769                         "\t\t  + sp (%u)\n"
770                         "\t\t  + wfq children per group (%u)\n"
771                         "\t\t  + wfq groups (%u)\n"
772                         "\t\t  + wfq weight (%u)\n",
773                         cap->nonleaf.sched_n_children_max,
774                         cap->nonleaf.sched_sp_n_priorities_max,
775                         cap->nonleaf.sched_wfq_n_children_per_group_max,
776                         cap->nonleaf.sched_wfq_n_groups_max,
777                         cap->nonleaf.sched_wfq_weight_max);
778         } else {
779                 printf("\t  -- shaper private: (%d) dual rate (%d)\n",
780                         cap->leaf.shaper_private_supported,
781                         cap->leaf.shaper_private_dual_rate_supported);
782                 printf("\t  -- shaper share: (%u)\n",
783                         cap->leaf.shaper_shared_n_max);
784                 printf("  -- leaf cman support:\n"
785                         "\t\t  + wred pkt mode (%d)\n"
786                         "\t\t  + wred byte mode (%d)\n"
787                         "\t\t  + head drop (%d)\n"
788                         "\t\t  + wred context private (%d)\n"
789                         "\t\t  + wred context shared (%u)\n",
790                         cap->leaf.cman_wred_packet_mode_supported,
791                         cap->leaf.cman_wred_byte_mode_supported,
792                         cap->leaf.cman_head_drop_supported,
793                         cap->leaf.cman_wred_context_private_supported,
794                         cap->leaf.cman_wred_context_shared_n_max);
795         }
796 }
797
798 static void
799 show_tm(void)
800 {
801         int ret = 0, check_for_leaf = 0, is_leaf = 0;
802         unsigned int j, k;
803         uint16_t i = 0;
804
805         snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD %"PRIu64,
806                         rte_get_tsc_hz());
807         STATS_BDR_STR(10, bdr_str);
808
809         RTE_ETH_FOREACH_DEV(i) {
810                 struct rte_eth_dev_info dev_info;
811                 struct rte_tm_capabilities cap;
812                 struct rte_tm_error error;
813                 struct rte_tm_node_capabilities capnode;
814                 struct rte_tm_level_capabilities caplevel;
815                 uint32_t n_leaf_nodes = 0;
816
817                 memset(&cap, 0, sizeof(cap));
818                 memset(&error, 0, sizeof(error));
819
820                 rte_eth_dev_info_get(i, &dev_info);
821                 printf("  - Generic for port (%u)\n"
822                         "\t  -- driver name %s\n"
823                         "\t  -- max vf (%u)\n"
824                         "\t  -- max tx queues (%u)\n"
825                         "\t  -- number of tx queues (%u)\n",
826                         i,
827                         dev_info.driver_name,
828                         dev_info.max_vfs,
829                         dev_info.max_tx_queues,
830                         dev_info.nb_tx_queues);
831
832                 ret = rte_tm_capabilities_get(i, &cap, &error);
833                 if (ret)
834                         continue;
835
836                 printf("  - MAX: nodes (%u) levels (%u) children (%u)\n",
837                         cap.n_nodes_max,
838                         cap.n_levels_max,
839                         cap.sched_n_children_max);
840
841                 printf("  - identical nodes: non leaf (%d) leaf (%d)\n",
842                         cap.non_leaf_nodes_identical,
843                         cap.leaf_nodes_identical);
844
845                 printf("  - Shaper MAX:\n"
846                         "\t  -- total (%u)\n"
847                         "\t  -- private (%u) private dual (%d)\n"
848                         "\t  -- shared (%u) shared dual (%u)\n",
849                         cap.shaper_n_max,
850                         cap.shaper_private_n_max,
851                         cap.shaper_private_dual_rate_n_max,
852                         cap.shaper_shared_n_max,
853                         cap.shaper_shared_dual_rate_n_max);
854
855                 printf("  - mark support:\n");
856                 printf("\t  -- vlan dei: GREEN (%d) YELLOW (%d) RED (%d)\n",
857                         cap.mark_vlan_dei_supported[RTE_TM_GREEN],
858                         cap.mark_vlan_dei_supported[RTE_TM_YELLOW],
859                         cap.mark_vlan_dei_supported[RTE_TM_RED]);
860                 printf("\t  -- ip ecn tcp: GREEN (%d) YELLOW (%d) RED (%d)\n",
861                         cap.mark_ip_ecn_tcp_supported[RTE_TM_GREEN],
862                         cap.mark_ip_ecn_tcp_supported[RTE_TM_YELLOW],
863                         cap.mark_ip_ecn_tcp_supported[RTE_TM_RED]);
864                 printf("\t  -- ip ecn sctp: GREEN (%d) YELLOW (%d) RED (%d)\n",
865                         cap.mark_ip_ecn_sctp_supported[RTE_TM_GREEN],
866                         cap.mark_ip_ecn_sctp_supported[RTE_TM_YELLOW],
867                         cap.mark_ip_ecn_sctp_supported[RTE_TM_RED]);
868                 printf("\t  -- ip dscp: GREEN (%d) YELLOW (%d) RED (%d)\n",
869                         cap.mark_ip_dscp_supported[RTE_TM_GREEN],
870                         cap.mark_ip_dscp_supported[RTE_TM_YELLOW],
871                         cap.mark_ip_dscp_supported[RTE_TM_RED]);
872
873                 printf("  - mask stats (0x%"PRIx64")"
874                         " dynamic update (0x%"PRIx64")\n",
875                         cap.stats_mask,
876                         cap.dynamic_update_mask);
877
878                 printf("  - sched MAX:\n"
879                         "\t  -- total (%u)\n"
880                         "\t  -- sp levels (%u)\n"
881                         "\t  -- wfq children per group (%u)\n"
882                         "\t  -- wfq groups (%u)\n"
883                         "\t  -- wfq weight (%u)\n",
884                         cap.sched_sp_n_priorities_max,
885                         cap.sched_sp_n_priorities_max,
886                         cap.sched_wfq_n_children_per_group_max,
887                         cap.sched_wfq_n_groups_max,
888                         cap.sched_wfq_weight_max);
889
890                 printf("  - CMAN support:\n"
891                         "\t  -- WRED mode: pkt (%d) byte (%d)\n"
892                         "\t  -- head drop (%d)\n",
893                         cap.cman_wred_packet_mode_supported,
894                         cap.cman_wred_byte_mode_supported,
895                         cap.cman_head_drop_supported);
896                 printf("\t  -- MAX WRED CONTEXT:"
897                         " total (%u) private (%u) shared (%u)\n",
898                         cap.cman_wred_context_n_max,
899                         cap.cman_wred_context_private_n_max,
900                         cap.cman_wred_context_shared_n_max);
901
902                 for (j = 0; j < cap.n_nodes_max; j++) {
903                         memset(&capnode, 0, sizeof(capnode));
904                         ret = rte_tm_node_capabilities_get(i, j,
905                                         &capnode, &error);
906                         if (ret)
907                                 continue;
908
909                         check_for_leaf = 1;
910
911                         printf("  NODE %u\n", j);
912                         printf("\t  - shaper private: (%d) dual rate (%d)\n",
913                                 capnode.shaper_private_supported,
914                                 capnode.shaper_private_dual_rate_supported);
915                         printf("\t  - shaper shared max: (%u)\n",
916                                 capnode.shaper_shared_n_max);
917                         printf("\t  - stats mask %"PRIx64"\n",
918                                 capnode.stats_mask);
919
920                         ret = rte_tm_node_type_get(i, j, &is_leaf, &error);
921                         if (ret)
922                                 continue;
923
924                         display_nodecap_info(is_leaf, &capnode);
925                 }
926
927                 for (j = 0; j < cap.n_levels_max; j++) {
928                         memset(&caplevel, 0, sizeof(caplevel));
929                         ret = rte_tm_level_capabilities_get(i, j,
930                                         &caplevel, &error);
931                         if (ret)
932                                 continue;
933
934                         printf("  - Level %u\n", j);
935                         printf("\t  -- node MAX: %u non leaf %u leaf %u\n",
936                                 caplevel.n_nodes_max,
937                                 caplevel.n_nodes_nonleaf_max,
938                                 caplevel.n_nodes_leaf_max);
939                         printf("\t  -- indetical: non leaf %u leaf %u\n",
940                                 caplevel.non_leaf_nodes_identical,
941                                 caplevel.leaf_nodes_identical);
942
943                         for (k = 0; k < caplevel.n_nodes_max; k++) {
944                                 ret = rte_tm_node_type_get(i, k,
945                                         &is_leaf, &error);
946                                 if (ret)
947                                         continue;
948
949                                 display_levelcap_info(is_leaf, &caplevel);
950                         }
951                 }
952
953                 if (check_for_leaf) {
954                         ret = rte_tm_get_number_of_leaf_nodes(i,
955                                         &n_leaf_nodes, &error);
956                         if (ret == 0)
957                                 printf("  - leaf nodes (%u)\n", n_leaf_nodes);
958                 }
959
960                 for (j = 0; j < n_leaf_nodes; j++) {
961                         struct rte_tm_node_stats stats;
962                         memset(&stats, 0, sizeof(stats));
963
964                         ret = rte_tm_node_stats_read(i, j,
965                                         &stats, &cap.stats_mask, 0, &error);
966                         if (ret)
967                                 continue;
968
969                         printf("  - STATS for node (%u)\n", j);
970                         printf("  -- pkts (%"PRIu64") bytes (%"PRIu64")\n",
971                                 stats.n_pkts, stats.n_bytes);
972
973                         ret = rte_tm_node_type_get(i, j, &is_leaf, &error);
974                         if (ret || (!is_leaf))
975                                 continue;
976
977                         printf("  -- leaf queued:"
978                                 " pkts (%"PRIu64") bytes (%"PRIu64")\n",
979                                 stats.leaf.n_pkts_queued,
980                                 stats.leaf.n_bytes_queued);
981                         printf("  - dropped:\n"
982                                 "\t  -- GREEN:"
983                                 " pkts (%"PRIu64") bytes (%"PRIu64")\n"
984                                 "\t  -- YELLOW:"
985                                 " pkts (%"PRIu64") bytes (%"PRIu64")\n"
986                                 "\t  -- RED:"
987                                 " pkts (%"PRIu64") bytes (%"PRIu64")\n",
988                                 stats.leaf.n_pkts_dropped[RTE_TM_GREEN],
989                                 stats.leaf.n_bytes_dropped[RTE_TM_GREEN],
990                                 stats.leaf.n_pkts_dropped[RTE_TM_YELLOW],
991                                 stats.leaf.n_bytes_dropped[RTE_TM_YELLOW],
992                                 stats.leaf.n_pkts_dropped[RTE_TM_RED],
993                                 stats.leaf.n_bytes_dropped[RTE_TM_RED]);
994                 }
995         }
996
997         STATS_BDR_STR(50, "");
998 }
999
1000 static void
1001 display_crypto_feature_info(uint64_t x)
1002 {
1003         if (x == 0)
1004                 return;
1005
1006         printf("\t  -- feature flags\n");
1007         printf("\t\t  + symmetric (%c), asymmetric (%c)\n"
1008                 "\t\t  + symmetric operation chaining (%c)\n",
1009                 (x & RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO) ? 'y' : 'n',
1010                 (x & RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO) ? 'y' : 'n',
1011                 (x & RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING) ? 'y' : 'n');
1012         printf("\t\t  + CPU: SSE (%c), AVX (%c), AVX2 (%c), AVX512 (%c)\n",
1013                 (x & RTE_CRYPTODEV_FF_CPU_SSE) ? 'y' : 'n',
1014                 (x & RTE_CRYPTODEV_FF_CPU_AVX) ? 'y' : 'n',
1015                 (x & RTE_CRYPTODEV_FF_CPU_AVX2) ? 'y' : 'n',
1016                 (x & RTE_CRYPTODEV_FF_CPU_AVX512) ? 'y' : 'n');
1017         printf("\t\t  + AESNI: CPU (%c), HW (%c)\n",
1018                 (x & RTE_CRYPTODEV_FF_CPU_AESNI) ? 'y' : 'n',
1019                 (x & RTE_CRYPTODEV_FF_HW_ACCELERATED) ? 'y' : 'n');
1020         printf("\t\t  + INLINE (%c)\n",
1021                 (x & RTE_CRYPTODEV_FF_SECURITY) ? 'y' : 'n');
1022         printf("\t\t  + ARM: NEON (%c), CE (%c)\n",
1023                 (x & RTE_CRYPTODEV_FF_CPU_NEON) ? 'y' : 'n',
1024                 (x & RTE_CRYPTODEV_FF_CPU_ARM_CE) ? 'y' : 'n');
1025         printf("\t  -- buffer offload\n");
1026         printf("\t\t  + IN_PLACE_SGL (%c)\n",
1027                 (x & RTE_CRYPTODEV_FF_IN_PLACE_SGL) ? 'y' : 'n');
1028         printf("\t\t  + OOP_SGL_IN_SGL_OUT (%c)\n",
1029                 (x & RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT) ? 'y' : 'n');
1030         printf("\t\t  + OOP_SGL_IN_LB_OUT (%c)\n",
1031                 (x & RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT) ? 'y' : 'n');
1032         printf("\t\t  + OOP_LB_IN_SGL_OUT (%c)\n",
1033                 (x & RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT) ? 'y' : 'n');
1034         printf("\t\t  + OOP_LB_IN_LB_OUT (%c)\n",
1035                 (x & RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT) ? 'y' : 'n');
1036 }
1037
1038 static void
1039 show_crypto(void)
1040 {
1041         uint8_t crypto_dev_count = rte_cryptodev_count(), i;
1042
1043         snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD %"PRIu64,
1044                         rte_get_tsc_hz());
1045         STATS_BDR_STR(10, bdr_str);
1046
1047         for (i = 0; i < crypto_dev_count; i++) {
1048                 struct rte_cryptodev_info dev_info;
1049                 struct rte_cryptodev_stats stats;
1050
1051                 rte_cryptodev_info_get(i, &dev_info);
1052
1053                 printf("  - device (%u)\n", i);
1054                 printf("\t  -- name (%s)\n"
1055                         "\t  -- driver (%s)\n"
1056                         "\t  -- id (%u) on socket (%d)\n"
1057                         "\t  -- queue pairs (%d)\n",
1058                         rte_cryptodev_name_get(i),
1059                         dev_info.driver_name,
1060                         dev_info.driver_id,
1061                         dev_info.device->numa_node,
1062                         rte_cryptodev_queue_pair_count(i));
1063
1064                 display_crypto_feature_info(dev_info.feature_flags);
1065
1066                 memset(&stats, 0, sizeof(0));
1067                 if (rte_cryptodev_stats_get(i, &stats) == 0) {
1068                         printf("\t  -- stats\n");
1069                         printf("\t\t  + enqueue count (%"PRIu64")"
1070                                 " error (%"PRIu64")\n",
1071                                 stats.enqueued_count,
1072                                 stats.enqueue_err_count);
1073                         printf("\t\t  + dequeue count (%"PRIu64")"
1074                                 " error (%"PRIu64")\n",
1075                                 stats.dequeued_count,
1076                                 stats.dequeue_err_count);
1077                 }
1078         }
1079
1080         STATS_BDR_STR(50, "");
1081 }
1082
1083 static void
1084 show_ring(char *name)
1085 {
1086         snprintf(bdr_str, MAX_STRING_LEN, " show - RING %"PRIu64,
1087                         rte_get_tsc_hz());
1088         STATS_BDR_STR(10, bdr_str);
1089
1090         if (name != NULL) {
1091                 struct rte_ring *ptr = rte_ring_lookup(name);
1092                 if (ptr != NULL) {
1093                         printf("  - Name (%s) on socket (%d)\n"
1094                                 "  - flags:\n"
1095                                 "\t  -- Single Producer Enqueue (%u)\n"
1096                                 "\t  -- Single Consmer Dequeue (%u)\n",
1097                                 ptr->name,
1098                                 ptr->memzone->socket_id,
1099                                 ptr->flags & RING_F_SP_ENQ,
1100                                 ptr->flags & RING_F_SC_DEQ);
1101                         printf("  - size (%u) mask (0x%x) capacity (%u)\n",
1102                                 ptr->size,
1103                                 ptr->mask,
1104                                 ptr->capacity);
1105                         printf("  - count (%u) free count (%u)\n",
1106                                 rte_ring_count(ptr),
1107                                 rte_ring_free_count(ptr));
1108                         printf("  - full (%d) empty (%d)\n",
1109                                 rte_ring_full(ptr),
1110                                 rte_ring_empty(ptr));
1111
1112                         STATS_BDR_STR(50, "");
1113                         return;
1114                 }
1115         }
1116
1117         rte_ring_list_dump(stdout);
1118         STATS_BDR_STR(50, "");
1119 }
1120
1121 int
1122 main(int argc, char **argv)
1123 {
1124         int ret;
1125         int i;
1126         char c_flag[] = "-c1";
1127         char n_flag[] = "-n4";
1128         char mp_flag[] = "--proc-type=secondary";
1129         char *argp[argc + 3];
1130         uint16_t nb_ports;
1131
1132         /* preparse app arguments */
1133         ret = proc_info_preparse_args(argc, argv);
1134         if (ret < 0) {
1135                 printf("Failed to parse arguments\n");
1136                 return -1;
1137         }
1138
1139         argp[0] = argv[0];
1140         argp[1] = c_flag;
1141         argp[2] = n_flag;
1142         argp[3] = mp_flag;
1143
1144         for (i = 1; i < argc; i++)
1145                 argp[i + 3] = argv[i];
1146
1147         argc += 3;
1148
1149         ret = rte_eal_init(argc, argp);
1150         if (ret < 0)
1151                 rte_panic("Cannot init EAL\n");
1152
1153         argc -= ret;
1154         argv += (ret - 3);
1155
1156         if (!rte_eal_primary_proc_alive(NULL))
1157                 rte_exit(EXIT_FAILURE, "No primary DPDK process is running.\n");
1158
1159         /* parse app arguments */
1160         ret = proc_info_parse_args(argc, argv);
1161         if (ret < 0)
1162                 rte_exit(EXIT_FAILURE, "Invalid argument\n");
1163
1164         if (mem_info) {
1165                 meminfo_display();
1166                 return 0;
1167         }
1168
1169         nb_ports = rte_eth_dev_count_avail();
1170         if (nb_ports == 0)
1171                 rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
1172
1173         /* If no port mask was specified*/
1174         if (enabled_port_mask == 0)
1175                 enabled_port_mask = 0xffff;
1176
1177         RTE_ETH_FOREACH_DEV(i) {
1178                 if (enabled_port_mask & (1 << i)) {
1179                         if (enable_stats)
1180                                 nic_stats_display(i);
1181                         else if (enable_xstats)
1182                                 nic_xstats_display(i);
1183                         else if (reset_stats)
1184                                 nic_stats_clear(i);
1185                         else if (reset_xstats)
1186                                 nic_xstats_clear(i);
1187                         else if (enable_xstats_name)
1188                                 nic_xstats_by_name_display(i, xstats_name);
1189                         else if (nb_xstats_ids > 0)
1190                                 nic_xstats_by_ids_display(i, xstats_ids,
1191                                                 nb_xstats_ids);
1192                         else if (enable_metrics)
1193                                 metrics_display(i);
1194                 }
1195         }
1196
1197         /* print port independent stats */
1198         if (enable_metrics)
1199                 metrics_display(RTE_METRICS_GLOBAL);
1200
1201         /* show information for PMD */
1202         if (enable_shw_port)
1203                 show_port();
1204         if (enable_shw_tm)
1205                 show_tm();
1206         if (enable_shw_crypto)
1207                 show_crypto();
1208         if (enable_shw_ring)
1209                 show_ring(ring_name);
1210
1211         ret = rte_eal_cleanup();
1212         if (ret)
1213                 printf("Error from rte_eal_cleanup(), %d\n", ret);
1214
1215         snprintf(bdr_str, MAX_STRING_LEN, " ");
1216         STATS_BDR_STR(50, bdr_str);
1217
1218         return 0;
1219 }