Fix compilation issue with older gcc
[samplevnf.git] / common / vnf_common / thread_fe.h
1 /*
2 // Copyright (c) 2017 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 #ifndef THREAD_FE_H_
18 #define THREAD_FE_H_
19
20 static inline struct rte_ring *
21 app_thread_msgq_in_get(struct app_params *app,
22                 uint32_t socket_id, uint32_t core_id, uint32_t ht_id)
23 {
24         char msgq_name[32];
25         ssize_t param_idx;
26
27         snprintf(msgq_name, sizeof(msgq_name),
28                 "MSGQ-REQ-CORE-s%" PRIu32 "c%" PRIu32 "%s",
29                 socket_id,
30                 core_id,
31                 (ht_id) ? "h" : "");
32         param_idx = APP_PARAM_FIND(app->msgq_params, msgq_name);
33
34         if (param_idx < 0)
35                 return NULL;
36
37         return app->msgq[param_idx];
38 }
39
40 static inline struct rte_ring *
41 app_thread_msgq_out_get(struct app_params *app,
42                 uint32_t socket_id, uint32_t core_id, uint32_t ht_id)
43 {
44         char msgq_name[32];
45         ssize_t param_idx;
46
47         snprintf(msgq_name, sizeof(msgq_name),
48                 "MSGQ-RSP-CORE-s%" PRIu32 "c%" PRIu32 "%s",
49                 socket_id,
50                 core_id,
51                 (ht_id) ? "h" : "");
52         param_idx = APP_PARAM_FIND(app->msgq_params, msgq_name);
53
54         if (param_idx < 0)
55                 return NULL;
56
57         return app->msgq[param_idx];
58
59 }
60
61 int
62 app_pipeline_thread_cmd_push(struct app_params *app);
63
64 int
65 app_pipeline_enable(struct app_params *app,
66                 uint32_t core_id,
67                 uint32_t socket_id,
68                 uint32_t hyper_th_id,
69                 uint32_t pipeline_id);
70
71 int
72 app_pipeline_disable(struct app_params *app,
73                 uint32_t core_id,
74                 uint32_t socket_id,
75                 uint32_t hyper_th_id,
76                 uint32_t pipeline_id);
77
78 int
79 app_thread_headroom(struct app_params *app,
80                 uint32_t core_id,
81                 uint32_t socket_id,
82                 uint32_t hyper_th_id);
83
84 #endif /* THREAD_FE_H_ */