4 * Copyright(c) 2010-2014 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.
38 #include <sys/types.h>
40 #include <sys/queue.h>
45 #include <rte_common.h>
46 #include <rte_byteorder.h>
48 #include <rte_memory.h>
49 #include <rte_memcpy.h>
50 #include <rte_memzone.h>
52 #include <rte_per_lcore.h>
53 #include <rte_launch.h>
54 #include <rte_atomic.h>
55 #include <rte_cycles.h>
56 #include <rte_prefetch.h>
57 #include <rte_lcore.h>
58 #include <rte_per_lcore.h>
59 #include <rte_branch_prediction.h>
60 #include <rte_interrupts.h>
62 #include <rte_random.h>
63 #include <rte_debug.h>
64 #include <rte_ether.h>
65 #include <rte_ethdev.h>
67 #include <rte_mempool.h>
72 #include <rte_string_fns.h>
76 struct app_params app;
78 static const char usage[] =
80 " load_balancer <EAL PARAMS> -- <APP PARAMS> \n"
82 "Application manadatory parameters: \n"
83 " --rx \"(PORT, QUEUE, LCORE), ...\" : List of NIC RX ports and queues \n"
84 " handled by the I/O RX lcores \n"
85 " --tx \"(PORT, LCORE), ...\" : List of NIC TX ports handled by the I/O TX \n"
87 " --w \"LCORE, ...\" : List of the worker lcores \n"
88 " --lpm \"IP / PREFIX => PORT; ...\" : List of LPM rules used by the worker \n"
89 " lcores for packet forwarding \n"
91 "Application optional parameters: \n"
92 " --rsz \"A, B, C, D\" : Ring sizes \n"
93 " A = Size (in number of buffer descriptors) of each of the NIC RX \n"
94 " rings read by the I/O RX lcores (default value is %u) \n"
95 " B = Size (in number of elements) of each of the SW rings used by the\n"
96 " I/O RX lcores to send packets to worker lcores (default value is\n"
98 " C = Size (in number of elements) of each of the SW rings used by the\n"
99 " worker lcores to send packets to I/O TX lcores (default value is\n"
101 " D = Size (in number of buffer descriptors) of each of the NIC TX \n"
102 " rings written by I/O TX lcores (default value is %u) \n"
103 " --bsz \"(A, B), (C, D), (E, F)\" : Burst sizes \n"
104 " A = I/O RX lcore read burst size from NIC RX (default value is %u) \n"
105 " B = I/O RX lcore write burst size to output SW rings (default value \n"
107 " C = Worker lcore read burst size from input SW rings (default value \n"
109 " D = Worker lcore write burst size to output SW rings (default value \n"
111 " E = I/O TX lcore read burst size from input SW rings (default value \n"
113 " F = I/O TX lcore write burst size to NIC TX (default value is %u) \n"
114 " --pos-lb POS : Position of the 1-byte field within the input packet used by\n"
115 " the I/O RX lcores to identify the worker lcore for the current \n"
116 " packet (default value is %u) \n";
119 app_print_usage(void)
122 APP_DEFAULT_NIC_RX_RING_SIZE,
123 APP_DEFAULT_RING_RX_SIZE,
124 APP_DEFAULT_RING_TX_SIZE,
125 APP_DEFAULT_NIC_TX_RING_SIZE,
126 APP_DEFAULT_BURST_SIZE_IO_RX_READ,
127 APP_DEFAULT_BURST_SIZE_IO_RX_WRITE,
128 APP_DEFAULT_BURST_SIZE_WORKER_READ,
129 APP_DEFAULT_BURST_SIZE_WORKER_WRITE,
130 APP_DEFAULT_BURST_SIZE_IO_TX_READ,
131 APP_DEFAULT_BURST_SIZE_IO_TX_WRITE,
132 APP_DEFAULT_IO_RX_LB_POS
136 #ifndef APP_ARG_RX_MAX_CHARS
137 #define APP_ARG_RX_MAX_CHARS 4096
140 #ifndef APP_ARG_RX_MAX_TUPLES
141 #define APP_ARG_RX_MAX_TUPLES 128
145 str_to_unsigned_array(
146 const char *s, size_t sbuflen,
152 char *splits[num_vals];
154 int i, num_splits = 0;
156 /* copy s so we don't modify original string */
157 snprintf(str, sizeof(str), "%s", s);
158 num_splits = rte_strsplit(str, sizeof(str), splits, num_vals, separator);
161 for (i = 0; i < num_splits; i++) {
162 vals[i] = strtoul(splits[i], &endptr, 0);
163 if (errno != 0 || *endptr != '\0')
171 str_to_unsigned_vals(
175 unsigned num_vals, ...)
177 unsigned i, vals[num_vals];
180 num_vals = str_to_unsigned_array(s, sbuflen, separator, num_vals, vals);
182 va_start(ap, num_vals);
183 for (i = 0; i < num_vals; i++) {
184 unsigned *u = va_arg(ap, unsigned *);
192 parse_arg_rx(const char *arg)
194 const char *p0 = arg, *p = arg;
197 if (strnlen(arg, APP_ARG_RX_MAX_CHARS + 1) == APP_ARG_RX_MAX_CHARS + 1) {
202 while ((p = strchr(p0,'(')) != NULL) {
203 struct app_lcore_params *lp;
204 uint32_t port, queue, lcore, i;
206 p0 = strchr(p++, ')');
208 (str_to_unsigned_vals(p, p0 - p, ',', 3, &port, &queue, &lcore) != 3)) {
212 /* Enable port and queue for later initialization */
213 if ((port >= APP_MAX_NIC_PORTS) || (queue >= APP_MAX_RX_QUEUES_PER_NIC_PORT)) {
216 if (app.nic_rx_queue_mask[port][queue] != 0) {
219 app.nic_rx_queue_mask[port][queue] = 1;
221 /* Check and assign (port, queue) to I/O lcore */
222 if (rte_lcore_is_enabled(lcore) == 0) {
226 if (lcore >= APP_MAX_LCORES) {
229 lp = &app.lcore_params[lcore];
230 if (lp->type == e_APP_LCORE_WORKER) {
233 lp->type = e_APP_LCORE_IO;
234 for (i = 0; i < lp->io.rx.n_nic_queues; i ++) {
235 if ((lp->io.rx.nic_queues[i].port == port) &&
236 (lp->io.rx.nic_queues[i].queue == queue)) {
240 if (lp->io.rx.n_nic_queues >= APP_MAX_NIC_RX_QUEUES_PER_IO_LCORE) {
243 lp->io.rx.nic_queues[lp->io.rx.n_nic_queues].port = (uint8_t) port;
244 lp->io.rx.nic_queues[lp->io.rx.n_nic_queues].queue = (uint8_t) queue;
245 lp->io.rx.n_nic_queues ++;
248 if (n_tuples > APP_ARG_RX_MAX_TUPLES) {
260 #ifndef APP_ARG_TX_MAX_CHARS
261 #define APP_ARG_TX_MAX_CHARS 4096
264 #ifndef APP_ARG_TX_MAX_TUPLES
265 #define APP_ARG_TX_MAX_TUPLES 128
269 parse_arg_tx(const char *arg)
271 const char *p0 = arg, *p = arg;
274 if (strnlen(arg, APP_ARG_TX_MAX_CHARS + 1) == APP_ARG_TX_MAX_CHARS + 1) {
279 while ((p = strchr(p0,'(')) != NULL) {
280 struct app_lcore_params *lp;
281 uint32_t port, lcore, i;
283 p0 = strchr(p++, ')');
285 (str_to_unsigned_vals(p, p0 - p, ',', 2, &port, &lcore) != 2)) {
289 /* Enable port and queue for later initialization */
290 if (port >= APP_MAX_NIC_PORTS) {
293 if (app.nic_tx_port_mask[port] != 0) {
296 app.nic_tx_port_mask[port] = 1;
298 /* Check and assign (port, queue) to I/O lcore */
299 if (rte_lcore_is_enabled(lcore) == 0) {
303 if (lcore >= APP_MAX_LCORES) {
306 lp = &app.lcore_params[lcore];
307 if (lp->type == e_APP_LCORE_WORKER) {
310 lp->type = e_APP_LCORE_IO;
311 for (i = 0; i < lp->io.tx.n_nic_ports; i ++) {
312 if (lp->io.tx.nic_ports[i] == port) {
316 if (lp->io.tx.n_nic_ports >= APP_MAX_NIC_TX_PORTS_PER_IO_LCORE) {
319 lp->io.tx.nic_ports[lp->io.tx.n_nic_ports] = (uint8_t) port;
320 lp->io.tx.n_nic_ports ++;
323 if (n_tuples > APP_ARG_TX_MAX_TUPLES) {
335 #ifndef APP_ARG_W_MAX_CHARS
336 #define APP_ARG_W_MAX_CHARS 4096
339 #ifndef APP_ARG_W_MAX_TUPLES
340 #define APP_ARG_W_MAX_TUPLES APP_MAX_WORKER_LCORES
344 parse_arg_w(const char *arg)
349 if (strnlen(arg, APP_ARG_W_MAX_CHARS + 1) == APP_ARG_W_MAX_CHARS + 1) {
355 struct app_lcore_params *lp;
359 lcore = strtoul(p, NULL, 0);
364 /* Check and enable worker lcore */
365 if (rte_lcore_is_enabled(lcore) == 0) {
369 if (lcore >= APP_MAX_LCORES) {
372 lp = &app.lcore_params[lcore];
373 if (lp->type == e_APP_LCORE_IO) {
376 lp->type = e_APP_LCORE_WORKER;
379 if (n_tuples > APP_ARG_W_MAX_TUPLES) {
394 if ((n_tuples & (n_tuples - 1)) != 0) {
401 #ifndef APP_ARG_LPM_MAX_CHARS
402 #define APP_ARG_LPM_MAX_CHARS 4096
406 parse_arg_lpm(const char *arg)
408 const char *p = arg, *p0;
410 if (strnlen(arg, APP_ARG_LPM_MAX_CHARS + 1) == APP_ARG_TX_MAX_CHARS + 1) {
415 uint32_t ip_a, ip_b, ip_c, ip_d, ip, depth, if_out;
420 (str_to_unsigned_vals(p, p0 - p, '.', 4, &ip_a, &ip_b, &ip_c, &ip_d) != 4)) {
426 depth = strtoul(p, &endptr, 0);
427 if (errno != 0 || *endptr != '=') {
434 if_out = strtoul(++p, &endptr, 0);
435 if (errno != 0 || (*endptr != '\0' && *endptr != ';')) {
439 if ((ip_a >= 256) || (ip_b >= 256) || (ip_c >= 256) || (ip_d >= 256) ||
440 (depth == 0) || (depth >= 32) ||
441 (if_out >= APP_MAX_NIC_PORTS)) {
444 ip = (ip_a << 24) | (ip_b << 16) | (ip_c << 8) | ip_d;
446 if (app.n_lpm_rules >= APP_MAX_LPM_RULES) {
449 app.lpm_rules[app.n_lpm_rules].ip = ip;
450 app.lpm_rules[app.n_lpm_rules].depth = (uint8_t) depth;
451 app.lpm_rules[app.n_lpm_rules].if_out = (uint8_t) if_out;
461 if (app.n_lpm_rules == 0) {
469 app_check_lpm_table(void)
473 /* For each rule, check that the output I/F is enabled */
474 for (rule = 0; rule < app.n_lpm_rules; rule ++)
476 uint32_t port = app.lpm_rules[rule].if_out;
478 if (app.nic_tx_port_mask[port] == 0) {
487 app_check_every_rx_port_is_tx_enabled(void)
491 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
492 if ((app_get_nic_rx_queues_per_port(port) > 0) && (app.nic_tx_port_mask[port] == 0)) {
500 #ifndef APP_ARG_RSZ_CHARS
501 #define APP_ARG_RSZ_CHARS 63
505 parse_arg_rsz(const char *arg)
507 if (strnlen(arg, APP_ARG_RSZ_CHARS + 1) == APP_ARG_RSZ_CHARS + 1) {
511 if (str_to_unsigned_vals(arg, APP_ARG_RSZ_CHARS, ',', 4,
512 &app.nic_rx_ring_size,
515 &app.nic_tx_ring_size) != 4)
519 if ((app.nic_rx_ring_size == 0) ||
520 (app.nic_tx_ring_size == 0) ||
521 (app.ring_rx_size == 0) ||
522 (app.ring_tx_size == 0)) {
529 #ifndef APP_ARG_BSZ_CHARS
530 #define APP_ARG_BSZ_CHARS 63
534 parse_arg_bsz(const char *arg)
536 const char *p = arg, *p0;
537 if (strnlen(arg, APP_ARG_BSZ_CHARS + 1) == APP_ARG_BSZ_CHARS + 1) {
541 p0 = strchr(p++, ')');
543 (str_to_unsigned_vals(p, p0 - p, ',', 2, &app.burst_size_io_rx_read, &app.burst_size_io_rx_write) != 2)) {
552 p0 = strchr(p++, ')');
554 (str_to_unsigned_vals(p, p0 - p, ',', 2, &app.burst_size_worker_read, &app.burst_size_worker_write) != 2)) {
563 p0 = strchr(p++, ')');
565 (str_to_unsigned_vals(p, p0 - p, ',', 2, &app.burst_size_io_tx_read, &app.burst_size_io_tx_write) != 2)) {
569 if ((app.burst_size_io_rx_read == 0) ||
570 (app.burst_size_io_rx_write == 0) ||
571 (app.burst_size_worker_read == 0) ||
572 (app.burst_size_worker_write == 0) ||
573 (app.burst_size_io_tx_read == 0) ||
574 (app.burst_size_io_tx_write == 0)) {
578 if ((app.burst_size_io_rx_read > APP_MBUF_ARRAY_SIZE) ||
579 (app.burst_size_io_rx_write > APP_MBUF_ARRAY_SIZE) ||
580 (app.burst_size_worker_read > APP_MBUF_ARRAY_SIZE) ||
581 (app.burst_size_worker_write > APP_MBUF_ARRAY_SIZE) ||
582 ((2 * app.burst_size_io_tx_read) > APP_MBUF_ARRAY_SIZE) ||
583 (app.burst_size_io_tx_write > APP_MBUF_ARRAY_SIZE)) {
590 #ifndef APP_ARG_NUMERICAL_SIZE_CHARS
591 #define APP_ARG_NUMERICAL_SIZE_CHARS 15
595 parse_arg_pos_lb(const char *arg)
600 if (strnlen(arg, APP_ARG_NUMERICAL_SIZE_CHARS + 1) == APP_ARG_NUMERICAL_SIZE_CHARS + 1) {
605 x = strtoul(arg, &endpt, 10);
606 if (errno != 0 || endpt == arg || *endpt != '\0'){
614 app.pos_lb = (uint8_t) x;
619 /* Parse the argument given in the command line of the application */
621 app_parse_args(int argc, char **argv)
626 char *prgname = argv[0];
627 static struct option lgopts[] = {
640 uint32_t arg_lpm = 0;
641 uint32_t arg_rsz = 0;
642 uint32_t arg_bsz = 0;
643 uint32_t arg_pos_lb = 0;
647 while ((opt = getopt_long(argc, argvopt, "",
648 lgopts, &option_index)) != EOF) {
653 if (!strcmp(lgopts[option_index].name, "rx")) {
655 ret = parse_arg_rx(optarg);
657 printf("Incorrect value for --rx argument (%d)\n", ret);
661 if (!strcmp(lgopts[option_index].name, "tx")) {
663 ret = parse_arg_tx(optarg);
665 printf("Incorrect value for --tx argument (%d)\n", ret);
669 if (!strcmp(lgopts[option_index].name, "w")) {
671 ret = parse_arg_w(optarg);
673 printf("Incorrect value for --w argument (%d)\n", ret);
677 if (!strcmp(lgopts[option_index].name, "lpm")) {
679 ret = parse_arg_lpm(optarg);
681 printf("Incorrect value for --lpm argument (%d)\n", ret);
685 if (!strcmp(lgopts[option_index].name, "rsz")) {
687 ret = parse_arg_rsz(optarg);
689 printf("Incorrect value for --rsz argument (%d)\n", ret);
693 if (!strcmp(lgopts[option_index].name, "bsz")) {
695 ret = parse_arg_bsz(optarg);
697 printf("Incorrect value for --bsz argument (%d)\n", ret);
701 if (!strcmp(lgopts[option_index].name, "pos-lb")) {
703 ret = parse_arg_pos_lb(optarg);
705 printf("Incorrect value for --pos-lb argument (%d)\n", ret);
716 /* Check that all mandatory arguments are provided */
717 if ((arg_rx == 0) || (arg_tx == 0) || (arg_w == 0) || (arg_lpm == 0)){
718 printf("Not all mandatory arguments are present\n");
722 /* Assign default values for the optional arguments not provided */
724 app.nic_rx_ring_size = APP_DEFAULT_NIC_RX_RING_SIZE;
725 app.nic_tx_ring_size = APP_DEFAULT_NIC_TX_RING_SIZE;
726 app.ring_rx_size = APP_DEFAULT_RING_RX_SIZE;
727 app.ring_tx_size = APP_DEFAULT_RING_TX_SIZE;
731 app.burst_size_io_rx_read = APP_DEFAULT_BURST_SIZE_IO_RX_READ;
732 app.burst_size_io_rx_write = APP_DEFAULT_BURST_SIZE_IO_RX_WRITE;
733 app.burst_size_io_tx_read = APP_DEFAULT_BURST_SIZE_IO_TX_READ;
734 app.burst_size_io_tx_write = APP_DEFAULT_BURST_SIZE_IO_TX_WRITE;
735 app.burst_size_worker_read = APP_DEFAULT_BURST_SIZE_WORKER_READ;
736 app.burst_size_worker_write = APP_DEFAULT_BURST_SIZE_WORKER_WRITE;
739 if (arg_pos_lb == 0) {
740 app.pos_lb = APP_DEFAULT_IO_RX_LB_POS;
743 /* Check cross-consistency of arguments */
744 if ((ret = app_check_lpm_table()) < 0) {
745 printf("At least one LPM rule is inconsistent (%d)\n", ret);
748 if (app_check_every_rx_port_is_tx_enabled() < 0) {
749 printf("On LPM lookup miss, packet is sent back on the input port.\n");
750 printf("At least one RX port is not enabled for TX.\n");
755 argv[optind - 1] = prgname;
758 optind = 0; /* reset getopt lib */
763 app_get_nic_rx_queues_per_port(uint8_t port)
767 if (port >= APP_MAX_NIC_PORTS) {
772 for (i = 0; i < APP_MAX_RX_QUEUES_PER_NIC_PORT; i ++) {
773 if (app.nic_rx_queue_mask[port][i] == 1) {
782 app_get_lcore_for_nic_rx(uint8_t port, uint8_t queue, uint32_t *lcore_out)
786 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
787 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
790 if (app.lcore_params[lcore].type != e_APP_LCORE_IO) {
794 for (i = 0; i < lp->rx.n_nic_queues; i ++) {
795 if ((lp->rx.nic_queues[i].port == port) &&
796 (lp->rx.nic_queues[i].queue == queue)) {
807 app_get_lcore_for_nic_tx(uint8_t port, uint32_t *lcore_out)
811 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
812 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
815 if (app.lcore_params[lcore].type != e_APP_LCORE_IO) {
819 for (i = 0; i < lp->tx.n_nic_ports; i ++) {
820 if (lp->tx.nic_ports[i] == port) {
831 app_is_socket_used(uint32_t socket)
835 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
836 if (app.lcore_params[lcore].type == e_APP_LCORE_DISABLED) {
840 if (socket == rte_lcore_to_socket_id(lcore)) {
849 app_get_lcores_io_rx(void)
851 uint32_t lcore, count;
854 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
855 struct app_lcore_params_io *lp_io = &app.lcore_params[lcore].io;
857 if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
858 (lp_io->rx.n_nic_queues == 0)) {
869 app_get_lcores_worker(void)
871 uint32_t lcore, count;
874 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
875 if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
882 if (count > APP_MAX_WORKER_LCORES) {
883 rte_panic("Algorithmic error (too many worker lcores)\n");
891 app_print_params(void)
893 unsigned port, queue, lcore, rule, i, j;
895 /* Print NIC RX configuration */
896 printf("NIC RX ports: ");
897 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
898 uint32_t n_rx_queues = app_get_nic_rx_queues_per_port((uint8_t) port);
900 if (n_rx_queues == 0) {
904 printf("%u (", port);
905 for (queue = 0; queue < APP_MAX_RX_QUEUES_PER_NIC_PORT; queue ++) {
906 if (app.nic_rx_queue_mask[port][queue] == 1) {
907 printf("%u ", queue);
914 /* Print I/O lcore RX params */
915 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
916 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
918 if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
919 (lp->rx.n_nic_queues == 0)) {
923 printf("I/O lcore %u (socket %u): ", lcore, rte_lcore_to_socket_id(lcore));
926 for (i = 0; i < lp->rx.n_nic_queues; i ++) {
928 (unsigned) lp->rx.nic_queues[i].port,
929 (unsigned) lp->rx.nic_queues[i].queue);
933 printf("Output rings ");
934 for (i = 0; i < lp->rx.n_rings; i ++) {
935 printf("%p ", lp->rx.rings[i]);
940 /* Print worker lcore RX params */
941 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
942 struct app_lcore_params_worker *lp = &app.lcore_params[lcore].worker;
944 if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
948 printf("Worker lcore %u (socket %u) ID %u: ",
950 rte_lcore_to_socket_id(lcore),
951 (unsigned)lp->worker_id);
953 printf("Input rings ");
954 for (i = 0; i < lp->n_rings_in; i ++) {
955 printf("%p ", lp->rings_in[i]);
963 /* Print NIC TX configuration */
964 printf("NIC TX ports: ");
965 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
966 if (app.nic_tx_port_mask[port] == 1) {
972 /* Print I/O TX lcore params */
973 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
974 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
975 uint32_t n_workers = app_get_lcores_worker();
977 if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
978 (lp->tx.n_nic_ports == 0)) {
982 printf("I/O lcore %u (socket %u): ", lcore, rte_lcore_to_socket_id(lcore));
984 printf("Input rings per TX port ");
985 for (i = 0; i < lp->tx.n_nic_ports; i ++) {
986 port = lp->tx.nic_ports[i];
988 printf("%u (", port);
989 for (j = 0; j < n_workers; j ++) {
990 printf("%p ", lp->tx.rings[port][j]);
999 /* Print worker lcore TX params */
1000 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
1001 struct app_lcore_params_worker *lp = &app.lcore_params[lcore].worker;
1003 if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
1007 printf("Worker lcore %u (socket %u) ID %u: \n",
1009 rte_lcore_to_socket_id(lcore),
1010 (unsigned)lp->worker_id);
1012 printf("Output rings per TX port ");
1013 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
1014 if (lp->rings_out[port] != NULL) {
1015 printf("%u (%p) ", port, lp->rings_out[port]);
1022 /* Print LPM rules */
1023 printf("LPM rules: \n");
1024 for (rule = 0; rule < app.n_lpm_rules; rule ++) {
1025 uint32_t ip = app.lpm_rules[rule].ip;
1026 uint8_t depth = app.lpm_rules[rule].depth;
1027 uint8_t if_out = app.lpm_rules[rule].if_out;
1029 printf("\t%u: %u.%u.%u.%u/%u => %u;\n",
1031 (unsigned) (ip & 0xFF000000) >> 24,
1032 (unsigned) (ip & 0x00FF0000) >> 16,
1033 (unsigned) (ip & 0x0000FF00) >> 8,
1034 (unsigned) ip & 0x000000FF,
1041 printf("Ring sizes: NIC RX = %u; Worker in = %u; Worker out = %u; NIC TX = %u;\n",
1042 (unsigned) app.nic_rx_ring_size,
1043 (unsigned) app.ring_rx_size,
1044 (unsigned) app.ring_tx_size,
1045 (unsigned) app.nic_tx_ring_size);
1048 printf("Burst sizes: I/O RX (rd = %u, wr = %u); Worker (rd = %u, wr = %u); I/O TX (rd = %u, wr = %u)\n",
1049 (unsigned) app.burst_size_io_rx_read,
1050 (unsigned) app.burst_size_io_rx_write,
1051 (unsigned) app.burst_size_worker_read,
1052 (unsigned) app.burst_size_worker_write,
1053 (unsigned) app.burst_size_io_tx_read,
1054 (unsigned) app.burst_size_io_tx_write);