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
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_local_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 */
77 struct rte_eth_conf conf;
81 struct app_pktq_hwq_in_params {
84 uint32_t mempool_id; /* Position in the app->mempool_params */
88 struct rte_eth_rxconf conf;
91 struct app_pktq_hwq_out_params {
98 struct rte_eth_txconf conf;
101 struct app_pktq_swq_params {
106 uint32_t burst_write;
109 uint32_t cpu_socket_id;
112 #ifndef APP_FILE_NAME_SIZE
113 #define APP_FILE_NAME_SIZE 256
116 #ifndef APP_MAX_SCHED_SUBPORTS
117 #define APP_MAX_SCHED_SUBPORTS 8
120 #ifndef APP_MAX_SCHED_PIPES
121 #define APP_MAX_SCHED_PIPES 4096
124 struct app_pktq_tm_params {
127 const char *file_name;
128 struct rte_sched_port_params sched_port_params;
129 struct rte_sched_subport_params
130 sched_subport_params[APP_MAX_SCHED_SUBPORTS];
131 struct rte_sched_pipe_params
132 sched_pipe_profiles[RTE_SCHED_PIPE_PROFILES_PER_PORT];
133 int sched_pipe_to_profile[APP_MAX_SCHED_SUBPORTS * APP_MAX_SCHED_PIPES];
135 uint32_t burst_write;
138 struct app_pktq_source_params {
141 uint32_t mempool_id; /* Position in the app->mempool_params array */
145 struct app_pktq_sink_params {
150 struct app_msgq_params {
154 uint32_t cpu_socket_id;
157 enum app_pktq_in_type {
164 struct app_pktq_in_params {
165 enum app_pktq_in_type type;
166 uint32_t id; /* Position in the appropriate app array */
169 enum app_pktq_out_type {
176 struct app_pktq_out_params {
177 enum app_pktq_out_type type;
178 uint32_t id; /* Position in the appropriate app array */
181 #ifndef APP_PIPELINE_TYPE_SIZE
182 #define APP_PIPELINE_TYPE_SIZE 64
185 #define APP_MAX_PIPELINE_PKTQ_IN PIPELINE_MAX_PORT_IN
186 #define APP_MAX_PIPELINE_PKTQ_OUT PIPELINE_MAX_PORT_OUT
187 #define APP_MAX_PIPELINE_MSGQ_IN PIPELINE_MAX_MSGQ_IN
188 #define APP_MAX_PIPELINE_MSGQ_OUT PIPELINE_MAX_MSGQ_OUT
190 #define APP_MAX_PIPELINE_ARGS PIPELINE_MAX_ARGS
192 struct app_pipeline_params {
196 char type[APP_PIPELINE_TYPE_SIZE];
200 uint32_t hyper_th_id;
202 struct app_pktq_in_params pktq_in[APP_MAX_PIPELINE_PKTQ_IN];
203 struct app_pktq_out_params pktq_out[APP_MAX_PIPELINE_PKTQ_OUT];
204 uint32_t msgq_in[APP_MAX_PIPELINE_MSGQ_IN];
205 uint32_t msgq_out[APP_MAX_PIPELINE_MSGQ_OUT];
212 uint32_t timer_period;
214 char *args_name[APP_MAX_PIPELINE_ARGS];
215 char *args_value[APP_MAX_PIPELINE_ARGS];
219 struct app_pipeline_data {
222 uint64_t timer_period;
225 struct app_thread_pipeline_data {
227 pipeline_be_op_run f_run;
228 pipeline_be_op_timer f_timer;
229 uint64_t timer_period;
233 #ifndef APP_MAX_THREAD_PIPELINES
234 #define APP_MAX_THREAD_PIPELINES 16
237 struct app_thread_data {
238 struct app_thread_pipeline_data regular[APP_MAX_THREAD_PIPELINES];
239 struct app_thread_pipeline_data custom[APP_MAX_THREAD_PIPELINES];
247 struct app_eal_params {
248 /* Map lcore set to physical cpu set */
251 /* Core ID that is used as master */
252 uint32_t master_lcore_present;
253 uint32_t master_lcore;
255 /* Number of memory channels */
256 uint32_t channels_present;
259 /* Memory to allocate (see also --socket-mem) */
260 uint32_t memory_present;
263 /* Force number of memory ranks (don't detect) */
264 uint32_t ranks_present;
267 /* Add a PCI device in black list. */
270 /* Add a PCI device in white list. */
273 /* Add a virtual device. */
276 /* Use VMware TSC map instead of native RDTSC */
277 uint32_t vmware_tsc_map_present;
280 /* Type of this process (primary|secondary|auto) */
283 /* Set syslog facility */
286 /* Set default log level */
287 uint32_t log_level_present;
290 /* Display version information on startup */
291 uint32_t version_present;
295 uint32_t help_present;
298 /* Use malloc instead of hugetlbfs */
299 uint32_t no_huge_present;
303 uint32_t no_pci_present;
307 uint32_t no_hpet_present;
310 /* No shared config (mmap'd files) */
311 uint32_t no_shconf_present;
317 /* Memory to allocate on sockets (comma separated values)*/
320 /* Directory where hugetlbfs is mounted */
323 /* Prefix for hugepage filenames */
326 /* Base virtual address */
329 /* Create /dev/uioX (usually done by hotplug) */
330 uint32_t create_uio_dev_present;
333 /* Interrupt mode for VFIO (legacy|msi|msix) */
336 /* Support running on Xen dom0 without hugetlbfs */
337 uint32_t xen_dom0_present;
341 #ifndef APP_APPNAME_SIZE
342 #define APP_APPNAME_SIZE 256
345 #ifndef APP_MAX_MEMPOOLS
346 #define APP_MAX_MEMPOOLS 8
349 #ifndef APP_MAX_LINKS
350 #define APP_MAX_LINKS 16
353 #ifndef APP_LINK_MAX_HWQ_IN
354 #define APP_LINK_MAX_HWQ_IN 64
357 #ifndef APP_LINK_MAX_HWQ_OUT
358 #define APP_LINK_MAX_HWQ_OUT 64
361 #define APP_MAX_HWQ_IN (APP_MAX_LINKS * APP_LINK_MAX_HWQ_IN)
363 #define APP_MAX_HWQ_OUT (APP_MAX_LINKS * APP_LINK_MAX_HWQ_OUT)
365 #ifndef APP_MAX_PKTQ_SWQ
366 #define APP_MAX_PKTQ_SWQ 256
369 #define APP_MAX_PKTQ_TM APP_MAX_LINKS
371 #ifndef APP_MAX_PKTQ_SOURCE
372 #define APP_MAX_PKTQ_SOURCE 16
375 #ifndef APP_MAX_PKTQ_SINK
376 #define APP_MAX_PKTQ_SINK 16
380 #define APP_MAX_MSGQ 64
383 #ifndef APP_MAX_PIPELINES
384 #define APP_MAX_PIPELINES 64
388 #define APP_EAL_ARGC 32
391 #ifndef APP_MAX_PIPELINE_TYPES
392 #define APP_MAX_PIPELINE_TYPES 64
395 #ifndef APP_MAX_THREADS
396 #define APP_MAX_THREADS RTE_MAX_LCORE
400 #define APP_MAX_CMDS 64
405 char app_name[APP_APPNAME_SIZE];
406 const char *config_file;
407 const char *script_file;
411 struct app_eal_params eal_params;
412 struct app_mempool_params mempool_params[APP_MAX_MEMPOOLS];
413 struct app_link_params link_params[APP_MAX_LINKS];
414 struct app_pktq_hwq_in_params hwq_in_params[APP_MAX_HWQ_IN];
415 struct app_pktq_hwq_out_params hwq_out_params[APP_MAX_HWQ_OUT];
416 struct app_pktq_swq_params swq_params[APP_MAX_PKTQ_SWQ];
417 struct app_pktq_tm_params tm_params[APP_MAX_PKTQ_TM];
418 struct app_pktq_source_params source_params[APP_MAX_PKTQ_SOURCE];
419 struct app_pktq_sink_params sink_params[APP_MAX_PKTQ_SINK];
420 struct app_msgq_params msgq_params[APP_MAX_MSGQ];
421 struct app_pipeline_params pipeline_params[APP_MAX_PIPELINES];
425 uint32_t n_pktq_hwq_in;
426 uint32_t n_pktq_hwq_out;
429 uint32_t n_pktq_source;
430 uint32_t n_pktq_sink;
432 uint32_t n_pipelines;
435 char *eal_argv[1 + APP_EAL_ARGC];
436 struct cpu_core_map *core_map;
438 struct rte_mempool *mempool[APP_MAX_MEMPOOLS];
439 struct rte_ring *swq[APP_MAX_PKTQ_SWQ];
440 struct rte_sched_port *tm[APP_MAX_PKTQ_TM];
441 struct rte_ring *msgq[APP_MAX_MSGQ];
442 struct pipeline_type pipeline_type[APP_MAX_PIPELINE_TYPES];
443 struct app_pipeline_data pipeline_data[APP_MAX_PIPELINES];
444 struct app_thread_data thread_data[APP_MAX_THREADS];
445 cmdline_parse_ctx_t cmds[APP_MAX_CMDS + 1];
448 uint32_t n_pipeline_types;
452 #define APP_PARAM_VALID(obj) ((obj)->name != NULL)
454 #define APP_PARAM_COUNT(obj_array, n_objs) \
459 for (i = 0; i < RTE_DIM(obj_array); i++) \
460 if (APP_PARAM_VALID(&((obj_array)[i]))) \
464 #define APP_PARAM_FIND(obj_array, key) \
467 const ssize_t obj_count = RTE_DIM(obj_array); \
469 for (obj_idx = 0; obj_idx < obj_count; obj_idx++) { \
470 if (!APP_PARAM_VALID(&((obj_array)[obj_idx]))) \
473 if (strcmp(key, (obj_array)[obj_idx].name) == 0) \
476 obj_idx < obj_count ? obj_idx : -ENOENT; \
479 #define APP_PARAM_FIND_BY_ID(obj_array, prefix, id, obj) \
481 char name[APP_PARAM_NAME_SIZE]; \
484 sprintf(name, prefix "%" PRIu32, id); \
485 pos = APP_PARAM_FIND(obj_array, name); \
486 obj = (pos < 0) ? NULL : &((obj_array)[pos]); \
489 #define APP_PARAM_GET_ID(obj, prefix, id) \
491 sscanf(obj->name, prefix "%" SCNu32, &id); \
494 #define APP_PARAM_ADD(obj_array, obj_name) \
497 const ssize_t obj_count = RTE_DIM(obj_array); \
499 obj_idx = APP_PARAM_FIND(obj_array, obj_name); \
501 for (obj_idx = 0; obj_idx < obj_count; obj_idx++) { \
502 if (!APP_PARAM_VALID(&((obj_array)[obj_idx]))) \
506 if (obj_idx < obj_count) { \
507 (obj_array)[obj_idx].name = strdup(obj_name); \
508 if ((obj_array)[obj_idx].name == NULL) \
516 #define APP_CHECK(exp, fmt, ...) \
519 fprintf(stderr, fmt "\n", ## __VA_ARGS__); \
525 APP_LOG_LEVEL_HIGH = 1,
530 #define APP_LOG(app, level, fmt, ...) \
532 if (app->log_level >= APP_LOG_LEVEL_ ## level) \
533 fprintf(stdout, "[APP] " fmt "\n", ## __VA_ARGS__); \
536 static inline uint32_t
537 app_link_get_n_rxq(struct app_params *app, struct app_link_params *link)
539 uint32_t n_rxq = 0, link_id, i;
540 uint32_t n_pktq_hwq_in = RTE_MIN(app->n_pktq_hwq_in,
541 RTE_DIM(app->hwq_in_params));
543 APP_PARAM_GET_ID(link, "LINK", link_id);
545 for (i = 0; i < n_pktq_hwq_in; i++) {
546 struct app_pktq_hwq_in_params *p = &app->hwq_in_params[i];
547 uint32_t rxq_link_id, rxq_queue_id;
549 sscanf(p->name, "RXQ%" SCNu32 ".%" SCNu32,
550 &rxq_link_id, &rxq_queue_id);
551 if (rxq_link_id == link_id)
558 static inline uint32_t
559 app_link_get_n_txq(struct app_params *app, struct app_link_params *link)
561 uint32_t n_txq = 0, link_id, i;
562 uint32_t n_pktq_hwq_out = RTE_MIN(app->n_pktq_hwq_out,
563 RTE_DIM(app->hwq_out_params));
565 APP_PARAM_GET_ID(link, "LINK", link_id);
567 for (i = 0; i < n_pktq_hwq_out; i++) {
568 struct app_pktq_hwq_out_params *p = &app->hwq_out_params[i];
569 uint32_t txq_link_id, txq_queue_id;
571 sscanf(p->name, "TXQ%" SCNu32 ".%" SCNu32,
572 &txq_link_id, &txq_queue_id);
573 if (txq_link_id == link_id)
580 static inline uint32_t
581 app_rxq_get_readers(struct app_params *app, struct app_pktq_hwq_in_params *rxq)
583 uint32_t pos = rxq - app->hwq_in_params;
584 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
585 RTE_DIM(app->pipeline_params));
586 uint32_t n_readers = 0, i;
588 for (i = 0; i < n_pipelines; i++) {
589 struct app_pipeline_params *p = &app->pipeline_params[i];
590 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
593 for (j = 0; j < n_pktq_in; j++) {
594 struct app_pktq_in_params *pktq = &p->pktq_in[j];
596 if ((pktq->type == APP_PKTQ_IN_HWQ) &&
605 static inline uint32_t
606 app_swq_get_readers(struct app_params *app, struct app_pktq_swq_params *swq)
608 uint32_t pos = swq - app->swq_params;
609 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
610 RTE_DIM(app->pipeline_params));
611 uint32_t n_readers = 0, i;
613 for (i = 0; i < n_pipelines; i++) {
614 struct app_pipeline_params *p = &app->pipeline_params[i];
615 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
618 for (j = 0; j < n_pktq_in; j++) {
619 struct app_pktq_in_params *pktq = &p->pktq_in[j];
621 if ((pktq->type == APP_PKTQ_IN_SWQ) &&
630 static inline uint32_t
631 app_tm_get_readers(struct app_params *app, struct app_pktq_tm_params *tm)
633 uint32_t pos = tm - app->tm_params;
634 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
635 RTE_DIM(app->pipeline_params));
636 uint32_t n_readers = 0, i;
638 for (i = 0; i < n_pipelines; i++) {
639 struct app_pipeline_params *p = &app->pipeline_params[i];
640 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
643 for (j = 0; j < n_pktq_in; j++) {
644 struct app_pktq_in_params *pktq = &p->pktq_in[j];
646 if ((pktq->type == APP_PKTQ_IN_TM) &&
655 static inline uint32_t
656 app_source_get_readers(struct app_params *app,
657 struct app_pktq_source_params *source)
659 uint32_t pos = source - app->source_params;
660 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
661 RTE_DIM(app->pipeline_params));
662 uint32_t n_readers = 0, i;
664 for (i = 0; i < n_pipelines; i++) {
665 struct app_pipeline_params *p = &app->pipeline_params[i];
666 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
669 for (j = 0; j < n_pktq_in; j++) {
670 struct app_pktq_in_params *pktq = &p->pktq_in[j];
672 if ((pktq->type == APP_PKTQ_IN_SOURCE) &&
681 static inline uint32_t
682 app_msgq_get_readers(struct app_params *app, struct app_msgq_params *msgq)
684 uint32_t pos = msgq - app->msgq_params;
685 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
686 RTE_DIM(app->pipeline_params));
687 uint32_t n_readers = 0, i;
689 for (i = 0; i < n_pipelines; i++) {
690 struct app_pipeline_params *p = &app->pipeline_params[i];
691 uint32_t n_msgq_in = RTE_MIN(p->n_msgq_in, RTE_DIM(p->msgq_in));
694 for (j = 0; j < n_msgq_in; j++)
695 if (p->msgq_in[j] == pos)
702 static inline uint32_t
703 app_txq_get_writers(struct app_params *app, struct app_pktq_hwq_out_params *txq)
705 uint32_t pos = txq - app->hwq_out_params;
706 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
707 RTE_DIM(app->pipeline_params));
708 uint32_t n_writers = 0, i;
710 for (i = 0; i < n_pipelines; i++) {
711 struct app_pipeline_params *p = &app->pipeline_params[i];
712 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
713 RTE_DIM(p->pktq_out));
716 for (j = 0; j < n_pktq_out; j++) {
717 struct app_pktq_out_params *pktq = &p->pktq_out[j];
719 if ((pktq->type == APP_PKTQ_OUT_HWQ) &&
728 static inline uint32_t
729 app_swq_get_writers(struct app_params *app, struct app_pktq_swq_params *swq)
731 uint32_t pos = swq - app->swq_params;
732 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
733 RTE_DIM(app->pipeline_params));
734 uint32_t n_writers = 0, i;
736 for (i = 0; i < n_pipelines; i++) {
737 struct app_pipeline_params *p = &app->pipeline_params[i];
738 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
739 RTE_DIM(p->pktq_out));
742 for (j = 0; j < n_pktq_out; j++) {
743 struct app_pktq_out_params *pktq = &p->pktq_out[j];
745 if ((pktq->type == APP_PKTQ_OUT_SWQ) &&
754 static inline uint32_t
755 app_tm_get_writers(struct app_params *app, struct app_pktq_tm_params *tm)
757 uint32_t pos = tm - app->tm_params;
758 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
759 RTE_DIM(app->pipeline_params));
760 uint32_t n_writers = 0, i;
762 for (i = 0; i < n_pipelines; i++) {
763 struct app_pipeline_params *p = &app->pipeline_params[i];
764 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
765 RTE_DIM(p->pktq_out));
768 for (j = 0; j < n_pktq_out; j++) {
769 struct app_pktq_out_params *pktq = &p->pktq_out[j];
771 if ((pktq->type == APP_PKTQ_OUT_TM) &&
780 static inline uint32_t
781 app_sink_get_writers(struct app_params *app, struct app_pktq_sink_params *sink)
783 uint32_t pos = sink - app->sink_params;
784 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
785 RTE_DIM(app->pipeline_params));
786 uint32_t n_writers = 0, i;
788 for (i = 0; i < n_pipelines; i++) {
789 struct app_pipeline_params *p = &app->pipeline_params[i];
790 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
791 RTE_DIM(p->pktq_out));
794 for (j = 0; j < n_pktq_out; j++) {
795 struct app_pktq_out_params *pktq = &p->pktq_out[j];
797 if ((pktq->type == APP_PKTQ_OUT_SINK) &&
806 static inline uint32_t
807 app_msgq_get_writers(struct app_params *app, struct app_msgq_params *msgq)
809 uint32_t pos = msgq - app->msgq_params;
810 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
811 RTE_DIM(app->pipeline_params));
812 uint32_t n_writers = 0, i;
814 for (i = 0; i < n_pipelines; i++) {
815 struct app_pipeline_params *p = &app->pipeline_params[i];
816 uint32_t n_msgq_out = RTE_MIN(p->n_msgq_out,
817 RTE_DIM(p->msgq_out));
820 for (j = 0; j < n_msgq_out; j++)
821 if (p->msgq_out[j] == pos)
828 static inline struct app_link_params *
829 app_get_link_for_rxq(struct app_params *app, struct app_pktq_hwq_in_params *p)
831 char link_name[APP_PARAM_NAME_SIZE];
832 ssize_t link_param_idx;
833 uint32_t rxq_link_id, rxq_queue_id;
835 sscanf(p->name, "RXQ%" SCNu32 ".%" SCNu32,
836 &rxq_link_id, &rxq_queue_id);
837 sprintf(link_name, "LINK%" PRIu32, rxq_link_id);
838 link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
839 APP_CHECK((link_param_idx >= 0),
840 "Cannot find %s for %s", link_name, p->name);
842 return &app->link_params[link_param_idx];
845 static inline struct app_link_params *
846 app_get_link_for_txq(struct app_params *app, struct app_pktq_hwq_out_params *p)
848 char link_name[APP_PARAM_NAME_SIZE];
849 ssize_t link_param_idx;
850 uint32_t txq_link_id, txq_queue_id;
852 sscanf(p->name, "TXQ%" SCNu32 ".%" SCNu32,
853 &txq_link_id, &txq_queue_id);
854 sprintf(link_name, "LINK%" PRIu32, txq_link_id);
855 link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
856 APP_CHECK((link_param_idx >= 0),
857 "Cannot find %s for %s", link_name, p->name);
859 return &app->link_params[link_param_idx];
862 static inline struct app_link_params *
863 app_get_link_for_tm(struct app_params *app, struct app_pktq_tm_params *p_tm)
865 char link_name[APP_PARAM_NAME_SIZE];
867 ssize_t link_param_idx;
869 sscanf(p_tm->name, "TM%" PRIu32, &link_id);
870 sprintf(link_name, "LINK%" PRIu32, link_id);
871 link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
872 APP_CHECK((link_param_idx >= 0),
873 "Cannot find %s for %s", link_name, p_tm->name);
875 return &app->link_params[link_param_idx];
878 int app_config_init(struct app_params *app);
880 int app_config_args(struct app_params *app,
881 int argc, char **argv);
883 int app_config_parse(struct app_params *app,
884 const char *file_name);
886 int app_config_parse_tm(struct app_params *app);
888 void app_config_save(struct app_params *app,
889 const char *file_name);
891 int app_config_check(struct app_params *app);
893 int app_init(struct app_params *app);
895 int app_thread(void *arg);
897 int app_pipeline_type_register(struct app_params *app,
898 struct pipeline_type *ptype);
900 struct pipeline_type *app_pipeline_type_find(struct app_params *app,
903 void app_link_up_internal(struct app_params *app,
904 struct app_link_params *cp);
906 void app_link_down_internal(struct app_params *app,
907 struct app_link_params *cp);