2 // Copyright (c) 2017 Intel Corporation
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __INCLUDE_PIPELINE_TIMER_BE_H__
18 #define __INCLUDE_PIPELINE_TIMER_BE_H__
20 #include <rte_timer.h>
21 #include "pipeline_cgnapt_be.h"
22 #include "pipeline_common_be.h"
23 #include "pipeline_cgnapt_common.h"
25 extern struct pipeline_be_ops pipeline_timer_be_ops;
26 /*uint8_t timer_ring_init;*/
27 struct rte_ring *timer_ring;
28 extern struct rte_mempool *timer_mempool;
30 extern struct rte_mempool *timer_key_mempool;
31 /*static int timer_objs_mempool_count = 70000;*/
32 /*static int timer_ring_alloc_cnt = 4096;*/
33 extern uint64_t cgnapt_timeout;
34 extern uint32_t timer_lcore;
36 /* one timer entry created for pair of egress and ingress entry */
38 struct pipeline_cgnapt_entry_key egress_key, ingress_key;
39 struct cgnapt_table_entry *egress_entry, *ingress_entry;
40 struct pipeline *p_nat;
41 } __rte_cache_aligned;
43 /******* Function declarations ********/
45 void cgnapt_entry_delete(struct rte_timer *tim, void *arg);
47 void timer_thread_enqueue(struct pipeline_cgnapt_entry_key *egress_key,
48 struct pipeline_cgnapt_entry_key *ingress_key,
49 struct cgnapt_table_entry *egress_entry,
50 struct cgnapt_table_entry *ingress_entry,
51 struct pipeline *p_nat);
53 void timer_thread_dequeue(void);
54 extern uint64_t nextPowerOf2(uint64_t n);