c2650c1d2d5e1642112ec2c41f950220ca627f9e
[vpp.git] / plugins / ila-plugin / ila / ila.h
1 /*
2  * Copyright (c) 2016 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 ILA_H
17 #define ILA_H
18
19 #include <vnet/vnet.h>
20 #include <vnet/ip/ip.h>
21
22 #include <vppinfra/bihash_24_8.h>
23 #include <vppinfra/bihash_template.h>
24
25 #define ila_foreach_type                \
26   _(IID, 0, "iid")                      \
27   _(LUID, 1, "luid")                    \
28   _(VNID4, 2, "vnid-ip4")               \
29   _(VNID6, 3, "vnid-ip6")               \
30   _(VNIDM, 4, "vnid-multicast")
31
32 typedef enum {
33 #define _(i,n,s) ILA_TYPE_##i = n,
34   ila_foreach_type
35 #undef _
36 } ila_type_t;
37
38 #define ila_csum_foreach_type \
39 _(NO_ACTION, 0, "no-action") \
40 _(NEUTRAL_MAP, 1, "neutral-map") \
41 _(ADJUST_TRANSPORT, 2, "adjust-transport")
42
43 typedef enum {
44 #define _(i,n,s) ILA_CSUM_MODE_##i = n,
45   ila_csum_foreach_type
46 #undef _
47   ILA_CSUM_N_TYPES
48 } ila_csum_mode_t;
49
50 typedef struct {
51   ila_type_t type;
52   ip6_address_t sir_address;
53   ip6_address_t ila_address;
54   u32 ila_adj_index;
55   ila_csum_mode_t csum_mode;
56 } ila_entry_t;
57
58 typedef struct {
59   u32 entry_index;
60 } ila_adj_data_t;
61
62 typedef struct {
63   ila_entry_t *entries;         //Pool of ILA entries
64
65   u64 lookup_table_nbuckets;
66   u64 lookup_table_size;
67   clib_bihash_24_8_t id_to_entry_table;
68
69   u32 ila_sir2ila_feature_index;
70
71   u32 ip6_lookup_next_index;
72 } ila_main_t;
73
74
75 typedef struct {
76   ila_type_t type;
77   ip6_address_t sir_address;
78   u64 locator;
79   u32 vnid;
80   u32 local_adj_index;
81   ila_csum_mode_t csum_mode;
82   u8 is_del;
83 } ila_add_del_entry_args_t;
84
85 int ila_add_del_entry (ila_add_del_entry_args_t * args);
86 int ila_interface (u32 sw_if_index, u8 disable);
87
88 #endif //ILA_H