1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2018 Intel Corporation
11 #include <rte_launch.h>
17 #include "cryptodev.h"
26 static const char usage[] =
27 "%s EAL_ARGS -- [-h HOST] [-p PORT] [-s SCRIPT]\n";
29 static const char welcome[] =
31 "Welcome to IP Pipeline!\n"
34 static const char prompt[] = "pipeline> ";
36 static struct app_params {
37 struct conn_params conn;
45 .buf_size = 1024 * 1024,
46 .msg_in_len_max = 1024,
47 .msg_out_len_max = 1024 * 1024,
48 .msg_handle = cli_process,
54 parse_args(int argc, char **argv)
56 char *app_name = argv[0];
57 struct option lgopts[] = {
60 int opt, option_index;
61 int h_present, p_present, s_present, n_args, i;
63 /* Skip EAL input args */
65 for (i = 0; i < n_args; i++)
66 if (strcmp(argv[i], "--") == 0) {
80 while ((opt = getopt_long(argc, argv, "h:p:s:", lgopts, &option_index))
85 printf("Error: Multiple -h arguments\n");
90 if (!strlen(optarg)) {
91 printf("Error: Argument for -h not provided\n");
95 app.conn.addr = strdup(optarg);
96 if (app.conn.addr == NULL) {
97 printf("Error: Not enough memory\n");
104 printf("Error: Multiple -p arguments\n");
109 if (!strlen(optarg)) {
110 printf("Error: Argument for -p not provided\n");
114 app.conn.port = (uint16_t) atoi(optarg);
119 printf("Error: Multiple -s arguments\n");
124 if (!strlen(optarg)) {
125 printf("Error: Argument for -s not provided\n");
129 app.script_name = strdup(optarg);
130 if (app.script_name == NULL) {
131 printf("Error: Not enough memory\n");
137 printf(usage, app_name);
141 optind = 1; /* reset getopt lib */
147 main(int argc, char **argv)
152 /* Parse application arguments */
153 status = parse_args(argc, argv);
158 status = rte_eal_init(argc, argv);
160 printf("Error: EAL initialization failed (%d)\n", status);
165 conn = conn_init(&app.conn);
167 printf("Error: Connectivity initialization failed (%d)\n",
173 status = mempool_init();
175 printf("Error: Mempool initialization failed (%d)\n", status);
180 status = link_init();
182 printf("Error: Link initialization failed (%d)\n", status);
189 printf("Error: SWQ initialization failed (%d)\n", status);
193 /* Traffic Manager */
194 status = tmgr_init();
196 printf("Error: TMGR initialization failed (%d)\n", status);
203 printf("Error: TAP initialization failed (%d)\n", status);
210 printf("Error: KNI initialization failed (%d)\n", status);
215 status = cryptodev_init();
217 printf("Error: Cryptodev initialization failed (%d)\n",
223 status = port_in_action_profile_init();
225 printf("Error: Input port action profile initialization failed (%d)\n", status);
229 status = table_action_profile_init();
231 printf("Error: Action profile initialization failed (%d)\n",
237 status = pipeline_init();
239 printf("Error: Pipeline initialization failed (%d)\n", status);
244 status = thread_init();
246 printf("Error: Thread initialization failed (%d)\n", status);
250 rte_eal_mp_remote_launch(
257 cli_script_process(app.script_name,
258 app.conn.msg_in_len_max,
259 app.conn.msg_out_len_max);
263 conn_poll_for_conn(conn);
265 conn_poll_for_msg(conn);
267 kni_handle_request();