summaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp/gbp_endpoint_group.h
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-01-21 23:34:18 -0800
committerDamjan Marion <dmarion@me.com>2019-01-22 14:37:51 +0000
commit879d11c250a4710759ddefe22afd7fc05bda2946 (patch)
tree86f1984cf7324e05d8b100f9201ea69df83edc56 /src/plugins/gbp/gbp_endpoint_group.h
parent03ae24b97498bcc9265d4650efe3ddaa5e1d3255 (diff)
GBP: Sclass to src-epg conversions
Change-Id: Ica88268fd6a6ee01da7e9219bb4e81f22ed2fd4b Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/plugins/gbp/gbp_endpoint_group.h')
-rw-r--r--src/plugins/gbp/gbp_endpoint_group.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/gbp/gbp_endpoint_group.h b/src/plugins/gbp/gbp_endpoint_group.h
index 763a80e4d87..123954f63ea 100644
--- a/src/plugins/gbp/gbp_endpoint_group.h
+++ b/src/plugins/gbp/gbp_endpoint_group.h
@@ -31,6 +31,11 @@ typedef struct gpb_endpoint_group_t_
epg_id_t gg_id;
/**
+ * Sclass. Could be unset => ~0
+ */
+ u16 gg_sclass;
+
+ /**
* Bridge-domain ID the EPG is in
*/
index_t gg_gbd;
@@ -71,6 +76,7 @@ typedef struct gbp_endpoint_group_db_t_
} gbp_endpoint_group_db_t;
extern int gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
+ u16 sclass,
u32 bd_id,
u32 rd_id,
u32 uplink_sw_if_index);
@@ -96,6 +102,19 @@ extern u8 *format_gbp_endpoint_group (u8 * s, va_list * args);
*/
extern gbp_endpoint_group_db_t gbp_endpoint_group_db;
extern gbp_endpoint_group_t *gbp_endpoint_group_pool;
+extern uword *gbp_epg_sclass_db;
+
+always_inline gbp_endpoint_group_t *
+gbp_epg_get (epg_id_t epg)
+{
+ uword *p;
+
+ p = hash_get (gbp_endpoint_group_db.gg_hash, epg);
+
+ if (NULL != p)
+ return (pool_elt_at_index (gbp_endpoint_group_pool, p[0]));
+ return (NULL);
+}
always_inline u32
gbp_epg_itf_lookup (epg_id_t epg)
@@ -114,6 +133,20 @@ gbp_epg_itf_lookup (epg_id_t epg)
return (~0);
}
+always_inline epg_id_t
+gbp_epg_sclass_2_id (u16 sclass)
+{
+ uword *p;
+
+ p = hash_get (gbp_epg_sclass_db, sclass);
+
+ if (NULL != p)
+ {
+ return (p[0]);
+ }
+ return (EPG_INVALID);
+}
+
always_inline const dpo_id_t *
gbp_epg_dpo_lookup (epg_id_t epg, fib_protocol_t fproto)
{