summaryrefslogtreecommitdiffstats
path: root/plugins/ila-plugin/ila/ila.h
blob: 29b87fa0c3df51601311a23b9e01c66eea37e1d7 (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
/*
 * Copyright (c) 2016 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 ILA_H
#define ILA_H

#include <vnet/vnet.h>
#include <vnet/ip/ip.h>

#include <vppinfra/bihash_24_8.h>
#include <vppinfra/bihash_template.h>

#define ila_foreach_type		\
  _(IID, 0, "iid")			\
  _(LUID, 1, "luid")			\
  _(VNID4, 2, "vnid-ip4")		\
  _(VNID6, 3, "vnid-ip6")		\
  _(VNIDM, 4, "vnid-multicast")

#define ila_type_list "iid,luid,vnid-ip4,vnid-ip6,vnid-multicast"

typedef enum
{
#define _(i,n,s) ILA_TYPE_##i = n,
  ila_foreach_type
#undef _
} ila_type_t;

#define ila_csum_foreach_type \
_(NO_ACTION, 0, "no-action") \
_(NEUTRAL_MAP, 1, "neutral-map") \
_(ADJUST_TRANSPORT, 2, "adjust-transport")

#define ila_csum_list "no-action,neutral-map,adjust-transport"

typedef enum
{
#define _(i,n,s) ILA_CSUM_MODE_##i = n,
  ila_csum_foreach_type
#undef _
  ILA_CSUM_N_TYPES
} ila_csum_mode_t;

#define ila_foreach_direction \
_(BIDIR, 0, "bidir") \
_(SIR2ILA, 1, "sir2ila") \
_(ILA2SIR, 2, "ila2sir")

#define ila_direction_list "bidir,sir2ila,ila2sir"

typedef enum
{
#define _(i,n,s) ILA_DIR_##i = n,
  ila_foreach_direction
#undef _
} ila_direction_t;

typedef struct
{
  ila_type_t type;
  ip6_address_t sir_address;
  ip6_address_t ila_address;
  u32 ila_adj_index;
  ila_csum_mode_t csum_mode;
  ila_direction_t dir;
} ila_entry_t;

typedef struct
{
  u32 entry_index;
} ila_adj_data_t;

typedef struct
{
  ila_entry_t *entries;		//Pool of ILA entries

  u64 lookup_table_nbuckets;
  u64 lookup_table_size;
  clib_bihash_24_8_t id_to_entry_table;

  u32 ila_sir2ila_feature_index;

  u32 ip6_lookup_next_index;
} ila_main_t;


typedef struct
{
  ila_type_t type;
  ip6_address_t sir_address;
  u64 locator;
  u32 vnid;
  u32 local_adj_index;
  ila_csum_mode_t csum_mode;
  ila_direction_t dir;
  u8 is_del;
} ila_add_del_entry_args_t;

int ila_add_del_entry (ila_add_del_entry_args_t * args);
int ila_interface (u32 sw_if_index, u8 disable);

u8 *format_half_ip6_address (u8 * s, va_list * va);
u8 *format_ila_direction (u8 * s, va_list * args);
u8 *format_ila_csum_mode (u8 * s, va_list * va);
u8 *format_ila_type (u8 * s, va_list * args);

#endif //ILA_H