aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2018-08-20 18:32:39 +0200
committerNeale Ranns <nranns@cisco.com>2018-09-10 12:38:30 +0000
commit61b94c6bc417dbcb11323962b40493e6f7ec2f7e (patch)
treeaa10b1e25de448b4ea13eaf00c4f3e1e98833dc6 /src/plugins
parentb414d0d23aff66f793c018a75d83af4d29fb1bd4 (diff)
vxlan-gbp: Add support for vxlan gbp
This patch implements vxlan with extension of group based policy support. Change-Id: I70405bf7332c02867286da8958d9652837edd3c2 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gbp/gbp.api12
-rw-r--r--src/plugins/gbp/gbp_api.c30
-rw-r--r--src/plugins/gbp/gbp_classify.c2
-rw-r--r--src/plugins/gbp/gbp_contract.c12
-rw-r--r--src/plugins/gbp/gbp_contract.h4
-rw-r--r--src/plugins/gbp/gbp_policy.c2
-rw-r--r--src/plugins/gbp/gbp_policy_dpo.c2
-rw-r--r--src/plugins/gbp/gbp_subnet.c2
-rw-r--r--src/plugins/gbp/gbp_types.h4
9 files changed, 35 insertions, 35 deletions
diff --git a/src/plugins/gbp/gbp.api b/src/plugins/gbp/gbp.api
index b2b32e90d4b..3e27abbb88a 100644
--- a/src/plugins/gbp/gbp.api
+++ b/src/plugins/gbp/gbp.api
@@ -24,7 +24,7 @@ option version = "1.0.0";
typeonly define gbp_endpoint
{
u32 sw_if_index;
- u32 epg_id;
+ u16 epg_id;
u8 is_ip6;
u8 address[16];
u8 mac[6];
@@ -52,7 +52,7 @@ define gbp_endpoint_details
typeonly define gbp_endpoint_group
{
- u32 epg_id;
+ u16 epg_id;
u32 bd_id;
u32 ip4_table_id;
u32 ip6_table_id;
@@ -81,8 +81,8 @@ define gbp_endpoint_group_details
typeonly define gbp_recirc
{
- u32 epg_id;
u32 sw_if_index;
+ u16 epg_id;
u8 is_ext;
};
@@ -110,7 +110,7 @@ typeonly define gbp_subnet
{
u32 table_id;
u32 sw_if_index;
- u32 epg_id;
+ u16 epg_id;
u8 is_ip6;
u8 is_internal;
u8 address_length;
@@ -139,8 +139,8 @@ define gbp_subnet_details
typeonly define gbp_contract
{
- u32 src_epg;
- u32 dst_epg;
+ u16 src_epg;
+ u16 dst_epg;
u32 acl_index;
};
diff --git a/src/plugins/gbp/gbp_api.c b/src/plugins/gbp/gbp_api.c
index 1f24eedc3d0..f487695bdf3 100644
--- a/src/plugins/gbp/gbp_api.c
+++ b/src/plugins/gbp/gbp_api.c
@@ -93,7 +93,7 @@ vl_api_gbp_endpoint_add_del_t_handler (vl_api_gbp_endpoint_add_del_t * mp)
if (mp->is_add)
{
rv =
- gbp_endpoint_update (sw_if_index, &ip, ntohl (mp->endpoint.epg_id));
+ gbp_endpoint_update (sw_if_index, &ip, ntohs (mp->endpoint.epg_id));
}
else
{
@@ -137,7 +137,7 @@ gbp_endpoint_send_details (gbp_endpoint_t * gbpe, void *args)
&gbpe->ge_key->gek_ip.ip4,
sizeof (gbpe->ge_key->gek_ip.ip4));
- mp->endpoint.epg_id = ntohl (gbpe->ge_epg_id);
+ mp->endpoint.epg_id = ntohs (gbpe->ge_epg_id);
vl_api_send_msg (ctx->reg, (u8 *) mp);
@@ -175,7 +175,7 @@ static void
if (mp->is_add)
{
- rv = gbp_endpoint_group_add (ntohl (mp->epg.epg_id),
+ rv = gbp_endpoint_group_add (ntohs (mp->epg.epg_id),
ntohl (mp->epg.bd_id),
ntohl (mp->epg.ip4_table_id),
ntohl (mp->epg.ip6_table_id),
@@ -183,7 +183,7 @@ static void
}
else
{
- gbp_endpoint_group_delete (ntohl (mp->epg.epg_id));
+ gbp_endpoint_group_delete (ntohs (mp->epg.epg_id));
}
BAD_SW_IF_INDEX_LABEL;
@@ -211,7 +211,7 @@ vl_api_gbp_subnet_add_del_t_handler (vl_api_gbp_subnet_add_del_t * mp)
rv = gbp_subnet_add_del (ntohl (mp->subnet.table_id),
&pfx,
ntohl (mp->subnet.sw_if_index),
- ntohl (mp->subnet.epg_id),
+ ntohs (mp->subnet.epg_id),
mp->is_add, mp->subnet.is_internal);
REPLY_MACRO (VL_API_GBP_SUBNET_ADD_DEL_REPLY + GBP_MSG_BASE);
@@ -237,7 +237,7 @@ gbp_subnet_send_details (u32 table_id,
mp->subnet.is_internal = is_internal;
mp->subnet.sw_if_index = ntohl (sw_if_index);
- mp->subnet.epg_id = ntohl (epg);
+ mp->subnet.epg_id = ntohs (epg);
mp->subnet.is_ip6 = (pfx->fp_proto == FIB_PROTOCOL_IP6);
mp->subnet.address_length = pfx->fp_len;
mp->subnet.table_id = ntohl (table_id);
@@ -287,7 +287,7 @@ gbp_endpoint_group_send_details (gbp_endpoint_group_t * gepg, void *args)
mp->context = ctx->context;
mp->epg.uplink_sw_if_index = ntohl (gepg->gepg_uplink_sw_if_index);
- mp->epg.epg_id = ntohl (gepg->gepg_id);
+ mp->epg.epg_id = ntohs (gepg->gepg_id);
mp->epg.bd_id = ntohl (gepg->gepg_bd);
mp->epg.ip4_table_id = ntohl (gepg->gepg_rd[FIB_PROTOCOL_IP4]);
mp->epg.ip6_table_id = ntohl (gepg->gepg_rd[FIB_PROTOCOL_IP6]);
@@ -328,7 +328,7 @@ vl_api_gbp_recirc_add_del_t_handler (vl_api_gbp_recirc_add_del_t * mp)
if (mp->is_add)
gbp_recirc_add (sw_if_index,
- ntohl (mp->recirc.epg_id), mp->recirc.is_ext);
+ ntohs (mp->recirc.epg_id), mp->recirc.is_ext);
else
gbp_recirc_delete (sw_if_index);
@@ -352,7 +352,7 @@ gbp_recirc_send_details (gbp_recirc_t * gr, void *args)
mp->_vl_msg_id = ntohs (VL_API_GBP_RECIRC_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
- mp->recirc.epg_id = ntohl (gr->gr_epg);
+ mp->recirc.epg_id = ntohs (gr->gr_epg);
mp->recirc.sw_if_index = ntohl (gr->gr_sw_if_index);
mp->recirc.is_ext = ntohl (gr->gr_is_ext);
@@ -385,12 +385,12 @@ vl_api_gbp_contract_add_del_t_handler (vl_api_gbp_contract_add_del_t * mp)
int rv = 0;
if (mp->is_add)
- gbp_contract_update (ntohl (mp->contract.src_epg),
- ntohl (mp->contract.dst_epg),
+ gbp_contract_update (ntohs (mp->contract.src_epg),
+ ntohs (mp->contract.dst_epg),
ntohl (mp->contract.acl_index));
else
- gbp_contract_delete (ntohl (mp->contract.src_epg),
- ntohl (mp->contract.dst_epg));
+ gbp_contract_delete (ntohs (mp->contract.src_epg),
+ ntohs (mp->contract.dst_epg));
REPLY_MACRO (VL_API_GBP_CONTRACT_ADD_DEL_REPLY + GBP_MSG_BASE);
}
@@ -410,8 +410,8 @@ gbp_contract_send_details (gbp_contract_t * gbpc, void *args)
mp->_vl_msg_id = ntohs (VL_API_GBP_CONTRACT_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
- mp->contract.src_epg = ntohl (gbpc->gc_key.gck_src);
- mp->contract.dst_epg = ntohl (gbpc->gc_key.gck_dst);
+ mp->contract.src_epg = ntohs (gbpc->gc_key.gck_src);
+ mp->contract.dst_epg = ntohs (gbpc->gc_key.gck_dst);
mp->contract.acl_index = ntohl (gbpc->gc_value.gc_acl_index);
vl_api_send_msg (ctx->reg, (u8 *) mp);
diff --git a/src/plugins/gbp/gbp_classify.c b/src/plugins/gbp/gbp_classify.c
index 6b91d8cf099..fdb1e9f6776 100644
--- a/src/plugins/gbp/gbp_classify.c
+++ b/src/plugins/gbp/gbp_classify.c
@@ -90,7 +90,7 @@ gbp_classify_inline (vlib_main_t * vm,
if (GBP_SRC_CLASSIFY_NULL == type)
{
- src_epg = ~0;
+ src_epg = EPG_INVALID;
next0 =
vnet_l2_feature_next (b0, gscm->l2_input_feat_next[type],
L2INPUT_FEAT_GBP_NULL_CLASSIFY);
diff --git a/src/plugins/gbp/gbp_contract.c b/src/plugins/gbp/gbp_contract.c
index a536f89e5fe..32dd94441db 100644
--- a/src/plugins/gbp/gbp_contract.c
+++ b/src/plugins/gbp/gbp_contract.c
@@ -45,7 +45,7 @@ gbp_contract_update (epg_id_t src_epg, epg_id_t dst_epg, u32 acl_index)
gm->acl_plugin.register_user_module ("GBP ACL", "src-epg", "dst-epg");
}
- p = hash_get (gbp_contract_db.gc_hash, key.as_u64);
+ p = hash_get (gbp_contract_db.gc_hash, key.as_u32);
if (p != NULL)
{
value.as_u64 = p[0];
@@ -56,7 +56,7 @@ gbp_contract_update (epg_id_t src_epg, epg_id_t dst_epg, u32 acl_index)
gm->acl_plugin.get_lookup_context_index (gm->gbp_acl_user_id, src_epg,
dst_epg);
value.gc_acl_index = acl_index;
- hash_set (gbp_contract_db.gc_hash, key.as_u64, value.as_u64);
+ hash_set (gbp_contract_db.gc_hash, key.as_u32, value.as_u64);
}
if (value.gc_lc_index == ~0)
@@ -77,13 +77,13 @@ gbp_contract_delete (epg_id_t src_epg, epg_id_t dst_epg)
.gck_dst = dst_epg,
};
- p = hash_get (gbp_contract_db.gc_hash, key.as_u64);
+ p = hash_get (gbp_contract_db.gc_hash, key.as_u32);
if (p != NULL)
{
value.as_u64 = p[0];
gm->acl_plugin.put_lookup_context_index (value.gc_lc_index);
}
- hash_unset (gbp_contract_db.gc_hash, key.as_u64);
+ hash_unset (gbp_contract_db.gc_hash, key.as_u32);
}
void
@@ -93,7 +93,7 @@ gbp_contract_walk (gbp_contract_cb_t cb, void *ctx)
gbp_contract_value_t value;
/* *INDENT-OFF* */
- hash_foreach(key.as_u64, value.as_u64, gbp_contract_db.gc_hash,
+ hash_foreach(key.as_u32, value.as_u64, gbp_contract_db.gc_hash,
({
gbp_contract_t gbpc = {
.gc_key = key,
@@ -174,7 +174,7 @@ gbp_contract_show (vlib_main_t * vm,
vlib_cli_output (vm, "Contracts:");
/* *INDENT-OFF* */
- hash_foreach (key.as_u64, value.as_u64, gbp_contract_db.gc_hash,
+ hash_foreach (key.as_u32, value.as_u64, gbp_contract_db.gc_hash,
{
vlib_cli_output (vm, " {%d,%d} -> %d", key.gck_src,
key.gck_dst, value.gc_acl_index);
diff --git a/src/plugins/gbp/gbp_contract.h b/src/plugins/gbp/gbp_contract.h
index 75f2edca116..121192c9c96 100644
--- a/src/plugins/gbp/gbp_contract.h
+++ b/src/plugins/gbp/gbp_contract.h
@@ -33,7 +33,7 @@ typedef struct gbp_contract_key_t_
epg_id_t gck_src;
epg_id_t gck_dst;
};
- u64 as_u64;
+ u32 as_u32;
};
} gbp_contract_key_t;
@@ -102,7 +102,7 @@ gbp_acl_lookup (gbp_contract_key_t * key)
{
uword *p;
- p = hash_get (gbp_contract_db.gc_hash, key->as_u64);
+ p = hash_get (gbp_contract_db.gc_hash, key->as_u32);
if (NULL != p)
return (p[0]);
diff --git a/src/plugins/gbp/gbp_policy.c b/src/plugins/gbp/gbp_policy.c
index 38254644631..c0a8866e1ee 100644
--- a/src/plugins/gbp/gbp_policy.c
+++ b/src/plugins/gbp/gbp_policy.c
@@ -110,7 +110,7 @@ gbp_policy (vlib_main_t * vm,
key0.gck_dst = gbp_port_to_epg (sw_if_index0);
key0.gck_src = vnet_buffer2 (b0)->gbp.src_epg;
- if (~0 != key0.gck_src)
+ if (EPG_INVALID != key0.gck_src)
{
if (PREDICT_FALSE (key0.gck_src == key0.gck_dst))
{
diff --git a/src/plugins/gbp/gbp_policy_dpo.c b/src/plugins/gbp/gbp_policy_dpo.c
index 4b8cd5bf6ad..3a06604121b 100644
--- a/src/plugins/gbp/gbp_policy_dpo.c
+++ b/src/plugins/gbp/gbp_policy_dpo.c
@@ -248,7 +248,7 @@ gbp_policy_dpo_inline (vlib_main_t * vm,
key0.gck_src = vnet_buffer2 (b0)->gbp.src_epg;
key0.gck_dst = gpd0->gpd_epg;
- if (~0 != key0.gck_src)
+ if (EPG_INVALID != key0.gck_src)
{
if (PREDICT_FALSE (key0.gck_src == key0.gck_dst))
{
diff --git a/src/plugins/gbp/gbp_subnet.c b/src/plugins/gbp/gbp_subnet.c
index 3819a51595b..b3925110b7b 100644
--- a/src/plugins/gbp/gbp_subnet.c
+++ b/src/plugins/gbp/gbp_subnet.c
@@ -129,7 +129,7 @@ gbp_subnet_fib_table_walk (fib_node_index_t fei, void *arg)
/* *INDENT-OFF* */
ctx->cb (table_id, pfx,
~0, // sw_if_index
- ~0, // epg
+ EPG_INVALID, // epg
1, // is_internal
ctx->ctx);
/* *INDENT-ON* */
diff --git a/src/plugins/gbp/gbp_types.h b/src/plugins/gbp/gbp_types.h
index fa337451028..afb17e3a5d5 100644
--- a/src/plugins/gbp/gbp_types.h
+++ b/src/plugins/gbp/gbp_types.h
@@ -18,8 +18,8 @@
#include <vnet/vnet.h>
-typedef u32 epg_id_t;
-#define EPG_INVALID (~0)
+typedef u16 epg_id_t;
+#define EPG_INVALID ((u16)~0)
#endif