4 * Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * version: DPDK.L.1.2.3-3
40 #include <sys/types.h>
42 #include <sys/queue.h>
47 #include <rte_common.h>
48 #include <rte_byteorder.h>
50 #include <rte_memory.h>
51 #include <rte_memcpy.h>
52 #include <rte_memzone.h>
53 #include <rte_tailq.h>
55 #include <rte_per_lcore.h>
56 #include <rte_launch.h>
57 #include <rte_atomic.h>
58 #include <rte_cycles.h>
59 #include <rte_prefetch.h>
60 #include <rte_lcore.h>
61 #include <rte_per_lcore.h>
62 #include <rte_branch_prediction.h>
63 #include <rte_interrupts.h>
65 #include <rte_random.h>
66 #include <rte_debug.h>
67 #include <rte_ether.h>
68 #include <rte_ethdev.h>
70 #include <rte_mempool.h>
75 #include <rte_string_fns.h>
79 struct app_params app;
81 static const char usage[] =
83 " load_balancer <EAL PARAMS> -- <APP PARAMS> \n"
85 "Application manadatory parameters: \n"
86 " --rx \"(PORT, QUEUE, LCORE), ...\" : List of NIC RX ports and queues \n"
87 " handled by the I/O RX lcores \n"
88 " --tx \"(PORT, LCORE), ...\" : List of NIC TX ports handled by the I/O TX \n"
90 " --w \"LCORE, ...\" : List of the worker lcores \n"
91 " --lpm \"IP / PREFIX => PORT; ...\" : List of LPM rules used by the worker \n"
92 " lcores for packet forwarding \n"
94 "Application optional parameters: \n"
95 " --rsz \"A, B, C, D\" : Ring sizes \n"
96 " A = Size (in number of buffer descriptors) of each of the NIC RX \n"
97 " rings read by the I/O RX lcores (default value is %u) \n"
98 " B = Size (in number of elements) of each of the SW rings used by the\n"
99 " I/O RX lcores to send packets to worker lcores (default value is\n"
101 " C = Size (in number of elements) of each of the SW rings used by the\n"
102 " worker lcores to send packets to I/O TX lcores (default value is\n"
104 " D = Size (in number of buffer descriptors) of each of the NIC TX \n"
105 " rings written by I/O TX lcores (default value is %u) \n"
106 " --bsz \"(A, B), (C, D), (E, F)\" : Burst sizes \n"
107 " A = I/O RX lcore read burst size from NIC RX (default value is %u) \n"
108 " B = I/O RX lcore write burst size to output SW rings (default value \n"
110 " C = Worker lcore read burst size from input SW rings (default value \n"
112 " D = Worker lcore write burst size to output SW rings (default value \n"
114 " E = I/O TX lcore read burst size from input SW rings (default value \n"
116 " F = I/O TX lcore write burst size to NIC TX (default value is %u) \n"
117 " --pos-lb POS : Position of the 1-byte field within the input packet used by\n"
118 " the I/O RX lcores to identify the worker lcore for the current \n"
119 " packet (default value is %u) \n";
122 app_print_usage(void)
125 APP_DEFAULT_NIC_RX_RING_SIZE,
126 APP_DEFAULT_RING_RX_SIZE,
127 APP_DEFAULT_RING_TX_SIZE,
128 APP_DEFAULT_NIC_TX_RING_SIZE,
129 APP_DEFAULT_BURST_SIZE_IO_RX_READ,
130 APP_DEFAULT_BURST_SIZE_IO_RX_WRITE,
131 APP_DEFAULT_BURST_SIZE_WORKER_READ,
132 APP_DEFAULT_BURST_SIZE_WORKER_WRITE,
133 APP_DEFAULT_BURST_SIZE_IO_TX_READ,
134 APP_DEFAULT_BURST_SIZE_IO_TX_WRITE,
135 APP_DEFAULT_IO_RX_LB_POS
139 #ifndef APP_ARG_RX_MAX_CHARS
140 #define APP_ARG_RX_MAX_CHARS 4096
143 #ifndef APP_ARG_RX_MAX_TUPLES
144 #define APP_ARG_RX_MAX_TUPLES 128
148 str_to_unsigned_array(
149 const char *s, size_t sbuflen,
155 char *splits[num_vals];
157 int i, num_splits = 0;
159 /* copy s so we don't modify original string */
160 rte_snprintf(str, sizeof(str), "%s", s);
161 num_splits = rte_strsplit(str, sizeof(str), splits, num_vals, separator);
164 for (i = 0; i < num_splits; i++) {
165 vals[i] = strtoul(splits[i], &endptr, 0);
166 if (errno != 0 || *endptr != '\0')
174 str_to_unsigned_vals(
178 unsigned num_vals, ...)
180 unsigned i, vals[num_vals];
183 num_vals = str_to_unsigned_array(s, sbuflen, separator, num_vals, vals);
185 va_start(ap, num_vals);
186 for (i = 0; i < num_vals; i++) {
187 unsigned *u = va_arg(ap, unsigned *);
195 parse_arg_rx(const char *arg)
197 const char *p0 = arg, *p = arg;
200 if (strnlen(arg, APP_ARG_RX_MAX_CHARS + 1) == APP_ARG_RX_MAX_CHARS + 1) {
205 while ((p = strchr(p0,'(')) != NULL) {
206 struct app_lcore_params *lp;
207 uint32_t port, queue, lcore, i;
209 p0 = strchr(p++, ')');
211 (str_to_unsigned_vals(p, p0 - p, ',', 3, &port, &queue, &lcore) != 3)) {
215 /* Enable port and queue for later initialization */
216 if ((port >= APP_MAX_NIC_PORTS) || (queue >= APP_MAX_RX_QUEUES_PER_NIC_PORT)) {
219 if (app.nic_rx_queue_mask[port][queue] != 0) {
222 app.nic_rx_queue_mask[port][queue] = 1;
224 /* Check and assign (port, queue) to I/O lcore */
225 if (rte_lcore_is_enabled(lcore) == 0) {
229 if (lcore >= APP_MAX_LCORES) {
232 lp = &app.lcore_params[lcore];
233 if (lp->type == e_APP_LCORE_WORKER) {
236 lp->type = e_APP_LCORE_IO;
237 for (i = 0; i < lp->io.rx.n_nic_queues; i ++) {
238 if ((lp->io.rx.nic_queues[i].port == port) &&
239 (lp->io.rx.nic_queues[i].queue == queue)) {
243 if (lp->io.rx.n_nic_queues >= APP_MAX_NIC_RX_QUEUES_PER_IO_LCORE) {
246 lp->io.rx.nic_queues[lp->io.rx.n_nic_queues].port = (uint8_t) port;
247 lp->io.rx.nic_queues[lp->io.rx.n_nic_queues].queue = (uint8_t) queue;
248 lp->io.rx.n_nic_queues ++;
251 if (n_tuples > APP_ARG_RX_MAX_TUPLES) {
263 #ifndef APP_ARG_TX_MAX_CHARS
264 #define APP_ARG_TX_MAX_CHARS 4096
267 #ifndef APP_ARG_TX_MAX_TUPLES
268 #define APP_ARG_TX_MAX_TUPLES 128
272 parse_arg_tx(const char *arg)
274 const char *p0 = arg, *p = arg;
277 if (strnlen(arg, APP_ARG_TX_MAX_CHARS + 1) == APP_ARG_TX_MAX_CHARS + 1) {
282 while ((p = strchr(p0,'(')) != NULL) {
283 struct app_lcore_params *lp;
284 uint32_t port, lcore, i;
286 p0 = strchr(p++, ')');
288 (str_to_unsigned_vals(p, p0 - p, ',', 2, &port, &lcore) != 2)) {
292 /* Enable port and queue for later initialization */
293 if (port >= APP_MAX_NIC_PORTS) {
296 if (app.nic_tx_port_mask[port] != 0) {
299 app.nic_tx_port_mask[port] = 1;
301 /* Check and assign (port, queue) to I/O lcore */
302 if (rte_lcore_is_enabled(lcore) == 0) {
306 if (lcore >= APP_MAX_LCORES) {
309 lp = &app.lcore_params[lcore];
310 if (lp->type == e_APP_LCORE_WORKER) {
313 lp->type = e_APP_LCORE_IO;
314 for (i = 0; i < lp->io.tx.n_nic_ports; i ++) {
315 if (lp->io.tx.nic_ports[i] == port) {
319 if (lp->io.tx.n_nic_ports >= APP_MAX_NIC_TX_PORTS_PER_IO_LCORE) {
322 lp->io.tx.nic_ports[lp->io.tx.n_nic_ports] = (uint8_t) port;
323 lp->io.tx.n_nic_ports ++;
326 if (n_tuples > APP_ARG_TX_MAX_TUPLES) {
338 #ifndef APP_ARG_W_MAX_CHARS
339 #define APP_ARG_W_MAX_CHARS 4096
342 #ifndef APP_ARG_W_MAX_TUPLES
343 #define APP_ARG_W_MAX_TUPLES APP_MAX_WORKER_LCORES
347 parse_arg_w(const char *arg)
352 if (strnlen(arg, APP_ARG_W_MAX_CHARS + 1) == APP_ARG_W_MAX_CHARS + 1) {
358 struct app_lcore_params *lp;
362 lcore = strtoul(p, NULL, 0);
367 /* Check and enable worker lcore */
368 if (rte_lcore_is_enabled(lcore) == 0) {
372 if (lcore >= APP_MAX_LCORES) {
375 lp = &app.lcore_params[lcore];
376 if (lp->type == e_APP_LCORE_IO) {
379 lp->type = e_APP_LCORE_WORKER;
382 if (n_tuples > APP_ARG_W_MAX_TUPLES) {
397 if ((n_tuples & (n_tuples - 1)) != 0) {
404 #ifndef APP_ARG_LPM_MAX_CHARS
405 #define APP_ARG_LPM_MAX_CHARS 4096
409 parse_arg_lpm(const char *arg)
411 const char *p = arg, *p0;
413 if (strnlen(arg, APP_ARG_LPM_MAX_CHARS + 1) == APP_ARG_TX_MAX_CHARS + 1) {
418 uint32_t ip_a, ip_b, ip_c, ip_d, ip, depth, if_out;
423 (str_to_unsigned_vals(p, p0 - p, '.', 4, &ip_a, &ip_b, &ip_c, &ip_d) != 4)) {
429 depth = strtoul(p, &endptr, 0);
430 if (errno != 0 || *endptr != '=') {
437 if_out = strtoul(++p, &endptr, 0);
438 if (errno != 0 || (*endptr != '\0' && *endptr != ';')) {
442 if ((ip_a >= 256) || (ip_b >= 256) || (ip_c >= 256) || (ip_d >= 256) ||
443 (depth == 0) || (depth >= 32) ||
444 (if_out >= APP_MAX_NIC_PORTS)) {
447 ip = (ip_a << 24) | (ip_b << 16) | (ip_c << 8) | ip_d;
449 if (app.n_lpm_rules >= APP_MAX_LPM_RULES) {
452 app.lpm_rules[app.n_lpm_rules].ip = ip;
453 app.lpm_rules[app.n_lpm_rules].depth = (uint8_t) depth;
454 app.lpm_rules[app.n_lpm_rules].if_out = (uint8_t) if_out;
464 if (app.n_lpm_rules == 0) {
472 app_check_lpm_table(void)
476 /* For each rule, check that the output I/F is enabled */
477 for (rule = 0; rule < app.n_lpm_rules; rule ++)
479 uint32_t port = app.lpm_rules[rule].if_out;
481 if (app.nic_tx_port_mask[port] == 0) {
490 app_check_every_rx_port_is_tx_enabled(void)
494 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
495 if ((app_get_nic_rx_queues_per_port(port) > 0) && (app.nic_tx_port_mask[port] == 0)) {
503 #ifndef APP_ARG_RSZ_CHARS
504 #define APP_ARG_RSZ_CHARS 63
508 parse_arg_rsz(const char *arg)
510 if (strnlen(arg, APP_ARG_RSZ_CHARS + 1) == APP_ARG_RSZ_CHARS + 1) {
514 if (str_to_unsigned_vals(arg, APP_ARG_RSZ_CHARS, ',', 4,
515 &app.nic_rx_ring_size,
518 &app.nic_tx_ring_size) != 4)
522 if ((app.nic_rx_ring_size == 0) ||
523 (app.nic_tx_ring_size == 0) ||
524 (app.ring_rx_size == 0) ||
525 (app.ring_tx_size == 0)) {
532 #ifndef APP_ARG_BSZ_CHARS
533 #define APP_ARG_BSZ_CHARS 63
537 parse_arg_bsz(const char *arg)
539 const char *p = arg, *p0;
540 if (strnlen(arg, APP_ARG_BSZ_CHARS + 1) == APP_ARG_BSZ_CHARS + 1) {
544 p0 = strchr(p++, ')');
546 (str_to_unsigned_vals(p, p0 - p, ',', 2, &app.burst_size_io_rx_read, &app.burst_size_io_rx_write) != 2)) {
555 p0 = strchr(p++, ')');
557 (str_to_unsigned_vals(p, p0 - p, ',', 2, &app.burst_size_worker_read, &app.burst_size_worker_write) != 2)) {
566 p0 = strchr(p++, ')');
568 (str_to_unsigned_vals(p, p0 - p, ',', 2, &app.burst_size_io_tx_read, &app.burst_size_io_tx_write) != 2)) {
572 if ((app.burst_size_io_rx_read == 0) ||
573 (app.burst_size_io_rx_write == 0) ||
574 (app.burst_size_worker_read == 0) ||
575 (app.burst_size_worker_write == 0) ||
576 (app.burst_size_io_tx_read == 0) ||
577 (app.burst_size_io_tx_write == 0)) {
581 if ((app.burst_size_io_rx_read > APP_MBUF_ARRAY_SIZE) ||
582 (app.burst_size_io_rx_write > APP_MBUF_ARRAY_SIZE) ||
583 (app.burst_size_worker_read > APP_MBUF_ARRAY_SIZE) ||
584 (app.burst_size_worker_write > APP_MBUF_ARRAY_SIZE) ||
585 ((2 * app.burst_size_io_tx_read) > APP_MBUF_ARRAY_SIZE) ||
586 (app.burst_size_io_tx_write > APP_MBUF_ARRAY_SIZE)) {
593 #ifndef APP_ARG_NUMERICAL_SIZE_CHARS
594 #define APP_ARG_NUMERICAL_SIZE_CHARS 15
598 parse_arg_pos_lb(const char *arg)
603 if (strnlen(arg, APP_ARG_NUMERICAL_SIZE_CHARS + 1) == APP_ARG_NUMERICAL_SIZE_CHARS + 1) {
608 x = strtoul(arg, &endpt, 10);
609 if (errno != 0 || endpt == arg || *endpt != '\0'){
617 app.pos_lb = (uint8_t) x;
622 /* Parse the argument given in the command line of the application */
624 app_parse_args(int argc, char **argv)
629 char *prgname = argv[0];
630 static struct option lgopts[] = {
643 uint32_t arg_lpm = 0;
644 uint32_t arg_rsz = 0;
645 uint32_t arg_bsz = 0;
646 uint32_t arg_pos_lb = 0;
650 while ((opt = getopt_long(argc, argvopt, "",
651 lgopts, &option_index)) != EOF) {
656 if (!strcmp(lgopts[option_index].name, "rx")) {
658 ret = parse_arg_rx(optarg);
660 printf("Incorrect value for --rx argument (%d)\n", ret);
664 if (!strcmp(lgopts[option_index].name, "tx")) {
666 ret = parse_arg_tx(optarg);
668 printf("Incorrect value for --tx argument (%d)\n", ret);
672 if (!strcmp(lgopts[option_index].name, "w")) {
674 ret = parse_arg_w(optarg);
676 printf("Incorrect value for --w argument (%d)\n", ret);
680 if (!strcmp(lgopts[option_index].name, "lpm")) {
682 ret = parse_arg_lpm(optarg);
684 printf("Incorrect value for --lpm argument (%d)\n", ret);
688 if (!strcmp(lgopts[option_index].name, "rsz")) {
690 ret = parse_arg_rsz(optarg);
692 printf("Incorrect value for --rsz argument (%d)\n", ret);
696 if (!strcmp(lgopts[option_index].name, "bsz")) {
698 ret = parse_arg_bsz(optarg);
700 printf("Incorrect value for --bsz argument (%d)\n", ret);
704 if (!strcmp(lgopts[option_index].name, "pos-lb")) {
706 ret = parse_arg_pos_lb(optarg);
708 printf("Incorrect value for --pos-lb argument (%d)\n", ret);
719 /* Check that all mandatory arguments are provided */
720 if ((arg_rx == 0) || (arg_tx == 0) || (arg_w == 0) || (arg_lpm == 0)){
721 printf("Not all mandatory arguments are present\n");
725 /* Assign default values for the optional arguments not provided */
727 app.nic_rx_ring_size = APP_DEFAULT_NIC_RX_RING_SIZE;
728 app.nic_tx_ring_size = APP_DEFAULT_NIC_TX_RING_SIZE;
729 app.ring_rx_size = APP_DEFAULT_RING_RX_SIZE;
730 app.ring_tx_size = APP_DEFAULT_RING_TX_SIZE;
734 app.burst_size_io_rx_read = APP_DEFAULT_BURST_SIZE_IO_RX_READ;
735 app.burst_size_io_rx_write = APP_DEFAULT_BURST_SIZE_IO_RX_WRITE;
736 app.burst_size_io_tx_read = APP_DEFAULT_BURST_SIZE_IO_TX_READ;
737 app.burst_size_io_tx_write = APP_DEFAULT_BURST_SIZE_IO_TX_WRITE;
738 app.burst_size_worker_read = APP_DEFAULT_BURST_SIZE_WORKER_READ;
739 app.burst_size_worker_write = APP_DEFAULT_BURST_SIZE_WORKER_WRITE;
742 if (arg_pos_lb == 0) {
743 app.pos_lb = APP_DEFAULT_IO_RX_LB_POS;
746 /* Check cross-consistency of arguments */
747 if ((ret = app_check_lpm_table()) < 0) {
748 printf("At least one LPM rule is inconsistent (%d)\n", ret);
751 if (app_check_every_rx_port_is_tx_enabled() < 0) {
752 printf("On LPM lookup miss, packet is sent back on the input port.\n");
753 printf("At least one RX port is not enabled for TX.\n");
758 argv[optind - 1] = prgname;
761 optind = 0; /* reset getopt lib */
766 app_get_nic_rx_queues_per_port(uint8_t port)
770 if (port >= APP_MAX_NIC_PORTS) {
775 for (i = 0; i < APP_MAX_RX_QUEUES_PER_NIC_PORT; i ++) {
776 if (app.nic_rx_queue_mask[port][i] == 1) {
785 app_get_lcore_for_nic_rx(uint8_t port, uint8_t queue, uint32_t *lcore_out)
789 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
790 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
793 if (app.lcore_params[lcore].type != e_APP_LCORE_IO) {
797 for (i = 0; i < lp->rx.n_nic_queues; i ++) {
798 if ((lp->rx.nic_queues[i].port == port) &&
799 (lp->rx.nic_queues[i].queue == queue)) {
810 app_get_lcore_for_nic_tx(uint8_t port, uint32_t *lcore_out)
814 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
815 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
818 if (app.lcore_params[lcore].type != e_APP_LCORE_IO) {
822 for (i = 0; i < lp->tx.n_nic_ports; i ++) {
823 if (lp->tx.nic_ports[i] == port) {
834 app_is_socket_used(uint32_t socket)
838 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
839 if (app.lcore_params[lcore].type == e_APP_LCORE_DISABLED) {
843 if (socket == rte_lcore_to_socket_id(lcore)) {
852 app_get_lcores_io_rx(void)
854 uint32_t lcore, count;
857 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
858 struct app_lcore_params_io *lp_io = &app.lcore_params[lcore].io;
860 if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
861 (lp_io->rx.n_nic_queues == 0)) {
872 app_get_lcores_worker(void)
874 uint32_t lcore, count;
877 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
878 if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
885 if (count > APP_MAX_WORKER_LCORES) {
886 rte_panic("Algorithmic error (too many worker lcores)\n");
894 app_print_params(void)
896 uint32_t port, queue, lcore, rule, i, j;
898 /* Print NIC RX configuration */
899 printf("NIC RX ports: ");
900 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
901 uint32_t n_rx_queues = app_get_nic_rx_queues_per_port((uint8_t) port);
903 if (n_rx_queues == 0) {
907 printf("%u (", port);
908 for (queue = 0; queue < APP_MAX_RX_QUEUES_PER_NIC_PORT; queue ++) {
909 if (app.nic_rx_queue_mask[port][queue] == 1) {
910 printf("%u ", queue);
917 /* Print I/O lcore RX params */
918 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
919 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
921 if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
922 (lp->rx.n_nic_queues == 0)) {
926 printf("I/O lcore %u (socket %u): ", lcore, rte_lcore_to_socket_id(lcore));
929 for (i = 0; i < lp->rx.n_nic_queues; i ++) {
931 (uint32_t) lp->rx.nic_queues[i].port,
932 (uint32_t) lp->rx.nic_queues[i].queue);
936 printf("Output rings ");
937 for (i = 0; i < lp->rx.n_rings; i ++) {
938 printf("%p ", lp->rx.rings[i]);
943 /* Print worker lcore RX params */
944 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
945 struct app_lcore_params_worker *lp = &app.lcore_params[lcore].worker;
947 if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
951 printf("Worker lcore %u (socket %u) ID %u: ",
953 rte_lcore_to_socket_id(lcore),
956 printf("Input rings ");
957 for (i = 0; i < lp->n_rings_in; i ++) {
958 printf("%p ", lp->rings_in[i]);
966 /* Print NIC TX configuration */
967 printf("NIC TX ports: ");
968 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
969 if (app.nic_tx_port_mask[port] == 1) {
975 /* Print I/O TX lcore params */
976 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
977 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
978 uint32_t n_workers = app_get_lcores_worker();
980 if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
981 (lp->tx.n_nic_ports == 0)) {
985 printf("I/O lcore %u (socket %u): ", lcore, rte_lcore_to_socket_id(lcore));
987 printf("Input rings per TX port ");
988 for (i = 0; i < lp->tx.n_nic_ports; i ++) {
989 port = lp->tx.nic_ports[i];
991 printf("%u (", port);
992 for (j = 0; j < n_workers; j ++) {
993 printf("%p ", lp->tx.rings[port][j]);
1002 /* Print worker lcore TX params */
1003 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
1004 struct app_lcore_params_worker *lp = &app.lcore_params[lcore].worker;
1006 if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
1010 printf("Worker lcore %u (socket %u) ID %u: \n",
1012 rte_lcore_to_socket_id(lcore),
1015 printf("Output rings per TX port ");
1016 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
1017 if (lp->rings_out[port] != NULL) {
1018 printf("%u (%p) ", port, lp->rings_out[port]);
1025 /* Print LPM rules */
1026 printf("LPM rules: \n");
1027 for (rule = 0; rule < app.n_lpm_rules; rule ++) {
1028 uint32_t ip = app.lpm_rules[rule].ip;
1029 uint8_t depth = app.lpm_rules[rule].depth;
1030 uint8_t if_out = app.lpm_rules[rule].if_out;
1032 printf("\t%u: %u.%u.%u.%u/%u => %u;\n",
1034 (ip & 0xFF000000) >> 24,
1035 (ip & 0x00FF0000) >> 16,
1036 (ip & 0x0000FF00) >> 8,
1044 printf("Ring sizes: NIC RX = %u; Worker in = %u; Worker out = %u; NIC TX = %u;\n",
1045 app.nic_rx_ring_size,
1048 app.nic_tx_ring_size);
1051 printf("Burst sizes: I/O RX (rd = %u, wr = %u); Worker (rd = %u, wr = %u); I/O TX (rd = %u, wr = %u)\n",
1052 app.burst_size_io_rx_read,
1053 app.burst_size_io_rx_write,
1054 app.burst_size_worker_read,
1055 app.burst_size_worker_write,
1056 app.burst_size_io_tx_read,
1057 app.burst_size_io_tx_write);