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
54 struct app_mempool_params {
60 uint32_t cpu_socket_id;
63 struct app_link_params {
66 uint32_t pmd_id; /* Generated based on port mask */
67 uint32_t arp_q; /* 0 = Disabled (packets go to default queue 0) */
68 uint32_t tcp_syn_q; /* 0 = Disabled (pkts go to default queue) */
69 uint32_t ip_local_q; /* 0 = Disabled (pkts go to default queue 0) */
70 uint32_t tcp_local_q; /* 0 = Disabled (pkts go to default queue 0) */
71 uint32_t udp_local_q; /* 0 = Disabled (pkts go to default queue 0) */
72 uint32_t sctp_local_q; /* 0 = Disabled (pkts go to default queue 0) */
73 uint32_t state; /* DOWN = 0, UP = 1 */
74 uint32_t ip; /* 0 = Invalid */
75 uint32_t depth; /* Valid only when IP is valid */
76 uint64_t mac_addr; /* Read from HW */
77 char pci_bdf[APP_LINK_PCI_BDF_SIZE];
79 struct rte_eth_conf conf;
83 struct app_pktq_hwq_in_params {
86 uint32_t mempool_id; /* Position in the app->mempool_params */
90 struct rte_eth_rxconf conf;
93 struct app_pktq_hwq_out_params {
100 struct rte_eth_txconf conf;
103 struct app_pktq_swq_params {
108 uint32_t burst_write;
111 uint32_t cpu_socket_id;
117 uint32_t metadata_size;
118 uint32_t mempool_direct_id;
119 uint32_t mempool_indirect_id;
122 #ifndef APP_FILE_NAME_SIZE
123 #define APP_FILE_NAME_SIZE 256
126 #ifndef APP_MAX_SCHED_SUBPORTS
127 #define APP_MAX_SCHED_SUBPORTS 8
130 #ifndef APP_MAX_SCHED_PIPES
131 #define APP_MAX_SCHED_PIPES 4096
134 struct app_pktq_tm_params {
137 const char *file_name;
138 struct rte_sched_port_params sched_port_params;
139 struct rte_sched_subport_params
140 sched_subport_params[APP_MAX_SCHED_SUBPORTS];
141 struct rte_sched_pipe_params
142 sched_pipe_profiles[RTE_SCHED_PIPE_PROFILES_PER_PORT];
143 int sched_pipe_to_profile[APP_MAX_SCHED_SUBPORTS * APP_MAX_SCHED_PIPES];
145 uint32_t burst_write;
148 struct app_pktq_source_params {
151 uint32_t mempool_id; /* Position in the app->mempool_params array */
153 char *file_name; /* Full path of PCAP file to be copied to mbufs */
154 uint32_t n_bytes_per_pkt;
157 struct app_pktq_sink_params {
160 char *file_name; /* Full path of PCAP file to be copied to mbufs */
161 uint32_t n_pkts_to_dump;
164 struct app_msgq_params {
168 uint32_t cpu_socket_id;
171 enum app_pktq_in_type {
178 struct app_pktq_in_params {
179 enum app_pktq_in_type type;
180 uint32_t id; /* Position in the appropriate app array */
183 enum app_pktq_out_type {
190 struct app_pktq_out_params {
191 enum app_pktq_out_type type;
192 uint32_t id; /* Position in the appropriate app array */
195 #ifndef APP_PIPELINE_TYPE_SIZE
196 #define APP_PIPELINE_TYPE_SIZE 64
199 #define APP_MAX_PIPELINE_PKTQ_IN PIPELINE_MAX_PORT_IN
200 #define APP_MAX_PIPELINE_PKTQ_OUT PIPELINE_MAX_PORT_OUT
201 #define APP_MAX_PIPELINE_MSGQ_IN PIPELINE_MAX_MSGQ_IN
202 #define APP_MAX_PIPELINE_MSGQ_OUT PIPELINE_MAX_MSGQ_OUT
204 #define APP_MAX_PIPELINE_ARGS PIPELINE_MAX_ARGS
206 struct app_pipeline_params {
210 char type[APP_PIPELINE_TYPE_SIZE];
214 uint32_t hyper_th_id;
216 struct app_pktq_in_params pktq_in[APP_MAX_PIPELINE_PKTQ_IN];
217 struct app_pktq_out_params pktq_out[APP_MAX_PIPELINE_PKTQ_OUT];
218 uint32_t msgq_in[APP_MAX_PIPELINE_MSGQ_IN];
219 uint32_t msgq_out[APP_MAX_PIPELINE_MSGQ_OUT];
226 uint32_t timer_period;
228 char *args_name[APP_MAX_PIPELINE_ARGS];
229 char *args_value[APP_MAX_PIPELINE_ARGS];
233 struct app_pipeline_data {
236 struct pipeline_type *ptype;
237 uint64_t timer_period;
241 struct app_thread_pipeline_data {
242 uint32_t pipeline_id;
244 pipeline_be_op_run f_run;
245 pipeline_be_op_timer f_timer;
246 uint64_t timer_period;
250 #ifndef APP_MAX_THREAD_PIPELINES
251 #define APP_MAX_THREAD_PIPELINES 16
254 #ifndef APP_THREAD_TIMER_PERIOD
255 #define APP_THREAD_TIMER_PERIOD 1
258 struct app_thread_data {
259 struct app_thread_pipeline_data regular[APP_MAX_THREAD_PIPELINES];
260 struct app_thread_pipeline_data custom[APP_MAX_THREAD_PIPELINES];
265 uint64_t timer_period;
266 uint64_t thread_req_deadline;
270 struct rte_ring *msgq_in;
271 struct rte_ring *msgq_out;
273 uint64_t headroom_time;
274 uint64_t headroom_cycles;
275 double headroom_ratio;
278 #ifndef APP_MAX_LINKS
279 #define APP_MAX_LINKS 16
282 struct app_eal_params {
283 /* Map lcore set to physical cpu set */
286 /* Core ID that is used as master */
287 uint32_t master_lcore_present;
288 uint32_t master_lcore;
290 /* Number of memory channels */
291 uint32_t channels_present;
294 /* Memory to allocate (see also --socket-mem) */
295 uint32_t memory_present;
298 /* Force number of memory ranks (don't detect) */
299 uint32_t ranks_present;
302 /* Add a PCI device in black list. */
303 char *pci_blacklist[APP_MAX_LINKS];
305 /* Add a PCI device in white list. */
306 char *pci_whitelist[APP_MAX_LINKS];
308 /* Add a virtual device. */
309 char *vdev[APP_MAX_LINKS];
311 /* Use VMware TSC map instead of native RDTSC */
312 uint32_t vmware_tsc_map_present;
315 /* Type of this process (primary|secondary|auto) */
318 /* Set syslog facility */
321 /* Set default log level */
322 uint32_t log_level_present;
325 /* Display version information on startup */
326 uint32_t version_present;
330 uint32_t help_present;
333 /* Use malloc instead of hugetlbfs */
334 uint32_t no_huge_present;
338 uint32_t no_pci_present;
342 uint32_t no_hpet_present;
345 /* No shared config (mmap'd files) */
346 uint32_t no_shconf_present;
352 /* Memory to allocate on sockets (comma separated values)*/
355 /* Directory where hugetlbfs is mounted */
358 /* Prefix for hugepage filenames */
361 /* Base virtual address */
364 /* Create /dev/uioX (usually done by hotplug) */
365 uint32_t create_uio_dev_present;
368 /* Interrupt mode for VFIO (legacy|msi|msix) */
371 /* Support running on Xen dom0 without hugetlbfs */
372 uint32_t xen_dom0_present;
378 #ifndef APP_APPNAME_SIZE
379 #define APP_APPNAME_SIZE 256
382 #ifndef APP_MAX_MEMPOOLS
383 #define APP_MAX_MEMPOOLS 8
386 #ifndef APP_LINK_MAX_HWQ_IN
387 #define APP_LINK_MAX_HWQ_IN 64
390 #ifndef APP_LINK_MAX_HWQ_OUT
391 #define APP_LINK_MAX_HWQ_OUT 64
394 #define APP_MAX_HWQ_IN (APP_MAX_LINKS * APP_LINK_MAX_HWQ_IN)
396 #define APP_MAX_HWQ_OUT (APP_MAX_LINKS * APP_LINK_MAX_HWQ_OUT)
398 #ifndef APP_MAX_PKTQ_SWQ
399 #define APP_MAX_PKTQ_SWQ 256
402 #define APP_MAX_PKTQ_TM APP_MAX_LINKS
404 #ifndef APP_MAX_PKTQ_SOURCE
405 #define APP_MAX_PKTQ_SOURCE 16
408 #ifndef APP_MAX_PKTQ_SINK
409 #define APP_MAX_PKTQ_SINK 16
413 #define APP_MAX_MSGQ 64
416 #ifndef APP_MAX_PIPELINES
417 #define APP_MAX_PIPELINES 64
421 #define APP_EAL_ARGC 64
424 #ifndef APP_MAX_PIPELINE_TYPES
425 #define APP_MAX_PIPELINE_TYPES 64
428 #ifndef APP_MAX_THREADS
429 #define APP_MAX_THREADS RTE_MAX_LCORE
433 #define APP_MAX_CMDS 64
436 #ifndef APP_THREAD_HEADROOM_STATS_COLLECT
437 #define APP_THREAD_HEADROOM_STATS_COLLECT 1
442 char app_name[APP_APPNAME_SIZE];
443 const char *config_file;
444 const char *script_file;
445 const char *parser_file;
446 const char *output_file;
448 const char *preproc_args;
452 struct app_eal_params eal_params;
453 struct app_mempool_params mempool_params[APP_MAX_MEMPOOLS];
454 struct app_link_params link_params[APP_MAX_LINKS];
455 struct app_pktq_hwq_in_params hwq_in_params[APP_MAX_HWQ_IN];
456 struct app_pktq_hwq_out_params hwq_out_params[APP_MAX_HWQ_OUT];
457 struct app_pktq_swq_params swq_params[APP_MAX_PKTQ_SWQ];
458 struct app_pktq_tm_params tm_params[APP_MAX_PKTQ_TM];
459 struct app_pktq_source_params source_params[APP_MAX_PKTQ_SOURCE];
460 struct app_pktq_sink_params sink_params[APP_MAX_PKTQ_SINK];
461 struct app_msgq_params msgq_params[APP_MAX_MSGQ];
462 struct app_pipeline_params pipeline_params[APP_MAX_PIPELINES];
466 uint32_t n_pktq_hwq_in;
467 uint32_t n_pktq_hwq_out;
470 uint32_t n_pktq_source;
471 uint32_t n_pktq_sink;
473 uint32_t n_pipelines;
476 char *eal_argv[1 + APP_EAL_ARGC];
477 struct cpu_core_map *core_map;
479 struct rte_mempool *mempool[APP_MAX_MEMPOOLS];
480 struct rte_ring *swq[APP_MAX_PKTQ_SWQ];
481 struct rte_sched_port *tm[APP_MAX_PKTQ_TM];
482 struct rte_ring *msgq[APP_MAX_MSGQ];
483 struct pipeline_type pipeline_type[APP_MAX_PIPELINE_TYPES];
484 struct app_pipeline_data pipeline_data[APP_MAX_PIPELINES];
485 struct app_thread_data thread_data[APP_MAX_THREADS];
486 cmdline_parse_ctx_t cmds[APP_MAX_CMDS + 1];
489 uint32_t n_pipeline_types;
493 #define APP_PARAM_VALID(obj) ((obj)->name != NULL)
495 #define APP_PARAM_COUNT(obj_array, n_objs) \
500 for (i = 0; i < RTE_DIM(obj_array); i++) \
501 if (APP_PARAM_VALID(&((obj_array)[i]))) \
505 #define APP_PARAM_FIND(obj_array, key) \
508 const ssize_t obj_count = RTE_DIM(obj_array); \
510 for (obj_idx = 0; obj_idx < obj_count; obj_idx++) { \
511 if (!APP_PARAM_VALID(&((obj_array)[obj_idx]))) \
514 if (strcmp(key, (obj_array)[obj_idx].name) == 0) \
517 obj_idx < obj_count ? obj_idx : -ENOENT; \
520 #define APP_PARAM_FIND_BY_ID(obj_array, prefix, id, obj) \
522 char name[APP_PARAM_NAME_SIZE]; \
525 sprintf(name, prefix "%" PRIu32, id); \
526 pos = APP_PARAM_FIND(obj_array, name); \
527 obj = (pos < 0) ? NULL : &((obj_array)[pos]); \
530 #define APP_PARAM_GET_ID(obj, prefix, id) \
532 sscanf(obj->name, prefix "%" SCNu32, &id); \
535 #define APP_CHECK(exp, fmt, ...) \
538 fprintf(stderr, fmt "\n", ## __VA_ARGS__); \
544 APP_LOG_LEVEL_HIGH = 1,
549 #define APP_LOG(app, level, fmt, ...) \
551 if (app->log_level >= APP_LOG_LEVEL_ ## level) \
552 fprintf(stdout, "[APP] " fmt "\n", ## __VA_ARGS__); \
555 static inline uint32_t
556 app_link_get_n_rxq(struct app_params *app, struct app_link_params *link)
558 uint32_t n_rxq = 0, link_id, i;
559 uint32_t n_pktq_hwq_in = RTE_MIN(app->n_pktq_hwq_in,
560 RTE_DIM(app->hwq_in_params));
562 APP_PARAM_GET_ID(link, "LINK", link_id);
564 for (i = 0; i < n_pktq_hwq_in; i++) {
565 struct app_pktq_hwq_in_params *p = &app->hwq_in_params[i];
566 uint32_t rxq_link_id, rxq_queue_id;
568 sscanf(p->name, "RXQ%" SCNu32 ".%" SCNu32,
569 &rxq_link_id, &rxq_queue_id);
570 if (rxq_link_id == link_id)
577 static inline uint32_t
578 app_link_get_n_txq(struct app_params *app, struct app_link_params *link)
580 uint32_t n_txq = 0, link_id, i;
581 uint32_t n_pktq_hwq_out = RTE_MIN(app->n_pktq_hwq_out,
582 RTE_DIM(app->hwq_out_params));
584 APP_PARAM_GET_ID(link, "LINK", link_id);
586 for (i = 0; i < n_pktq_hwq_out; i++) {
587 struct app_pktq_hwq_out_params *p = &app->hwq_out_params[i];
588 uint32_t txq_link_id, txq_queue_id;
590 sscanf(p->name, "TXQ%" SCNu32 ".%" SCNu32,
591 &txq_link_id, &txq_queue_id);
592 if (txq_link_id == link_id)
599 static inline uint32_t
600 app_rxq_get_readers(struct app_params *app, struct app_pktq_hwq_in_params *rxq)
602 uint32_t pos = rxq - app->hwq_in_params;
603 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
604 RTE_DIM(app->pipeline_params));
605 uint32_t n_readers = 0, i;
607 for (i = 0; i < n_pipelines; i++) {
608 struct app_pipeline_params *p = &app->pipeline_params[i];
609 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
612 for (j = 0; j < n_pktq_in; j++) {
613 struct app_pktq_in_params *pktq = &p->pktq_in[j];
615 if ((pktq->type == APP_PKTQ_IN_HWQ) &&
624 static inline uint32_t
625 app_swq_get_readers(struct app_params *app, struct app_pktq_swq_params *swq)
627 uint32_t pos = swq - app->swq_params;
628 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
629 RTE_DIM(app->pipeline_params));
630 uint32_t n_readers = 0, i;
632 for (i = 0; i < n_pipelines; i++) {
633 struct app_pipeline_params *p = &app->pipeline_params[i];
634 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
637 for (j = 0; j < n_pktq_in; j++) {
638 struct app_pktq_in_params *pktq = &p->pktq_in[j];
640 if ((pktq->type == APP_PKTQ_IN_SWQ) &&
649 static inline uint32_t
650 app_tm_get_readers(struct app_params *app, struct app_pktq_tm_params *tm)
652 uint32_t pos = tm - app->tm_params;
653 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
654 RTE_DIM(app->pipeline_params));
655 uint32_t n_readers = 0, i;
657 for (i = 0; i < n_pipelines; i++) {
658 struct app_pipeline_params *p = &app->pipeline_params[i];
659 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
662 for (j = 0; j < n_pktq_in; j++) {
663 struct app_pktq_in_params *pktq = &p->pktq_in[j];
665 if ((pktq->type == APP_PKTQ_IN_TM) &&
674 static inline uint32_t
675 app_source_get_readers(struct app_params *app,
676 struct app_pktq_source_params *source)
678 uint32_t pos = source - app->source_params;
679 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
680 RTE_DIM(app->pipeline_params));
681 uint32_t n_readers = 0, i;
683 for (i = 0; i < n_pipelines; i++) {
684 struct app_pipeline_params *p = &app->pipeline_params[i];
685 uint32_t n_pktq_in = RTE_MIN(p->n_pktq_in, RTE_DIM(p->pktq_in));
688 for (j = 0; j < n_pktq_in; j++) {
689 struct app_pktq_in_params *pktq = &p->pktq_in[j];
691 if ((pktq->type == APP_PKTQ_IN_SOURCE) &&
700 static inline uint32_t
701 app_msgq_get_readers(struct app_params *app, struct app_msgq_params *msgq)
703 uint32_t pos = msgq - app->msgq_params;
704 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
705 RTE_DIM(app->pipeline_params));
706 uint32_t n_readers = 0, i;
708 for (i = 0; i < n_pipelines; i++) {
709 struct app_pipeline_params *p = &app->pipeline_params[i];
710 uint32_t n_msgq_in = RTE_MIN(p->n_msgq_in, RTE_DIM(p->msgq_in));
713 for (j = 0; j < n_msgq_in; j++)
714 if (p->msgq_in[j] == pos)
721 static inline uint32_t
722 app_txq_get_writers(struct app_params *app, struct app_pktq_hwq_out_params *txq)
724 uint32_t pos = txq - app->hwq_out_params;
725 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
726 RTE_DIM(app->pipeline_params));
727 uint32_t n_writers = 0, i;
729 for (i = 0; i < n_pipelines; i++) {
730 struct app_pipeline_params *p = &app->pipeline_params[i];
731 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
732 RTE_DIM(p->pktq_out));
735 for (j = 0; j < n_pktq_out; j++) {
736 struct app_pktq_out_params *pktq = &p->pktq_out[j];
738 if ((pktq->type == APP_PKTQ_OUT_HWQ) &&
747 static inline uint32_t
748 app_swq_get_writers(struct app_params *app, struct app_pktq_swq_params *swq)
750 uint32_t pos = swq - app->swq_params;
751 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
752 RTE_DIM(app->pipeline_params));
753 uint32_t n_writers = 0, i;
755 for (i = 0; i < n_pipelines; i++) {
756 struct app_pipeline_params *p = &app->pipeline_params[i];
757 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
758 RTE_DIM(p->pktq_out));
761 for (j = 0; j < n_pktq_out; j++) {
762 struct app_pktq_out_params *pktq = &p->pktq_out[j];
764 if ((pktq->type == APP_PKTQ_OUT_SWQ) &&
773 static inline uint32_t
774 app_tm_get_writers(struct app_params *app, struct app_pktq_tm_params *tm)
776 uint32_t pos = tm - app->tm_params;
777 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
778 RTE_DIM(app->pipeline_params));
779 uint32_t n_writers = 0, i;
781 for (i = 0; i < n_pipelines; i++) {
782 struct app_pipeline_params *p = &app->pipeline_params[i];
783 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
784 RTE_DIM(p->pktq_out));
787 for (j = 0; j < n_pktq_out; j++) {
788 struct app_pktq_out_params *pktq = &p->pktq_out[j];
790 if ((pktq->type == APP_PKTQ_OUT_TM) &&
799 static inline uint32_t
800 app_sink_get_writers(struct app_params *app, struct app_pktq_sink_params *sink)
802 uint32_t pos = sink - app->sink_params;
803 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
804 RTE_DIM(app->pipeline_params));
805 uint32_t n_writers = 0, i;
807 for (i = 0; i < n_pipelines; i++) {
808 struct app_pipeline_params *p = &app->pipeline_params[i];
809 uint32_t n_pktq_out = RTE_MIN(p->n_pktq_out,
810 RTE_DIM(p->pktq_out));
813 for (j = 0; j < n_pktq_out; j++) {
814 struct app_pktq_out_params *pktq = &p->pktq_out[j];
816 if ((pktq->type == APP_PKTQ_OUT_SINK) &&
825 static inline uint32_t
826 app_msgq_get_writers(struct app_params *app, struct app_msgq_params *msgq)
828 uint32_t pos = msgq - app->msgq_params;
829 uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
830 RTE_DIM(app->pipeline_params));
831 uint32_t n_writers = 0, i;
833 for (i = 0; i < n_pipelines; i++) {
834 struct app_pipeline_params *p = &app->pipeline_params[i];
835 uint32_t n_msgq_out = RTE_MIN(p->n_msgq_out,
836 RTE_DIM(p->msgq_out));
839 for (j = 0; j < n_msgq_out; j++)
840 if (p->msgq_out[j] == pos)
847 static inline struct app_link_params *
848 app_get_link_for_rxq(struct app_params *app, struct app_pktq_hwq_in_params *p)
850 char link_name[APP_PARAM_NAME_SIZE];
851 ssize_t link_param_idx;
852 uint32_t rxq_link_id, rxq_queue_id;
854 sscanf(p->name, "RXQ%" SCNu32 ".%" SCNu32,
855 &rxq_link_id, &rxq_queue_id);
856 sprintf(link_name, "LINK%" PRIu32, rxq_link_id);
857 link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
858 APP_CHECK((link_param_idx >= 0),
859 "Cannot find %s for %s", link_name, p->name);
861 return &app->link_params[link_param_idx];
864 static inline struct app_link_params *
865 app_get_link_for_txq(struct app_params *app, struct app_pktq_hwq_out_params *p)
867 char link_name[APP_PARAM_NAME_SIZE];
868 ssize_t link_param_idx;
869 uint32_t txq_link_id, txq_queue_id;
871 sscanf(p->name, "TXQ%" SCNu32 ".%" SCNu32,
872 &txq_link_id, &txq_queue_id);
873 sprintf(link_name, "LINK%" PRIu32, txq_link_id);
874 link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
875 APP_CHECK((link_param_idx >= 0),
876 "Cannot find %s for %s", link_name, p->name);
878 return &app->link_params[link_param_idx];
881 static inline struct app_link_params *
882 app_get_link_for_tm(struct app_params *app, struct app_pktq_tm_params *p_tm)
884 char link_name[APP_PARAM_NAME_SIZE];
886 ssize_t link_param_idx;
888 sscanf(p_tm->name, "TM%" PRIu32, &link_id);
889 sprintf(link_name, "LINK%" PRIu32, link_id);
890 link_param_idx = APP_PARAM_FIND(app->link_params, link_name);
891 APP_CHECK((link_param_idx >= 0),
892 "Cannot find %s for %s", link_name, p_tm->name);
894 return &app->link_params[link_param_idx];
897 int app_config_init(struct app_params *app);
899 int app_config_args(struct app_params *app,
900 int argc, char **argv);
902 int app_config_preproc(struct app_params *app);
904 int app_config_parse(struct app_params *app,
905 const char *file_name);
907 int app_config_parse_tm(struct app_params *app);
909 void app_config_save(struct app_params *app,
910 const char *file_name);
912 int app_config_check(struct app_params *app);
914 int app_init(struct app_params *app);
916 int app_thread(void *arg);
918 int app_pipeline_type_register(struct app_params *app,
919 struct pipeline_type *ptype);
921 struct pipeline_type *app_pipeline_type_find(struct app_params *app,
924 void app_link_up_internal(struct app_params *app,
925 struct app_link_params *cp);
927 void app_link_down_internal(struct app_params *app,
928 struct app_link_params *cp);