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.
39 #include <sys/types.h>
41 #include <sys/queue.h>
46 #include <rte_common.h>
47 #include <rte_byteorder.h>
49 #include <rte_memory.h>
50 #include <rte_memcpy.h>
51 #include <rte_memzone.h>
52 #include <rte_tailq.h>
54 #include <rte_per_lcore.h>
55 #include <rte_launch.h>
56 #include <rte_atomic.h>
57 #include <rte_cycles.h>
58 #include <rte_prefetch.h>
59 #include <rte_lcore.h>
60 #include <rte_per_lcore.h>
61 #include <rte_branch_prediction.h>
62 #include <rte_interrupts.h>
64 #include <rte_random.h>
65 #include <rte_debug.h>
66 #include <rte_ether.h>
67 #include <rte_ethdev.h>
69 #include <rte_mempool.h>
74 #include <rte_string_fns.h>
78 struct app_params app;
80 static const char usage[] =
82 " load_balancer <EAL PARAMS> -- <APP PARAMS> \n"
84 "Application manadatory parameters: \n"
85 " --rx \"(PORT, QUEUE, LCORE), ...\" : List of NIC RX ports and queues \n"
86 " handled by the I/O RX lcores \n"
87 " --tx \"(PORT, LCORE), ...\" : List of NIC TX ports handled by the I/O TX \n"
89 " --w \"LCORE, ...\" : List of the worker lcores \n"
90 " --lpm \"IP / PREFIX => PORT; ...\" : List of LPM rules used by the worker \n"
91 " lcores for packet forwarding \n"
93 "Application optional parameters: \n"
94 " --rsz \"A, B, C, D\" : Ring sizes \n"
95 " A = Size (in number of buffer descriptors) of each of the NIC RX \n"
96 " rings read by the I/O RX lcores (default value is %u) \n"
97 " B = Size (in number of elements) of each of the SW rings used by the\n"
98 " I/O RX lcores to send packets to worker lcores (default value is\n"
100 " C = Size (in number of elements) of each of the SW rings used by the\n"
101 " worker lcores to send packets to I/O TX lcores (default value is\n"
103 " D = Size (in number of buffer descriptors) of each of the NIC TX \n"
104 " rings written by I/O TX lcores (default value is %u) \n"
105 " --bsz \"(A, B), (C, D), (E, F)\" : Burst sizes \n"
106 " A = I/O RX lcore read burst size from NIC RX (default value is %u) \n"
107 " B = I/O RX lcore write burst size to output SW rings (default value \n"
109 " C = Worker lcore read burst size from input SW rings (default value \n"
111 " D = Worker lcore write burst size to output SW rings (default value \n"
113 " E = I/O TX lcore read burst size from input SW rings (default value \n"
115 " F = I/O TX lcore write burst size to NIC TX (default value is %u) \n"
116 " --pos-lb POS : Position of the 1-byte field within the input packet used by\n"
117 " the I/O RX lcores to identify the worker lcore for the current \n"
118 " packet (default value is %u) \n";
121 app_print_usage(void)
124 APP_DEFAULT_NIC_RX_RING_SIZE,
125 APP_DEFAULT_RING_RX_SIZE,
126 APP_DEFAULT_RING_TX_SIZE,
127 APP_DEFAULT_NIC_TX_RING_SIZE,
128 APP_DEFAULT_BURST_SIZE_IO_RX_READ,
129 APP_DEFAULT_BURST_SIZE_IO_RX_WRITE,
130 APP_DEFAULT_BURST_SIZE_WORKER_READ,
131 APP_DEFAULT_BURST_SIZE_WORKER_WRITE,
132 APP_DEFAULT_BURST_SIZE_IO_TX_READ,
133 APP_DEFAULT_BURST_SIZE_IO_TX_WRITE,
134 APP_DEFAULT_IO_RX_LB_POS
138 #ifndef APP_ARG_RX_MAX_CHARS
139 #define APP_ARG_RX_MAX_CHARS 4096
142 #ifndef APP_ARG_RX_MAX_TUPLES
143 #define APP_ARG_RX_MAX_TUPLES 128
147 str_to_unsigned_array(
148 const char *s, size_t sbuflen,
154 char *splits[num_vals];
156 int i, num_splits = 0;
158 /* copy s so we don't modify original string */
159 rte_snprintf(str, sizeof(str), "%s", s);
160 num_splits = rte_strsplit(str, sizeof(str), splits, num_vals, separator);
163 for (i = 0; i < num_splits; i++) {
164 vals[i] = strtoul(splits[i], &endptr, 0);
165 if (errno != 0 || *endptr != '\0')
173 str_to_unsigned_vals(
177 unsigned num_vals, ...)
179 unsigned i, vals[num_vals];
182 num_vals = str_to_unsigned_array(s, sbuflen, separator, num_vals, vals);
184 va_start(ap, num_vals);
185 for (i = 0; i < num_vals; i++) {
186 unsigned *u = va_arg(ap, unsigned *);
194 parse_arg_rx(const char *arg)
196 const char *p0 = arg, *p = arg;
199 if (strnlen(arg, APP_ARG_RX_MAX_CHARS + 1) == APP_ARG_RX_MAX_CHARS + 1) {
204 while ((p = strchr(p0,'(')) != NULL) {
205 struct app_lcore_params *lp;
206 uint32_t port, queue, lcore, i;
208 p0 = strchr(p++, ')');
210 (str_to_unsigned_vals(p, p0 - p, ',', 3, &port, &queue, &lcore) != 3)) {
214 /* Enable port and queue for later initialization */
215 if ((port >= APP_MAX_NIC_PORTS) || (queue >= APP_MAX_RX_QUEUES_PER_NIC_PORT)) {
218 if (app.nic_rx_queue_mask[port][queue] != 0) {
221 app.nic_rx_queue_mask[port][queue] = 1;
223 /* Check and assign (port, queue) to I/O lcore */
224 if (rte_lcore_is_enabled(lcore) == 0) {
228 if (lcore >= APP_MAX_LCORES) {
231 lp = &app.lcore_params[lcore];
232 if (lp->type == e_APP_LCORE_WORKER) {
235 lp->type = e_APP_LCORE_IO;
236 for (i = 0; i < lp->io.rx.n_nic_queues; i ++) {
237 if ((lp->io.rx.nic_queues[i].port == port) &&
238 (lp->io.rx.nic_queues[i].queue == queue)) {
242 if (lp->io.rx.n_nic_queues >= APP_MAX_NIC_RX_QUEUES_PER_IO_LCORE) {
245 lp->io.rx.nic_queues[lp->io.rx.n_nic_queues].port = (uint8_t) port;
246 lp->io.rx.nic_queues[lp->io.rx.n_nic_queues].queue = (uint8_t) queue;
247 lp->io.rx.n_nic_queues ++;
250 if (n_tuples > APP_ARG_RX_MAX_TUPLES) {
262 #ifndef APP_ARG_TX_MAX_CHARS
263 #define APP_ARG_TX_MAX_CHARS 4096
266 #ifndef APP_ARG_TX_MAX_TUPLES
267 #define APP_ARG_TX_MAX_TUPLES 128
271 parse_arg_tx(const char *arg)
273 const char *p0 = arg, *p = arg;
276 if (strnlen(arg, APP_ARG_TX_MAX_CHARS + 1) == APP_ARG_TX_MAX_CHARS + 1) {
281 while ((p = strchr(p0,'(')) != NULL) {
282 struct app_lcore_params *lp;
283 uint32_t port, lcore, i;
285 p0 = strchr(p++, ')');
287 (str_to_unsigned_vals(p, p0 - p, ',', 2, &port, &lcore) != 2)) {
291 /* Enable port and queue for later initialization */
292 if (port >= APP_MAX_NIC_PORTS) {
295 if (app.nic_tx_port_mask[port] != 0) {
298 app.nic_tx_port_mask[port] = 1;
300 /* Check and assign (port, queue) to I/O lcore */
301 if (rte_lcore_is_enabled(lcore) == 0) {
305 if (lcore >= APP_MAX_LCORES) {
308 lp = &app.lcore_params[lcore];
309 if (lp->type == e_APP_LCORE_WORKER) {
312 lp->type = e_APP_LCORE_IO;
313 for (i = 0; i < lp->io.tx.n_nic_ports; i ++) {
314 if (lp->io.tx.nic_ports[i] == port) {
318 if (lp->io.tx.n_nic_ports >= APP_MAX_NIC_TX_PORTS_PER_IO_LCORE) {
321 lp->io.tx.nic_ports[lp->io.tx.n_nic_ports] = (uint8_t) port;
322 lp->io.tx.n_nic_ports ++;
325 if (n_tuples > APP_ARG_TX_MAX_TUPLES) {
337 #ifndef APP_ARG_W_MAX_CHARS
338 #define APP_ARG_W_MAX_CHARS 4096
341 #ifndef APP_ARG_W_MAX_TUPLES
342 #define APP_ARG_W_MAX_TUPLES APP_MAX_WORKER_LCORES
346 parse_arg_w(const char *arg)
351 if (strnlen(arg, APP_ARG_W_MAX_CHARS + 1) == APP_ARG_W_MAX_CHARS + 1) {
357 struct app_lcore_params *lp;
361 lcore = strtoul(p, NULL, 0);
366 /* Check and enable worker lcore */
367 if (rte_lcore_is_enabled(lcore) == 0) {
371 if (lcore >= APP_MAX_LCORES) {
374 lp = &app.lcore_params[lcore];
375 if (lp->type == e_APP_LCORE_IO) {
378 lp->type = e_APP_LCORE_WORKER;
381 if (n_tuples > APP_ARG_W_MAX_TUPLES) {
396 if ((n_tuples & (n_tuples - 1)) != 0) {
403 #ifndef APP_ARG_LPM_MAX_CHARS
404 #define APP_ARG_LPM_MAX_CHARS 4096
408 parse_arg_lpm(const char *arg)
410 const char *p = arg, *p0;
412 if (strnlen(arg, APP_ARG_LPM_MAX_CHARS + 1) == APP_ARG_TX_MAX_CHARS + 1) {
417 uint32_t ip_a, ip_b, ip_c, ip_d, ip, depth, if_out;
422 (str_to_unsigned_vals(p, p0 - p, '.', 4, &ip_a, &ip_b, &ip_c, &ip_d) != 4)) {
428 depth = strtoul(p, &endptr, 0);
429 if (errno != 0 || *endptr != '=') {
436 if_out = strtoul(++p, &endptr, 0);
437 if (errno != 0 || (*endptr != '\0' && *endptr != ';')) {
441 if ((ip_a >= 256) || (ip_b >= 256) || (ip_c >= 256) || (ip_d >= 256) ||
442 (depth == 0) || (depth >= 32) ||
443 (if_out >= APP_MAX_NIC_PORTS)) {
446 ip = (ip_a << 24) | (ip_b << 16) | (ip_c << 8) | ip_d;
448 if (app.n_lpm_rules >= APP_MAX_LPM_RULES) {
451 app.lpm_rules[app.n_lpm_rules].ip = ip;
452 app.lpm_rules[app.n_lpm_rules].depth = (uint8_t) depth;
453 app.lpm_rules[app.n_lpm_rules].if_out = (uint8_t) if_out;
463 if (app.n_lpm_rules == 0) {
471 app_check_lpm_table(void)
475 /* For each rule, check that the output I/F is enabled */
476 for (rule = 0; rule < app.n_lpm_rules; rule ++)
478 uint32_t port = app.lpm_rules[rule].if_out;
480 if (app.nic_tx_port_mask[port] == 0) {
489 app_check_every_rx_port_is_tx_enabled(void)
493 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
494 if ((app_get_nic_rx_queues_per_port(port) > 0) && (app.nic_tx_port_mask[port] == 0)) {
502 #ifndef APP_ARG_RSZ_CHARS
503 #define APP_ARG_RSZ_CHARS 63
507 parse_arg_rsz(const char *arg)
509 if (strnlen(arg, APP_ARG_RSZ_CHARS + 1) == APP_ARG_RSZ_CHARS + 1) {
513 if (str_to_unsigned_vals(arg, APP_ARG_RSZ_CHARS, ',', 4,
514 &app.nic_rx_ring_size,
517 &app.nic_tx_ring_size) != 4)
521 if ((app.nic_rx_ring_size == 0) ||
522 (app.nic_tx_ring_size == 0) ||
523 (app.ring_rx_size == 0) ||
524 (app.ring_tx_size == 0)) {
531 #ifndef APP_ARG_BSZ_CHARS
532 #define APP_ARG_BSZ_CHARS 63
536 parse_arg_bsz(const char *arg)
538 const char *p = arg, *p0;
539 if (strnlen(arg, APP_ARG_BSZ_CHARS + 1) == APP_ARG_BSZ_CHARS + 1) {
543 p0 = strchr(p++, ')');
545 (str_to_unsigned_vals(p, p0 - p, ',', 2, &app.burst_size_io_rx_read, &app.burst_size_io_rx_write) != 2)) {
554 p0 = strchr(p++, ')');
556 (str_to_unsigned_vals(p, p0 - p, ',', 2, &app.burst_size_worker_read, &app.burst_size_worker_write) != 2)) {
565 p0 = strchr(p++, ')');
567 (str_to_unsigned_vals(p, p0 - p, ',', 2, &app.burst_size_io_tx_read, &app.burst_size_io_tx_write) != 2)) {
571 if ((app.burst_size_io_rx_read == 0) ||
572 (app.burst_size_io_rx_write == 0) ||
573 (app.burst_size_worker_read == 0) ||
574 (app.burst_size_worker_write == 0) ||
575 (app.burst_size_io_tx_read == 0) ||
576 (app.burst_size_io_tx_write == 0)) {
580 if ((app.burst_size_io_rx_read > APP_MBUF_ARRAY_SIZE) ||
581 (app.burst_size_io_rx_write > APP_MBUF_ARRAY_SIZE) ||
582 (app.burst_size_worker_read > APP_MBUF_ARRAY_SIZE) ||
583 (app.burst_size_worker_write > APP_MBUF_ARRAY_SIZE) ||
584 ((2 * app.burst_size_io_tx_read) > APP_MBUF_ARRAY_SIZE) ||
585 (app.burst_size_io_tx_write > APP_MBUF_ARRAY_SIZE)) {
592 #ifndef APP_ARG_NUMERICAL_SIZE_CHARS
593 #define APP_ARG_NUMERICAL_SIZE_CHARS 15
597 parse_arg_pos_lb(const char *arg)
602 if (strnlen(arg, APP_ARG_NUMERICAL_SIZE_CHARS + 1) == APP_ARG_NUMERICAL_SIZE_CHARS + 1) {
607 x = strtoul(arg, &endpt, 10);
608 if (errno != 0 || endpt == arg || *endpt != '\0'){
616 app.pos_lb = (uint8_t) x;
621 /* Parse the argument given in the command line of the application */
623 app_parse_args(int argc, char **argv)
628 char *prgname = argv[0];
629 static struct option lgopts[] = {
642 uint32_t arg_lpm = 0;
643 uint32_t arg_rsz = 0;
644 uint32_t arg_bsz = 0;
645 uint32_t arg_pos_lb = 0;
649 while ((opt = getopt_long(argc, argvopt, "",
650 lgopts, &option_index)) != EOF) {
655 if (!strcmp(lgopts[option_index].name, "rx")) {
657 ret = parse_arg_rx(optarg);
659 printf("Incorrect value for --rx argument (%d)\n", ret);
663 if (!strcmp(lgopts[option_index].name, "tx")) {
665 ret = parse_arg_tx(optarg);
667 printf("Incorrect value for --tx argument (%d)\n", ret);
671 if (!strcmp(lgopts[option_index].name, "w")) {
673 ret = parse_arg_w(optarg);
675 printf("Incorrect value for --w argument (%d)\n", ret);
679 if (!strcmp(lgopts[option_index].name, "lpm")) {
681 ret = parse_arg_lpm(optarg);
683 printf("Incorrect value for --lpm argument (%d)\n", ret);
687 if (!strcmp(lgopts[option_index].name, "rsz")) {
689 ret = parse_arg_rsz(optarg);
691 printf("Incorrect value for --rsz argument (%d)\n", ret);
695 if (!strcmp(lgopts[option_index].name, "bsz")) {
697 ret = parse_arg_bsz(optarg);
699 printf("Incorrect value for --bsz argument (%d)\n", ret);
703 if (!strcmp(lgopts[option_index].name, "pos-lb")) {
705 ret = parse_arg_pos_lb(optarg);
707 printf("Incorrect value for --pos-lb argument (%d)\n", ret);
718 /* Check that all mandatory arguments are provided */
719 if ((arg_rx == 0) || (arg_tx == 0) || (arg_w == 0) || (arg_lpm == 0)){
720 printf("Not all mandatory arguments are present\n");
724 /* Assign default values for the optional arguments not provided */
726 app.nic_rx_ring_size = APP_DEFAULT_NIC_RX_RING_SIZE;
727 app.nic_tx_ring_size = APP_DEFAULT_NIC_TX_RING_SIZE;
728 app.ring_rx_size = APP_DEFAULT_RING_RX_SIZE;
729 app.ring_tx_size = APP_DEFAULT_RING_TX_SIZE;
733 app.burst_size_io_rx_read = APP_DEFAULT_BURST_SIZE_IO_RX_READ;
734 app.burst_size_io_rx_write = APP_DEFAULT_BURST_SIZE_IO_RX_WRITE;
735 app.burst_size_io_tx_read = APP_DEFAULT_BURST_SIZE_IO_TX_READ;
736 app.burst_size_io_tx_write = APP_DEFAULT_BURST_SIZE_IO_TX_WRITE;
737 app.burst_size_worker_read = APP_DEFAULT_BURST_SIZE_WORKER_READ;
738 app.burst_size_worker_write = APP_DEFAULT_BURST_SIZE_WORKER_WRITE;
741 if (arg_pos_lb == 0) {
742 app.pos_lb = APP_DEFAULT_IO_RX_LB_POS;
745 /* Check cross-consistency of arguments */
746 if ((ret = app_check_lpm_table()) < 0) {
747 printf("At least one LPM rule is inconsistent (%d)\n", ret);
750 if (app_check_every_rx_port_is_tx_enabled() < 0) {
751 printf("On LPM lookup miss, packet is sent back on the input port.\n");
752 printf("At least one RX port is not enabled for TX.\n");
757 argv[optind - 1] = prgname;
760 optind = 0; /* reset getopt lib */
765 app_get_nic_rx_queues_per_port(uint8_t port)
769 if (port >= APP_MAX_NIC_PORTS) {
774 for (i = 0; i < APP_MAX_RX_QUEUES_PER_NIC_PORT; i ++) {
775 if (app.nic_rx_queue_mask[port][i] == 1) {
784 app_get_lcore_for_nic_rx(uint8_t port, uint8_t queue, uint32_t *lcore_out)
788 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
789 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
792 if (app.lcore_params[lcore].type != e_APP_LCORE_IO) {
796 for (i = 0; i < lp->rx.n_nic_queues; i ++) {
797 if ((lp->rx.nic_queues[i].port == port) &&
798 (lp->rx.nic_queues[i].queue == queue)) {
809 app_get_lcore_for_nic_tx(uint8_t port, uint32_t *lcore_out)
813 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
814 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
817 if (app.lcore_params[lcore].type != e_APP_LCORE_IO) {
821 for (i = 0; i < lp->tx.n_nic_ports; i ++) {
822 if (lp->tx.nic_ports[i] == port) {
833 app_is_socket_used(uint32_t socket)
837 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
838 if (app.lcore_params[lcore].type == e_APP_LCORE_DISABLED) {
842 if (socket == rte_lcore_to_socket_id(lcore)) {
851 app_get_lcores_io_rx(void)
853 uint32_t lcore, count;
856 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
857 struct app_lcore_params_io *lp_io = &app.lcore_params[lcore].io;
859 if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
860 (lp_io->rx.n_nic_queues == 0)) {
871 app_get_lcores_worker(void)
873 uint32_t lcore, count;
876 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
877 if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
884 if (count > APP_MAX_WORKER_LCORES) {
885 rte_panic("Algorithmic error (too many worker lcores)\n");
893 app_print_params(void)
895 uint32_t port, queue, lcore, rule, i, j;
897 /* Print NIC RX configuration */
898 printf("NIC RX ports: ");
899 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
900 uint32_t n_rx_queues = app_get_nic_rx_queues_per_port((uint8_t) port);
902 if (n_rx_queues == 0) {
906 printf("%u (", port);
907 for (queue = 0; queue < APP_MAX_RX_QUEUES_PER_NIC_PORT; queue ++) {
908 if (app.nic_rx_queue_mask[port][queue] == 1) {
909 printf("%u ", queue);
916 /* Print I/O lcore RX params */
917 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
918 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
920 if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
921 (lp->rx.n_nic_queues == 0)) {
925 printf("I/O lcore %u (socket %u): ", lcore, rte_lcore_to_socket_id(lcore));
928 for (i = 0; i < lp->rx.n_nic_queues; i ++) {
930 (uint32_t) lp->rx.nic_queues[i].port,
931 (uint32_t) lp->rx.nic_queues[i].queue);
935 printf("Output rings ");
936 for (i = 0; i < lp->rx.n_rings; i ++) {
937 printf("%p ", lp->rx.rings[i]);
942 /* Print worker lcore RX params */
943 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
944 struct app_lcore_params_worker *lp = &app.lcore_params[lcore].worker;
946 if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
950 printf("Worker lcore %u (socket %u) ID %u: ",
952 rte_lcore_to_socket_id(lcore),
955 printf("Input rings ");
956 for (i = 0; i < lp->n_rings_in; i ++) {
957 printf("%p ", lp->rings_in[i]);
965 /* Print NIC TX configuration */
966 printf("NIC TX ports: ");
967 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
968 if (app.nic_tx_port_mask[port] == 1) {
974 /* Print I/O TX lcore params */
975 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
976 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
977 uint32_t n_workers = app_get_lcores_worker();
979 if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
980 (lp->tx.n_nic_ports == 0)) {
984 printf("I/O lcore %u (socket %u): ", lcore, rte_lcore_to_socket_id(lcore));
986 printf("Input rings per TX port ");
987 for (i = 0; i < lp->tx.n_nic_ports; i ++) {
988 port = lp->tx.nic_ports[i];
990 printf("%u (", port);
991 for (j = 0; j < n_workers; j ++) {
992 printf("%p ", lp->tx.rings[port][j]);
1001 /* Print worker lcore TX params */
1002 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
1003 struct app_lcore_params_worker *lp = &app.lcore_params[lcore].worker;
1005 if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
1009 printf("Worker lcore %u (socket %u) ID %u: \n",
1011 rte_lcore_to_socket_id(lcore),
1014 printf("Output rings per TX port ");
1015 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
1016 if (lp->rings_out[port] != NULL) {
1017 printf("%u (%p) ", port, lp->rings_out[port]);
1024 /* Print LPM rules */
1025 printf("LPM rules: \n");
1026 for (rule = 0; rule < app.n_lpm_rules; rule ++) {
1027 uint32_t ip = app.lpm_rules[rule].ip;
1028 uint8_t depth = app.lpm_rules[rule].depth;
1029 uint8_t if_out = app.lpm_rules[rule].if_out;
1031 printf("\t%u: %u.%u.%u.%u/%u => %u;\n",
1033 (ip & 0xFF000000) >> 24,
1034 (ip & 0x00FF0000) >> 16,
1035 (ip & 0x0000FF00) >> 8,
1043 printf("Ring sizes: NIC RX = %u; Worker in = %u; Worker out = %u; NIC TX = %u;\n",
1044 app.nic_rx_ring_size,
1047 app.nic_tx_ring_size);
1050 printf("Burst sizes: I/O RX (rd = %u, wr = %u); Worker (rd = %u, wr = %u); I/O TX (rd = %u, wr = %u)\n",
1051 app.burst_size_io_rx_read,
1052 app.burst_size_io_rx_write,
1053 app.burst_size_worker_read,
1054 app.burst_size_worker_write,
1055 app.burst_size_io_tx_read,
1056 app.burst_size_io_tx_write);