FD.io VPP
v16.06
Vector Packet Processing
Main Page
Related Pages
Data Structures
Source
Files
Symbols
l2_bd.h
Go to the documentation of this file.
1
/*
2
* l2_bd.h : layer 2 bridge domain
3
*
4
* Copyright (c) 2013 Cisco and/or its affiliates.
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at:
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
18
#ifndef included_l2bd_h
19
#define included_l2bd_h
20
21
#include <
vlib/vlib.h
>
22
#include <
vnet/vnet.h
>
23
24
typedef
struct
{
25
// hash bd_id -> bd_index
26
uword
*
bd_index_by_bd_id
;
27
28
// Busy bd_index bitmap
29
uword
*
bd_index_bitmap
;
30
31
// convenience
32
vlib_main_t
*
vlib_main
;
33
vnet_main_t
*
vnet_main
;
34
}
bd_main_t
;
35
36
bd_main_t
bd_main
;
37
38
// Bridge domain member
39
40
#define L2_FLOOD_MEMBER_NORMAL 0
41
#define L2_FLOOD_MEMBER_BVI 1
42
43
typedef
struct
{
44
u32
sw_if_index
;
// the output L2 interface
45
u8
flags
;
// 0=normal, 1=bvi
46
u8
shg
;
// split horizon group number
47
u16
spare
;
48
}
l2_flood_member_t
;
49
50
51
// Per-bridge domain configuration
52
53
typedef
struct
{
54
u32
feature_bitmap
;
55
// Contains bit enables for flooding, learning, and forwarding.
56
// All other feature bits should always be set.
57
58
// identity of the bridge-domain's BVI interface
59
// set to ~0 if there is no BVI
60
u32
bvi_sw_if_index
;
61
62
// bridge domain id, not to be confused with bd_index
63
u32
bd_id
;
64
65
// Vector of members in the replication group
66
l2_flood_member_t
*
members
;
67
68
// hash ip4/ip6 -> mac for arp termination
69
uword
*
mac_by_ip4
;
70
uword
*
mac_by_ip6
;
71
72
}
l2_bridge_domain_t
;
73
74
// Return 1 if bridge domain has been initialized
75
always_inline
u32
76
bd_is_valid
(
l2_bridge_domain_t
* bd_config)
77
{
78
return
(bd_config->
feature_bitmap
!= 0);
79
}
80
81
// Init bridge domain if not done already
82
void
83
bd_validate
(
l2_bridge_domain_t
* bd_config);
84
85
86
void
87
bd_add_member
(
l2_bridge_domain_t
* bd_config,
88
l2_flood_member_t
* member);
89
90
u32
91
bd_remove_member
(
l2_bridge_domain_t
* bd_config,
92
u32
sw_if_index);
93
94
95
#define L2_LEARN (1<<0)
96
#define L2_FWD (1<<1)
97
#define L2_FLOOD (1<<2)
98
#define L2_UU_FLOOD (1<<3)
99
#define L2_ARP_TERM (1<<4)
100
101
u32
102
bd_set_flags
(
vlib_main_t
* vm,
103
u32
bd_index,
104
u32
flags
,
105
u32
enable);
106
107
/**
108
* \brief Get or create a bridge domain.
109
*
110
* Get or create a bridge domain with the given bridge domain ID.
111
*
112
* \param bdm bd_main pointer.
113
* \param bd_id The bridge domain ID or ~0 if an arbitrary unused bridge domain should be used.
114
* \return The bridge domain index in \c l2input_main->l2_bridge_domain_t vector.
115
*/
116
u32
bd_find_or_add_bd_index
(
bd_main_t
* bdm,
u32
bd_id);
117
118
/**
119
* \brief Delete a bridge domain.
120
*
121
* Delete an existing bridge domain with the given bridge domain ID.
122
*
123
* \param bdm bd_main pointer.
124
* \param bd_id The bridge domain ID.
125
* \return 0 on success and -1 if the bridge domain does not exist.
126
*/
127
int
bd_delete_bd_index
(
bd_main_t
* bdm,
u32
bd_id);
128
129
u32
bd_add_del_ip_mac
(
u32
bd_index,
130
u8
*ip_addr,
131
u8
*mac_addr,
132
u8
is_ip6,
133
u8
is_add);
134
135
#endif
136
l2_bridge_domain_t::bvi_sw_if_index
u32 bvi_sw_if_index
Definition:
l2_bd.h:60
bd_is_valid
always_inline u32 bd_is_valid(l2_bridge_domain_t *bd_config)
Definition:
l2_bd.h:76
l2_bridge_domain_t::members
l2_flood_member_t * members
Definition:
l2_bd.h:66
bd_add_member
void bd_add_member(l2_bridge_domain_t *bd_config, l2_flood_member_t *member)
Definition:
l2_bd.c:102
l2_flood_member_t::spare
u16 spare
Definition:
l2_bd.h:47
bd_delete_bd_index
int bd_delete_bd_index(bd_main_t *bdm, u32 bd_id)
Delete a bridge domain.
Definition:
l2_bd.c:80
always_inline
#define always_inline
Definition:
clib.h:84
l2_flood_member_t::shg
u8 shg
Definition:
l2_bd.h:46
bd_main
bd_main_t bd_main
Definition:
l2_bd.h:36
bd_main_t::bd_index_by_bd_id
uword * bd_index_by_bd_id
Definition:
l2_bd.h:26
bd_main_t::vnet_main
vnet_main_t * vnet_main
Definition:
l2_bd.h:33
bd_set_flags
u32 bd_set_flags(vlib_main_t *vm, u32 bd_index, u32 flags, u32 enable)
Definition:
l2_bd.c:164
l2_bridge_domain_t::bd_id
u32 bd_id
Definition:
l2_bd.h:63
bd_main_t::bd_index_bitmap
uword * bd_index_bitmap
Definition:
l2_bd.h:29
vnet.h
l2_flood_member_t
Definition:
l2_bd.h:43
bd_remove_member
u32 bd_remove_member(l2_bridge_domain_t *bd_config, u32 sw_if_index)
Definition:
l2_bd.c:127
l2_bridge_domain_t::mac_by_ip6
uword * mac_by_ip6
Definition:
l2_bd.h:70
bd_add_del_ip_mac
u32 bd_add_del_ip_mac(u32 bd_index, u8 *ip_addr, u8 *mac_addr, u8 is_ip6, u8 is_add)
Definition:
l2_bd.c:447
vlib.h
vnet_main_t
Definition:
vnet.h:58
u32
unsigned int u32
Definition:
types.h:88
bd_main_t
Definition:
l2_bd.h:24
l2_bridge_domain_t
Definition:
l2_bd.h:53
uword
u64 uword
Definition:
types.h:112
bd_main_t::vlib_main
vlib_main_t * vlib_main
Definition:
l2_bd.h:32
u16
unsigned short u16
Definition:
types.h:57
l2_bridge_domain_t::feature_bitmap
u32 feature_bitmap
Definition:
l2_bd.h:54
u8
unsigned char u8
Definition:
types.h:56
vlib_main_t
Definition:
main.h:59
bd_find_or_add_bd_index
u32 bd_find_or_add_bd_index(bd_main_t *bdm, u32 bd_id)
Get or create a bridge domain.
Definition:
l2_bd.c:52
l2_bridge_domain_t::mac_by_ip4
uword * mac_by_ip4
Definition:
l2_bd.h:69
l2_flood_member_t::sw_if_index
u32 sw_if_index
Definition:
l2_bd.h:44
flags
u32 flags
Definition:
vhost-user.h:73
bd_validate
void bd_validate(l2_bridge_domain_t *bd_config)
Definition:
l2_bd.c:40
l2_flood_member_t::flags
u8 flags
Definition:
l2_bd.h:45
vnet
vnet
l2
l2_bd.h
Generated on Thu Sep 1 2016 09:11:40 for FD.io VPP by
1.8.11