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>
51 #include <rte_tailq.h>
53 #include <rte_per_lcore.h>
54 #include <rte_launch.h>
55 #include <rte_atomic.h>
56 #include <rte_cycles.h>
57 #include <rte_prefetch.h>
58 #include <rte_lcore.h>
59 #include <rte_per_lcore.h>
60 #include <rte_branch_prediction.h>
61 #include <rte_interrupts.h>
63 #include <rte_random.h>
64 #include <rte_debug.h>
65 #include <rte_ether.h>
66 #include <rte_ethdev.h>
68 #include <rte_mempool.h>
73 #include <rte_string_fns.h>
77 struct app_params app;
79 static const char usage[] =
81 " load_balancer <EAL PARAMS> -- <APP PARAMS> \n"
83 "Application manadatory parameters: \n"
84 " --rx \"(PORT, QUEUE, LCORE), ...\" : List of NIC RX ports and queues \n"
85 " handled by the I/O RX lcores \n"
86 " --tx \"(PORT, LCORE), ...\" : List of NIC TX ports handled by the I/O TX \n"
88 " --w \"LCORE, ...\" : List of the worker lcores \n"
89 " --lpm \"IP / PREFIX => PORT; ...\" : List of LPM rules used by the worker \n"
90 " lcores for packet forwarding \n"
92 "Application optional parameters: \n"
93 " --rsz \"A, B, C, D\" : Ring sizes \n"
94 " A = Size (in number of buffer descriptors) of each of the NIC RX \n"
95 " rings read by the I/O RX lcores (default value is %u) \n"
96 " B = Size (in number of elements) of each of the SW rings used by the\n"
97 " I/O RX lcores to send packets to worker lcores (default value is\n"
99 " C = Size (in number of elements) of each of the SW rings used by the\n"
100 " worker lcores to send packets to I/O TX lcores (default value is\n"
102 " D = Size (in number of buffer descriptors) of each of the NIC TX \n"
103 " rings written by I/O TX lcores (default value is %u) \n"
104 " --bsz \"(A, B), (C, D), (E, F)\" : Burst sizes \n"
105 " A = I/O RX lcore read burst size from NIC RX (default value is %u) \n"
106 " B = I/O RX lcore write burst size to output SW rings (default value \n"
108 " C = Worker lcore read burst size from input SW rings (default value \n"
110 " D = Worker lcore write burst size to output SW rings (default value \n"
112 " E = I/O TX lcore read burst size from input SW rings (default value \n"
114 " F = I/O TX lcore write burst size to NIC TX (default value is %u) \n"
115 " --pos-lb POS : Position of the 1-byte field within the input packet used by\n"
116 " the I/O RX lcores to identify the worker lcore for the current \n"
117 " packet (default value is %u) \n";
120 app_print_usage(void)
123 APP_DEFAULT_NIC_RX_RING_SIZE,
124 APP_DEFAULT_RING_RX_SIZE,
125 APP_DEFAULT_RING_TX_SIZE,
126 APP_DEFAULT_NIC_TX_RING_SIZE,
127 APP_DEFAULT_BURST_SIZE_IO_RX_READ,
128 APP_DEFAULT_BURST_SIZE_IO_RX_WRITE,
129 APP_DEFAULT_BURST_SIZE_WORKER_READ,
130 APP_DEFAULT_BURST_SIZE_WORKER_WRITE,
131 APP_DEFAULT_BURST_SIZE_IO_TX_READ,
132 APP_DEFAULT_BURST_SIZE_IO_TX_WRITE,
133 APP_DEFAULT_IO_RX_LB_POS
137 #ifndef APP_ARG_RX_MAX_CHARS
138 #define APP_ARG_RX_MAX_CHARS 4096
141 #ifndef APP_ARG_RX_MAX_TUPLES
142 #define APP_ARG_RX_MAX_TUPLES 128
146 str_to_unsigned_array(
147 const char *s, size_t sbuflen,
153 char *splits[num_vals];
155 int i, num_splits = 0;
157 /* copy s so we don't modify original string */
158 snprintf(str, sizeof(str), "%s", s);
159 num_splits = rte_strsplit(str, sizeof(str), splits, num_vals, separator);
162 for (i = 0; i < num_splits; i++) {
163 vals[i] = strtoul(splits[i], &endptr, 0);
164 if (errno != 0 || *endptr != '\0')
172 str_to_unsigned_vals(
176 unsigned num_vals, ...)
178 unsigned i, vals[num_vals];
181 num_vals = str_to_unsigned_array(s, sbuflen, separator, num_vals, vals);
183 va_start(ap, num_vals);
184 for (i = 0; i < num_vals; i++) {
185 unsigned *u = va_arg(ap, unsigned *);
193 parse_arg_rx(const char *arg)
195 const char *p0 = arg, *p = arg;
198 if (strnlen(arg, APP_ARG_RX_MAX_CHARS + 1) == APP_ARG_RX_MAX_CHARS + 1) {
203 while ((p = strchr(p0,'(')) != NULL) {
204 struct app_lcore_params *lp;
205 uint32_t port, queue, lcore, i;
207 p0 = strchr(p++, ')');
209 (str_to_unsigned_vals(p, p0 - p, ',', 3, &port, &queue, &lcore) != 3)) {
213 /* Enable port and queue for later initialization */
214 if ((port >= APP_MAX_NIC_PORTS) || (queue >= APP_MAX_RX_QUEUES_PER_NIC_PORT)) {
217 if (app.nic_rx_queue_mask[port][queue] != 0) {
220 app.nic_rx_queue_mask[port][queue] = 1;
222 /* Check and assign (port, queue) to I/O lcore */
223 if (rte_lcore_is_enabled(lcore) == 0) {
227 if (lcore >= APP_MAX_LCORES) {
230 lp = &app.lcore_params[lcore];
231 if (lp->type == e_APP_LCORE_WORKER) {
234 lp->type = e_APP_LCORE_IO;
235 for (i = 0; i < lp->io.rx.n_nic_queues; i ++) {
236 if ((lp->io.rx.nic_queues[i].port == port) &&
237 (lp->io.rx.nic_queues[i].queue == queue)) {
241 if (lp->io.rx.n_nic_queues >= APP_MAX_NIC_RX_QUEUES_PER_IO_LCORE) {
244 lp->io.rx.nic_queues[lp->io.rx.n_nic_queues].port = (uint8_t) port;
245 lp->io.rx.nic_queues[lp->io.rx.n_nic_queues].queue = (uint8_t) queue;
246 lp->io.rx.n_nic_queues ++;
249 if (n_tuples > APP_ARG_RX_MAX_TUPLES) {
261 #ifndef APP_ARG_TX_MAX_CHARS
262 #define APP_ARG_TX_MAX_CHARS 4096
265 #ifndef APP_ARG_TX_MAX_TUPLES
266 #define APP_ARG_TX_MAX_TUPLES 128
270 parse_arg_tx(const char *arg)
272 const char *p0 = arg, *p = arg;
275 if (strnlen(arg, APP_ARG_TX_MAX_CHARS + 1) == APP_ARG_TX_MAX_CHARS + 1) {
280 while ((p = strchr(p0,'(')) != NULL) {
281 struct app_lcore_params *lp;
282 uint32_t port, lcore, i;
284 p0 = strchr(p++, ')');
286 (str_to_unsigned_vals(p, p0 - p, ',', 2, &port, &lcore) != 2)) {
290 /* Enable port and queue for later initialization */
291 if (port >= APP_MAX_NIC_PORTS) {
294 if (app.nic_tx_port_mask[port] != 0) {
297 app.nic_tx_port_mask[port] = 1;
299 /* Check and assign (port, queue) to I/O lcore */
300 if (rte_lcore_is_enabled(lcore) == 0) {
304 if (lcore >= APP_MAX_LCORES) {
307 lp = &app.lcore_params[lcore];
308 if (lp->type == e_APP_LCORE_WORKER) {
311 lp->type = e_APP_LCORE_IO;
312 for (i = 0; i < lp->io.tx.n_nic_ports; i ++) {
313 if (lp->io.tx.nic_ports[i] == port) {
317 if (lp->io.tx.n_nic_ports >= APP_MAX_NIC_TX_PORTS_PER_IO_LCORE) {
320 lp->io.tx.nic_ports[lp->io.tx.n_nic_ports] = (uint8_t) port;
321 lp->io.tx.n_nic_ports ++;
324 if (n_tuples > APP_ARG_TX_MAX_TUPLES) {
336 #ifndef APP_ARG_W_MAX_CHARS
337 #define APP_ARG_W_MAX_CHARS 4096
340 #ifndef APP_ARG_W_MAX_TUPLES
341 #define APP_ARG_W_MAX_TUPLES APP_MAX_WORKER_LCORES
345 parse_arg_w(const char *arg)
350 if (strnlen(arg, APP_ARG_W_MAX_CHARS + 1) == APP_ARG_W_MAX_CHARS + 1) {
356 struct app_lcore_params *lp;
360 lcore = strtoul(p, NULL, 0);
365 /* Check and enable worker lcore */
366 if (rte_lcore_is_enabled(lcore) == 0) {
370 if (lcore >= APP_MAX_LCORES) {
373 lp = &app.lcore_params[lcore];
374 if (lp->type == e_APP_LCORE_IO) {
377 lp->type = e_APP_LCORE_WORKER;
380 if (n_tuples > APP_ARG_W_MAX_TUPLES) {
395 if ((n_tuples & (n_tuples - 1)) != 0) {
402 #ifndef APP_ARG_LPM_MAX_CHARS
403 #define APP_ARG_LPM_MAX_CHARS 4096
407 parse_arg_lpm(const char *arg)
409 const char *p = arg, *p0;
411 if (strnlen(arg, APP_ARG_LPM_MAX_CHARS + 1) == APP_ARG_TX_MAX_CHARS + 1) {
416 uint32_t ip_a, ip_b, ip_c, ip_d, ip, depth, if_out;
421 (str_to_unsigned_vals(p, p0 - p, '.', 4, &ip_a, &ip_b, &ip_c, &ip_d) != 4)) {
427 depth = strtoul(p, &endptr, 0);
428 if (errno != 0 || *endptr != '=') {
435 if_out = strtoul(++p, &endptr, 0);
436 if (errno != 0 || (*endptr != '\0' && *endptr != ';')) {
440 if ((ip_a >= 256) || (ip_b >= 256) || (ip_c >= 256) || (ip_d >= 256) ||
441 (depth == 0) || (depth >= 32) ||
442 (if_out >= APP_MAX_NIC_PORTS)) {
445 ip = (ip_a << 24) | (ip_b << 16) | (ip_c << 8) | ip_d;
447 if (app.n_lpm_rules >= APP_MAX_LPM_RULES) {
450 app.lpm_rules[app.n_lpm_rules].ip = ip;
451 app.lpm_rules[app.n_lpm_rules].depth = (uint8_t) depth;
452 app.lpm_rules[app.n_lpm_rules].if_out = (uint8_t) if_out;
462 if (app.n_lpm_rules == 0) {
470 app_check_lpm_table(void)
474 /* For each rule, check that the output I/F is enabled */
475 for (rule = 0; rule < app.n_lpm_rules; rule ++)
477 uint32_t port = app.lpm_rules[rule].if_out;
479 if (app.nic_tx_port_mask[port] == 0) {
488 app_check_every_rx_port_is_tx_enabled(void)
492 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
493 if ((app_get_nic_rx_queues_per_port(port) > 0) && (app.nic_tx_port_mask[port] == 0)) {
501 #ifndef APP_ARG_RSZ_CHARS
502 #define APP_ARG_RSZ_CHARS 63
506 parse_arg_rsz(const char *arg)
508 if (strnlen(arg, APP_ARG_RSZ_CHARS + 1) == APP_ARG_RSZ_CHARS + 1) {
512 if (str_to_unsigned_vals(arg, APP_ARG_RSZ_CHARS, ',', 4,
513 &app.nic_rx_ring_size,
516 &app.nic_tx_ring_size) != 4)
520 if ((app.nic_rx_ring_size == 0) ||
521 (app.nic_tx_ring_size == 0) ||
522 (app.ring_rx_size == 0) ||
523 (app.ring_tx_size == 0)) {
530 #ifndef APP_ARG_BSZ_CHARS
531 #define APP_ARG_BSZ_CHARS 63
535 parse_arg_bsz(const char *arg)
537 const char *p = arg, *p0;
538 if (strnlen(arg, APP_ARG_BSZ_CHARS + 1) == APP_ARG_BSZ_CHARS + 1) {
542 p0 = strchr(p++, ')');
544 (str_to_unsigned_vals(p, p0 - p, ',', 2, &app.burst_size_io_rx_read, &app.burst_size_io_rx_write) != 2)) {
553 p0 = strchr(p++, ')');
555 (str_to_unsigned_vals(p, p0 - p, ',', 2, &app.burst_size_worker_read, &app.burst_size_worker_write) != 2)) {
564 p0 = strchr(p++, ')');
566 (str_to_unsigned_vals(p, p0 - p, ',', 2, &app.burst_size_io_tx_read, &app.burst_size_io_tx_write) != 2)) {
570 if ((app.burst_size_io_rx_read == 0) ||
571 (app.burst_size_io_rx_write == 0) ||
572 (app.burst_size_worker_read == 0) ||
573 (app.burst_size_worker_write == 0) ||
574 (app.burst_size_io_tx_read == 0) ||
575 (app.burst_size_io_tx_write == 0)) {
579 if ((app.burst_size_io_rx_read > APP_MBUF_ARRAY_SIZE) ||
580 (app.burst_size_io_rx_write > APP_MBUF_ARRAY_SIZE) ||
581 (app.burst_size_worker_read > APP_MBUF_ARRAY_SIZE) ||
582 (app.burst_size_worker_write > APP_MBUF_ARRAY_SIZE) ||
583 ((2 * app.burst_size_io_tx_read) > APP_MBUF_ARRAY_SIZE) ||
584 (app.burst_size_io_tx_write > APP_MBUF_ARRAY_SIZE)) {
591 #ifndef APP_ARG_NUMERICAL_SIZE_CHARS
592 #define APP_ARG_NUMERICAL_SIZE_CHARS 15
596 parse_arg_pos_lb(const char *arg)
601 if (strnlen(arg, APP_ARG_NUMERICAL_SIZE_CHARS + 1) == APP_ARG_NUMERICAL_SIZE_CHARS + 1) {
606 x = strtoul(arg, &endpt, 10);
607 if (errno != 0 || endpt == arg || *endpt != '\0'){
615 app.pos_lb = (uint8_t) x;
620 /* Parse the argument given in the command line of the application */
622 app_parse_args(int argc, char **argv)
627 char *prgname = argv[0];
628 static struct option lgopts[] = {
641 uint32_t arg_lpm = 0;
642 uint32_t arg_rsz = 0;
643 uint32_t arg_bsz = 0;
644 uint32_t arg_pos_lb = 0;
648 while ((opt = getopt_long(argc, argvopt, "",
649 lgopts, &option_index)) != EOF) {
654 if (!strcmp(lgopts[option_index].name, "rx")) {
656 ret = parse_arg_rx(optarg);
658 printf("Incorrect value for --rx argument (%d)\n", ret);
662 if (!strcmp(lgopts[option_index].name, "tx")) {
664 ret = parse_arg_tx(optarg);
666 printf("Incorrect value for --tx argument (%d)\n", ret);
670 if (!strcmp(lgopts[option_index].name, "w")) {
672 ret = parse_arg_w(optarg);
674 printf("Incorrect value for --w argument (%d)\n", ret);
678 if (!strcmp(lgopts[option_index].name, "lpm")) {
680 ret = parse_arg_lpm(optarg);
682 printf("Incorrect value for --lpm argument (%d)\n", ret);
686 if (!strcmp(lgopts[option_index].name, "rsz")) {
688 ret = parse_arg_rsz(optarg);
690 printf("Incorrect value for --rsz argument (%d)\n", ret);
694 if (!strcmp(lgopts[option_index].name, "bsz")) {
696 ret = parse_arg_bsz(optarg);
698 printf("Incorrect value for --bsz argument (%d)\n", ret);
702 if (!strcmp(lgopts[option_index].name, "pos-lb")) {
704 ret = parse_arg_pos_lb(optarg);
706 printf("Incorrect value for --pos-lb argument (%d)\n", ret);
717 /* Check that all mandatory arguments are provided */
718 if ((arg_rx == 0) || (arg_tx == 0) || (arg_w == 0) || (arg_lpm == 0)){
719 printf("Not all mandatory arguments are present\n");
723 /* Assign default values for the optional arguments not provided */
725 app.nic_rx_ring_size = APP_DEFAULT_NIC_RX_RING_SIZE;
726 app.nic_tx_ring_size = APP_DEFAULT_NIC_TX_RING_SIZE;
727 app.ring_rx_size = APP_DEFAULT_RING_RX_SIZE;
728 app.ring_tx_size = APP_DEFAULT_RING_TX_SIZE;
732 app.burst_size_io_rx_read = APP_DEFAULT_BURST_SIZE_IO_RX_READ;
733 app.burst_size_io_rx_write = APP_DEFAULT_BURST_SIZE_IO_RX_WRITE;
734 app.burst_size_io_tx_read = APP_DEFAULT_BURST_SIZE_IO_TX_READ;
735 app.burst_size_io_tx_write = APP_DEFAULT_BURST_SIZE_IO_TX_WRITE;
736 app.burst_size_worker_read = APP_DEFAULT_BURST_SIZE_WORKER_READ;
737 app.burst_size_worker_write = APP_DEFAULT_BURST_SIZE_WORKER_WRITE;
740 if (arg_pos_lb == 0) {
741 app.pos_lb = APP_DEFAULT_IO_RX_LB_POS;
744 /* Check cross-consistency of arguments */
745 if ((ret = app_check_lpm_table()) < 0) {
746 printf("At least one LPM rule is inconsistent (%d)\n", ret);
749 if (app_check_every_rx_port_is_tx_enabled() < 0) {
750 printf("On LPM lookup miss, packet is sent back on the input port.\n");
751 printf("At least one RX port is not enabled for TX.\n");
756 argv[optind - 1] = prgname;
759 optind = 0; /* reset getopt lib */
764 app_get_nic_rx_queues_per_port(uint8_t port)
768 if (port >= APP_MAX_NIC_PORTS) {
773 for (i = 0; i < APP_MAX_RX_QUEUES_PER_NIC_PORT; i ++) {
774 if (app.nic_rx_queue_mask[port][i] == 1) {
783 app_get_lcore_for_nic_rx(uint8_t port, uint8_t queue, uint32_t *lcore_out)
787 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
788 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
791 if (app.lcore_params[lcore].type != e_APP_LCORE_IO) {
795 for (i = 0; i < lp->rx.n_nic_queues; i ++) {
796 if ((lp->rx.nic_queues[i].port == port) &&
797 (lp->rx.nic_queues[i].queue == queue)) {
808 app_get_lcore_for_nic_tx(uint8_t port, uint32_t *lcore_out)
812 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
813 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
816 if (app.lcore_params[lcore].type != e_APP_LCORE_IO) {
820 for (i = 0; i < lp->tx.n_nic_ports; i ++) {
821 if (lp->tx.nic_ports[i] == port) {
832 app_is_socket_used(uint32_t socket)
836 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
837 if (app.lcore_params[lcore].type == e_APP_LCORE_DISABLED) {
841 if (socket == rte_lcore_to_socket_id(lcore)) {
850 app_get_lcores_io_rx(void)
852 uint32_t lcore, count;
855 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
856 struct app_lcore_params_io *lp_io = &app.lcore_params[lcore].io;
858 if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
859 (lp_io->rx.n_nic_queues == 0)) {
870 app_get_lcores_worker(void)
872 uint32_t lcore, count;
875 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
876 if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
883 if (count > APP_MAX_WORKER_LCORES) {
884 rte_panic("Algorithmic error (too many worker lcores)\n");
892 app_print_params(void)
894 unsigned port, queue, lcore, rule, i, j;
896 /* Print NIC RX configuration */
897 printf("NIC RX ports: ");
898 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
899 uint32_t n_rx_queues = app_get_nic_rx_queues_per_port((uint8_t) port);
901 if (n_rx_queues == 0) {
905 printf("%u (", port);
906 for (queue = 0; queue < APP_MAX_RX_QUEUES_PER_NIC_PORT; queue ++) {
907 if (app.nic_rx_queue_mask[port][queue] == 1) {
908 printf("%u ", queue);
915 /* Print I/O lcore RX params */
916 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
917 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
919 if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
920 (lp->rx.n_nic_queues == 0)) {
924 printf("I/O lcore %u (socket %u): ", lcore, rte_lcore_to_socket_id(lcore));
927 for (i = 0; i < lp->rx.n_nic_queues; i ++) {
929 (unsigned) lp->rx.nic_queues[i].port,
930 (unsigned) lp->rx.nic_queues[i].queue);
934 printf("Output rings ");
935 for (i = 0; i < lp->rx.n_rings; i ++) {
936 printf("%p ", lp->rx.rings[i]);
941 /* Print worker lcore RX params */
942 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
943 struct app_lcore_params_worker *lp = &app.lcore_params[lcore].worker;
945 if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
949 printf("Worker lcore %u (socket %u) ID %u: ",
951 rte_lcore_to_socket_id(lcore),
952 (unsigned)lp->worker_id);
954 printf("Input rings ");
955 for (i = 0; i < lp->n_rings_in; i ++) {
956 printf("%p ", lp->rings_in[i]);
964 /* Print NIC TX configuration */
965 printf("NIC TX ports: ");
966 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
967 if (app.nic_tx_port_mask[port] == 1) {
973 /* Print I/O TX lcore params */
974 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
975 struct app_lcore_params_io *lp = &app.lcore_params[lcore].io;
976 uint32_t n_workers = app_get_lcores_worker();
978 if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
979 (lp->tx.n_nic_ports == 0)) {
983 printf("I/O lcore %u (socket %u): ", lcore, rte_lcore_to_socket_id(lcore));
985 printf("Input rings per TX port ");
986 for (i = 0; i < lp->tx.n_nic_ports; i ++) {
987 port = lp->tx.nic_ports[i];
989 printf("%u (", port);
990 for (j = 0; j < n_workers; j ++) {
991 printf("%p ", lp->tx.rings[port][j]);
1000 /* Print worker lcore TX params */
1001 for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
1002 struct app_lcore_params_worker *lp = &app.lcore_params[lcore].worker;
1004 if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
1008 printf("Worker lcore %u (socket %u) ID %u: \n",
1010 rte_lcore_to_socket_id(lcore),
1011 (unsigned)lp->worker_id);
1013 printf("Output rings per TX port ");
1014 for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
1015 if (lp->rings_out[port] != NULL) {
1016 printf("%u (%p) ", port, lp->rings_out[port]);
1023 /* Print LPM rules */
1024 printf("LPM rules: \n");
1025 for (rule = 0; rule < app.n_lpm_rules; rule ++) {
1026 uint32_t ip = app.lpm_rules[rule].ip;
1027 uint8_t depth = app.lpm_rules[rule].depth;
1028 uint8_t if_out = app.lpm_rules[rule].if_out;
1030 printf("\t%u: %u.%u.%u.%u/%u => %u;\n",
1032 (unsigned) (ip & 0xFF000000) >> 24,
1033 (unsigned) (ip & 0x00FF0000) >> 16,
1034 (unsigned) (ip & 0x0000FF00) >> 8,
1035 (unsigned) ip & 0x000000FF,
1042 printf("Ring sizes: NIC RX = %u; Worker in = %u; Worker out = %u; NIC TX = %u;\n",
1043 (unsigned) app.nic_rx_ring_size,
1044 (unsigned) app.ring_rx_size,
1045 (unsigned) app.ring_tx_size,
1046 (unsigned) app.nic_tx_ring_size);
1049 printf("Burst sizes: I/O RX (rd = %u, wr = %u); Worker (rd = %u, wr = %u); I/O TX (rd = %u, wr = %u)\n",
1050 (unsigned) app.burst_size_io_rx_read,
1051 (unsigned) app.burst_size_io_rx_write,
1052 (unsigned) app.burst_size_worker_read,
1053 (unsigned) app.burst_size_worker_write,
1054 (unsigned) app.burst_size_io_tx_read,
1055 (unsigned) app.burst_size_io_tx_write);