aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-11-07 04:21:12 -0800
committerNeale Ranns <nranns@cisco.com>2018-11-07 13:28:11 +0000
commitc29c0af40eda76e382a63269bca9ff57c6ecf5d5 (patch)
tree3be3f4a3ff2047bcfe553719a0d87ae048ec1f11 /src
parent7ac053b27fee8f9e437cf7b61357943356381061 (diff)
GBP: Endpoints with VLAN tags and birdges that don't learn
Change-Id: I20192f3a8f4f01f47e775746f6fde7c685f185ee Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/gbp/gbp.api7
-rw-r--r--src/plugins/gbp/gbp_api.c16
-rw-r--r--src/plugins/gbp/gbp_bridge_domain.c21
-rw-r--r--src/plugins/gbp/gbp_bridge_domain.h43
-rw-r--r--src/plugins/gbp/gbp_learn.c7
5 files changed, 77 insertions, 17 deletions
diff --git a/src/plugins/gbp/gbp.api b/src/plugins/gbp/gbp.api
index bf42243e0d0..1fb9073d190 100644
--- a/src/plugins/gbp/gbp.api
+++ b/src/plugins/gbp/gbp.api
@@ -19,9 +19,16 @@ option version = "2.0.0";
import "vnet/ip/ip_types.api";
import "vnet/ethernet/ethernet_types.api";
+enum gbp_bridge_domain_flags
+{
+ GBP_BD_API_FLAG_NONE = 0,
+ GBP_BD_API_FLAG_DO_NOT_LEARN = 1,
+};
+
typedef gbp_bridge_domain
{
u32 bd_id;
+ vl_api_gbp_bridge_domain_flags_t flags;
u32 bvi_sw_if_index;
u32 uu_fwd_sw_if_index;
};
diff --git a/src/plugins/gbp/gbp_api.c b/src/plugins/gbp/gbp_api.c
index faf036e9d81..47823d5cd9b 100644
--- a/src/plugins/gbp/gbp_api.c
+++ b/src/plugins/gbp/gbp_api.c
@@ -299,6 +299,20 @@ static void
REPLY_MACRO (VL_API_GBP_ENDPOINT_GROUP_DEL_REPLY + GBP_MSG_BASE);
}
+static gbp_bridge_domain_flags_t
+gbp_bridge_domain_flags_from_api (vl_api_gbp_bridge_domain_flags_t a)
+{
+ gbp_bridge_domain_flags_t g;
+
+ g = GBP_BD_FLAG_NONE;
+ a = clib_net_to_host_u32 (a);
+
+ if (a & GBP_BD_API_FLAG_DO_NOT_LEARN)
+ g |= GBP_BD_FLAG_DO_NOT_LEARN;
+
+ return (g);
+}
+
static void
vl_api_gbp_bridge_domain_add_t_handler (vl_api_gbp_bridge_domain_add_t * mp)
{
@@ -306,6 +320,8 @@ vl_api_gbp_bridge_domain_add_t_handler (vl_api_gbp_bridge_domain_add_t * mp)
int rv = 0;
rv = gbp_bridge_domain_add_and_lock (ntohl (mp->bd.bd_id),
+ gbp_bridge_domain_flags_from_api
+ (mp->bd.flags),
ntohl (mp->bd.bvi_sw_if_index),
ntohl (mp->bd.uu_fwd_sw_if_index));
diff --git a/src/plugins/gbp/gbp_bridge_domain.c b/src/plugins/gbp/gbp_bridge_domain.c
index b7812eb1645..1a1a7bd3383 100644
--- a/src/plugins/gbp/gbp_bridge_domain.c
+++ b/src/plugins/gbp/gbp_bridge_domain.c
@@ -31,12 +31,7 @@ gbp_bridge_domain_t *gbp_bridge_domain_pool;
/**
* DB of bridge_domains
*/
-typedef struct gbp_bridge_domain_db_t
-{
- uword *gbd_by_bd_id;
-} gbp_bridge_domain_db_t;
-
-static gbp_bridge_domain_db_t gbp_bridge_domain_db;
+gbp_bridge_domain_db_t gbp_bridge_domain_db;
/**
* logger
@@ -46,12 +41,6 @@ vlib_log_class_t gb_logger;
#define GBP_BD_DBG(...) \
vlib_log_debug (gb_logger, __VA_ARGS__);
-gbp_bridge_domain_t *
-gbp_bridge_domain_get (index_t i)
-{
- return (pool_elt_at_index (gbp_bridge_domain_pool, i));
-}
-
static void
gbp_bridge_domain_lock (index_t i)
{
@@ -95,16 +84,21 @@ gbp_bridge_domain_db_add (gbp_bridge_domain_t * gb)
index_t gbi = gb - gbp_bridge_domain_pool;
hash_set (gbp_bridge_domain_db.gbd_by_bd_id, gb->gb_bd_id, gbi);
+ vec_validate_init_empty (gbp_bridge_domain_db.gbd_by_bd_index,
+ gb->gb_bd_index, INDEX_INVALID);
+ gbp_bridge_domain_db.gbd_by_bd_index[gb->gb_bd_index] = gbi;
}
static void
gbp_bridge_domain_db_remove (gbp_bridge_domain_t * gb)
{
hash_unset (gbp_bridge_domain_db.gbd_by_bd_id, gb->gb_bd_id);
+ gbp_bridge_domain_db.gbd_by_bd_index[gb->gb_bd_index] = INDEX_INVALID;
}
int
gbp_bridge_domain_add_and_lock (u32 bd_id,
+ gbp_bridge_domain_flags_t flags,
u32 bvi_sw_if_index, u32 uu_fwd_sw_if_index)
{
gbp_bridge_domain_t *gb;
@@ -134,6 +128,7 @@ gbp_bridge_domain_add_and_lock (u32 bd_id,
gb->gb_uu_fwd_sw_if_index = uu_fwd_sw_if_index;
gb->gb_bvi_sw_if_index = bvi_sw_if_index;
gb->gb_locks = 1;
+ gb->gb_flags = flags;
/*
* Set the BVI and uu-flood interfaces into the BD
@@ -269,7 +264,7 @@ gbp_bridge_domain_cli (vlib_main_t * vm,
if (~0 == bvi_sw_if_index)
return clib_error_return (0, "interface must be specified");
- gbp_bridge_domain_add_and_lock (bd_id,
+ gbp_bridge_domain_add_and_lock (bd_id, GBP_BD_FLAG_NONE,
bvi_sw_if_index, uu_fwd_sw_if_index);
}
else
diff --git a/src/plugins/gbp/gbp_bridge_domain.h b/src/plugins/gbp/gbp_bridge_domain.h
index 992900b4aa1..4135c2d8232 100644
--- a/src/plugins/gbp/gbp_bridge_domain.h
+++ b/src/plugins/gbp/gbp_bridge_domain.h
@@ -21,11 +21,20 @@
#include <vnet/fib/fib_types.h>
/**
+ * Bridge Domain Flags
+ */
+typedef enum gbp_bridge_domain_flags_t_
+{
+ GBP_BD_FLAG_NONE = 0,
+ GBP_BD_FLAG_DO_NOT_LEARN = (1 << 0),
+} gbp_bridge_domain_flags_t;
+
+/**
* A bridge Domain Representation.
* This is a standard bridge-domain plus all the attributes it must
* have to supprt the GBP model.
*/
-typedef struct gpb_bridge_domain_t_
+typedef struct gbp_bridge_domain_t_
{
/**
* Bridge-domain ID
@@ -34,6 +43,11 @@ typedef struct gpb_bridge_domain_t_
u32 gb_bd_index;
/**
+ * Flags conttrolling behaviour
+ */
+ gbp_bridge_domain_flags_t gb_flags;
+
+ /**
* The BD's BVI interface (obligatory)
*/
u32 gb_bvi_sw_if_index;
@@ -57,18 +71,43 @@ typedef struct gpb_bridge_domain_t_
} gbp_bridge_domain_t;
extern int gbp_bridge_domain_add_and_lock (u32 bd_id,
+ gbp_bridge_domain_flags_t flags,
u32 bvi_sw_if_index,
u32 uu_fwd_sw_if_index);
extern void gbp_bridge_domain_unlock (index_t gbi);
extern index_t gbp_bridge_domain_find_and_lock (u32 bd_id);
extern int gbp_bridge_domain_delete (u32 bd_id);
-extern gbp_bridge_domain_t *gbp_bridge_domain_get (index_t i);
typedef int (*gbp_bridge_domain_cb_t) (gbp_bridge_domain_t * gb, void *ctx);
extern void gbp_bridge_domain_walk (gbp_bridge_domain_cb_t bgpe, void *ctx);
extern u8 *format_gbp_bridge_domain (u8 * s, va_list * args);
+/**
+ * DB of bridge_domains
+ */
+typedef struct gbp_bridge_domain_db_t
+{
+ uword *gbd_by_bd_id;
+ index_t *gbd_by_bd_index;
+} gbp_bridge_domain_db_t;
+
+extern gbp_bridge_domain_db_t gbp_bridge_domain_db;
+extern gbp_bridge_domain_t *gbp_bridge_domain_pool;
+
+always_inline gbp_bridge_domain_t *
+gbp_bridge_domain_get (index_t i)
+{
+ return (pool_elt_at_index (gbp_bridge_domain_pool, i));
+}
+
+always_inline gbp_bridge_domain_t *
+gbp_bridge_domain_get_by_bd_index (u32 bd_index)
+{
+ return (gbp_bridge_domain_get
+ (gbp_bridge_domain_db.gbd_by_bd_index[bd_index]));
+}
+
#endif
/*
diff --git a/src/plugins/gbp/gbp_learn.c b/src/plugins/gbp/gbp_learn.c
index 9239779dd99..883f3d1c862 100644
--- a/src/plugins/gbp/gbp_learn.c
+++ b/src/plugins/gbp/gbp_learn.c
@@ -236,6 +236,7 @@ gbp_learn_l2 (vlib_main_t * vm,
ip4_address_t outer_src, outer_dst;
u32 bi0, sw_if_index0, t0, epg0;
const ethernet_header_t *eh0;
+ gbp_bridge_domain_t *gb0;
gbp_learn_next_t next0;
gbp_endpoint_t *ge0;
vlib_buffer_t *b0;
@@ -259,10 +260,12 @@ gbp_learn_l2 (vlib_main_t * vm,
ge0 = gbp_endpoint_find_mac (eh0->src_address,
vnet_buffer (b0)->l2.bd_index);
+ gb0 =
+ gbp_bridge_domain_get_by_bd_index (vnet_buffer (b0)->l2.bd_index);
- if (vnet_buffer2 (b0)->gbp.flags & VXLAN_GBP_GPFLAGS_D)
+ if ((vnet_buffer2 (b0)->gbp.flags & VXLAN_GBP_GPFLAGS_D) ||
+ (gb0->gb_flags & GBP_BD_FLAG_DO_NOT_LEARN))
{
- ge0 = NULL;
t0 = 1;
goto trace;
}