app/regex: support multiple cores
[dpdk.git] / app / test-regex / main.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2020 Mellanox Technologies, Ltd
3  */
4
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <stdint.h>
9 #include <stdbool.h>
10 #include <stdarg.h>
11 #include <ctype.h>
12 #include <errno.h>
13 #include <getopt.h>
14 #include <signal.h>
15
16 #include <rte_eal.h>
17 #include <rte_common.h>
18 #include <rte_malloc.h>
19 #include <rte_mempool.h>
20 #include <rte_mbuf.h>
21 #include <rte_cycles.h>
22 #include <rte_regexdev.h>
23
24 #define MAX_FILE_NAME 255
25 #define MBUF_CACHE_SIZE 256
26 #define MBUF_SIZE (1 << 8)
27 #define START_BURST_SIZE 32u
28
29 enum app_args {
30         ARG_HELP,
31         ARG_RULES_FILE_NAME,
32         ARG_DATA_FILE_NAME,
33         ARG_NUM_OF_JOBS,
34         ARG_PERF_MODE,
35         ARG_NUM_OF_ITERATIONS,
36         ARG_NUM_OF_QPS,
37         ARG_NUM_OF_LCORES,
38 };
39
40 struct job_ctx {
41         struct rte_mbuf *mbuf;
42 };
43
44 struct qp_params {
45         uint32_t total_enqueue;
46         uint32_t total_dequeue;
47         uint32_t total_matches;
48         struct rte_regex_ops **ops;
49         struct job_ctx *jobs_ctx;
50         char *buf;
51 };
52
53 struct qps_per_lcore {
54         unsigned int lcore_id;
55         int socket;
56         uint16_t qp_id_base;
57         uint16_t nb_qps;
58 };
59
60 struct regex_conf {
61         uint32_t nb_jobs;
62         bool perf_mode;
63         uint32_t nb_iterations;
64         char *data_file;
65         uint8_t nb_max_matches;
66         uint32_t nb_qps;
67         uint16_t qp_id_base;
68         char *data_buf;
69         long data_len;
70         long job_len;
71 };
72
73 static void
74 usage(const char *prog_name)
75 {
76         printf("%s [EAL options] --\n"
77                 " --rules NAME: precompiled rules file\n"
78                 " --data NAME: data file to use\n"
79                 " --nb_jobs: number of jobs to use\n"
80                 " --perf N: only outputs the performance data\n"
81                 " --nb_iter N: number of iteration to run\n"
82                 " --nb_qps N: number of queues to use\n"
83                 " --nb_lcores N: number of lcores to use\n",
84                 prog_name);
85 }
86
87 static void
88 args_parse(int argc, char **argv, char *rules_file, char *data_file,
89            uint32_t *nb_jobs, bool *perf_mode, uint32_t *nb_iterations,
90            uint32_t *nb_qps, uint32_t *nb_lcores)
91 {
92         char **argvopt;
93         int opt;
94         int opt_idx;
95         size_t len;
96         static struct option lgopts[] = {
97                 { "help",  0, 0, ARG_HELP},
98                 /* Rules database file to load. */
99                 { "rules",  1, 0, ARG_RULES_FILE_NAME},
100                 /* Data file to load. */
101                 { "data",  1, 0, ARG_DATA_FILE_NAME},
102                 /* Number of jobs to create. */
103                 { "nb_jobs",  1, 0, ARG_NUM_OF_JOBS},
104                 /* Perf test only */
105                 { "perf", 0, 0, ARG_PERF_MODE},
106                 /* Number of iterations to run with perf test */
107                 { "nb_iter", 1, 0, ARG_NUM_OF_ITERATIONS},
108                 /* Number of QPs. */
109                 { "nb_qps", 1, 0, ARG_NUM_OF_QPS},
110                 /* Number of lcores. */
111                 { "nb_lcores", 1, 0, ARG_NUM_OF_LCORES},
112                 /* End of options */
113                 { 0, 0, 0, 0 }
114         };
115
116         argvopt = argv;
117         while ((opt = getopt_long(argc, argvopt, "",
118                                 lgopts, &opt_idx)) != EOF) {
119                 switch (opt) {
120                 case ARG_RULES_FILE_NAME:
121                         len = strnlen(optarg, MAX_FILE_NAME - 1);
122                         if (len == MAX_FILE_NAME)
123                                 rte_exit(EXIT_FAILURE,
124                                          "Rule file name to long max %d\n",
125                                          MAX_FILE_NAME - 1);
126                         strncpy(rules_file, optarg, MAX_FILE_NAME - 1);
127                         break;
128                 case ARG_DATA_FILE_NAME:
129                         len = strnlen(optarg, MAX_FILE_NAME - 1);
130                         if (len == MAX_FILE_NAME)
131                                 rte_exit(EXIT_FAILURE,
132                                          "Data file name to long max %d\n",
133                                          MAX_FILE_NAME - 1);
134                         strncpy(data_file, optarg, MAX_FILE_NAME - 1);
135                         break;
136                 case ARG_NUM_OF_JOBS:
137                         *nb_jobs = atoi(optarg);
138                         break;
139                 case ARG_PERF_MODE:
140                         *perf_mode = true;
141                         break;
142                 case ARG_NUM_OF_ITERATIONS:
143                         *nb_iterations = atoi(optarg);
144                         break;
145                 case ARG_NUM_OF_QPS:
146                         *nb_qps = atoi(optarg);
147                         break;
148                 case ARG_NUM_OF_LCORES:
149                         *nb_lcores = atoi(optarg);
150                         break;
151                 case ARG_HELP:
152                         usage("RegEx test app");
153                         break;
154                 default:
155                         fprintf(stderr, "Invalid option: %s\n", argv[optind]);
156                         usage("RegEx test app");
157                         rte_exit(EXIT_FAILURE, "Invalid option\n");
158                         break;
159                 }
160         }
161
162         if (!perf_mode)
163                 *nb_iterations = 1;
164 }
165
166 static long
167 read_file(char *file, char **buf)
168 {
169         FILE *fp;
170         long buf_len = 0;
171         size_t read_len;
172         int res = 0;
173
174         fp = fopen(file, "r");
175         if (!fp)
176                 return -EIO;
177         if (fseek(fp, 0L, SEEK_END) == 0) {
178                 buf_len = ftell(fp);
179                 if (buf_len == -1) {
180                         res = EIO;
181                         goto error;
182                 }
183                 *buf = rte_malloc(NULL, sizeof(char) * (buf_len + 1), 4096);
184                 if (!*buf) {
185                         res = ENOMEM;
186                         goto error;
187                 }
188                 if (fseek(fp, 0L, SEEK_SET) != 0) {
189                         res = EIO;
190                         goto error;
191                 }
192                 read_len = fread(*buf, sizeof(char), buf_len, fp);
193                 if (read_len != (unsigned long)buf_len) {
194                         res = EIO;
195                         goto error;
196                 }
197         }
198         fclose(fp);
199         return buf_len;
200 error:
201         printf("Error, can't open file %s\n, err = %d", file, res);
202         if (fp)
203                 fclose(fp);
204         if (*buf)
205                 rte_free(*buf);
206         return -res;
207 }
208
209 static int
210 clone_buf(char *data_buf, char **buf, long data_len)
211 {
212         char *dest_buf;
213         dest_buf =
214                 rte_malloc(NULL, sizeof(char) * (data_len + 1), 4096);
215         if (!dest_buf)
216                 return -ENOMEM;
217         memcpy(dest_buf, data_buf, data_len + 1);
218         *buf = dest_buf;
219         return 0;
220 }
221
222 static int
223 init_port(uint16_t *nb_max_payload, char *rules_file, uint8_t *nb_max_matches,
224           uint32_t nb_qps)
225 {
226         uint16_t id;
227         uint16_t qp_id;
228         uint16_t num_devs;
229         char *rules = NULL;
230         long rules_len;
231         struct rte_regexdev_info info;
232         struct rte_regexdev_config dev_conf = {
233                 .nb_queue_pairs = nb_qps,
234                 .nb_groups = 1,
235         };
236         struct rte_regexdev_qp_conf qp_conf = {
237                 .nb_desc = 1024,
238                 .qp_conf_flags = 0,
239         };
240         int res = 0;
241
242         num_devs = rte_regexdev_count();
243         if (num_devs == 0) {
244                 printf("Error, no devices detected.\n");
245                 return -EINVAL;
246         }
247
248         rules_len = read_file(rules_file, &rules);
249         if (rules_len < 0) {
250                 printf("Error, can't read rules files.\n");
251                 res = -EIO;
252                 goto error;
253         }
254
255         for (id = 0; id < num_devs; id++) {
256                 res = rte_regexdev_info_get(id, &info);
257                 if (res != 0) {
258                         printf("Error, can't get device info.\n");
259                         goto error;
260                 }
261                 printf(":: initializing dev: %d\n", id);
262                 *nb_max_matches = info.max_matches;
263                 *nb_max_payload = info.max_payload_size;
264                 if (info.regexdev_capa & RTE_REGEXDEV_SUPP_MATCH_AS_END_F)
265                         dev_conf.dev_cfg_flags |=
266                         RTE_REGEXDEV_CFG_MATCH_AS_END_F;
267                 dev_conf.nb_max_matches = info.max_matches;
268                 dev_conf.nb_rules_per_group = info.max_rules_per_group;
269                 dev_conf.rule_db_len = rules_len;
270                 dev_conf.rule_db = rules;
271                 res = rte_regexdev_configure(id, &dev_conf);
272                 if (res < 0) {
273                         printf("Error, can't configure device %d.\n", id);
274                         goto error;
275                 }
276                 if (info.regexdev_capa & RTE_REGEXDEV_CAPA_QUEUE_PAIR_OOS_F)
277                         qp_conf.qp_conf_flags |=
278                         RTE_REGEX_QUEUE_PAIR_CFG_OOS_F;
279                 for (qp_id = 0; qp_id < nb_qps; qp_id++) {
280                         res = rte_regexdev_queue_pair_setup(id, qp_id,
281                                                             &qp_conf);
282                         if (res < 0) {
283                                 printf("Error, can't setup queue pair %u for "
284                                        "device %d.\n", qp_id, id);
285                                 goto error;
286                         }
287                 }
288                 printf(":: initializing device: %d done\n", id);
289         }
290         rte_free(rules);
291         return 0;
292 error:
293         if (rules)
294                 rte_free(rules);
295         return res;
296 }
297
298 static void
299 extbuf_free_cb(void *addr __rte_unused, void *fcb_opaque __rte_unused)
300 {
301 }
302
303 static int
304 run_regex(void *args)
305 {
306         struct regex_conf *rgxc = args;
307         uint32_t nb_jobs = rgxc->nb_jobs;
308         uint32_t nb_iterations = rgxc->nb_iterations;
309         uint8_t nb_max_matches = rgxc->nb_max_matches;
310         uint32_t nb_qps = rgxc->nb_qps;
311         uint16_t qp_id_base  = rgxc->qp_id_base;
312         char *data_buf = rgxc->data_buf;
313         long data_len = rgxc->data_len;
314         long job_len = rgxc->job_len;
315
316         char *buf = NULL;
317         uint32_t actual_jobs = 0;
318         uint32_t i;
319         uint16_t qp_id;
320         uint16_t dev_id = 0;
321         uint8_t nb_matches;
322         struct rte_regexdev_match *match;
323         long pos;
324         unsigned long d_ind = 0;
325         struct rte_mbuf_ext_shared_info shinfo;
326         int res = 0;
327         time_t start;
328         time_t end;
329         double time;
330         struct rte_mempool *mbuf_mp;
331         struct qp_params *qp;
332         struct qp_params *qps = NULL;
333         bool update;
334         uint16_t qps_used = 0;
335         char mbuf_pool[16];
336
337         shinfo.free_cb = extbuf_free_cb;
338         snprintf(mbuf_pool,
339                  sizeof(mbuf_pool),
340                  "mbuf_pool_%2u", qp_id_base);
341         mbuf_mp = rte_pktmbuf_pool_create(mbuf_pool, nb_jobs * nb_qps, 0,
342                         0, MBUF_SIZE, rte_socket_id());
343         if (mbuf_mp == NULL) {
344                 printf("Error, can't create memory pool\n");
345                 return -ENOMEM;
346         }
347
348         qps = rte_malloc(NULL, sizeof(*qps) * nb_qps, 0);
349         if (!qps) {
350                 printf("Error, can't allocate memory for QPs\n");
351                 res = -ENOMEM;
352                 goto end;
353         }
354
355         for (qp_id = 0; qp_id < nb_qps; qp_id++) {
356                 struct rte_regex_ops **ops;
357                 struct job_ctx *jobs_ctx;
358
359                 qps_used++;
360                 qp = &qps[qp_id];
361                 qp->jobs_ctx = NULL;
362                 qp->buf = NULL;
363                 qp->ops = ops = rte_malloc(NULL, sizeof(*ops) * nb_jobs, 0);
364                 if (!ops) {
365                         printf("Error, can't allocate memory for ops.\n");
366                         res = -ENOMEM;
367                         goto end;
368                 }
369
370                 qp->jobs_ctx = jobs_ctx =
371                         rte_malloc(NULL, sizeof(*jobs_ctx) * nb_jobs, 0);
372                 if (!jobs_ctx) {
373                         printf("Error, can't allocate memory for jobs_ctx.\n");
374                         res = -ENOMEM;
375                         goto end;
376                 }
377
378                 /* Allocate the jobs and assign each job with an mbuf. */
379                 for (i = 0; i < nb_jobs; i++) {
380                         ops[i] = rte_malloc(NULL, sizeof(*ops[0]) +
381                                         nb_max_matches *
382                                         sizeof(struct rte_regexdev_match), 0);
383                         if (!ops[i]) {
384                                 printf("Error, can't allocate "
385                                        "memory for op.\n");
386                                 res = -ENOMEM;
387                                 goto end;
388                         }
389                         ops[i]->mbuf = rte_pktmbuf_alloc(mbuf_mp);
390                         if (!ops[i]->mbuf) {
391                                 printf("Error, can't attach mbuf.\n");
392                                 res = -ENOMEM;
393                                 goto end;
394                         }
395                 }
396
397                 if (clone_buf(data_buf, &buf, data_len)) {
398                         printf("Error, can't clone buf.\n");
399                         res = -EXIT_FAILURE;
400                         goto end;
401                 }
402
403                 /* Assign each mbuf with the data to handle. */
404                 actual_jobs = 0;
405                 pos = 0;
406                 for (i = 0; (pos < data_len) && (i < nb_jobs) ; i++) {
407                         long act_job_len = RTE_MIN(job_len, data_len - pos);
408                         rte_pktmbuf_attach_extbuf(ops[i]->mbuf, &buf[pos], 0,
409                                         act_job_len, &shinfo);
410                         jobs_ctx[i].mbuf = ops[i]->mbuf;
411                         ops[i]->mbuf->data_len = job_len;
412                         ops[i]->mbuf->pkt_len = act_job_len;
413                         ops[i]->user_id = i;
414                         ops[i]->group_id0 = 1;
415                         pos += act_job_len;
416                         actual_jobs++;
417                 }
418
419                 qp->buf = buf;
420                 qp->total_matches = 0;
421         }
422
423         start = clock();
424         for (i = 0; i < nb_iterations; i++) {
425                 for (qp_id = 0; qp_id < nb_qps; qp_id++) {
426                         qp = &qps[qp_id];
427                         qp->total_enqueue = 0;
428                         qp->total_dequeue = 0;
429                 }
430                 do {
431                         update = false;
432                         for (qp_id = 0; qp_id < nb_qps; qp_id++) {
433                                 qp = &qps[qp_id];
434                                 if (qp->total_dequeue < actual_jobs) {
435                                         struct rte_regex_ops **
436                                                 cur_ops_to_enqueue = qp->ops +
437                                                 qp->total_enqueue;
438
439                                         if (actual_jobs - qp->total_enqueue)
440                                                 qp->total_enqueue +=
441                                                 rte_regexdev_enqueue_burst
442                                                         (dev_id,
443                                                         qp_id_base + qp_id,
444                                                         cur_ops_to_enqueue,
445                                                         actual_jobs -
446                                                         qp->total_enqueue);
447                                 }
448                         }
449                         for (qp_id = 0; qp_id < nb_qps; qp_id++) {
450                                 qp = &qps[qp_id];
451                                 if (qp->total_dequeue < actual_jobs) {
452                                         struct rte_regex_ops **
453                                                 cur_ops_to_dequeue = qp->ops +
454                                                 qp->total_dequeue;
455
456                                         qp->total_dequeue +=
457                                                 rte_regexdev_dequeue_burst
458                                                         (dev_id,
459                                                         qp_id_base + qp_id,
460                                                         cur_ops_to_dequeue,
461                                                         qp->total_enqueue -
462                                                         qp->total_dequeue);
463                                         update = true;
464                                 }
465                         }
466                 } while (update);
467         }
468         end = clock();
469         time = ((double)end - start) / CLOCKS_PER_SEC;
470         printf("Job len = %ld Bytes\n",  job_len);
471         printf("Time = %lf sec\n",  time);
472         printf("Perf = %lf Gbps\n",
473                (((double)actual_jobs * job_len * nb_iterations * 8) / time) /
474                 1000000000.0);
475
476         if (rgxc->perf_mode)
477                 goto end;
478         for (qp_id = 0; qp_id < nb_qps; qp_id++) {
479                 printf("\n############ QP id=%u ############\n", qp_id);
480                 qp = &qps[qp_id];
481                 /* Log results per job. */
482                 for (d_ind = 0; d_ind < qp->total_dequeue; d_ind++) {
483                         nb_matches = qp->ops[d_ind % actual_jobs]->nb_matches;
484                         printf("Job id %"PRIu64" number of matches = %d\n",
485                                         qp->ops[d_ind]->user_id, nb_matches);
486                         qp->total_matches += nb_matches;
487                         match = qp->ops[d_ind % actual_jobs]->matches;
488                         for (i = 0; i < nb_matches; i++) {
489                                 printf("match %d, rule = %d, "
490                                        "start = %d,len = %d\n",
491                                        i, match->rule_id, match->start_offset,
492                                        match->len);
493                                 match++;
494                         }
495                 }
496                 printf("Total matches = %d\n", qp->total_matches);
497                 printf("All Matches:\n");
498                 /* Log absolute results. */
499                 for (d_ind = 0; d_ind < qp->total_dequeue; d_ind++) {
500                         nb_matches = qp->ops[d_ind % actual_jobs]->nb_matches;
501                         qp->total_matches += nb_matches;
502                         match = qp->ops[d_ind % actual_jobs]->matches;
503                         for (i = 0; i < nb_matches; i++) {
504                                 printf("start = %ld, len = %d, rule = %d\n",
505                                                 match->start_offset +
506                                                 d_ind * job_len,
507                                                 match->len, match->rule_id);
508                                 match++;
509                         }
510                 }
511         }
512 end:
513         for (qp_id = 0; qp_id < qps_used; qp_id++) {
514                 qp = &qps[qp_id];
515                 for (i = 0; i < actual_jobs && qp->ops; i++)
516                         rte_free(qp->ops[i]);
517                 rte_free(qp->ops);
518                 qp->ops = NULL;
519                 for (i = 0; i < actual_jobs && qp->jobs_ctx; i++)
520                         rte_pktmbuf_free(qp->jobs_ctx[i].mbuf);
521                 rte_free(qp->jobs_ctx);
522                 qp->jobs_ctx = NULL;
523                 rte_free(qp->buf);
524                 qp->buf = NULL;
525         }
526         if (mbuf_mp)
527                 rte_mempool_free(mbuf_mp);
528         rte_free(qps);
529         return res;
530 }
531
532 static int
533 distribute_qps_to_lcores(uint32_t nb_cores, uint32_t nb_qps,
534                          struct qps_per_lcore **qpl)
535 {
536         int socket;
537         unsigned lcore_id;
538         uint32_t i;
539         uint16_t min_qp_id;
540         uint16_t max_qp_id;
541         struct qps_per_lcore *qps_per_lcore;
542         uint32_t detected_lcores;
543
544         if (nb_qps < nb_cores) {
545                 nb_cores = nb_qps;
546                 printf("Reducing number of cores to number of QPs (%u)\n",
547                        nb_cores);
548         }
549         /* Allocate qps_per_lcore array */
550         qps_per_lcore =
551                 rte_malloc(NULL, sizeof(*qps_per_lcore) * nb_cores, 0);
552         if (!qps_per_lcore)
553                 rte_exit(EXIT_FAILURE, "Failed to create qps_per_lcore array\n");
554         *qpl = qps_per_lcore;
555         detected_lcores = 0;
556         min_qp_id = 0;
557
558         RTE_LCORE_FOREACH_WORKER(lcore_id) {
559                 if (detected_lcores >= nb_cores)
560                         break;
561                 qps_per_lcore[detected_lcores].lcore_id = lcore_id;
562                 socket = rte_lcore_to_socket_id(lcore_id);
563                 if (socket == SOCKET_ID_ANY)
564                         socket = 0;
565                 qps_per_lcore[detected_lcores].socket = socket;
566                 qps_per_lcore[detected_lcores].qp_id_base = min_qp_id;
567                 max_qp_id = min_qp_id + nb_qps / nb_cores - 1;
568                 if (nb_qps % nb_cores > detected_lcores)
569                         max_qp_id++;
570                 qps_per_lcore[detected_lcores].nb_qps = max_qp_id -
571                                                         min_qp_id + 1;
572                 min_qp_id = max_qp_id + 1;
573                 detected_lcores++;
574         }
575         if (detected_lcores != nb_cores)
576                 return -1;
577
578         for (i = 0; i < detected_lcores; i++) {
579                 printf("===> Core %d: allocated queues: ",
580                        qps_per_lcore[i].lcore_id);
581                 min_qp_id = qps_per_lcore[i].qp_id_base;
582                 max_qp_id =
583                         qps_per_lcore[i].qp_id_base + qps_per_lcore[i].nb_qps;
584                 while (min_qp_id < max_qp_id) {
585                         printf("%u ", min_qp_id);
586                         min_qp_id++;
587                 }
588                 printf("\n");
589         }
590         return 0;
591 }
592
593 int
594 main(int argc, char **argv)
595 {
596         char rules_file[MAX_FILE_NAME];
597         char data_file[MAX_FILE_NAME];
598         uint32_t nb_jobs = 0;
599         bool perf_mode = 0;
600         uint32_t nb_iterations = 0;
601         int ret;
602         uint16_t nb_max_payload = 0;
603         uint8_t nb_max_matches = 0;
604         uint32_t nb_qps = 1;
605         char *data_buf;
606         long data_len;
607         long job_len;
608         uint32_t nb_lcores = 1;
609         struct regex_conf *rgxc;
610         uint32_t i;
611         struct qps_per_lcore *qps_per_lcore;
612
613         /* Init EAL. */
614         ret = rte_eal_init(argc, argv);
615         if (ret < 0)
616                 rte_exit(EXIT_FAILURE, "EAL init failed\n");
617         argc -= ret;
618         argv += ret;
619         if (argc > 1)
620                 args_parse(argc, argv, rules_file, data_file, &nb_jobs,
621                                 &perf_mode, &nb_iterations, &nb_qps,
622                                 &nb_lcores);
623
624         if (nb_qps == 0)
625                 rte_exit(EXIT_FAILURE, "Number of QPs must be greater than 0\n");
626         if (nb_lcores == 0)
627                 rte_exit(EXIT_FAILURE, "Number of lcores must be greater than 0\n");
628         if (distribute_qps_to_lcores(nb_lcores, nb_qps, &qps_per_lcore) < 0)
629                 rte_exit(EXIT_FAILURE, "Failed to distribute queues to lcores!\n");
630         ret = init_port(&nb_max_payload, rules_file,
631                         &nb_max_matches, nb_qps);
632         if (ret < 0)
633                 rte_exit(EXIT_FAILURE, "init port failed\n");
634
635         data_len = read_file(data_file, &data_buf);
636         if (data_len <= 0)
637                 rte_exit(EXIT_FAILURE, "Error, can't read file, or file is empty.\n");
638
639         job_len = data_len / nb_jobs;
640         if (job_len == 0)
641                 rte_exit(EXIT_FAILURE, "Error, To many jobs, for the given input.\n");
642
643         if (job_len > nb_max_payload)
644                 rte_exit(EXIT_FAILURE, "Error, not enough jobs to cover input.\n");
645
646         rgxc = rte_malloc(NULL, sizeof(*rgxc) * nb_lcores, 0);
647         if (!rgxc)
648                 rte_exit(EXIT_FAILURE, "Failed to create Regex Conf\n");
649         for (i = 0; i < nb_lcores; i++) {
650                 rgxc[i] = (struct regex_conf){
651                         .nb_jobs = nb_jobs,
652                         .perf_mode = perf_mode,
653                         .nb_iterations = nb_iterations,
654                         .nb_max_matches = nb_max_matches,
655                         .nb_qps = qps_per_lcore[i].nb_qps,
656                         .qp_id_base = qps_per_lcore[i].qp_id_base,
657                         .data_buf = data_buf,
658                         .data_len = data_len,
659                         .job_len = job_len,
660                 };
661                 rte_eal_remote_launch(run_regex, &rgxc[i],
662                                       qps_per_lcore[i].lcore_id);
663         }
664         rte_eal_mp_wait_lcore();
665         rte_free(data_buf);
666         rte_free(rgxc);
667         rte_free(qps_per_lcore);
668         return EXIT_SUCCESS;
669 }