summaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/params.h
blob: 7c7850d30c602c15be155e5b4c2aa718583017ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
 * Copyright (c) 2017-2020 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __HICN_PARAM_H__
#define __HICN_PARAM_H__

#include <math.h>

/**
 * @file params.h
 *
 */

/*
 * Features
 */
#define HICN_FEATURE_CS 1 // 1 enable 0 disable

/*
 * Face compile-time parameters
 */
#define HICN_PARAM_FACES_MAX 512

STATIC_ASSERT ((HICN_PARAM_FACES_MAX & (HICN_PARAM_FACES_MAX - 1)) == 0,
	       "HICN_PARAM_FACES_MAX must be a power of 2");

/*
 * Max length for hICN names
 */
#define HICN_PARAM_HICN_NAME_LEN_MAX 20 // bytes

// Max next - hops supported in a FIB entry
#define HICN_PARAM_FIB_ENTRY_NHOPS_MAX 10

// Default and limit on weight, whatever weight means
#define HICN_PARAM_FIB_ENTRY_NHOP_WGHT_DFLT 0x10
#define HICN_PARAM_FIB_ENTRY_NHOP_WGHT_MAX  0xff

/*
 * PIT compile-time parameters
 */
#define HICN_PARAM_PIT_ENTRIES_MIN  1024
#define HICN_PARAM_PIT_ENTRIES_DFLT 1024 * 128
#define HICN_PARAM_PIT_ENTRIES_MAX  2 * 1024 * 1024

// aggregation limit(interest previous hops)
// Supported up to 516. For more than 4 faces this param must
// HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4 must be a power of two
#define HICN_PARAM_PIT_ENTRY_PHOPS_MAX 20

STATIC_ASSERT ((ceil (log2 ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4)))) ==
		 (floor (log2 ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4)))),
	       "HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4 must be a power of two");

STATIC_ASSERT (
  (HICN_PARAM_PIT_ENTRY_PHOPS_MAX <= HICN_PARAM_FACES_MAX),
  "HICN_PARAM_PIT_ENTRY_PHOP_MAX must be <= than HICN_PARAM_FACES_MAX");

// tFIB parameters
#define HICN_PARAM_RTX_MAX 10

// PIT lifetime limits on API override this(in seconds, integer type)
#define HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC 0
#define HICN_PARAM_PIT_LIFETIME_BOUND_MAX_SEC 200

// PIT lifetime params if not set at API(in mseconds, integer type)
#define HICN_PARAM_PIT_LIFETIME_DFLT_MAX_MS 20000

// Face CS reservation params
#define HICN_PARAM_FACE_MAX_CS_RESERVED 20000 // packets
#define HICN_PARAM_FACE_MIN_CS_RESERVED 0     // packets
#define HICN_PARAM_FACE_DFT_CS_RESERVED 20000 // packets

/*
 * CS compile-time parameters
 */
#define HICN_PARAM_CS_ENTRIES_MIN  0 // can disable CS
#define HICN_PARAM_CS_ENTRIES_DFLT 4 * 1024
#define HICN_PARAM_CS_ENTRIES_MAX  1024 * 1024

#define HICN_PARAM_CS_LRU_DEFAULT (16 * 1024)

/* CS lifetime defines, in mseconds, integer type */
#define HICN_PARAM_CS_LIFETIME_MIN  0
#define HICN_PARAM_CS_LIFETIME_DFLT (5 * 60 * 1000)    // 300 seconds
#define HICN_PARAM_CS_LIFETIME_MAX  (24 * 3600 * 1000) // 24 hours...

/* CS reserved portion for applications */
#define HICN_PARAM_CS_RESERVED_APP 50 //%
#define HICN_PARAM_CS_MIN_MBUF                                                \
  4096 // this seems to be the minumim default number of mbuf we can have in
       // vpp

/* Cloning parameters */
/* ip4 */
#define HICN_IP4_VERSION_HEADER_LENGTH 0x45
#define HICN_IP4_PROTOCOL	       IP_PROTOCOL_TCP
#define HICN_IP4_TTL_DEFAULT	       128

/* ip6 */
#define IPV6_DEFAULT_VERSION	   6
#define IPV6_DEFAULT_TRAFFIC_CLASS 0
#define IPV6_DEFAULT_FLOW_LABEL	   0
#define HCIN_IP6_VERSION_TRAFFIC_FLOW                                         \
  (IPV6_DEFAULT_VERSION << 28) | (IPV6_DEFAULT_TRAFFIC_CLASS << 20) |         \
    (IPV6_DEFAULT_FLOW_LABEL & 0xfffff)
#define HICN_IP6_PROTOCOL  IP_PROTOCOL_TCP
#define HICN_IP6_HOP_LIMIT 0x40

#endif /* // __HICN_PARAM_H__ */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables: eval: (c-set-style "gnu") End:
 */