4 * Copyright(c) 2010-2015 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 */
154 struct app_pktq_sink_params {
159 struct app_msgq_params {
163 uint32_t cpu_socket_id;
166 enum app_pktq_in_type {
173 struct app_pktq_in_params {
174 enum app_pktq_in_type type;
175 uint32_t id; /* Position in the appropriate app array */
178 enum app_pktq_out_type {
185 struct app_pktq_out_params {
186 enum app_pktq_out_type type;
187 uint32_t id; /* Position in the appropriate app array */
190 #ifndef APP_PIPELINE_TYPE_SIZE
191 #define APP_PIPELINE_TYPE_SIZE 64
194 #define APP_MAX_PIPELINE_PKTQ_IN PIPELINE_MAX_PORT_IN
195 #define APP_MAX_PIPELINE_PKTQ_OUT PIPELINE_MAX_PORT_OUT
196 #define APP_MAX_PIPELINE_MSGQ_IN PIPELINE_MAX_MSGQ_IN
197 #define APP_MAX_PIPELINE_MSGQ_OUT PIPELINE_MAX_MSGQ_OUT
199 #define APP_MAX_PIPELINE_ARGS PIPELINE_MAX_ARGS
201 struct app_pipeline_params {
205 char type[APP_PIPELINE_TYPE_SIZE];
209 uint32_t hyper_th_id;
211 struct app_pktq_in_params pktq_in[APP_MAX_PIPELINE_PKTQ_IN];
212 struct app_pktq_out_params pktq_out[APP_MAX_PIPELINE_PKTQ_OUT];
213 uint32_t msgq_in[APP_MAX_PIPELINE_MSGQ_IN];
214 uint32_t msgq_out[APP_MAX_PIPELINE_MSGQ_OUT];
221 uint32_t timer_period;
223 char *args_name[APP_MAX_PIPELINE_ARGS];
224 char *args_value[APP_MAX_PIPELINE_ARGS];
228 struct app_pipeline_data {
231 struct pipeline_type *ptype;
232 uint64_t timer_period;
236 struct app_thread_pipeline_data {
237 uint32_t pipeline_id;
239 pipeline_be_op_run f_run;
240 pipeline_be_op_timer f_timer;
241 uint64_t timer_period;
245 #ifndef APP_MAX_THREAD_PIPELINES
246 #define APP_MAX_THREAD_PIPELINES 16
249 #ifndef APP_THREAD_TIMER_PERIOD
250 #define APP_THREAD_TIMER_PERIOD 1
253 struct app_thread_data {
254 struct app_thread_pipeline_data regular[APP_MAX_THREAD_PIPELINES];
255 struct app_thread_pipeline_data custom[APP_MAX_THREAD_PIPELINES];
260 uint64_t timer_period;
261 uint64_t thread_req_deadline;
265 struct rte_ring *msgq_in;
266 struct rte_ring *msgq_out;
268 uint64_t headroom_time;
269 uint64_t headroom_cycles;
270 double headroom_ratio;
273 #ifndef APP_MAX_LINKS
274 #define APP_MAX_LINKS 16
277 struct app_eal_params {
278 /* Map lcore set to physical cpu set */
281 /* Core ID that is used as master */
282 uint32_t master_lcore_present;
283 uint32_t master_lcore;
285 /* Number of memory channels */
286 uint32_t channels_present;
289 /* Memory to allocate (see also --socket-mem) */
290 uint32_t memory_present;
293 /* Force number of memory ranks (don't detect) */
294 uint32_t ranks_present;
297 /* Add a PCI device in black list. */
298 char *pci_blacklist[APP_MAX_LINKS];
300 /* Add a PCI device in white list. */
301 char *pci_whitelist[APP_MAX_LINKS];
303 /* Add a virtual device. */
304 char *vdev[APP_MAX_LINKS];
306 /* Use VMware TSC map instead of native RDTSC */
307 uint32_t vmware_tsc_map_present;
310 /* Type of this process (primary|secondary|auto) */
313 /* Set syslog facility */
316 /* Set default log level */
317 uint32_t log_level_present;
320 /* Display version information on startup */
321 uint32_t version_present;
325 uint32_t help_present;
328 /* Use malloc instead of hugetlbfs */
329 uint32_t no_huge_present;
333 uint32_t no_pci_present;
337 uint32_t no_hpet_present;
340 /* No shared config (mmap'd files) */
341 uint32_t no_shconf_present;
347 /* Memory to allocate on sockets (comma separated values)*/
350 /* Directory where hugetlbfs is mounted */
353 /* Prefix for hugepage filenames */
356 /* Base virtual address */
359 /* Create /dev/uioX (usually done by hotplug) */
360 uint32_t create_uio_dev_present;
363 /* Interrupt mode for VFIO (legacy|msi|msix) */
366 /* Support running on Xen dom0 without hugetlbfs */
367 uint32_t xen_dom0_present;
371 #ifndef APP_APPNAME_SIZE
372 #define APP_APPNAME_SIZE 256
375 #ifndef APP_MAX_MEMPOOLS
376 #define APP_MAX_MEMPOOLS 8
379 #ifndef APP_LINK_MAX_HWQ_IN
380 #define APP_LINK_MAX_HWQ_IN 64
383 #ifndef APP_LINK_MAX_HWQ_OUT
384 #define APP_LINK_MAX_HWQ_OUT 64
387 #define APP_MAX_HWQ_IN (APP_MAX_LINKS * APP_LINK_MAX_HWQ_IN)
389 #define APP_MAX_HWQ_OUT (APP_MAX_LINKS * APP_LINK_MAX_HWQ_OUT)
391 #ifndef APP_MAX_PKTQ_SWQ
392 #define APP_MAX_PKTQ_SWQ 256
395 #define APP_MAX_PKTQ_TM APP_MAX_LINKS
397 #ifndef APP_MAX_PKTQ_SOURCE
398 #define APP_MAX_PKTQ_SOURCE 16
401 #ifndef APP_MAX_PKTQ_SINK
402 #define APP_MAX_PKTQ_SINK 16
406 #define APP_MAX_MSGQ 64
409 #ifndef APP_MAX_PIPELINES
410 #define APP_MAX_PIPELINES 64
414 #define APP_EAL_ARGC 32
417 #ifndef APP_MAX_PIPELINE_TYPES
418 #define APP_MAX_PIPELINE_TYPES 64
421 #ifndef APP_MAX_THREADS
422 #define APP_MAX_THREADS RTE_MAX_LCORE
426 #define APP_MAX_CMDS 64
429 #ifndef APP_THREAD_HEADROOM_STATS_COLLECT
430 #define APP_THREAD_HEADROOM_STATS_COLLECT 1
435 char app_name[APP_APPNAME_SIZE];
436 const char *config_file;
437 const char *script_file;
438 const char *parser_file;
439 const char *output_file;
441 const char *preproc_args;
445 struct app_eal_params eal_params;
446 struct app_mempool_params mempool_params[APP_MAX_MEMPOOLS];
447 struct app_link_params link_params[APP_MAX_LINKS];
448 struct app_pktq_hwq_in_params hwq_in_params[APP_MAX_HWQ_IN];
449 struct app_pktq_hwq_out_params hwq_out_params[APP_MAX_HWQ_OUT];
450 struct app_pktq_swq_params swq_params[APP_MAX_PKTQ_SWQ];
451 struct app_pktq_tm_params tm_params[APP_MAX_PKTQ_TM];
452 struct app_pktq_source_params source_params[APP_MAX_PKTQ_SOURCE];
453 struct app_pktq_sink_params sink_params[APP_MAX_PKTQ_SINK];
454 struct app_msgq_params msgq_params[APP_MAX_MSGQ];
455 struct app_pipeline_params pipeline_params[APP_MAX_PIPELINES];
459 uint32_t n_pktq_hwq_in;
460 uint32_t n_pktq_hwq_out;
463 uint32_t n_pktq_source;
464 uint32_t n_pktq_sink;
466 uint32_t n_pipelines;
469 char *eal_argv[1 + APP_EAL_ARGC];
470 struct cpu_core_map *core_map;
472 struct rte_mempool *mempool[APP_MAX_MEMPOOLS];
473 struct rte_ring *swq[APP_MAX_PKTQ_SWQ];
474 struct rte_sched_port *tm[APP_MAX_PKTQ_TM];
475 struct rte_ring *msgq[APP_MAX_MSGQ];
476 struct pipeline_type pipeline_type[APP_MAX_PIPELINE_TYPES];
477 struct app_pipeline_data pipeline_data[APP_MAX_PIPELINES];
478 struct app_thread_data thread_data[APP_MAX_THREADS];
479 cmdline_parse_ctx_t cmds[APP_MAX_CMDS + 1];
482 uint32_t n_pipeline_types;
486 #define APP_PARAM_VALID(obj) ((obj)->name != NULL)
488 #define APP_PARAM_COUNT(obj_array, n_objs) \
493 for (i = 0; i < RTE_DIM(obj_array); i++) \
494 if (APP_PARAM_VALID(&((obj_array)[i]))) \
498 #define APP_PARAM_FIND(obj_array, key) \
501 const ssize_t obj_count = RTE_DIM(obj_array); \
503 for (obj_idx = 0; obj_idx < obj_count; obj_idx++) { \
504 if (!APP_PARAM_VALID(&((obj_array)[obj_idx]))) \
507 if (strcmp(key, (obj_array)[obj_idx].name) == 0) \
510 obj_idx < obj_count ? obj_idx : -ENOENT; \
513 #define APP_PARAM_FIND_BY_ID(obj_array, prefix, id, obj) \
515 char name[APP_PARAM_NAME_SIZE]; \
518 sprintf(name, prefix "%" PRIu32, id); \
519 pos = APP_PARAM_FIND(obj_array, name); \
520 obj = (pos < 0) ? NULL : &((obj_array)[pos]); \
523 #define APP_PARAM_GET_ID(obj, prefix, id) \
525 sscanf(obj->name, prefix "%" SCNu32, &id); \
528 #define APP_PARAM_ADD(obj_array, obj_name) \
531 const ssize_t obj_count = RTE_DIM(obj_array); \
533 obj_idx = APP_PARAM_FIND(obj_array, obj_name); \
535 for (obj_idx = 0; obj_idx < obj_count; obj_idx++) { \
536 if (!APP_PARAM_VALID(&((obj_array)[obj_idx]))) \
540 if (obj_idx < obj_count) { \
541 (obj_array)[obj_idx].name = strdup(obj_name); \
542 if ((obj_array)[obj_idx].name == NULL) \
550 #define APP_CHECK(exp, fmt, ...) \
553 fprintf(stderr, fmt "\n", ## __VA_ARGS__); \
559 APP_LOG_LEVEL_HIGH = 1,
564 #define APP_LOG(app, level, fmt, ...) \
566 if (app->log_level >= APP_LOG_LEVEL_ ## level) \
567 fprintf(stdout, "[APP] " fmt "\n", ## __VA_ARGS__); \
570 static inline uint32_t
571 app_link_get_n_rxq(struct app_params *app, struct app_link_params *link)
573 uint32_t n_rxq = 0, link_id, i;
574 uint32_t n_pktq_hwq_in = RTE_MIN(app->n_pktq_hwq_in,
575 RTE_DIM(app->hwq_in_params));
577 APP_PARAM_GET_ID(link, "LINK", link_id);
579 for (i = 0; i < n_pktq_hwq_in; i++) {
580 struct app_pktq_hwq_in_params *p = &app->hwq_in_params[i];
581 uint32_t rxq_link_id, rxq_queue_id;
583 sscanf(p->name, "RXQ%" SCNu32 ".%" SCNu32,
584 &rxq_link_id, &rxq_queue_id);
585 if (rxq_link_id == link_id)
592 static inline uint32_t
593 app_link_get_n_txq(struct app_params *app, struct app_link_params *link)
595 uint32_t n_txq = 0, link_id, i;
596 uint32_t n_pktq_hwq_out = RTE_MIN(app->n_pktq_hwq_out,
597 RTE_DIM(app->hwq_out_params));
599 APP_PARAM_GET_ID(link, "LINK", link_id);
601 for (i = 0; i < n_pktq_hwq_out; i++) {
602 struct app_pktq_hwq_out_params *p = &app->hwq_out_params[i];
603 uint32_t txq_link_id, txq_queue_id;
605 sscanf(p->name, "TXQ%" SCNu32 ".%" SCNu32,
606 &txq_link_id, &txq_queue_id);
607 if (txq_link_id == link_id)
614 static inline uint32_t
615 app_rxq_get_readers(struct app_params *app, struct app_pktq_hwq_in_params *rxq)
617 uint32_t pos = rxq - app->hwq_in_params;
618 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
619 RTE_DIM(app->pipeline_params));
620 uint32_t n_readers = 0, i;
622 for (i = 0; i < n_pipelines; i++) {
623 struct app_pipeline_params *p = &app->pipeline_params[i];
624 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
627 for (j = 0; j < n_pktq_in; j++) {
628 struct app_pktq_in_params *pktq = &p->pktq_in[j];
630 if ((pktq->type == APP_PKTQ_IN_HWQ) &&
639 static inline uint32_t
640 app_swq_get_readers(struct app_params *app, struct app_pktq_swq_params *swq)
642 uint32_t pos = swq - app->swq_params;
643 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
644 RTE_DIM(app->pipeline_params));
645 uint32_t n_readers = 0, i;
647 for (i = 0; i < n_pipelines; i++) {
648 struct app_pipeline_params *p = &app->pipeline_params[i];
649 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
652 for (j = 0; j < n_pktq_in; j++) {
653 struct app_pktq_in_params *pktq = &p->pktq_in[j];
655 if ((pktq->type == APP_PKTQ_IN_SWQ) &&
664 static inline uint32_t
665 app_tm_get_readers(struct app_params *app, struct app_pktq_tm_params *tm)
667 uint32_t pos = tm - app->tm_params;
668 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
669 RTE_DIM(app->pipeline_params));
670 uint32_t n_readers = 0, i;
672 for (i = 0; i < n_pipelines; i++) {
673 struct app_pipeline_params *p = &app->pipeline_params[i];
674 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
677 for (j = 0; j < n_pktq_in; j++) {
678 struct app_pktq_in_params *pktq = &p->pktq_in[j];
680 if ((pktq->type == APP_PKTQ_IN_TM) &&
689 static inline uint32_t
690 app_source_get_readers(struct app_params *app,
691 struct app_pktq_source_params *source)
693 uint32_t pos = source - app->source_params;
694 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
695 RTE_DIM(app->pipeline_params));
696 uint32_t n_readers = 0, i;
698 for (i = 0; i < n_pipelines; i++) {
699 struct app_pipeline_params *p = &app->pipeline_params[i];
700 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
703 for (j = 0; j < n_pktq_in; j++) {
704 struct app_pktq_in_params *pktq = &p->pktq_in[j];
706 if ((pktq->type == APP_PKTQ_IN_SOURCE) &&
715 static inline uint32_t
716 app_msgq_get_readers(struct app_params *app, struct app_msgq_params *msgq)
718 uint32_t pos = msgq - app->msgq_params;
719 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
720 RTE_DIM(app->pipeline_params));
721 uint32_t n_readers = 0, i;
723 for (i = 0; i < n_pipelines; i++) {
724 struct app_pipeline_params *p = &app->pipeline_params[i];
725 uint32_t n_msgq_in = RTE_MIN(p->n_msgq_in, RTE_DIM(p->msgq_in));
728 for (j = 0; j < n_msgq_in; j++)
729 if (p->msgq_in[j] == pos)
736 static inline uint32_t
737 app_txq_get_writers(struct app_params *app, struct app_pktq_hwq_out_params *txq)
739 uint32_t pos = txq - app->hwq_out_params;
740 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
741 RTE_DIM(app->pipeline_params));
742 uint32_t n_writers = 0, i;
744 for (i = 0; i < n_pipelines; i++) {
745 struct app_pipeline_params *p = &app->pipeline_params[i];
746 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
747 RTE_DIM(p->pktq_out));
750 for (j = 0; j < n_pktq_out; j++) {
751 struct app_pktq_out_params *pktq = &p->pktq_out[j];
753 if ((pktq->type == APP_PKTQ_OUT_HWQ) &&
762 static inline uint32_t
763 app_swq_get_writers(struct app_params *app, struct app_pktq_swq_params *swq)
765 uint32_t pos = swq - app->swq_params;
766 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
767 RTE_DIM(app->pipeline_params));
768 uint32_t n_writers = 0, i;
770 for (i = 0; i < n_pipelines; i++) {
771 struct app_pipeline_params *p = &app->pipeline_params[i];
772 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
773 RTE_DIM(p->pktq_out));
776 for (j = 0; j < n_pktq_out; j++) {
777 struct app_pktq_out_params *pktq = &p->pktq_out[j];
779 if ((pktq->type == APP_PKTQ_OUT_SWQ) &&
788 static inline uint32_t
789 app_tm_get_writers(struct app_params *app, struct app_pktq_tm_params *tm)
791 uint32_t pos = tm - app->tm_params;
792 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
793 RTE_DIM(app->pipeline_params));
794 uint32_t n_writers = 0, i;
796 for (i = 0; i < n_pipelines; i++) {
797 struct app_pipeline_params *p = &app->pipeline_params[i];
798 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
799 RTE_DIM(p->pktq_out));
802 for (j = 0; j < n_pktq_out; j++) {
803 struct app_pktq_out_params *pktq = &p->pktq_out[j];
805 if ((pktq->type == APP_PKTQ_OUT_TM) &&
814 static inline uint32_t
815 app_sink_get_writers(struct app_params *app, struct app_pktq_sink_params *sink)
817 uint32_t pos = sink - app->sink_params;
818 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
819 RTE_DIM(app->pipeline_params));
820 uint32_t n_writers = 0, i;
822 for (i = 0; i < n_pipelines; i++) {
823 struct app_pipeline_params *p = &app->pipeline_params[i];
824 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
825 RTE_DIM(p->pktq_out));
828 for (j = 0; j < n_pktq_out; j++) {
829 struct app_pktq_out_params *pktq = &p->pktq_out[j];
831 if ((pktq->type == APP_PKTQ_OUT_SINK) &&
840 static inline uint32_t
841 app_msgq_get_writers(struct app_params *app, struct app_msgq_params *msgq)
843 uint32_t pos = msgq - app->msgq_params;
844 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
845 RTE_DIM(app->pipeline_params));
846 uint32_t n_writers = 0, i;
848 for (i = 0; i < n_pipelines; i++) {
849 struct app_pipeline_params *p = &app->pipeline_params[i];
850 uint32_t n_msgq_out = RTE_MIN(p->n_msgq_out,
851 RTE_DIM(p->msgq_out));
854 for (j = 0; j < n_msgq_out; j++)
855 if (p->msgq_out[j] == pos)
862 static inline struct app_link_params *
863 app_get_link_for_rxq(struct app_params *app, struct app_pktq_hwq_in_params *p)
865 char link_name[APP_PARAM_NAME_SIZE];
866 ssize_t link_param_idx;
867 uint32_t rxq_link_id, rxq_queue_id;
869 sscanf(p->name, "RXQ%" SCNu32 ".%" SCNu32,
870 &rxq_link_id, &rxq_queue_id);
871 sprintf(link_name, "LINK%" PRIu32, rxq_link_id);
872 link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
873 APP_CHECK((link_param_idx >= 0),
874 "Cannot find %s for %s", link_name, p->name);
876 return &app->link_params[link_param_idx];
879 static inline struct app_link_params *
880 app_get_link_for_txq(struct app_params *app, struct app_pktq_hwq_out_params *p)
882 char link_name[APP_PARAM_NAME_SIZE];
883 ssize_t link_param_idx;
884 uint32_t txq_link_id, txq_queue_id;
886 sscanf(p->name, "TXQ%" SCNu32 ".%" SCNu32,
887 &txq_link_id, &txq_queue_id);
888 sprintf(link_name, "LINK%" PRIu32, txq_link_id);
889 link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
890 APP_CHECK((link_param_idx >= 0),
891 "Cannot find %s for %s", link_name, p->name);
893 return &app->link_params[link_param_idx];
896 static inline struct app_link_params *
897 app_get_link_for_tm(struct app_params *app, struct app_pktq_tm_params *p_tm)
899 char link_name[APP_PARAM_NAME_SIZE];
901 ssize_t link_param_idx;
903 sscanf(p_tm->name, "TM%" PRIu32, &link_id);
904 sprintf(link_name, "LINK%" PRIu32, link_id);
905 link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
906 APP_CHECK((link_param_idx >= 0),
907 "Cannot find %s for %s", link_name, p_tm->name);
909 return &app->link_params[link_param_idx];
912 int app_config_init(struct app_params *app);
914 int app_config_args(struct app_params *app,
915 int argc, char **argv);
917 int app_config_preproc(struct app_params *app);
919 int app_config_parse(struct app_params *app,
920 const char *file_name);
922 int app_config_parse_tm(struct app_params *app);
924 void app_config_save(struct app_params *app,
925 const char *file_name);
927 int app_config_check(struct app_params *app);
929 int app_init(struct app_params *app);
931 int app_thread(void *arg);
933 int app_pipeline_type_register(struct app_params *app,
934 struct pipeline_type *ptype);
936 struct pipeline_type *app_pipeline_type_find(struct app_params *app,
939 void app_link_up_internal(struct app_params *app,
940 struct app_link_params *cp);
942 void app_link_down_internal(struct app_params *app,
943 struct app_link_params *cp);