FD.io VPP  v17.04-9-g99c0734
Vector Packet Processing
l2_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * l2_api.c - layer 2 forwarding api
4  *
5  * Copyright (c) 2016 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #include <vnet/vnet.h>
21 #include <vlibmemory/api.h>
22 
23 #include <vnet/interface.h>
24 #include <vnet/api_errno.h>
25 #include <vnet/l2/l2_input.h>
26 #include <vnet/l2/l2_fib.h>
27 #include <vnet/l2/l2_vtr.h>
28 
29 #include <vnet/vnet_msg_enum.h>
30 
31 #define vl_typedefs /* define message structures */
32 #include <vnet/vnet_all_api_h.h>
33 #undef vl_typedefs
34 
35 #define vl_endianfun /* define message structures */
36 #include <vnet/vnet_all_api_h.h>
37 #undef vl_endianfun
38 
39 /* instantiate all the print functions we know about */
40 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
41 #define vl_printfun
42 #include <vnet/vnet_all_api_h.h>
43 #undef vl_printfun
44 
46 
47 #define foreach_vpe_api_msg \
48 _(L2_XCONNECT_DUMP, l2_xconnect_dump) \
49 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \
50 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
51 _(L2FIB_ADD_DEL, l2fib_add_del) \
52 _(L2_FLAGS, l2_flags) \
53 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \
54 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \
55 _(BRIDGE_FLAGS, bridge_flags) \
56 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \
57 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite)
58 
59 static void
61  u32 rx_sw_if_index, u32 tx_sw_if_index)
62 {
64 
65  mp = vl_msg_api_alloc (sizeof (*mp));
66  memset (mp, 0, sizeof (*mp));
67  mp->_vl_msg_id = ntohs (VL_API_L2_XCONNECT_DETAILS);
68  mp->context = context;
69  mp->rx_sw_if_index = htonl (rx_sw_if_index);
70  mp->tx_sw_if_index = htonl (tx_sw_if_index);
71 
72  vl_msg_api_send_shmem (q, (u8 *) & mp);
73 }
74 
75 static void
77 {
79  vnet_main_t *vnm = vnet_get_main ();
82  vnet_sw_interface_t *swif;
83  l2_input_config_t *config;
84 
86  if (q == 0)
87  return;
88 
89  /* *INDENT-OFF* */
90  pool_foreach (swif, im->sw_interfaces,
91  ({
92  config = vec_elt_at_index (l2im->configs, swif->sw_if_index);
93  if (config->xconnect)
94  send_l2_xconnect_details (q, mp->context, swif->sw_if_index,
95  config->output_sw_if_index);
96  }));
97  /* *INDENT-ON* */
98 }
99 
100 static void
102 {
103  int rv = 0;
105 
106  /* DAW-FIXME: This API should only clear non-static l2fib entries, but
107  * that is not currently implemented. When that TODO is fixed
108  * this call should be changed to pass 1 instead of 0.
109  */
110  l2fib_clear_table (0);
111 
112  REPLY_MACRO (VL_API_L2_FIB_CLEAR_TABLE_REPLY);
113 }
114 
115 static void
118  l2fib_entry_key_t * l2fe_key,
119  l2fib_entry_result_t * l2fe_res, u32 context)
120 {
122 
123  mp = vl_msg_api_alloc (sizeof (*mp));
124  memset (mp, 0, sizeof (*mp));
125  mp->_vl_msg_id = ntohs (VL_API_L2_FIB_TABLE_ENTRY);
126 
127  mp->bd_id =
128  ntohl (l2input_main.bd_configs[l2fe_key->fields.bd_index].bd_id);
129 
130  mp->mac = l2fib_make_key (l2fe_key->fields.mac, 0);
131  mp->sw_if_index = ntohl (l2fe_res->fields.sw_if_index);
132  mp->static_mac = l2fe_res->fields.static_mac;
133  mp->filter_mac = l2fe_res->fields.filter;
134  mp->bvi_mac = l2fe_res->fields.bvi;
135  mp->context = context;
136 
137  vl_msg_api_send_shmem (q, (u8 *) & mp);
138 }
139 
140 static void
142 {
144  bd_main_t *bdm = &bd_main;
145  l2fib_entry_key_t *l2fe_key = NULL;
146  l2fib_entry_result_t *l2fe_res = NULL;
147  u32 ni, bd_id = ntohl (mp->bd_id);
148  u32 bd_index;
150  uword *p;
151 
153  if (q == 0)
154  return;
155 
156  /* see l2fib_table_dump: ~0 means "any" */
157  if (bd_id == ~0)
158  bd_index = ~0;
159  else
160  {
161  p = hash_get (bdm->bd_index_by_bd_id, bd_id);
162  if (p == 0)
163  return;
164 
165  bd_index = p[0];
166  }
167 
168  l2fib_table_dump (bd_index, &l2fe_key, &l2fe_res);
169 
170  vec_foreach_index (ni, l2fe_key)
171  {
172  send_l2fib_table_entry (am, q, vec_elt_at_index (l2fe_key, ni),
173  vec_elt_at_index (l2fe_res, ni), mp->context);
174  }
175  vec_free (l2fe_key);
176  vec_free (l2fe_res);
177 }
178 
179 static void
181 {
182  bd_main_t *bdm = &bd_main;
183  l2input_main_t *l2im = &l2input_main;
185  int rv = 0;
186  u64 mac = 0;
187  u32 sw_if_index = ntohl (mp->sw_if_index);
188  u32 bd_id = ntohl (mp->bd_id);
189  u32 bd_index;
190  u32 static_mac;
191  u32 filter_mac;
192  u32 bvi_mac;
193  uword *p;
194 
195  mac = mp->mac;
196 
197  p = hash_get (bdm->bd_index_by_bd_id, bd_id);
198  if (!p)
199  {
200  rv = VNET_API_ERROR_NO_SUCH_ENTRY;
201  goto bad_sw_if_index;
202  }
203  bd_index = p[0];
204 
205  if (mp->is_add)
206  {
207  filter_mac = mp->filter_mac ? 1 : 0;
208  if (filter_mac == 0)
209  {
211  if (vec_len (l2im->configs) <= sw_if_index)
212  {
213  rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
214  goto bad_sw_if_index;
215  }
216  else
217  {
218  l2_input_config_t *config;
219  config = vec_elt_at_index (l2im->configs, sw_if_index);
220  if (config->bridge == 0)
221  {
222  rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
223  goto bad_sw_if_index;
224  }
225  }
226  }
227  static_mac = mp->static_mac ? 1 : 0;
228  bvi_mac = mp->bvi_mac ? 1 : 0;
229  l2fib_add_entry (mac, bd_index, sw_if_index, static_mac, filter_mac,
230  bvi_mac);
231  }
232  else
233  {
234  l2fib_del_entry (mac, bd_index);
235  }
236 
238 
239  REPLY_MACRO (VL_API_L2FIB_ADD_DEL_REPLY);
240 }
241 
242 static void
244 {
246  int rv = 0;
247  u32 sw_if_index = ntohl (mp->sw_if_index);
248  u32 flags = ntohl (mp->feature_bitmap);
249  u32 rbm = 0;
250 
252 
253 #define _(a,b) \
254  if (flags & L2INPUT_FEAT_ ## a) \
255  rbm = l2input_intf_bitmap_enable (sw_if_index, L2INPUT_FEAT_ ## a, mp->is_set);
257 #undef _
258 
260 
261  /* *INDENT-OFF* */
262  REPLY_MACRO2(VL_API_L2_FLAGS_REPLY,
263  ({
264  rmp->resulting_feature_bitmap = ntohl(rbm);
265  }));
266  /* *INDENT-ON* */
267 }
268 
269 static void
271 {
273  bd_main_t *bdm = &bd_main;
275  int rv = 0;
276  u32 enable_flags = 0, disable_flags = 0;
277  u32 bd_id = ntohl (mp->bd_id);
278  u32 bd_index;
279 
280  if (mp->is_add)
281  {
282  bd_index = bd_find_or_add_bd_index (bdm, bd_id);
283 
284  if (mp->flood)
285  enable_flags |= L2_FLOOD;
286  else
287  disable_flags |= L2_FLOOD;
288 
289  if (mp->uu_flood)
290  enable_flags |= L2_UU_FLOOD;
291  else
292  disable_flags |= L2_UU_FLOOD;
293 
294  if (mp->forward)
295  enable_flags |= L2_FWD;
296  else
297  disable_flags |= L2_FWD;
298 
299  if (mp->arp_term)
300  enable_flags |= L2_ARP_TERM;
301  else
302  disable_flags |= L2_ARP_TERM;
303 
304  if (mp->learn)
305  enable_flags |= L2_LEARN;
306  else
307  disable_flags |= L2_LEARN;
308 
309  if (enable_flags)
310  bd_set_flags (vm, bd_index, enable_flags, 1 /* enable */ );
311 
312  if (disable_flags)
313  bd_set_flags (vm, bd_index, disable_flags, 0 /* disable */ );
314 
315  bd_set_mac_age (vm, bd_index, mp->mac_age);
316  }
317  else
318  rv = bd_delete_bd_index (bdm, bd_id);
319 
320  REPLY_MACRO (VL_API_BRIDGE_DOMAIN_ADD_DEL_REPLY);
321 }
322 
323 static void
325  l2_bridge_domain_t * bd_config,
326  u32 n_sw_ifs, u32 context)
327 {
329 
330  mp = vl_msg_api_alloc (sizeof (*mp));
331  memset (mp, 0, sizeof (*mp));
332  mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_DETAILS);
333  mp->bd_id = ntohl (bd_config->bd_id);
334  mp->flood = bd_feature_flood (bd_config);
335  mp->uu_flood = bd_feature_uu_flood (bd_config);
336  mp->forward = bd_feature_forward (bd_config);
337  mp->learn = bd_feature_learn (bd_config);
338  mp->arp_term = bd_feature_arp_term (bd_config);
339  mp->bvi_sw_if_index = ntohl (bd_config->bvi_sw_if_index);
340  mp->mac_age = bd_config->mac_age;
341  mp->n_sw_ifs = ntohl (n_sw_ifs);
342  mp->context = context;
343 
344  vl_msg_api_send_shmem (q, (u8 *) & mp);
345 }
346 
347 static void
350  l2_flood_member_t * member, u32 bd_id, u32 context)
351 {
353  l2_input_config_t *input_cfg;
354 
355  mp = vl_msg_api_alloc (sizeof (*mp));
356  memset (mp, 0, sizeof (*mp));
357  mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_SW_IF_DETAILS);
358  mp->bd_id = ntohl (bd_id);
359  mp->sw_if_index = ntohl (member->sw_if_index);
360  input_cfg = vec_elt_at_index (l2im->configs, member->sw_if_index);
361  mp->shg = input_cfg->shg;
362  mp->context = context;
363 
364  vl_msg_api_send_shmem (q, (u8 *) & mp);
365 }
366 
367 static void
369 {
370  bd_main_t *bdm = &bd_main;
371  l2input_main_t *l2im = &l2input_main;
373  l2_bridge_domain_t *bd_config;
374  u32 bd_id, bd_index;
375  u32 end;
376 
378 
379  if (q == 0)
380  return;
381 
382  bd_id = ntohl (mp->bd_id);
383 
384  bd_index = (bd_id == ~0) ? 0 : bd_find_or_add_bd_index (bdm, bd_id);
385  end = (bd_id == ~0) ? vec_len (l2im->bd_configs) : bd_index + 1;
386  for (; bd_index < end; bd_index++)
387  {
388  bd_config = l2input_bd_config_from_index (l2im, bd_index);
389  /* skip dummy bd_id 0 */
390  if (bd_config && (bd_config->bd_id > 0))
391  {
392  u32 n_sw_ifs;
394 
395  n_sw_ifs = vec_len (bd_config->members);
396  send_bridge_domain_details (q, bd_config, n_sw_ifs, mp->context);
397 
398  vec_foreach (m, bd_config->members)
399  {
400  send_bd_sw_if_details (l2im, q, m, bd_config->bd_id, mp->context);
401  }
402  }
403  }
404 }
405 
406 static void
408 {
410  bd_main_t *bdm = &bd_main;
412  int rv = 0;
413  u32 bd_id = ntohl (mp->bd_id);
414  u32 bd_index;
415  u32 flags = ntohl (mp->feature_bitmap);
416  uword *p;
417 
418  p = hash_get (bdm->bd_index_by_bd_id, bd_id);
419  if (p == 0)
420  {
421  rv = VNET_API_ERROR_NO_SUCH_ENTRY;
422  goto out;
423  }
424 
425  bd_index = p[0];
426 
427  bd_set_flags (vm, bd_index, flags, mp->is_set);
428 
429 out:
430  /* *INDENT-OFF* */
431  REPLY_MACRO2(VL_API_BRIDGE_FLAGS_REPLY,
432  ({
433  rmp->resulting_feature_bitmap = ntohl(flags);
434  }));
435  /* *INDENT-ON* */
436 }
437 
438 static void
441 {
442  int rv = 0;
444  vnet_main_t *vnm = vnet_get_main ();
446  u32 vtr_op;
447 
449 
450  vtr_op = ntohl (mp->vtr_op);
451 
452  /* The L2 code is unsuspicious */
453  switch (vtr_op)
454  {
455  case L2_VTR_DISABLED:
456  case L2_VTR_PUSH_1:
457  case L2_VTR_PUSH_2:
458  case L2_VTR_POP_1:
459  case L2_VTR_POP_2:
464  break;
465 
466  default:
467  rv = VNET_API_ERROR_INVALID_VALUE;
468  goto bad_sw_if_index;
469  }
470 
471  rv = l2vtr_configure (vm, vnm, ntohl (mp->sw_if_index), vtr_op,
472  ntohl (mp->push_dot1q), ntohl (mp->tag1),
473  ntohl (mp->tag2));
474 
476 
477  REPLY_MACRO (VL_API_L2_INTERFACE_VLAN_TAG_REWRITE_REPLY);
478 }
479 
480 static void
483 {
485  vnet_main_t *vnm = vnet_get_main ();
487  u32 vtr_op;
488  int rv = 0;
489 
491 
492  vtr_op = ntohl (mp->vtr_op);
493 
494  switch (vtr_op)
495  {
496  case L2_VTR_DISABLED:
497  case L2_VTR_PUSH_2:
498  case L2_VTR_POP_2:
500  break;
501 
502  default:
503  rv = VNET_API_ERROR_INVALID_VALUE;
504  goto bad_sw_if_index;
505  }
506 
507  rv = l2pbb_configure (vm, vnm, ntohl (mp->sw_if_index), vtr_op,
508  mp->b_dmac, mp->b_smac, ntohs (mp->b_vlanid),
509  ntohl (mp->i_sid), ntohs (mp->outer_tag));
510 
512 
513  REPLY_MACRO (VL_API_L2_INTERFACE_PBB_TAG_REWRITE_REPLY);
514 }
515 
516 /*
517  * l2_api_hookup
518  * Add vpe's API message handlers to the table.
519  * vlib has alread mapped shared memory and
520  * added the client registration handlers.
521  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
522  */
523 #define vl_msg_name_crc_list
524 #include <vnet/vnet_all_api_h.h>
525 #undef vl_msg_name_crc_list
526 
527 static void
529 {
530 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
531  foreach_vl_msg_name_crc_l2;
532 #undef _
533 }
534 
535 static clib_error_t *
537 {
538  api_main_t *am = &api_main;
539 
540 #define _(N,n) \
541  vl_msg_api_set_handlers(VL_API_##N, #n, \
542  vl_api_##n##_t_handler, \
543  vl_noop_handler, \
544  vl_api_##n##_t_endian, \
545  vl_api_##n##_t_print, \
546  sizeof(vl_api_##n##_t), 1);
548 #undef _
549 
550  /*
551  * Set up the (msg_name, crc, message-id) table
552  */
554 
555  return 0;
556 }
557 
559 
560 /*
561  * fd.io coding-style-patch-verification: ON
562  *
563  * Local Variables:
564  * eval: (c-set-style "gnu")
565  * End:
566  */
static_always_inline u8 bd_feature_forward(l2_bridge_domain_t *bd_config)
Definition: l2_input.h:149
static void vl_api_l2_fib_table_dump_t_handler(vl_api_l2_fib_table_dump_t *mp)
Definition: l2_api.c:141
u32 bd_set_flags(vlib_main_t *vm, u32 bd_index, u32 flags, u32 enable)
Set the learn/forward/flood flags for the bridge domain.
Definition: l2_bd.c:226
#define vec_foreach_index(var, v)
Iterate over vector indices.
L2 interface vlan tag rewrite response.
Definition: l2.api:287
L2 FIB add entry request.
Definition: l2.api:99
l2_input_config_t * configs
Definition: l2_input.h:69
Set bridge flags response.
Definition: l2.api:256
u32 l2vtr_configure(vlib_main_t *vlib_main, vnet_main_t *vnet_main, u32 sw_if_index, u32 vtr_op, u32 push_dot1q, u32 vtr_tag1, u32 vtr_tag2)
Configure vtag tag rewrite on the given interface.
Definition: l2_vtr.c:136
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
vnet_main_t * vnet_get_main(void)
Definition: misc.c:46
u32 bvi_sw_if_index
Definition: l2_bd.h:65
static void vl_api_l2_flags_t_handler(vl_api_l2_flags_t *mp)
Definition: l2_api.c:243
vnet_interface_main_t interface_main
Definition: vnet.h:57
#define REPLY_MACRO2(t, body)
#define NULL
Definition: clib.h:55
#define L2_FLOOD
Definition: l2_bd.h:113
L2 bridge domain sw interface operational state response.
Definition: l2.api:226
#define L2_FWD
Definition: l2_bd.h:112
u32 l2fib_del_entry(u64 mac, u32 bd_index)
Delete an entry from the l2fib.
Definition: l2_fib.c:622
VLIB_API_INIT_FUNCTION(l2_api_hookup)
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
l2_flood_member_t * members
Definition: l2_bd.h:71
Dump L2 XConnects.
Definition: l2.api:33
static void vl_api_bridge_domain_add_del_t_handler(vl_api_bridge_domain_add_del_t *mp)
Definition: l2_api.c:270
L2 bridge domain request operational state details.
Definition: l2.api:190
Definition: l2_fib.h:56
static_always_inline u8 bd_feature_uu_flood(l2_bridge_domain_t *bd_config)
Definition: l2_input.h:142
static void vl_api_l2fib_add_del_t_handler(vl_api_l2fib_add_del_t *mp)
Definition: l2_api.c:180
struct l2fib_entry_result_t::@150::@152 fields
Reply to l2_xconnect_dump.
Definition: l2.api:22
static void send_l2_xconnect_details(unix_shared_memory_queue_t *q, u32 context, u32 rx_sw_if_index, u32 tx_sw_if_index)
Definition: l2_api.c:60
api_main_t api_main
Definition: api_shared.c:35
u32 bd_id
Definition: l2.api:50
L2 bridge domain operational state response.
Definition: l2.api:207
int bd_delete_bd_index(bd_main_t *bdm, u32 bd_id)
Delete a bridge domain.
Definition: l2_bd.c:100
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:376
u32 context
Definition: l2.api:49
u32 feature_bitmap
Definition: l2.api:135
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static_always_inline u8 bd_feature_arp_term(l2_bridge_domain_t *bd_config)
Definition: l2_input.h:162
static void vl_api_l2_fib_clear_table_t_handler(vl_api_l2_fib_clear_table_t *mp)
Definition: l2_api.c:101
#define L2_UU_FLOOD
Definition: l2_bd.h:114
unsigned long u64
Definition: types.h:89
uword * bd_index_by_bd_id
Definition: l2_bd.h:27
static void send_bridge_domain_details(unix_shared_memory_queue_t *q, l2_bridge_domain_t *bd_config, u32 n_sw_ifs, u32 context)
Definition: l2_api.c:324
Dump l2 fib (aka bridge domain) table.
Definition: l2.api:62
static_always_inline u8 bd_feature_flood(l2_bridge_domain_t *bd_config)
Definition: l2_input.h:135
#define hash_get(h, key)
Definition: hash.h:248
Set L2 flags request !!! TODO - need more info, feature bits in l2_input.h.
Definition: l2.api:129
L2 fib clear table request, clear all mac entries in the l2 fib.
Definition: l2.api:73
u64 mac
Definition: l2.api:51
L2 FIB add entry response.
Definition: l2.api:116
Set L2 bits response.
Definition: l2.api:142
L2 bridge domain add or delete response.
Definition: l2.api:179
#define REPLY_MACRO(t)
static clib_error_t * l2_api_hookup(vlib_main_t *vm)
Definition: l2_api.c:536
u8 bvi_mac
Definition: l2.api:55
static void send_bd_sw_if_details(l2input_main_t *l2im, unix_shared_memory_queue_t *q, l2_flood_member_t *member, u32 bd_id, u32 context)
Definition: l2_api.c:348
u32 l2pbb_configure(vlib_main_t *vlib_main, vnet_main_t *vnet_main, u32 sw_if_index, u32 vtr_op, u8 *b_dmac, u8 *b_smac, u16 b_vlanid, u32 i_sid, u16 vlan_outer_tag)
Definition: l2_vtr.c:54
L2 fib clear table response.
Definition: l2.api:83
void bd_set_mac_age(vlib_main_t *vm, u32 bd_index, u8 age)
Set the mac age for the bridge domain.
Definition: l2_bd.c:274
#define BAD_SW_IF_INDEX_LABEL
void * vl_msg_api_alloc(int nbytes)
void l2fib_clear_table(uint keep_static)
Definition: l2_fib.c:260
vlib_main_t * vm
Definition: buffer.c:276
static void vl_api_l2_xconnect_dump_t_handler(vl_api_l2_xconnect_dump_t *mp)
Definition: l2_api.c:76
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:340
#define foreach_vpe_api_msg
Definition: l2_api.c:47
static_always_inline u8 bd_feature_learn(l2_bridge_domain_t *bd_config)
Definition: l2_input.h:155
static void setup_message_id_table(api_main_t *am)
Definition: l2_api.c:528
void l2fib_add_entry(u64 mac, u32 bd_index, u32 sw_if_index, u32 static_mac, u32 filter_mac, u32 bvi_mac)
Add an entry to the l2fib.
Definition: l2_fib.c:315
u32 sw_if_index
Definition: l2.api:52
l2 fib table entry structure
Definition: l2.api:47
unsigned int u32
Definition: types.h:88
static_always_inline l2_bridge_domain_t * l2input_bd_config_from_index(l2input_main_t *l2im, u32 bd_index)
Definition: l2_input.h:84
Definition: l2_fib.h:33
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23
u64 uword
Definition: types.h:112
u32 resulting_feature_bitmap
Definition: l2.api:146
static void vl_api_l2_interface_vlan_tag_rewrite_t_handler(vl_api_l2_interface_vlan_tag_rewrite_t *mp)
Definition: l2_api.c:440
u8 static_mac
Definition: l2.api:53
l2input_main_t l2input_main
Definition: l2_input.c:88
u32 bd_find_or_add_bd_index(bd_main_t *bdm, u32 bd_id)
Get or create a bridge domain.
Definition: l2_bd.c:68
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
unsigned char u8
Definition: types.h:56
#define L2_ARP_TERM
Definition: l2_bd.h:115
static void vl_api_bridge_flags_t_handler(vl_api_bridge_flags_t *mp)
Definition: l2_api.c:407
vnet_sw_interface_t * sw_interfaces
Definition: interface.h:617
L2 interface vlan tag rewrite configure request.
Definition: l2.api:272
static u64 l2fib_make_key(u8 *mac_address, u16 bd_index)
Definition: l2_fib.h:98
l2_bridge_domain_t * bd_configs
Definition: l2_input.h:72
void l2fib_table_dump(u32 bd_index, l2fib_entry_key_t **l2fe_key, l2fib_entry_result_t **l2fe_res)
Definition: l2_fib.c:73
L2 interface pbb tag rewrite configure request.
Definition: l2.api:305
struct l2fib_entry_key_t::@146::@148 fields
u32 sw_if_index
Definition: l2.api:133
L2 interface pbb tag rewrite response.
Definition: l2.api:322
#define vec_foreach(var, vec)
Vector iterator.
Set bridge flags (such as L2_LEARN, L2_FWD, L2_FLOOD, L2_UU_FLOOD, or L2_ARP_TERM) request...
Definition: l2.api:242
u32 sw_if_index
Definition: l2_bd.h:46
u8 filter_mac
Definition: l2.api:54
u32 flags
Definition: vhost-user.h:78
bd_main_t bd_main
Definition: l2_bd.c:44
vpe_api_main_t vpe_api_main
Definition: api.c:161
#define L2_LEARN
Definition: l2_bd.h:111
static void vl_api_l2_interface_pbb_tag_rewrite_t_handler(vl_api_l2_interface_pbb_tag_rewrite_t *mp)
Definition: l2_api.c:482
static void send_l2fib_table_entry(vpe_api_main_t *am, unix_shared_memory_queue_t *q, l2fib_entry_key_t *l2fe_key, l2fib_entry_result_t *l2fe_res, u32 context)
Definition: l2_api.c:116
#define VALIDATE_SW_IF_INDEX(mp)
struct _unix_shared_memory_queue unix_shared_memory_queue_t
static void vl_api_bridge_domain_dump_t_handler(vl_api_bridge_domain_dump_t *mp)
Definition: l2_api.c:368
L2 bridge domain add or delete request.
Definition: l2.api:161