4 * Copyright(c) 2010-2016 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.
34 #ifndef __INCLUDE_APP_H__
35 #define __INCLUDE_APP_H__
40 #include <rte_common.h>
41 #include <rte_mempool.h>
43 #include <rte_sched.h>
44 #include <cmdline_parse.h>
46 #include <rte_ethdev.h>
48 #include "cpu_core_map.h"
51 #define APP_PARAM_NAME_SIZE PIPELINE_NAME_SIZE
52 #define APP_LINK_PCI_BDF_SIZE 16
53 struct app_mempool_params {
59 uint32_t cpu_socket_id;
62 struct app_link_params {
65 uint32_t pmd_id; /* Generated based on port mask */
66 uint32_t arp_q; /* 0 = Disabled (packets go to default queue 0) */
67 uint32_t tcp_syn_q; /* 0 = Disabled (pkts go to default queue) */
68 uint32_t ip_local_q; /* 0 = Disabled (pkts go to default queue 0) */
69 uint32_t tcp_local_q; /* 0 = Disabled (pkts go to default queue 0) */
70 uint32_t udp_local_q; /* 0 = Disabled (pkts go to default queue 0) */
71 uint32_t sctp_local_q; /* 0 = Disabled (pkts go to default queue 0) */
72 uint32_t state; /* DOWN = 0, UP = 1 */
73 uint32_t ip; /* 0 = Invalid */
74 uint32_t depth; /* Valid only when IP is valid */
75 uint64_t mac_addr; /* Read from HW */
76 char pci_bdf[APP_LINK_PCI_BDF_SIZE];
78 struct rte_eth_conf conf;
82 struct app_pktq_hwq_in_params {
85 uint32_t mempool_id; /* Position in the app->mempool_params */
89 struct rte_eth_rxconf conf;
92 struct app_pktq_hwq_out_params {
99 struct rte_eth_txconf conf;
102 struct app_pktq_swq_params {
107 uint32_t burst_write;
110 uint32_t cpu_socket_id;
116 uint32_t metadata_size;
117 uint32_t mempool_direct_id;
118 uint32_t mempool_indirect_id;
121 #ifndef APP_FILE_NAME_SIZE
122 #define APP_FILE_NAME_SIZE 256
125 #ifndef APP_MAX_SCHED_SUBPORTS
126 #define APP_MAX_SCHED_SUBPORTS 8
129 #ifndef APP_MAX_SCHED_PIPES
130 #define APP_MAX_SCHED_PIPES 4096
133 struct app_pktq_tm_params {
136 const char *file_name;
137 struct rte_sched_port_params sched_port_params;
138 struct rte_sched_subport_params
139 sched_subport_params[APP_MAX_SCHED_SUBPORTS];
140 struct rte_sched_pipe_params
141 sched_pipe_profiles[RTE_SCHED_PIPE_PROFILES_PER_PORT];
142 int sched_pipe_to_profile[APP_MAX_SCHED_SUBPORTS * APP_MAX_SCHED_PIPES];
144 uint32_t burst_write;
147 struct app_pktq_source_params {
150 uint32_t mempool_id; /* Position in the app->mempool_params array */
152 char *file_name; /* Full path of PCAP file to be copied to mbufs */
153 uint32_t n_bytes_per_pkt;
156 struct app_pktq_sink_params {
159 char *file_name; /* Full path of PCAP file to be copied to mbufs */
160 uint32_t n_pkts_to_dump;
163 struct app_msgq_params {
167 uint32_t cpu_socket_id;
170 enum app_pktq_in_type {
177 struct app_pktq_in_params {
178 enum app_pktq_in_type type;
179 uint32_t id; /* Position in the appropriate app array */
182 enum app_pktq_out_type {
189 struct app_pktq_out_params {
190 enum app_pktq_out_type type;
191 uint32_t id; /* Position in the appropriate app array */
194 #ifndef APP_PIPELINE_TYPE_SIZE
195 #define APP_PIPELINE_TYPE_SIZE 64
198 #define APP_MAX_PIPELINE_PKTQ_IN PIPELINE_MAX_PORT_IN
199 #define APP_MAX_PIPELINE_PKTQ_OUT PIPELINE_MAX_PORT_OUT
200 #define APP_MAX_PIPELINE_MSGQ_IN PIPELINE_MAX_MSGQ_IN
201 #define APP_MAX_PIPELINE_MSGQ_OUT PIPELINE_MAX_MSGQ_OUT
203 #define APP_MAX_PIPELINE_ARGS PIPELINE_MAX_ARGS
205 struct app_pipeline_params {
209 char type[APP_PIPELINE_TYPE_SIZE];
213 uint32_t hyper_th_id;
215 struct app_pktq_in_params pktq_in[APP_MAX_PIPELINE_PKTQ_IN];
216 struct app_pktq_out_params pktq_out[APP_MAX_PIPELINE_PKTQ_OUT];
217 uint32_t msgq_in[APP_MAX_PIPELINE_MSGQ_IN];
218 uint32_t msgq_out[APP_MAX_PIPELINE_MSGQ_OUT];
225 uint32_t timer_period;
227 char *args_name[APP_MAX_PIPELINE_ARGS];
228 char *args_value[APP_MAX_PIPELINE_ARGS];
232 struct app_pipeline_data {
235 struct pipeline_type *ptype;
236 uint64_t timer_period;
240 struct app_thread_pipeline_data {
241 uint32_t pipeline_id;
243 pipeline_be_op_run f_run;
244 pipeline_be_op_timer f_timer;
245 uint64_t timer_period;
249 #ifndef APP_MAX_THREAD_PIPELINES
250 #define APP_MAX_THREAD_PIPELINES 16
253 #ifndef APP_THREAD_TIMER_PERIOD
254 #define APP_THREAD_TIMER_PERIOD 1
257 struct app_thread_data {
258 struct app_thread_pipeline_data regular[APP_MAX_THREAD_PIPELINES];
259 struct app_thread_pipeline_data custom[APP_MAX_THREAD_PIPELINES];
264 uint64_t timer_period;
265 uint64_t thread_req_deadline;
269 struct rte_ring *msgq_in;
270 struct rte_ring *msgq_out;
272 uint64_t headroom_time;
273 uint64_t headroom_cycles;
274 double headroom_ratio;
277 #ifndef APP_MAX_LINKS
278 #define APP_MAX_LINKS 16
281 struct app_eal_params {
282 /* Map lcore set to physical cpu set */
285 /* Core ID that is used as master */
286 uint32_t master_lcore_present;
287 uint32_t master_lcore;
289 /* Number of memory channels */
290 uint32_t channels_present;
293 /* Memory to allocate (see also --socket-mem) */
294 uint32_t memory_present;
297 /* Force number of memory ranks (don't detect) */
298 uint32_t ranks_present;
301 /* Add a PCI device in black list. */
302 char *pci_blacklist[APP_MAX_LINKS];
304 /* Add a PCI device in white list. */
305 char *pci_whitelist[APP_MAX_LINKS];
307 /* Add a virtual device. */
308 char *vdev[APP_MAX_LINKS];
310 /* Use VMware TSC map instead of native RDTSC */
311 uint32_t vmware_tsc_map_present;
314 /* Type of this process (primary|secondary|auto) */
317 /* Set syslog facility */
320 /* Set default log level */
321 uint32_t log_level_present;
324 /* Display version information on startup */
325 uint32_t version_present;
329 uint32_t help_present;
332 /* Use malloc instead of hugetlbfs */
333 uint32_t no_huge_present;
337 uint32_t no_pci_present;
341 uint32_t no_hpet_present;
344 /* No shared config (mmap'd files) */
345 uint32_t no_shconf_present;
351 /* Memory to allocate on sockets (comma separated values)*/
354 /* Directory where hugetlbfs is mounted */
357 /* Prefix for hugepage filenames */
360 /* Base virtual address */
363 /* Create /dev/uioX (usually done by hotplug) */
364 uint32_t create_uio_dev_present;
367 /* Interrupt mode for VFIO (legacy|msi|msix) */
370 /* Support running on Xen dom0 without hugetlbfs */
371 uint32_t xen_dom0_present;
375 #ifndef APP_APPNAME_SIZE
376 #define APP_APPNAME_SIZE 256
379 #ifndef APP_MAX_MEMPOOLS
380 #define APP_MAX_MEMPOOLS 8
383 #ifndef APP_LINK_MAX_HWQ_IN
384 #define APP_LINK_MAX_HWQ_IN 64
387 #ifndef APP_LINK_MAX_HWQ_OUT
388 #define APP_LINK_MAX_HWQ_OUT 64
391 #define APP_MAX_HWQ_IN (APP_MAX_LINKS * APP_LINK_MAX_HWQ_IN)
393 #define APP_MAX_HWQ_OUT (APP_MAX_LINKS * APP_LINK_MAX_HWQ_OUT)
395 #ifndef APP_MAX_PKTQ_SWQ
396 #define APP_MAX_PKTQ_SWQ 256
399 #define APP_MAX_PKTQ_TM APP_MAX_LINKS
401 #ifndef APP_MAX_PKTQ_SOURCE
402 #define APP_MAX_PKTQ_SOURCE 16
405 #ifndef APP_MAX_PKTQ_SINK
406 #define APP_MAX_PKTQ_SINK 16
410 #define APP_MAX_MSGQ 64
413 #ifndef APP_MAX_PIPELINES
414 #define APP_MAX_PIPELINES 64
418 #define APP_EAL_ARGC 32
421 #ifndef APP_MAX_PIPELINE_TYPES
422 #define APP_MAX_PIPELINE_TYPES 64
425 #ifndef APP_MAX_THREADS
426 #define APP_MAX_THREADS RTE_MAX_LCORE
430 #define APP_MAX_CMDS 64
433 #ifndef APP_THREAD_HEADROOM_STATS_COLLECT
434 #define APP_THREAD_HEADROOM_STATS_COLLECT 1
439 char app_name[APP_APPNAME_SIZE];
440 const char *config_file;
441 const char *script_file;
442 const char *parser_file;
443 const char *output_file;
445 const char *preproc_args;
449 struct app_eal_params eal_params;
450 struct app_mempool_params mempool_params[APP_MAX_MEMPOOLS];
451 struct app_link_params link_params[APP_MAX_LINKS];
452 struct app_pktq_hwq_in_params hwq_in_params[APP_MAX_HWQ_IN];
453 struct app_pktq_hwq_out_params hwq_out_params[APP_MAX_HWQ_OUT];
454 struct app_pktq_swq_params swq_params[APP_MAX_PKTQ_SWQ];
455 struct app_pktq_tm_params tm_params[APP_MAX_PKTQ_TM];
456 struct app_pktq_source_params source_params[APP_MAX_PKTQ_SOURCE];
457 struct app_pktq_sink_params sink_params[APP_MAX_PKTQ_SINK];
458 struct app_msgq_params msgq_params[APP_MAX_MSGQ];
459 struct app_pipeline_params pipeline_params[APP_MAX_PIPELINES];
463 uint32_t n_pktq_hwq_in;
464 uint32_t n_pktq_hwq_out;
467 uint32_t n_pktq_source;
468 uint32_t n_pktq_sink;
470 uint32_t n_pipelines;
473 char *eal_argv[1 + APP_EAL_ARGC];
474 struct cpu_core_map *core_map;
476 struct rte_mempool *mempool[APP_MAX_MEMPOOLS];
477 struct rte_ring *swq[APP_MAX_PKTQ_SWQ];
478 struct rte_sched_port *tm[APP_MAX_PKTQ_TM];
479 struct rte_ring *msgq[APP_MAX_MSGQ];
480 struct pipeline_type pipeline_type[APP_MAX_PIPELINE_TYPES];
481 struct app_pipeline_data pipeline_data[APP_MAX_PIPELINES];
482 struct app_thread_data thread_data[APP_MAX_THREADS];
483 cmdline_parse_ctx_t cmds[APP_MAX_CMDS + 1];
486 uint32_t n_pipeline_types;
490 #define APP_PARAM_VALID(obj) ((obj)->name != NULL)
492 #define APP_PARAM_COUNT(obj_array, n_objs) \
497 for (i = 0; i < RTE_DIM(obj_array); i++) \
498 if (APP_PARAM_VALID(&((obj_array)[i]))) \
502 #define APP_PARAM_FIND(obj_array, key) \
505 const ssize_t obj_count = RTE_DIM(obj_array); \
507 for (obj_idx = 0; obj_idx < obj_count; obj_idx++) { \
508 if (!APP_PARAM_VALID(&((obj_array)[obj_idx]))) \
511 if (strcmp(key, (obj_array)[obj_idx].name) == 0) \
514 obj_idx < obj_count ? obj_idx : -ENOENT; \
517 #define APP_PARAM_FIND_BY_ID(obj_array, prefix, id, obj) \
519 char name[APP_PARAM_NAME_SIZE]; \
522 sprintf(name, prefix "%" PRIu32, id); \
523 pos = APP_PARAM_FIND(obj_array, name); \
524 obj = (pos < 0) ? NULL : &((obj_array)[pos]); \
527 #define APP_PARAM_GET_ID(obj, prefix, id) \
529 sscanf(obj->name, prefix "%" SCNu32, &id); \
532 #define APP_PARAM_ADD(obj_array, obj_name) \
535 const ssize_t obj_count = RTE_DIM(obj_array); \
537 obj_idx = APP_PARAM_FIND(obj_array, obj_name); \
539 for (obj_idx = 0; obj_idx < obj_count; obj_idx++) { \
540 if (!APP_PARAM_VALID(&((obj_array)[obj_idx]))) \
544 if (obj_idx < obj_count) { \
545 (obj_array)[obj_idx].name = strdup(obj_name); \
546 if ((obj_array)[obj_idx].name == NULL) \
554 #define APP_CHECK(exp, fmt, ...) \
557 fprintf(stderr, fmt "\n", ## __VA_ARGS__); \
563 APP_LOG_LEVEL_HIGH = 1,
568 #define APP_LOG(app, level, fmt, ...) \
570 if (app->log_level >= APP_LOG_LEVEL_ ## level) \
571 fprintf(stdout, "[APP] " fmt "\n", ## __VA_ARGS__); \
574 static inline uint32_t
575 app_link_get_n_rxq(struct app_params *app, struct app_link_params *link)
577 uint32_t n_rxq = 0, link_id, i;
578 uint32_t n_pktq_hwq_in = RTE_MIN(app->n_pktq_hwq_in,
579 RTE_DIM(app->hwq_in_params));
581 APP_PARAM_GET_ID(link, "LINK", link_id);
583 for (i = 0; i < n_pktq_hwq_in; i++) {
584 struct app_pktq_hwq_in_params *p = &app->hwq_in_params[i];
585 uint32_t rxq_link_id, rxq_queue_id;
587 sscanf(p->name, "RXQ%" SCNu32 ".%" SCNu32,
588 &rxq_link_id, &rxq_queue_id);
589 if (rxq_link_id == link_id)
596 static inline uint32_t
597 app_link_get_n_txq(struct app_params *app, struct app_link_params *link)
599 uint32_t n_txq = 0, link_id, i;
600 uint32_t n_pktq_hwq_out = RTE_MIN(app->n_pktq_hwq_out,
601 RTE_DIM(app->hwq_out_params));
603 APP_PARAM_GET_ID(link, "LINK", link_id);
605 for (i = 0; i < n_pktq_hwq_out; i++) {
606 struct app_pktq_hwq_out_params *p = &app->hwq_out_params[i];
607 uint32_t txq_link_id, txq_queue_id;
609 sscanf(p->name, "TXQ%" SCNu32 ".%" SCNu32,
610 &txq_link_id, &txq_queue_id);
611 if (txq_link_id == link_id)
618 static inline uint32_t
619 app_rxq_get_readers(struct app_params *app, struct app_pktq_hwq_in_params *rxq)
621 uint32_t pos = rxq - app->hwq_in_params;
622 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
623 RTE_DIM(app->pipeline_params));
624 uint32_t n_readers = 0, i;
626 for (i = 0; i < n_pipelines; i++) {
627 struct app_pipeline_params *p = &app->pipeline_params[i];
628 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
631 for (j = 0; j < n_pktq_in; j++) {
632 struct app_pktq_in_params *pktq = &p->pktq_in[j];
634 if ((pktq->type == APP_PKTQ_IN_HWQ) &&
643 static inline uint32_t
644 app_swq_get_readers(struct app_params *app, struct app_pktq_swq_params *swq)
646 uint32_t pos = swq - app->swq_params;
647 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
648 RTE_DIM(app->pipeline_params));
649 uint32_t n_readers = 0, i;
651 for (i = 0; i < n_pipelines; i++) {
652 struct app_pipeline_params *p = &app->pipeline_params[i];
653 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
656 for (j = 0; j < n_pktq_in; j++) {
657 struct app_pktq_in_params *pktq = &p->pktq_in[j];
659 if ((pktq->type == APP_PKTQ_IN_SWQ) &&
668 static inline uint32_t
669 app_tm_get_readers(struct app_params *app, struct app_pktq_tm_params *tm)
671 uint32_t pos = tm - app->tm_params;
672 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
673 RTE_DIM(app->pipeline_params));
674 uint32_t n_readers = 0, i;
676 for (i = 0; i < n_pipelines; i++) {
677 struct app_pipeline_params *p = &app->pipeline_params[i];
678 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
681 for (j = 0; j < n_pktq_in; j++) {
682 struct app_pktq_in_params *pktq = &p->pktq_in[j];
684 if ((pktq->type == APP_PKTQ_IN_TM) &&
693 static inline uint32_t
694 app_source_get_readers(struct app_params *app,
695 struct app_pktq_source_params *source)
697 uint32_t pos = source - app->source_params;
698 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
699 RTE_DIM(app->pipeline_params));
700 uint32_t n_readers = 0, i;
702 for (i = 0; i < n_pipelines; i++) {
703 struct app_pipeline_params *p = &app->pipeline_params[i];
704 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
707 for (j = 0; j < n_pktq_in; j++) {
708 struct app_pktq_in_params *pktq = &p->pktq_in[j];
710 if ((pktq->type == APP_PKTQ_IN_SOURCE) &&
719 static inline uint32_t
720 app_msgq_get_readers(struct app_params *app, struct app_msgq_params *msgq)
722 uint32_t pos = msgq - app->msgq_params;
723 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
724 RTE_DIM(app->pipeline_params));
725 uint32_t n_readers = 0, i;
727 for (i = 0; i < n_pipelines; i++) {
728 struct app_pipeline_params *p = &app->pipeline_params[i];
729 uint32_t n_msgq_in = RTE_MIN(p->n_msgq_in, RTE_DIM(p->msgq_in));
732 for (j = 0; j < n_msgq_in; j++)
733 if (p->msgq_in[j] == pos)
740 static inline uint32_t
741 app_txq_get_writers(struct app_params *app, struct app_pktq_hwq_out_params *txq)
743 uint32_t pos = txq - app->hwq_out_params;
744 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
745 RTE_DIM(app->pipeline_params));
746 uint32_t n_writers = 0, i;
748 for (i = 0; i < n_pipelines; i++) {
749 struct app_pipeline_params *p = &app->pipeline_params[i];
750 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
751 RTE_DIM(p->pktq_out));
754 for (j = 0; j < n_pktq_out; j++) {
755 struct app_pktq_out_params *pktq = &p->pktq_out[j];
757 if ((pktq->type == APP_PKTQ_OUT_HWQ) &&
766 static inline uint32_t
767 app_swq_get_writers(struct app_params *app, struct app_pktq_swq_params *swq)
769 uint32_t pos = swq - app->swq_params;
770 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
771 RTE_DIM(app->pipeline_params));
772 uint32_t n_writers = 0, i;
774 for (i = 0; i < n_pipelines; i++) {
775 struct app_pipeline_params *p = &app->pipeline_params[i];
776 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
777 RTE_DIM(p->pktq_out));
780 for (j = 0; j < n_pktq_out; j++) {
781 struct app_pktq_out_params *pktq = &p->pktq_out[j];
783 if ((pktq->type == APP_PKTQ_OUT_SWQ) &&
792 static inline uint32_t
793 app_tm_get_writers(struct app_params *app, struct app_pktq_tm_params *tm)
795 uint32_t pos = tm - app->tm_params;
796 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
797 RTE_DIM(app->pipeline_params));
798 uint32_t n_writers = 0, i;
800 for (i = 0; i < n_pipelines; i++) {
801 struct app_pipeline_params *p = &app->pipeline_params[i];
802 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
803 RTE_DIM(p->pktq_out));
806 for (j = 0; j < n_pktq_out; j++) {
807 struct app_pktq_out_params *pktq = &p->pktq_out[j];
809 if ((pktq->type == APP_PKTQ_OUT_TM) &&
818 static inline uint32_t
819 app_sink_get_writers(struct app_params *app, struct app_pktq_sink_params *sink)
821 uint32_t pos = sink - app->sink_params;
822 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
823 RTE_DIM(app->pipeline_params));
824 uint32_t n_writers = 0, i;
826 for (i = 0; i < n_pipelines; i++) {
827 struct app_pipeline_params *p = &app->pipeline_params[i];
828 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
829 RTE_DIM(p->pktq_out));
832 for (j = 0; j < n_pktq_out; j++) {
833 struct app_pktq_out_params *pktq = &p->pktq_out[j];
835 if ((pktq->type == APP_PKTQ_OUT_SINK) &&
844 static inline uint32_t
845 app_msgq_get_writers(struct app_params *app, struct app_msgq_params *msgq)
847 uint32_t pos = msgq - app->msgq_params;
848 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
849 RTE_DIM(app->pipeline_params));
850 uint32_t n_writers = 0, i;
852 for (i = 0; i < n_pipelines; i++) {
853 struct app_pipeline_params *p = &app->pipeline_params[i];
854 uint32_t n_msgq_out = RTE_MIN(p->n_msgq_out,
855 RTE_DIM(p->msgq_out));
858 for (j = 0; j < n_msgq_out; j++)
859 if (p->msgq_out[j] == pos)
866 static inline struct app_link_params *
867 app_get_link_for_rxq(struct app_params *app, struct app_pktq_hwq_in_params *p)
869 char link_name[APP_PARAM_NAME_SIZE];
870 ssize_t link_param_idx;
871 uint32_t rxq_link_id, rxq_queue_id;
873 sscanf(p->name, "RXQ%" SCNu32 ".%" SCNu32,
874 &rxq_link_id, &rxq_queue_id);
875 sprintf(link_name, "LINK%" PRIu32, rxq_link_id);
876 link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
877 APP_CHECK((link_param_idx >= 0),
878 "Cannot find %s for %s", link_name, p->name);
880 return &app->link_params[link_param_idx];
883 static inline struct app_link_params *
884 app_get_link_for_txq(struct app_params *app, struct app_pktq_hwq_out_params *p)
886 char link_name[APP_PARAM_NAME_SIZE];
887 ssize_t link_param_idx;
888 uint32_t txq_link_id, txq_queue_id;
890 sscanf(p->name, "TXQ%" SCNu32 ".%" SCNu32,
891 &txq_link_id, &txq_queue_id);
892 sprintf(link_name, "LINK%" PRIu32, txq_link_id);
893 link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
894 APP_CHECK((link_param_idx >= 0),
895 "Cannot find %s for %s", link_name, p->name);
897 return &app->link_params[link_param_idx];
900 static inline struct app_link_params *
901 app_get_link_for_tm(struct app_params *app, struct app_pktq_tm_params *p_tm)
903 char link_name[APP_PARAM_NAME_SIZE];
905 ssize_t link_param_idx;
907 sscanf(p_tm->name, "TM%" PRIu32, &link_id);
908 sprintf(link_name, "LINK%" PRIu32, link_id);
909 link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
910 APP_CHECK((link_param_idx >= 0),
911 "Cannot find %s for %s", link_name, p_tm->name);
913 return &app->link_params[link_param_idx];
916 int app_config_init(struct app_params *app);
918 int app_config_args(struct app_params *app,
919 int argc, char **argv);
921 int app_config_preproc(struct app_params *app);
923 int app_config_parse(struct app_params *app,
924 const char *file_name);
926 int app_config_parse_tm(struct app_params *app);
928 void app_config_save(struct app_params *app,
929 const char *file_name);
931 int app_config_check(struct app_params *app);
933 int app_init(struct app_params *app);
935 int app_thread(void *arg);
937 int app_pipeline_type_register(struct app_params *app,
938 struct pipeline_type *ptype);
940 struct pipeline_type *app_pipeline_type_find(struct app_params *app,
943 void app_link_up_internal(struct app_params *app,
944 struct app_link_params *cp);
946 void app_link_down_internal(struct app_params *app,
947 struct app_link_params *cp);