Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
ip: Replace Sematics for Interface IP addresses
[vpp.git]
/
src
/
plugins
/
gbp
/
gbp_recirc.c
diff --git
a/src/plugins/gbp/gbp_recirc.c
b/src/plugins/gbp/gbp_recirc.c
index
59588ea
..
2b45d48
100644
(file)
--- a/
src/plugins/gbp/gbp_recirc.c
+++ b/
src/plugins/gbp/gbp_recirc.c
@@
-21,6
+21,8
@@
#include <vnet/dpo/dvr_dpo.h>
#include <vnet/fib/fib_table.h>
#include <vnet/dpo/dvr_dpo.h>
#include <vnet/fib/fib_table.h>
+#include <vlib/unix/plugin.h>
+
/**
* Pool of GBP recircs
*/
/**
* Pool of GBP recircs
*/
@@
-36,6
+38,12
@@
index_t *gbp_recirc_db;
*/
vlib_log_class_t gr_logger;
*/
vlib_log_class_t gr_logger;
+/**
+ * L2 Emulation enable/disable symbols
+ */
+static void (*l2e_enable) (u32 sw_if_index);
+static void (*l2e_disable) (u32 sw_if_index);
+
#define GBP_RECIRC_DBG(...) \
vlib_log_debug (gr_logger, __VA_ARGS__);
#define GBP_RECIRC_DBG(...) \
vlib_log_debug (gr_logger, __VA_ARGS__);
@@
-45,13
+53,13
@@
format_gbp_recirc (u8 * s, va_list * args)
gbp_recirc_t *gr = va_arg (*args, gbp_recirc_t *);
vnet_main_t *vnm = vnet_get_main ();
gbp_recirc_t *gr = va_arg (*args, gbp_recirc_t *);
vnet_main_t *vnm = vnet_get_main ();
- return format (s, " %U,
epg
:%d, ext:%d",
+ return format (s, " %U,
sclass
:%d, ext:%d",
format_vnet_sw_if_index_name, vnm,
format_vnet_sw_if_index_name, vnm,
- gr->gr_sw_if_index, gr->gr_
epg
, gr->gr_is_ext);
+ gr->gr_sw_if_index, gr->gr_
sclass
, gr->gr_is_ext);
}
int
}
int
-gbp_recirc_add (u32 sw_if_index,
epg_id_t epg_id
, u8 is_ext)
+gbp_recirc_add (u32 sw_if_index,
sclass_t sclass
, u8 is_ext)
{
gbp_recirc_t *gr;
index_t gri;
{
gbp_recirc_t *gr;
index_t gri;
@@
-66,17
+74,16
@@
gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
fib_protocol_t fproto;
index_t ggi;
fib_protocol_t fproto;
index_t ggi;
- ggi = gbp_endpoint_group_find (
epg_id
);
+ ggi = gbp_endpoint_group_find (
sclass
);
if (INDEX_INVALID == ggi)
return (VNET_API_ERROR_NO_SUCH_ENTRY);
gbp_endpoint_group_lock (ggi);
if (INDEX_INVALID == ggi)
return (VNET_API_ERROR_NO_SUCH_ENTRY);
gbp_endpoint_group_lock (ggi);
- pool_get (gbp_recirc_pool, gr);
- clib_memset (gr, 0, sizeof (*gr));
+ pool_get_zero (gbp_recirc_pool, gr);
gri = gr - gbp_recirc_pool;
gri = gr - gbp_recirc_pool;
- gr->gr_
epg = epg_id
;
+ gr->gr_
sclass = sclass
;
gr->gr_is_ext = is_ext;
gr->gr_sw_if_index = sw_if_index;
gr->gr_is_ext = is_ext;
gr->gr_sw_if_index = sw_if_index;
@@
-94,14
+101,19
@@
gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
gg = gbp_endpoint_group_get (gr->gr_epgi);
FOR_EACH_FIB_IP_PROTOCOL (fproto)
{
gg = gbp_endpoint_group_get (gr->gr_epgi);
FOR_EACH_FIB_IP_PROTOCOL (fproto)
{
- gr->gr_fib_index[f
proto
] =
+ gr->gr_fib_index[f
ib_proto_to_dpo (fproto)
] =
gbp_endpoint_group_get_fib_index (gg, fproto);
}
/*
* bind to the bridge-domain of the EPG
*/
gbp_endpoint_group_get_fib_index (gg, fproto);
}
/*
* bind to the bridge-domain of the EPG
*/
- gr->gr_itf = gbp_itf_add_and_lock (gr->gr_sw_if_index, gg->gg_bd_index);
+ gr->gr_itf = gbp_itf_l2_add_and_lock (gr->gr_sw_if_index, gg->gg_gbd);
+
+ /*
+ * set the interface into L2 emulation mode
+ */
+ l2e_enable (gr->gr_sw_if_index);
/*
* Packets on the recirculation interface are subject to src-EPG
/*
* Packets on the recirculation interface are subject to src-EPG
@@
-123,7
+135,7
@@
gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_CP,
gr->gr_sw_if_index,
NULL, &mac, INDEX_INVALID,
gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_CP,
gr->gr_sw_if_index,
NULL, &mac, INDEX_INVALID,
- INDEX_INVALID, gr->gr_
epg
,
+ INDEX_INVALID, gr->gr_
sclass
,
GBP_ENDPOINT_FLAG_NONE,
NULL, NULL, &gr->gr_ep);
vnet_feature_enable_disable ("ip4-unicast",
GBP_ENDPOINT_FLAG_NONE,
NULL, NULL, &gr->gr_ep);
vnet_feature_enable_disable ("ip4-unicast",
@@
-159,12
+171,14
@@
gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
return (0);
}
return (0);
}
-void
+int
gbp_recirc_delete (u32 sw_if_index)
{
gbp_recirc_t *gr;
index_t gri;
gbp_recirc_delete (u32 sw_if_index)
{
gbp_recirc_t *gr;
index_t gri;
+ if (vec_len (gbp_recirc_db) <= sw_if_index)
+ return VNET_API_ERROR_INVALID_SW_IF_INDEX;
gri = gbp_recirc_db[sw_if_index];
if (INDEX_INVALID != gri)
gri = gbp_recirc_db[sw_if_index];
if (INDEX_INVALID != gri)
@@
-195,13
+209,16
@@
gbp_recirc_delete (u32 sw_if_index)
ip4_sw_interface_enable_disable (gr->gr_sw_if_index, 0);
ip6_sw_interface_enable_disable (gr->gr_sw_if_index, 0);
ip4_sw_interface_enable_disable (gr->gr_sw_if_index, 0);
ip6_sw_interface_enable_disable (gr->gr_sw_if_index, 0);
+ l2e_disable (gr->gr_sw_if_index);
- gbp_itf_unlock (gr->gr_itf);
+ gbp_itf_unlock (
&
gr->gr_itf);
gbp_endpoint_group_unlock (gr->gr_epgi);
gbp_recirc_db[sw_if_index] = INDEX_INVALID;
pool_put (gbp_recirc_pool, gr);
gbp_endpoint_group_unlock (gr->gr_epgi);
gbp_recirc_db[sw_if_index] = INDEX_INVALID;
pool_put (gbp_recirc_pool, gr);
+ return (0);
}
}
+ return VNET_API_ERROR_NO_SUCH_ENTRY;
}
void
}
void
@@
-218,12
+235,12
@@
gbp_recirc_walk (gbp_recirc_cb_t cb, void *ctx)
/* *INDENT-ON* */
}
/* *INDENT-ON* */
}
-static
in
t
+static
walk_rc_
t
gbp_recirc_show_one (gbp_recirc_t * gr, void *ctx)
{
vlib_cli_output (ctx, " %U", format_gbp_recirc, gr);
gbp_recirc_show_one (gbp_recirc_t * gr, void *ctx)
{
vlib_cli_output (ctx, " %U", format_gbp_recirc, gr);
- return (
1
);
+ return (
WALK_CONTINUE
);
}
static clib_error_t *
}
static clib_error_t *
@@
-256,6
+273,11
@@
gbp_recirc_init (vlib_main_t * vm)
{
gr_logger = vlib_log_register_class ("gbp", "recirc");
{
gr_logger = vlib_log_register_class ("gbp", "recirc");
+ l2e_enable =
+ vlib_get_plugin_symbol ("l2e_plugin.so", "l2_emulation_enable");
+ l2e_disable =
+ vlib_get_plugin_symbol ("l2e_plugin.so", "l2_emulation_disable");
+
return (NULL);
}
return (NULL);
}