Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
params.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2020 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __HICN_PARAM_H__
17 #define __HICN_PARAM_H__
18 
19 #include <math.h>
20 
26 /*
27  * Features
28  */
29 #define HICN_FEATURE_CS 1 // 1 enable 0 disable
30 
31 /*
32  * Face compile-time parameters
33  */
34 #define HICN_PARAM_FACES_MAX 512
35 
36 STATIC_ASSERT ((HICN_PARAM_FACES_MAX & (HICN_PARAM_FACES_MAX - 1)) == 0,
37  "HICN_PARAM_FACES_MAX must be a power of 2");
38 
39 /*
40  * Max length for hICN names
41  */
42 #define HICN_PARAM_HICN_NAME_LEN_MAX 20 // bytes
43 
44 // Max next - hops supported in a FIB entry
45 #define HICN_PARAM_FIB_ENTRY_NHOPS_MAX 10
46 
47 // Default and limit on weight, whatever weight means
48 #define HICN_PARAM_FIB_ENTRY_NHOP_WGHT_DFLT 0x10
49 #define HICN_PARAM_FIB_ENTRY_NHOP_WGHT_MAX 0xff
50 
51 /*
52  * PIT compile-time parameters
53  */
54 #define HICN_PARAM_PIT_ENTRIES_MIN 1024
55 #define HICN_PARAM_PIT_ENTRIES_DFLT 1024 * 128
56 #define HICN_PARAM_PIT_ENTRIES_MAX 2 * 1024 * 1024
57 
58 // aggregation limit(interest previous hops)
59 // Supported up to 516. For more than 4 faces this param must
60 // HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4 must be a power of two
61 #define HICN_PARAM_PIT_ENTRY_PHOPS_MAX 20
62 
63 STATIC_ASSERT ((ceil (log2 ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4)))) ==
64  (floor (log2 ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4)))),
65  "HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4 must be a power of two");
66 
67 STATIC_ASSERT (
68  (HICN_PARAM_PIT_ENTRY_PHOPS_MAX <= HICN_PARAM_FACES_MAX),
69  "HICN_PARAM_PIT_ENTRY_PHOP_MAX must be <= than HICN_PARAM_FACES_MAX");
70 
71 // tFIB parameters
72 #define HICN_PARAM_RTX_MAX 10
73 
74 // PIT lifetime limits on API override this(in seconds, integer type)
75 #define HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC 0
76 #define HICN_PARAM_PIT_LIFETIME_BOUND_MAX_SEC 200
77 
78 // PIT lifetime params if not set at API(in mseconds, integer type)
79 #define HICN_PARAM_PIT_LIFETIME_DFLT_MAX_MS 20000
80 
81 // Face CS reservation params
82 #define HICN_PARAM_FACE_MAX_CS_RESERVED 20000 // packets
83 #define HICN_PARAM_FACE_MIN_CS_RESERVED 0 // packets
84 #define HICN_PARAM_FACE_DFT_CS_RESERVED 20000 // packets
85 
86 /*
87  * CS compile-time parameters
88  */
89 #define HICN_PARAM_CS_ENTRIES_MIN 0 // can disable CS
90 #define HICN_PARAM_CS_ENTRIES_DFLT 4 * 1024
91 #define HICN_PARAM_CS_ENTRIES_MAX 1024 * 1024
92 
93 #define HICN_PARAM_CS_LRU_DEFAULT (16 * 1024)
94 
95 /* CS lifetime defines, in mseconds, integer type */
96 #define HICN_PARAM_CS_LIFETIME_MIN 0
97 #define HICN_PARAM_CS_LIFETIME_DFLT (5 * 60 * 1000) // 300 seconds
98 #define HICN_PARAM_CS_LIFETIME_MAX (24 * 3600 * 1000) // 24 hours...
99 
100 /* CS reserved portion for applications */
101 #define HICN_PARAM_CS_RESERVED_APP 50 //%
102 #define HICN_PARAM_CS_MIN_MBUF \
103  4096 // this seems to be the minumim default number of mbuf we can have in
104  // vpp
105 
106 /* Cloning parameters */
107 /* ip4 */
108 #define HICN_IP4_VERSION_HEADER_LENGTH 0x45
109 #define HICN_IP4_PROTOCOL IP_PROTOCOL_TCP
110 #define HICN_IP4_TTL_DEFAULT 128
111 
112 /* ip6 */
113 #define IPV6_DEFAULT_VERSION 6
114 #define IPV6_DEFAULT_TRAFFIC_CLASS 0
115 #define IPV6_DEFAULT_FLOW_LABEL 0
116 #define HCIN_IP6_VERSION_TRAFFIC_FLOW \
117  (IPV6_DEFAULT_VERSION << 28) | (IPV6_DEFAULT_TRAFFIC_CLASS << 20) | \
118  (IPV6_DEFAULT_FLOW_LABEL & 0xfffff)
119 #define HICN_IP6_PROTOCOL IP_PROTOCOL_TCP
120 #define HICN_IP6_HOP_LIMIT 0x40
121 
122 #endif /* // __HICN_PARAM_H__ */
123 
124 /*
125  * fd.io coding-style-patch-verification: ON
126  *
127  * Local Variables: eval: (c-set-style "gnu") End:
128  */