aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/gbp')
-rw-r--r--src/plugins/gbp/CMakeLists.txt3
-rw-r--r--src/plugins/gbp/gbp.api14
-rw-r--r--src/plugins/gbp/gbp_api.c36
-rw-r--r--src/plugins/gbp/gbp_bridge_domain.c5
-rw-r--r--src/plugins/gbp/gbp_classify_node.c31
-rw-r--r--src/plugins/gbp/gbp_contract.c32
-rw-r--r--src/plugins/gbp/gbp_contract.h10
-rw-r--r--src/plugins/gbp/gbp_endpoint.c21
-rw-r--r--src/plugins/gbp/gbp_endpoint.h6
-rw-r--r--src/plugins/gbp/gbp_endpoint_group.c35
-rw-r--r--src/plugins/gbp/gbp_endpoint_group.h44
-rw-r--r--src/plugins/gbp/gbp_fwd.c2
-rw-r--r--src/plugins/gbp/gbp_fwd_dpo.c12
-rw-r--r--src/plugins/gbp/gbp_fwd_node.c13
-rw-r--r--src/plugins/gbp/gbp_learn_node.c70
-rw-r--r--src/plugins/gbp/gbp_policy_dpo.c16
-rw-r--r--src/plugins/gbp/gbp_policy_dpo.h6
-rw-r--r--src/plugins/gbp/gbp_policy_node.c14
-rw-r--r--src/plugins/gbp/gbp_recirc.c12
-rw-r--r--src/plugins/gbp/gbp_recirc.h4
-rw-r--r--src/plugins/gbp/gbp_route_domain.c5
-rw-r--r--src/plugins/gbp/gbp_sclass.c94
-rw-r--r--src/plugins/gbp/gbp_sclass.h48
-rw-r--r--src/plugins/gbp/gbp_sclass_node.c296
-rw-r--r--src/plugins/gbp/gbp_subnet.c36
-rw-r--r--src/plugins/gbp/gbp_subnet.h4
-rw-r--r--src/plugins/gbp/gbp_types.h6
-rw-r--r--src/plugins/gbp/gbp_vxlan.c12
-rw-r--r--src/plugins/gbp/gbp_vxlan_node.c1
29 files changed, 204 insertions, 684 deletions
diff --git a/src/plugins/gbp/CMakeLists.txt b/src/plugins/gbp/CMakeLists.txt
index 02c4c17beb2..6789a9c1ade 100644
--- a/src/plugins/gbp/CMakeLists.txt
+++ b/src/plugins/gbp/CMakeLists.txt
@@ -33,8 +33,6 @@ add_vpp_plugin(gbp
gbp_recirc.c
gbp_route_domain.c
gbp_scanner.c
- gbp_sclass.c
- gbp_sclass_node.c
gbp_subnet.c
gbp_vxlan.c
gbp_vxlan_node.c
@@ -47,7 +45,6 @@ add_vpp_plugin(gbp
gbp_policy_dpo.c
gbp_policy_node.c
gbp_vxlan_node.c
- gbp_sclass_node.c
API_FILES
gbp.api
diff --git a/src/plugins/gbp/gbp.api b/src/plugins/gbp/gbp.api
index 8343e228f19..342c98bb6b3 100644
--- a/src/plugins/gbp/gbp.api
+++ b/src/plugins/gbp/gbp.api
@@ -114,7 +114,7 @@ typedef gbp_endpoint_tun
typedef gbp_endpoint
{
u32 sw_if_index;
- u16 epg_id;
+ u16 sclass;
vl_api_gbp_endpoint_flags_t flags;
vl_api_mac_address_t mac;
vl_api_gbp_endpoint_tun_t tun;
@@ -164,7 +164,7 @@ typedef gbp_endpoint_retention
typeonly define gbp_endpoint_group
{
- u16 epg_id;
+ u32 vnid;
u16 sclass;
u32 bd_id;
u32 rd_id;
@@ -182,7 +182,7 @@ autoreply define gbp_endpoint_group_del
{
u32 client_index;
u32 context;
- u16 epg_id;
+ u16 sclass;
};
define gbp_endpoint_group_dump
@@ -200,7 +200,7 @@ define gbp_endpoint_group_details
typeonly define gbp_recirc
{
u32 sw_if_index;
- u16 epg_id;
+ u16 sclass;
u8 is_ext;
};
@@ -236,7 +236,7 @@ typeonly define gbp_subnet
{
u32 rd_id;
u32 sw_if_index;
- u16 epg_id;
+ u16 sclass;
vl_api_gbp_subnet_type_t type;
vl_api_prefix_t prefix;
};
@@ -298,8 +298,8 @@ typedef gbp_rule
typedef gbp_contract
{
- u16 src_epg;
- u16 dst_epg;
+ u16 sclass;
+ u16 dclass;
u32 acl_index;
u8 n_rules;
vl_api_gbp_rule_t rules[n_rules];
diff --git a/src/plugins/gbp/gbp_api.c b/src/plugins/gbp/gbp_api.c
index ffdae2869bf..3f35555efd1 100644
--- a/src/plugins/gbp/gbp_api.c
+++ b/src/plugins/gbp/gbp_api.c
@@ -165,7 +165,7 @@ vl_api_gbp_endpoint_add_t_handler (vl_api_gbp_endpoint_add_t * mp)
rv = gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_CP,
sw_if_index, ips, &mac,
INDEX_INVALID, INDEX_INVALID,
- ntohs (mp->endpoint.epg_id),
+ ntohs (mp->endpoint.sclass),
gef, &tun_src, &tun_dst, &handle);
}
else
@@ -173,7 +173,7 @@ vl_api_gbp_endpoint_add_t_handler (vl_api_gbp_endpoint_add_t * mp)
rv = gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_CP,
sw_if_index, ips, &mac,
INDEX_INVALID, INDEX_INVALID,
- ntohs (mp->endpoint.epg_id),
+ ntohs (mp->endpoint.sclass),
gef, NULL, NULL, &handle);
}
vec_free (ips);
@@ -241,7 +241,7 @@ gbp_endpoint_send_details (index_t gei, void *args)
{
mp->endpoint.sw_if_index = ntohl (gef->gef_itf);
}
- mp->endpoint.epg_id = ntohs (ge->ge_fwd.gef_epg_id);
+ mp->endpoint.sclass = ntohs (ge->ge_fwd.gef_sclass);
mp->endpoint.n_ips = n_ips;
mp->endpoint.flags = gbp_endpoint_flags_encode (gef->gef_flags);
mp->handle = htonl (gei);
@@ -293,7 +293,7 @@ static void
gbp_retention_decode (&mp->epg.retention, &retention);
- rv = gbp_endpoint_group_add_and_lock (ntohs (mp->epg.epg_id),
+ rv = gbp_endpoint_group_add_and_lock (ntohl (mp->epg.vnid),
ntohs (mp->epg.sclass),
ntohl (mp->epg.bd_id),
ntohl (mp->epg.rd_id),
@@ -310,7 +310,7 @@ static void
vl_api_gbp_endpoint_group_del_reply_t *rmp;
int rv = 0;
- rv = gbp_endpoint_group_delete (ntohs (mp->epg_id));
+ rv = gbp_endpoint_group_delete (ntohs (mp->sclass));
REPLY_MACRO (VL_API_GBP_ENDPOINT_GROUP_DEL_REPLY + GBP_MSG_BASE);
}
@@ -425,7 +425,7 @@ vl_api_gbp_subnet_add_del_t_handler (vl_api_gbp_subnet_add_del_t * mp)
rv = gbp_subnet_add (ntohl (mp->subnet.rd_id),
&pfx, type,
ntohl (mp->subnet.sw_if_index),
- ntohs (mp->subnet.epg_id));
+ ntohs (mp->subnet.sclass));
else
rv = gbp_subnet_del (ntohl (mp->subnet.rd_id), &pfx);
@@ -463,7 +463,7 @@ static walk_rc_t
gbp_subnet_send_details (u32 rd_id,
const fib_prefix_t * pfx,
gbp_subnet_type_t type,
- u32 sw_if_index, epg_id_t epg, void *args)
+ u32 sw_if_index, sclass_t sclass, void *args)
{
vl_api_gbp_subnet_details_t *mp;
gbp_walk_ctx_t *ctx;
@@ -479,7 +479,7 @@ gbp_subnet_send_details (u32 rd_id,
mp->subnet.type = gub_subnet_type_to_api (type);
mp->subnet.sw_if_index = ntohl (sw_if_index);
- mp->subnet.epg_id = ntohs (epg);
+ mp->subnet.sclass = ntohs (sclass);
mp->subnet.rd_id = ntohl (rd_id);
ip_prefix_encode (pfx, &mp->subnet.prefix);
@@ -521,7 +521,7 @@ gbp_endpoint_group_send_details (gbp_endpoint_group_t * gg, void *args)
mp->context = ctx->context;
mp->epg.uplink_sw_if_index = ntohl (gg->gg_uplink_sw_if_index);
- mp->epg.epg_id = ntohs (gg->gg_id);
+ mp->epg.vnid = ntohl (gg->gg_vnid);
mp->epg.sclass = ntohs (gg->gg_sclass);
mp->epg.bd_id = ntohl (gbp_endpoint_group_get_bd_id (gg));
mp->epg.rd_id = ntohl (gbp_route_domain_get_rd_id (gg->gg_rd));
@@ -647,7 +647,7 @@ vl_api_gbp_recirc_add_del_t_handler (vl_api_gbp_recirc_add_del_t * mp)
if (mp->is_add)
rv = gbp_recirc_add (sw_if_index,
- ntohs (mp->recirc.epg_id), mp->recirc.is_ext);
+ ntohs (mp->recirc.sclass), mp->recirc.is_ext);
else
rv = gbp_recirc_delete (sw_if_index);
@@ -671,7 +671,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 = ntohs (gr->gr_epg);
+ mp->recirc.sclass = ntohs (gr->gr_sclass);
mp->recirc.sw_if_index = ntohl (gr->gr_sw_if_index);
mp->recirc.is_ext = gr->gr_is_ext;
@@ -959,14 +959,14 @@ vl_api_gbp_contract_add_del_t_handler (vl_api_gbp_contract_add_del_t * mp)
allowed_ethertypes[ii] = et[ii];
}
- rv = gbp_contract_update (ntohs (mp->contract.src_epg),
- ntohs (mp->contract.dst_epg),
+ rv = gbp_contract_update (ntohs (mp->contract.sclass),
+ ntohs (mp->contract.dclass),
ntohl (mp->contract.acl_index),
rules, allowed_ethertypes);
}
else
- rv = gbp_contract_delete (ntohs (mp->contract.src_epg),
- ntohs (mp->contract.dst_epg));
+ rv = gbp_contract_delete (ntohs (mp->contract.sclass),
+ ntohs (mp->contract.dclass));
out:
REPLY_MACRO (VL_API_GBP_CONTRACT_ADD_DEL_REPLY + GBP_MSG_BASE);
@@ -987,9 +987,9 @@ 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 = 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);
+ mp->contract.sclass = ntohs (gbpc->gc_key.gck_src);
+ mp->contract.dclass = ntohs (gbpc->gc_key.gck_dst);
+ mp->contract.acl_index = ntohl (gbpc->gc_acl_index);
vl_api_send_msg (ctx->reg, (u8 *) mp);
diff --git a/src/plugins/gbp/gbp_bridge_domain.c b/src/plugins/gbp/gbp_bridge_domain.c
index 24bfb254ad4..02ed97d7452 100644
--- a/src/plugins/gbp/gbp_bridge_domain.c
+++ b/src/plugins/gbp/gbp_bridge_domain.c
@@ -15,7 +15,6 @@
#include <plugins/gbp/gbp_bridge_domain.h>
#include <plugins/gbp/gbp_endpoint.h>
-#include <plugins/gbp/gbp_sclass.h>
#include <plugins/gbp/gbp_learn.h>
#include <vnet/dpo/dvr_dpo.h>
@@ -211,14 +210,12 @@ gbp_bridge_domain_add_and_lock (u32 bd_id,
set_int_l2_mode (vlib_get_main (), vnet_get_main (),
MODE_L2_BRIDGE, gb->gb_uu_fwd_sw_if_index,
bd_index, L2_BD_PORT_TYPE_UU_FWD, 0, 0);
- gbp_sclass_enable_l2 (gb->gb_uu_fwd_sw_if_index);
}
if (~0 != gb->gb_bm_flood_sw_if_index)
{
set_int_l2_mode (vlib_get_main (), vnet_get_main (),
MODE_L2_BRIDGE, gb->gb_bm_flood_sw_if_index,
bd_index, L2_BD_PORT_TYPE_NORMAL, 0, 0);
- gbp_sclass_enable_l2 (gb->gb_bm_flood_sw_if_index);
gbp_learn_enable (gb->gb_bm_flood_sw_if_index, GBP_LEARN_MODE_L2);
}
@@ -269,14 +266,12 @@ gbp_bridge_domain_unlock (index_t index)
set_int_l2_mode (vlib_get_main (), vnet_get_main (),
MODE_L3, gb->gb_uu_fwd_sw_if_index,
gb->gb_bd_index, L2_BD_PORT_TYPE_UU_FWD, 0, 0);
- gbp_sclass_disable_l2 (gb->gb_uu_fwd_sw_if_index);
}
if (~0 != gb->gb_bm_flood_sw_if_index)
{
set_int_l2_mode (vlib_get_main (), vnet_get_main (),
MODE_L3, gb->gb_bm_flood_sw_if_index,
gb->gb_bd_index, L2_BD_PORT_TYPE_NORMAL, 0, 0);
- gbp_sclass_disable_l2 (gb->gb_bm_flood_sw_if_index);
gbp_learn_enable (gb->gb_bm_flood_sw_if_index, GBP_LEARN_MODE_L2);
}
diff --git a/src/plugins/gbp/gbp_classify_node.c b/src/plugins/gbp/gbp_classify_node.c
index 43fea769cce..1b2cb0a2bc7 100644
--- a/src/plugins/gbp/gbp_classify_node.c
+++ b/src/plugins/gbp/gbp_classify_node.c
@@ -33,7 +33,7 @@
typedef struct gbp_classify_trace_t_
{
/* per-pkt trace data */
- epg_id_t src_epg;
+ sclass_t sclass;
} gbp_classify_trace_t;
/*
@@ -61,9 +61,10 @@ gbp_classify_inline (vlib_main_t * vm,
while (n_left_from > 0 && n_left_to_next > 0)
{
- u32 next0, bi0, src_epg, sw_if_index0;
+ u32 next0, bi0, sw_if_index0;
const gbp_endpoint_t *ge0;
vlib_buffer_t *b0;
+ sclass_t sclass0;
bi0 = from[0];
to_next[0] = bi0;
@@ -79,7 +80,7 @@ gbp_classify_inline (vlib_main_t * vm,
if (GBP_SRC_CLASSIFY_NULL == type)
{
- src_epg = EPG_INVALID;
+ sclass0 = SCLASS_INVALID;
next0 =
vnet_l2_feature_next (b0, gscm->l2_input_feat_next[type],
L2INPUT_FEAT_GBP_NULL_CLASSIFY);
@@ -139,18 +140,18 @@ gbp_classify_inline (vlib_main_t * vm,
}
if (PREDICT_TRUE (NULL != ge0))
- src_epg = ge0->ge_fwd.gef_epg_id;
+ sclass0 = ge0->ge_fwd.gef_sclass;
else
- src_epg = EPG_INVALID;
+ sclass0 = SCLASS_INVALID;
}
- vnet_buffer2 (b0)->gbp.src_epg = src_epg;
+ vnet_buffer2 (b0)->gbp.sclass = sclass0;
if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED)))
{
gbp_classify_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
- t->src_epg = src_epg;
+ t->sclass = sclass0;
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
@@ -205,7 +206,7 @@ format_gbp_classify_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
gbp_classify_trace_t *t = va_arg (*args, gbp_classify_trace_t *);
- s = format (s, "src-epg:%d", t->src_epg);
+ s = format (s, "sclass:%d", t->sclass);
return s;
}
@@ -342,7 +343,7 @@ gbp_lpm_classify_inline (vlib_main_t * vm,
ip4_header_t *ip4_0;
ip6_header_t *ip6_0;
vlib_buffer_t *b0;
- epg_id_t src_epg0;
+ sclass_t sclass0;
bi0 = from[0];
to_next[0] = bi0;
@@ -383,7 +384,7 @@ gbp_lpm_classify_inline (vlib_main_t * vm,
break;
default:
/* not IP so no LPM classify possible */
- src_epg0 = EPG_INVALID;
+ sclass0 = SCLASS_INVALID;
goto trace;
}
}
@@ -418,7 +419,7 @@ gbp_lpm_classify_inline (vlib_main_t * vm,
else
{
/* not IP so no LPM classify possible */
- src_epg0 = EPG_INVALID;
+ sclass0 = SCLASS_INVALID;
goto trace;
}
lb0 = load_balance_get (lbi0);
@@ -427,23 +428,23 @@ gbp_lpm_classify_inline (vlib_main_t * vm,
if (gbp_policy_dpo_type == dpo0->dpoi_type)
{
gpd0 = gbp_policy_dpo_get (dpo0->dpoi_index);
- src_epg0 = gpd0->gpd_epg;
+ sclass0 = gpd0->gpd_sclass;
}
else
{
/* could not classify => drop */
- src_epg0 = EPG_INVALID;
+ sclass0 = SCLASS_INVALID;
next0 = GPB_LPM_CLASSIFY_DROP;
}
trace:
- vnet_buffer2 (b0)->gbp.src_epg = src_epg0;
+ vnet_buffer2 (b0)->gbp.sclass = sclass0;
if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED)))
{
gbp_classify_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
- t->src_epg = src_epg0;
+ t->sclass = sclass0;
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
diff --git a/src/plugins/gbp/gbp_contract.c b/src/plugins/gbp/gbp_contract.c
index f7b8b6474c5..805e9b23d09 100644
--- a/src/plugins/gbp/gbp_contract.c
+++ b/src/plugins/gbp/gbp_contract.c
@@ -377,7 +377,7 @@ gbp_contract_next_hop_resolve (index_t gui, index_t gnhi)
gbd->gb_uu_fwd_sw_if_index,
ips,
&gnh->gnh_mac,
- gnh->gnh_bd, gnh->gnh_rd, EPG_INVALID,
+ gnh->gnh_bd, gnh->gnh_rd, SCLASS_INVALID,
GBP_ENDPOINT_FLAG_NONE, NULL, NULL,
&gnh->gnh_ge);
@@ -433,8 +433,8 @@ gbp_contract_mk_lbs (index_t * guis)
}
int
-gbp_contract_update (epg_id_t src_epg,
- epg_id_t dst_epg,
+gbp_contract_update (sclass_t sclass,
+ sclass_t dclass,
u32 acl_index, index_t * rules, u16 * allowed_ethertypes)
{
gbp_main_t *gm = &gbp_main;
@@ -444,8 +444,8 @@ gbp_contract_update (epg_id_t src_epg,
uword *p;
gbp_contract_key_t key = {
- .gck_src = src_epg,
- .gck_dst = dst_epg,
+ .gck_src = sclass,
+ .gck_dst = dclass,
};
if (~0 == gm->gbp_acl_user_id)
@@ -483,7 +483,7 @@ gbp_contract_update (epg_id_t src_epg,
gc->gc_acl_index = acl_index;
gc->gc_lc_index =
gm->acl_plugin.get_lookup_context_index (gm->gbp_acl_user_id,
- src_epg, dst_epg);
+ sclass, dclass);
vec_add1 (acl_vec, gc->gc_acl_index);
gm->acl_plugin.set_acl_vec_for_context (gc->gc_lc_index, acl_vec);
@@ -493,11 +493,11 @@ gbp_contract_update (epg_id_t src_epg,
}
int
-gbp_contract_delete (epg_id_t src_epg, epg_id_t dst_epg)
+gbp_contract_delete (sclass_t sclass, sclass_t dclass)
{
gbp_contract_key_t key = {
- .gck_src = src_epg,
- .gck_dst = dst_epg,
+ .gck_src = sclass,
+ .gck_dst = dclass,
};
gbp_contract_t *gc;
uword *p;
@@ -538,7 +538,7 @@ static clib_error_t *
gbp_contract_cli (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
- epg_id_t src_epg_id = EPG_INVALID, dst_epg_id = EPG_INVALID;
+ sclass_t sclass = SCLASS_INVALID, dclass = SCLASS_INVALID;
u32 acl_index = ~0;
u8 add = 1;
@@ -548,9 +548,9 @@ gbp_contract_cli (vlib_main_t * vm,
add = 1;
else if (unformat (input, "del"))
add = 0;
- else if (unformat (input, "src-epg %d", &src_epg_id))
+ else if (unformat (input, "src-epg %d", &sclass))
;
- else if (unformat (input, "dst-epg %d", &dst_epg_id))
+ else if (unformat (input, "dst-epg %d", &dclass))
;
else if (unformat (input, "acl-index %d", &acl_index))
;
@@ -558,18 +558,18 @@ gbp_contract_cli (vlib_main_t * vm,
break;
}
- if (EPG_INVALID == src_epg_id)
+ if (SCLASS_INVALID == sclass)
return clib_error_return (0, "Source EPG-ID must be specified");
- if (EPG_INVALID == dst_epg_id)
+ if (SCLASS_INVALID == dclass)
return clib_error_return (0, "Destination EPG-ID must be specified");
if (add)
{
- gbp_contract_update (src_epg_id, dst_epg_id, acl_index, NULL, NULL);
+ gbp_contract_update (sclass, dclass, acl_index, NULL, NULL);
}
else
{
- gbp_contract_delete (src_epg_id, dst_epg_id);
+ gbp_contract_delete (sclass, dclass);
}
return (NULL);
diff --git a/src/plugins/gbp/gbp_contract.h b/src/plugins/gbp/gbp_contract.h
index 876c10f3702..dff1b445061 100644
--- a/src/plugins/gbp/gbp_contract.h
+++ b/src/plugins/gbp/gbp_contract.h
@@ -30,8 +30,8 @@ typedef struct gbp_contract_key_t_
/**
* source and destination EPGs for which the ACL applies
*/
- epg_id_t gck_src;
- epg_id_t gck_dst;
+ sclass_t gck_src;
+ sclass_t gck_dst;
};
u32 as_u32;
};
@@ -138,11 +138,11 @@ typedef struct gbp_contract_db_t_
uword *gc_hash;
} gbp_contract_db_t;
-extern int gbp_contract_update (epg_id_t src_epg,
- epg_id_t dst_epg,
+extern int gbp_contract_update (sclass_t sclass,
+ sclass_t dclass,
u32 acl_index,
index_t * rules, u16 * allowed_ethertypes);
-extern int gbp_contract_delete (epg_id_t src_epg, epg_id_t dst_epg);
+extern int gbp_contract_delete (sclass_t sclass, sclass_t dclass);
extern index_t gbp_rule_alloc (gbp_rule_action_t action,
gbp_hash_mode_t hash_mode, index_t * nhs);
diff --git a/src/plugins/gbp/gbp_endpoint.c b/src/plugins/gbp/gbp_endpoint.c
index 4bd726fec31..36e0050c39d 100644
--- a/src/plugins/gbp/gbp_endpoint.c
+++ b/src/plugins/gbp/gbp_endpoint.c
@@ -636,7 +636,7 @@ gbb_endpoint_fwd_recalc (gbp_endpoint_t * ge)
if (INDEX_INVALID != gel->gel_epg)
{
gg = gbp_endpoint_group_get (gel->gel_epg);
- gef->gef_epg_id = gg->gg_id;
+ gef->gef_sclass = gg->gg_sclass;
}
else
{
@@ -757,7 +757,7 @@ gbb_endpoint_fwd_recalc (gbp_endpoint_t * ge)
* is applied
*/
gbp_policy_dpo_add_or_lock (fib_proto_to_dpo (pfx->fp_proto),
- gg->gg_id, ~0, &policy_dpo);
+ gg->gg_sclass, ~0, &policy_dpo);
fib_table_entry_special_dpo_add (fib_index, pfx,
FIB_SOURCE_PLUGIN_HI,
@@ -818,7 +818,8 @@ gbp_endpoint_update_and_lock (gbp_endpoint_src_t src,
u32 sw_if_index,
const ip46_address_t * ips,
const mac_address_t * mac,
- index_t gbdi, index_t grdi, epg_id_t epg_id,
+ index_t gbdi, index_t grdi,
+ sclass_t sclass,
gbp_endpoint_flags_t flags,
const ip46_address_t * tun_src,
const ip46_address_t * tun_dst, u32 * handle)
@@ -842,9 +843,9 @@ gbp_endpoint_update_and_lock (gbp_endpoint_src_t src,
* we need to determine the bridge-domain, either from the EPG or
* the BD passed
*/
- if (EPG_INVALID != epg_id)
+ if (SCLASS_INVALID != sclass)
{
- ggi = gbp_endpoint_group_find (epg_id);
+ ggi = gbp_endpoint_group_find (sclass);
if (INDEX_INVALID == ggi)
return (VNET_API_ERROR_NO_SUCH_ENTRY);
@@ -1074,7 +1075,7 @@ gbp_endpoint_cli (vlib_main_t * vm,
ip46_address_t ip = ip46_address_initializer, *ips = NULL;
mac_address_t mac = ZERO_MAC_ADDRESS;
vnet_main_t *vnm = vnet_get_main ();
- u32 epg_id = EPG_INVALID;
+ u32 sclass = SCLASS_INVALID;
u32 handle = INDEX_INVALID;
u32 sw_if_index = ~0;
u8 add = 1;
@@ -1091,7 +1092,7 @@ gbp_endpoint_cli (vlib_main_t * vm,
add = 1;
else if (unformat (input, "del"))
add = 0;
- else if (unformat (input, "epg %d", &epg_id))
+ else if (unformat (input, "sclass %d", &sclass))
;
else if (unformat (input, "handle %d", &handle))
;
@@ -1109,14 +1110,14 @@ gbp_endpoint_cli (vlib_main_t * vm,
{
if (~0 == sw_if_index)
return clib_error_return (0, "interface must be specified");
- if (EPG_INVALID == epg_id)
- return clib_error_return (0, "EPG-ID must be specified");
+ if (SCLASS_INVALID == sclass)
+ return clib_error_return (0, "SCLASS must be specified");
rv =
gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_CP,
sw_if_index, ips, &mac,
INDEX_INVALID, INDEX_INVALID,
- epg_id,
+ sclass,
GBP_ENDPOINT_FLAG_NONE,
NULL, NULL, &handle);
diff --git a/src/plugins/gbp/gbp_endpoint.h b/src/plugins/gbp/gbp_endpoint.h
index e399ff4f671..aba1f9d498c 100644
--- a/src/plugins/gbp/gbp_endpoint.h
+++ b/src/plugins/gbp/gbp_endpoint.h
@@ -164,9 +164,9 @@ typedef struct gbp_endpoint_fwd_t_
index_t *gef_adjs;
/**
- * Endpoint Group's ID. cached for fast DP access.
+ * Endpoint Group's sclass. cached for fast DP access.
*/
- epg_id_t gef_epg_id;
+ sclass_t gef_sclass;
gbp_endpoint_flags_t gef_flags;
} gbp_endpoint_fwd_t;
@@ -222,7 +222,7 @@ extern int gbp_endpoint_update_and_lock (gbp_endpoint_src_t src,
const ip46_address_t * ip,
const mac_address_t * mac,
index_t gbd, index_t grd,
- epg_id_t epg_id,
+ sclass_t sclass,
gbp_endpoint_flags_t flags,
const ip46_address_t * tun_src,
const ip46_address_t * tun_dst,
diff --git a/src/plugins/gbp/gbp_endpoint_group.c b/src/plugins/gbp/gbp_endpoint_group.c
index 821adef0c18..d6e42e81ac5 100644
--- a/src/plugins/gbp/gbp_endpoint_group.c
+++ b/src/plugins/gbp/gbp_endpoint_group.c
@@ -60,11 +60,11 @@ gbp_endpoint_group_lock (index_t i)
}
index_t
-gbp_endpoint_group_find (epg_id_t epg_id)
+gbp_endpoint_group_find (sclass_t sclass)
{
uword *p;
- p = hash_get (gbp_endpoint_group_db.gg_hash, epg_id);
+ p = hash_get (gbp_endpoint_group_db.gg_hash_sclass, sclass);
if (NULL != p)
return p[0];
@@ -73,7 +73,7 @@ gbp_endpoint_group_find (epg_id_t epg_id)
}
int
-gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
+gbp_endpoint_group_add_and_lock (vnid_t vnid,
u16 sclass,
u32 bd_id,
u32 rd_id,
@@ -83,7 +83,7 @@ gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
gbp_endpoint_group_t *gg;
index_t ggi;
- ggi = gbp_endpoint_group_find (epg_id);
+ ggi = gbp_endpoint_group_find (sclass);
if (INDEX_INVALID == ggi)
{
@@ -108,7 +108,7 @@ gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
pool_get_zero (gbp_endpoint_group_pool, gg);
- gg->gg_id = epg_id;
+ gg->gg_vnid = vnid;
gg->gg_rd = grdi;
gg->gg_gbd = gbi;
gg->gg_bd_index = gb->gb_bd_index;
@@ -119,7 +119,7 @@ gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
gg->gg_retention = *retention;
if (SCLASS_INVALID != gg->gg_sclass)
- hash_set (gbp_epg_sclass_db, gg->gg_sclass, gg->gg_id);
+ hash_set (gbp_epg_sclass_db, gg->gg_sclass, gg->gg_vnid);
/*
* an egress DVR dpo for internal subnets to use when sending
@@ -145,9 +145,8 @@ gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
L2INPUT_FEAT_GBP_NULL_CLASSIFY, 1);
}
- hash_set (gbp_endpoint_group_db.gg_hash,
- gg->gg_id, gg - gbp_endpoint_group_pool);
-
+ hash_set (gbp_endpoint_group_db.gg_hash_sclass,
+ gg->gg_sclass, gg - gbp_endpoint_group_pool);
}
else
{
@@ -196,18 +195,18 @@ gbp_endpoint_group_unlock (index_t ggi)
if (SCLASS_INVALID != gg->gg_sclass)
hash_unset (gbp_epg_sclass_db, gg->gg_sclass);
- hash_unset (gbp_endpoint_group_db.gg_hash, gg->gg_id);
+ hash_unset (gbp_endpoint_group_db.gg_hash_sclass, gg->gg_sclass);
pool_put (gbp_endpoint_group_pool, gg);
}
}
int
-gbp_endpoint_group_delete (epg_id_t epg_id)
+gbp_endpoint_group_delete (sclass_t sclass)
{
index_t ggi;
- ggi = gbp_endpoint_group_find (epg_id);
+ ggi = gbp_endpoint_group_find (sclass);
if (INDEX_INVALID != ggi)
{
@@ -261,7 +260,7 @@ gbp_endpoint_group_cli (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
gbp_endpoint_retention_t retention = { 0 };
- epg_id_t epg_id = EPG_INVALID, sclass;
+ vnid_t vnid = VNID_INVALID, sclass;
vnet_main_t *vnm = vnet_get_main ();
u32 uplink_sw_if_index = ~0;
u32 bd_id = ~0;
@@ -277,7 +276,7 @@ gbp_endpoint_group_cli (vlib_main_t * vm,
add = 1;
else if (unformat (input, "del"))
add = 0;
- else if (unformat (input, "epg %d", &epg_id))
+ else if (unformat (input, "epg %d", &vnid))
;
else if (unformat (input, "sclass %d", &sclass))
;
@@ -289,7 +288,7 @@ gbp_endpoint_group_cli (vlib_main_t * vm,
break;
}
- if (EPG_INVALID == epg_id)
+ if (VNID_INVALID == vnid)
return clib_error_return (0, "EPG-ID must be specified");
if (add)
@@ -301,11 +300,11 @@ gbp_endpoint_group_cli (vlib_main_t * vm,
if (~0 == rd_id)
return clib_error_return (0, "route-domain must be specified");
- gbp_endpoint_group_add_and_lock (epg_id, sclass, bd_id, rd_id,
+ gbp_endpoint_group_add_and_lock (vnid, sclass, bd_id, rd_id,
uplink_sw_if_index, &retention);
}
else
- gbp_endpoint_group_delete (epg_id);
+ gbp_endpoint_group_delete (vnid);
return (NULL);
}
@@ -343,7 +342,7 @@ format_gbp_endpoint_group (u8 * s, va_list * args)
if (NULL != gg)
s = format (s, "[%d] %d, sclass:%d bd:[%d,%d] rd:[%d] uplink:%U retnetion:%U locks:%d",
gg - gbp_endpoint_group_pool,
- gg->gg_id,
+ gg->gg_vnid,
gg->gg_sclass,
gbp_endpoint_group_get_bd_id(gg), gg->gg_bd_index,
gg->gg_rd,
diff --git a/src/plugins/gbp/gbp_endpoint_group.h b/src/plugins/gbp/gbp_endpoint_group.h
index 08e3a5c874c..e0d54eaaf86 100644
--- a/src/plugins/gbp/gbp_endpoint_group.h
+++ b/src/plugins/gbp/gbp_endpoint_group.h
@@ -37,7 +37,7 @@ typedef struct gpb_endpoint_group_t_
/**
* ID
*/
- epg_id_t gg_id;
+ vnid_t gg_vnid;
/**
* Sclass. Could be unset => ~0
@@ -86,18 +86,18 @@ typedef struct gpb_endpoint_group_t_
*/
typedef struct gbp_endpoint_group_db_t_
{
- uword *gg_hash;
+ uword *gg_hash_sclass;
} gbp_endpoint_group_db_t;
-extern int gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
+extern int gbp_endpoint_group_add_and_lock (vnid_t vnid,
u16 sclass,
u32 bd_id,
u32 rd_id,
u32 uplink_sw_if_index,
const gbp_endpoint_retention_t *
retention);
-extern index_t gbp_endpoint_group_find (epg_id_t epg_id);
-extern int gbp_endpoint_group_delete (epg_id_t epg_id);
+extern index_t gbp_endpoint_group_find (sclass_t sclass);
+extern int gbp_endpoint_group_delete (sclass_t sclass);
extern void gbp_endpoint_group_unlock (index_t index);
extern void gbp_endpoint_group_lock (index_t index);
extern u32 gbp_endpoint_group_get_bd_id (const gbp_endpoint_group_t *);
@@ -120,24 +120,12 @@ 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)
+gbp_epg_itf_lookup_sclass (sclass_t sclass)
{
uword *p;
- p = hash_get (gbp_endpoint_group_db.gg_hash, epg);
+ p = hash_get (gbp_endpoint_group_db.gg_hash_sclass, sclass);
if (NULL != p)
{
@@ -149,26 +137,12 @@ 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)
+gbp_epg_dpo_lookup (sclass_t sclass, fib_protocol_t fproto)
{
uword *p;
- p = hash_get (gbp_endpoint_group_db.gg_hash, epg);
+ p = hash_get (gbp_endpoint_group_db.gg_hash_sclass, sclass);
if (NULL != p)
{
diff --git a/src/plugins/gbp/gbp_fwd.c b/src/plugins/gbp/gbp_fwd.c
index dd393980038..4ecc4779b92 100644
--- a/src/plugins/gbp/gbp_fwd.c
+++ b/src/plugins/gbp/gbp_fwd.c
@@ -27,7 +27,7 @@ typedef struct gbp_fwd_main_t_
u32 l2_input_feat_next[32];
} gbp_fwd_main_t;
-static gbp_fwd_main_t gbp_fwd_main;
+gbp_fwd_main_t gbp_fwd_main;
static clib_error_t *
gbp_fwd_init (vlib_main_t * vm)
diff --git a/src/plugins/gbp/gbp_fwd_dpo.c b/src/plugins/gbp/gbp_fwd_dpo.c
index c0b19a9e398..b1023f5e78f 100644
--- a/src/plugins/gbp/gbp_fwd_dpo.c
+++ b/src/plugins/gbp/gbp_fwd_dpo.c
@@ -170,7 +170,7 @@ VLIB_INIT_FUNCTION (gbp_fwd_dpo_module_init);
typedef struct gbp_fwd_dpo_trace_t_
{
- u32 src_epg;
+ u32 sclass;
u32 dpo_index;
} gbp_fwd_dpo_trace_t;
@@ -203,7 +203,7 @@ gbp_fwd_dpo_inline (vlib_main_t * vm,
{
const dpo_id_t *next_dpo0;
vlib_buffer_t *b0;
- epg_id_t src_epg0;
+ sclass_t sclass0;
u32 bi0, next0;
bi0 = from[0];
@@ -215,8 +215,8 @@ gbp_fwd_dpo_inline (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
- src_epg0 = vnet_buffer2 (b0)->gbp.src_epg;
- next_dpo0 = gbp_epg_dpo_lookup (src_epg0, fproto);
+ sclass0 = vnet_buffer2 (b0)->gbp.sclass;
+ next_dpo0 = gbp_epg_dpo_lookup (sclass0, fproto);
if (PREDICT_TRUE (NULL != next_dpo0))
{
@@ -233,7 +233,7 @@ gbp_fwd_dpo_inline (vlib_main_t * vm,
gbp_fwd_dpo_trace_t *tr;
tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
- tr->src_epg = src_epg0;
+ tr->sclass = sclass0;
tr->dpo_index = (NULL != next_dpo0 ?
next_dpo0->dpoi_index : ~0);
}
@@ -253,7 +253,7 @@ format_gbp_fwd_dpo_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
gbp_fwd_dpo_trace_t *t = va_arg (*args, gbp_fwd_dpo_trace_t *);
- s = format (s, " epg:%d dpo:%d", t->src_epg, t->dpo_index);
+ s = format (s, " sclass:%d dpo:%d", t->sclass, t->dpo_index);
return s;
}
diff --git a/src/plugins/gbp/gbp_fwd_node.c b/src/plugins/gbp/gbp_fwd_node.c
index eff4aeb1880..6ea56fd8074 100644
--- a/src/plugins/gbp/gbp_fwd_node.c
+++ b/src/plugins/gbp/gbp_fwd_node.c
@@ -48,7 +48,7 @@ typedef enum
typedef struct gbp_fwd_trace_t_
{
/* per-pkt trace data */
- epg_id_t src_epg;
+ sclass_t sclass;
u32 sw_if_index;
} gbp_fwd_trace_t;
@@ -70,9 +70,10 @@ VLIB_NODE_FN (gbp_fwd_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
while (n_left_from > 0 && n_left_to_next > 0)
{
- u32 bi0, sw_if_index0, src_epg;
+ u32 bi0, sw_if_index0;
gbp_fwd_next_t next0;
vlib_buffer_t *b0;
+ sclass_t sclass0;
next0 = GBP_FWD_NEXT_DROP;
bi0 = from[0];
@@ -87,9 +88,9 @@ VLIB_NODE_FN (gbp_fwd_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
/*
* lookup the uplink based on src EPG
*/
- src_epg = vnet_buffer2 (b0)->gbp.src_epg;
+ sclass0 = vnet_buffer2 (b0)->gbp.sclass;
- sw_if_index0 = gbp_epg_itf_lookup (src_epg);
+ sw_if_index0 = gbp_epg_itf_lookup_sclass (sclass0);
if (~0 != sw_if_index0)
{
@@ -105,7 +106,7 @@ VLIB_NODE_FN (gbp_fwd_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED)))
{
gbp_fwd_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t));
- t->src_epg = src_epg;
+ t->sclass = sclass0;
t->sw_if_index = sw_if_index0;
}
@@ -129,7 +130,7 @@ format_gbp_fwd_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
gbp_fwd_trace_t *t = va_arg (*args, gbp_fwd_trace_t *);
- s = format (s, "src-epg:%d", t->src_epg);
+ s = format (s, "sclass:%d", t->sclass);
return s;
}
diff --git a/src/plugins/gbp/gbp_learn_node.c b/src/plugins/gbp/gbp_learn_node.c
index 461d209e0a6..8c623e8bd3e 100644
--- a/src/plugins/gbp/gbp_learn_node.c
+++ b/src/plugins/gbp/gbp_learn_node.c
@@ -58,7 +58,7 @@ typedef struct gbp_learn_l2_t_
mac_address_t mac;
u32 sw_if_index;
u32 bd_index;
- epg_id_t epg;
+ sclass_t sclass;
ip46_address_t outer_src;
ip46_address_t outer_dst;
} gbp_learn_l2_t;
@@ -71,7 +71,7 @@ gbp_learn_l2_cp (const gbp_learn_l2_t * gl2)
GBP_LEARN_DBG ("L2 EP: %U %U, %d",
format_mac_address_t, &gl2->mac,
- format_ip46_address, &gl2->ip, IP46_TYPE_ANY, gl2->epg);
+ format_ip46_address, &gl2->ip, IP46_TYPE_ANY, gl2->sclass);
if (!ip46_address_is_zero (&gl2->ip))
vec_add1 (ips, gl2->ip);
@@ -83,7 +83,7 @@ gbp_learn_l2_cp (const gbp_learn_l2_t * gl2)
gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_DP,
gl2->sw_if_index, ips,
&gl2->mac, INDEX_INVALID,
- INDEX_INVALID, gl2->epg,
+ INDEX_INVALID, gl2->sclass,
(GBP_ENDPOINT_FLAG_LEARNT |
GBP_ENDPOINT_FLAG_REMOTE),
&gl2->outer_dst, &gl2->outer_src, NULL);
@@ -92,14 +92,14 @@ gbp_learn_l2_cp (const gbp_learn_l2_t * gl2)
static void
gbp_learn_l2_ip4_dp (const u8 * mac, const ip4_address_t * ip,
- u32 bd_index, u32 sw_if_index, epg_id_t epg,
+ u32 bd_index, u32 sw_if_index, sclass_t sclass,
const ip4_address_t * outer_src,
const ip4_address_t * outer_dst)
{
gbp_learn_l2_t gl2 = {
.sw_if_index = sw_if_index,
.bd_index = bd_index,
- .epg = epg,
+ .sclass = sclass,
.ip.ip4 = *ip,
.outer_src.ip4 = *outer_src,
.outer_dst.ip4 = *outer_dst,
@@ -111,14 +111,14 @@ gbp_learn_l2_ip4_dp (const u8 * mac, const ip4_address_t * ip,
static void
gbp_learn_l2_ip6_dp (const u8 * mac, const ip6_address_t * ip,
- u32 bd_index, u32 sw_if_index, epg_id_t epg,
+ u32 bd_index, u32 sw_if_index, sclass_t sclass,
const ip4_address_t * outer_src,
const ip4_address_t * outer_dst)
{
gbp_learn_l2_t gl2 = {
.sw_if_index = sw_if_index,
.bd_index = bd_index,
- .epg = epg,
+ .sclass = sclass,
.ip.ip6 = *ip,
.outer_src.ip4 = *outer_src,
.outer_dst.ip4 = *outer_dst,
@@ -130,14 +130,14 @@ gbp_learn_l2_ip6_dp (const u8 * mac, const ip6_address_t * ip,
static void
gbp_learn_l2_dp (const u8 * mac, u32 bd_index, u32 sw_if_index,
- epg_id_t epg,
+ sclass_t sclass,
const ip4_address_t * outer_src,
const ip4_address_t * outer_dst)
{
gbp_learn_l2_t gl2 = {
.sw_if_index = sw_if_index,
.bd_index = bd_index,
- .epg = epg,
+ .sclass = sclass,
.outer_src.ip4 = *outer_src,
.outer_dst.ip4 = *outer_dst,
};
@@ -156,7 +156,7 @@ typedef struct gbp_learn_l2_trace_t_
u32 sw_if_index;
u32 new;
u32 throttled;
- u32 epg;
+ u32 sclass;
u32 d_bit;
gbp_bridge_domain_flags_t gb_flags;
} gbp_learn_l2_trace_t;
@@ -205,12 +205,13 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
while (n_left_from > 0 && n_left_to_next > 0)
{
ip4_address_t outer_src, outer_dst;
- u32 bi0, sw_if_index0, t0, epg0;
const ethernet_header_t *eh0;
+ u32 bi0, sw_if_index0, t0;
gbp_bridge_domain_t *gb0;
gbp_learn_next_t next0;
gbp_endpoint_t *ge0;
vlib_buffer_t *b0;
+ sclass_t sclass0;
next0 = GBP_LEARN_NEXT_DROP;
bi0 = from[0];
@@ -224,7 +225,7 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
eh0 = vlib_buffer_get_current (b0);
- epg0 = vnet_buffer2 (b0)->gbp.src_epg;
+ sclass0 = vnet_buffer2 (b0)->gbp.sclass;
next0 = vnet_l2_feature_next (b0, glm->gl_l2_input_feat_next,
L2INPUT_FEAT_GBP_LEARN);
@@ -273,7 +274,7 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
gbp_learn_l2_ip4_dp (eh0->src_address,
&ip0->src_address,
vnet_buffer (b0)->l2.bd_index,
- sw_if_index0, epg0,
+ sw_if_index0, sclass0,
&outer_src, &outer_dst);
break;
@@ -287,7 +288,7 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
gbp_learn_l2_ip6_dp (eh0->src_address,
&ip0->src_address,
vnet_buffer (b0)->l2.bd_index,
- sw_if_index0, epg0,
+ sw_if_index0, sclass0,
&outer_src, &outer_dst);
break;
@@ -301,14 +302,14 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
gbp_learn_l2_ip4_dp (eh0->src_address,
&arp0->ip4_over_ethernet[0].ip4,
vnet_buffer (b0)->l2.bd_index,
- sw_if_index0, epg0,
+ sw_if_index0, sclass0,
&outer_src, &outer_dst);
break;
}
default:
gbp_learn_l2_dp (eh0->src_address,
vnet_buffer (b0)->l2.bd_index,
- sw_if_index0, epg0,
+ sw_if_index0, sclass0,
&outer_src, &outer_dst);
break;
}
@@ -332,7 +333,7 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
t->new = (NULL == ge0);
t->throttled = t0;
t->sw_if_index = sw_if_index0;
- t->epg = epg0;
+ t->sclass = sclass0;
t->gb_flags = gb0->gb_flags;
t->d_bit = ! !(vnet_buffer2 (b0)->gbp.flags &
VXLAN_GBP_GPFLAGS_D);
@@ -358,10 +359,10 @@ format_gbp_learn_l2_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
gbp_learn_l2_trace_t *t = va_arg (*args, gbp_learn_l2_trace_t *);
- s = format (s, "new:%d throttled:%d d-bit:%d mac:%U itf:%d epg:%d"
+ s = format (s, "new:%d throttled:%d d-bit:%d mac:%U itf:%d sclass:%d"
" gb-flags:%U",
t->new, t->throttled, t->d_bit,
- format_mac_address_t, &t->mac, t->sw_if_index, t->epg,
+ format_mac_address_t, &t->mac, t->sw_if_index, t->sclass,
format_gbp_bridge_domain_flags, t->gb_flags);
return s;
@@ -390,7 +391,7 @@ typedef struct gbp_learn_l3_t_
ip46_address_t ip;
u32 fib_index;
u32 sw_if_index;
- epg_id_t epg;
+ sclass_t sclass;
ip46_address_t outer_src;
ip46_address_t outer_dst;
} gbp_learn_l3_t;
@@ -401,13 +402,13 @@ gbp_learn_l3_cp (const gbp_learn_l3_t * gl3)
ip46_address_t *ips = NULL;
GBP_LEARN_DBG ("L3 EP: %U, %d", format_ip46_address, &gl3->ip,
- IP46_TYPE_ANY, gl3->epg);
+ IP46_TYPE_ANY, gl3->sclass);
vec_add1 (ips, gl3->ip);
gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_DP,
gl3->sw_if_index, ips, NULL,
- INDEX_INVALID, INDEX_INVALID, gl3->epg,
+ INDEX_INVALID, INDEX_INVALID, gl3->sclass,
(GBP_ENDPOINT_FLAG_REMOTE |
GBP_ENDPOINT_FLAG_LEARNT),
&gl3->outer_dst, &gl3->outer_src, NULL);
@@ -416,7 +417,7 @@ gbp_learn_l3_cp (const gbp_learn_l3_t * gl3)
static void
gbp_learn_ip4_dp (const ip4_address_t * ip,
- u32 fib_index, u32 sw_if_index, epg_id_t epg,
+ u32 fib_index, u32 sw_if_index, sclass_t sclass,
const ip4_address_t * outer_src,
const ip4_address_t * outer_dst)
{
@@ -427,7 +428,7 @@ gbp_learn_ip4_dp (const ip4_address_t * ip,
},
.sw_if_index = sw_if_index,
.fib_index = fib_index,
- .epg = epg,
+ .sclass = sclass,
.outer_src.ip4 = *outer_src,
.outer_dst.ip4 = *outer_dst,
};
@@ -438,7 +439,7 @@ gbp_learn_ip4_dp (const ip4_address_t * ip,
static void
gbp_learn_ip6_dp (const ip6_address_t * ip,
- u32 fib_index, u32 sw_if_index, epg_id_t epg,
+ u32 fib_index, u32 sw_if_index, sclass_t sclass,
const ip4_address_t * outer_src,
const ip4_address_t * outer_dst)
{
@@ -449,7 +450,7 @@ gbp_learn_ip6_dp (const ip6_address_t * ip,
},
.sw_if_index = sw_if_index,
.fib_index = fib_index,
- .epg = epg,
+ .sclass = sclass,
.outer_src.ip4 = *outer_src,
.outer_dst.ip4 = *outer_dst,
};
@@ -468,7 +469,7 @@ typedef struct gbp_learn_l3_trace_t_
u32 sw_if_index;
u32 new;
u32 throttled;
- u32 epg;
+ u32 sclass;
} gbp_learn_l3_trace_t;
static uword
@@ -497,14 +498,15 @@ gbp_learn_l3 (vlib_main_t * vm,
while (n_left_from > 0 && n_left_to_next > 0)
{
- u32 bi0, sw_if_index0, t0, epg0, fib_index0;
CLIB_UNUSED (const ip4_header_t *) ip4_0;
CLIB_UNUSED (const ip6_header_t *) ip6_0;
+ u32 bi0, sw_if_index0, t0, fib_index0;
ip4_address_t outer_src, outer_dst;
ethernet_header_t *eth0;
gbp_learn_next_t next0;
gbp_endpoint_t *ge0;
vlib_buffer_t *b0;
+ sclass_t sclass0;
next0 = GBP_LEARN_NEXT_DROP;
bi0 = from[0];
@@ -516,7 +518,7 @@ gbp_learn_l3 (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
- epg0 = vnet_buffer2 (b0)->gbp.src_epg;
+ sclass0 = vnet_buffer2 (b0)->gbp.sclass;
ip6_0 = NULL;
ip4_0 = NULL;
@@ -551,7 +553,7 @@ gbp_learn_l3 (vlib_main_t * vm,
if (!t0)
{
gbp_learn_ip6_dp (&ip6_0->src_address,
- fib_index0, sw_if_index0, epg0,
+ fib_index0, sw_if_index0, sclass0,
&outer_src, &outer_dst);
}
}
@@ -582,7 +584,7 @@ gbp_learn_l3 (vlib_main_t * vm,
if (!t0)
{
gbp_learn_ip4_dp (&ip4_0->src_address,
- fib_index0, sw_if_index0, epg0,
+ fib_index0, sw_if_index0, sclass0,
&outer_src, &outer_dst);
}
}
@@ -610,7 +612,7 @@ gbp_learn_l3 (vlib_main_t * vm,
t->new = (NULL == ge0);
t->throttled = t0;
t->sw_if_index = sw_if_index0;
- t->epg = epg0;
+ t->sclass = sclass0;
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
@@ -632,10 +634,10 @@ format_gbp_learn_l3_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
gbp_learn_l3_trace_t *t = va_arg (*args, gbp_learn_l3_trace_t *);
- s = format (s, "new:%d throttled:%d ip:%U itf:%d epg:%d",
+ s = format (s, "new:%d throttled:%d ip:%U itf:%d sclass:%d",
t->new, t->throttled,
format_ip46_address, &t->ip, IP46_TYPE_ANY, t->sw_if_index,
- t->epg);
+ t->sclass);
return s;
}
diff --git a/src/plugins/gbp/gbp_policy_dpo.c b/src/plugins/gbp/gbp_policy_dpo.c
index ce628e5c975..c52dcc4dc48 100644
--- a/src/plugins/gbp/gbp_policy_dpo.c
+++ b/src/plugins/gbp/gbp_policy_dpo.c
@@ -92,7 +92,7 @@ gbp_policy_dpo_get_urpf (const dpo_id_t * dpo)
void
gbp_policy_dpo_add_or_lock (dpo_proto_t dproto,
- epg_id_t epg, u32 sw_if_index, dpo_id_t * dpo)
+ sclass_t sclass, u32 sw_if_index, dpo_id_t * dpo)
{
gbp_policy_dpo_t *gpd;
dpo_id_t parent = DPO_INVALID;
@@ -101,7 +101,7 @@ gbp_policy_dpo_add_or_lock (dpo_proto_t dproto,
gpd->gpd_proto = dproto;
gpd->gpd_sw_if_index = sw_if_index;
- gpd->gpd_epg = epg;
+ gpd->gpd_sclass = sclass;
if (~0 != sw_if_index)
{
@@ -127,9 +127,9 @@ format_gbp_policy_dpo (u8 * s, va_list * ap)
gbp_policy_dpo_t *gpd = gbp_policy_dpo_get (index);
vnet_main_t *vnm = vnet_get_main ();
- s = format (s, "gbp-policy-dpo: %U, epg:%d out:%U",
+ s = format (s, "gbp-policy-dpo: %U, sclass:%d out:%U",
format_dpo_proto, gpd->gpd_proto,
- gpd->gpd_epg,
+ (int) gpd->gpd_sclass,
format_vnet_sw_if_index_name, vnm, gpd->gpd_sw_if_index);
s = format (s, "\n%U", format_white_space, indent + 2);
s = format (s, "%U", format_dpo_id, &gpd->gpd_dpo, indent + 4);
@@ -150,7 +150,7 @@ gbp_policy_dpo_interpose (const dpo_id_t * original,
gpd = gbp_policy_dpo_get (original->dpoi_index);
gpd_clone->gpd_proto = gpd->gpd_proto;
- gpd_clone->gpd_epg = gpd->gpd_epg;
+ gpd_clone->gpd_sclass = gpd->gpd_sclass;
gpd_clone->gpd_sw_if_index = gpd->gpd_sw_if_index;
dpo_stack (gbp_policy_dpo_type,
@@ -290,10 +290,10 @@ gbp_policy_dpo_inline (vlib_main_t * vm,
goto trace;
}
- key0.gck_src = vnet_buffer2 (b0)->gbp.src_epg;
- key0.gck_dst = gpd0->gpd_epg;
+ key0.gck_src = vnet_buffer2 (b0)->gbp.sclass;
+ key0.gck_dst = gpd0->gpd_sclass;
- if (EPG_INVALID != key0.gck_src)
+ if (SCLASS_INVALID != key0.gck_src)
{
if (PREDICT_FALSE (key0.gck_src == key0.gck_dst))
{
diff --git a/src/plugins/gbp/gbp_policy_dpo.h b/src/plugins/gbp/gbp_policy_dpo.h
index 097205b8255..3a4264d9194 100644
--- a/src/plugins/gbp/gbp_policy_dpo.h
+++ b/src/plugins/gbp/gbp_policy_dpo.h
@@ -33,9 +33,9 @@ typedef struct gbp_policy_dpo_t_
dpo_proto_t gpd_proto;
/**
- * EPG
+ * SClass
*/
- epg_id_t gpd_epg;
+ sclass_t gpd_sclass;
/**
* output sw_if_index
@@ -54,7 +54,7 @@ typedef struct gbp_policy_dpo_t_
} gbp_policy_dpo_t;
extern void gbp_policy_dpo_add_or_lock (dpo_proto_t dproto,
- epg_id_t epg,
+ sclass_t sclass,
u32 sw_if_index, dpo_id_t * dpo);
extern dpo_type_t gbp_policy_dpo_get_type (void);
diff --git a/src/plugins/gbp/gbp_policy_node.c b/src/plugins/gbp/gbp_policy_node.c
index aaf362d2c9a..ff21e7d0e2e 100644
--- a/src/plugins/gbp/gbp_policy_node.c
+++ b/src/plugins/gbp/gbp_policy_node.c
@@ -49,7 +49,7 @@ typedef enum
typedef struct gbp_policy_trace_t_
{
/* per-pkt trace data */
- u32 src_epg;
+ u32 sclass;
u32 dst_epg;
u32 acl_index;
u32 allowed;
@@ -175,14 +175,14 @@ gbp_policy_inline (vlib_main_t * vm,
vnet_buffer (b0)->l2.bd_index);
if (NULL != ge0)
- key0.gck_dst = ge0->ge_fwd.gef_epg_id;
+ key0.gck_dst = ge0->ge_fwd.gef_sclass;
else
/* If you cannot determine the destination EP then drop */
goto trace;
- key0.gck_src = vnet_buffer2 (b0)->gbp.src_epg;
+ key0.gck_src = vnet_buffer2 (b0)->gbp.sclass;
- if (EPG_INVALID != key0.gck_src)
+ if (SCLASS_INVALID != key0.gck_src)
{
if (PREDICT_FALSE (key0.gck_src == key0.gck_dst))
{
@@ -305,7 +305,7 @@ gbp_policy_inline (vlib_main_t * vm,
{
gbp_policy_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
- t->src_epg = key0.gck_src;
+ t->sclass = key0.gck_src;
t->dst_epg = key0.gck_dst;
t->acl_index = (gc0 ? gc0->gc_acl_index : ~0),
t->allowed = (next0 != GBP_POLICY_NEXT_DENY);
@@ -346,8 +346,8 @@ format_gbp_policy_trace (u8 * s, va_list * args)
gbp_policy_trace_t *t = va_arg (*args, gbp_policy_trace_t *);
s =
- format (s, "src:%d, dst:%d, acl:%d allowed:%d",
- t->src_epg, t->dst_epg, t->acl_index, t->allowed);
+ format (s, "sclass:%d, dst:%d, acl:%d allowed:%d",
+ t->sclass, t->dst_epg, t->acl_index, t->allowed);
return s;
}
diff --git a/src/plugins/gbp/gbp_recirc.c b/src/plugins/gbp/gbp_recirc.c
index cee63811bd8..87d0d0564ad 100644
--- a/src/plugins/gbp/gbp_recirc.c
+++ b/src/plugins/gbp/gbp_recirc.c
@@ -53,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 ();
- return format (s, " %U, epg:%d, ext:%d",
+ return format (s, " %U, sclass:%d, ext:%d",
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
-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;
@@ -74,7 +74,7 @@ gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
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);
@@ -83,7 +83,7 @@ gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
pool_get_zero (gbp_recirc_pool, gr);
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;
@@ -135,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,
- 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",
diff --git a/src/plugins/gbp/gbp_recirc.h b/src/plugins/gbp/gbp_recirc.h
index 86b857d74a9..3af77b42b4b 100644
--- a/src/plugins/gbp/gbp_recirc.h
+++ b/src/plugins/gbp/gbp_recirc.h
@@ -30,7 +30,7 @@ typedef struct gpb_recirc_t_
/**
* EPG ID that packets will classify to when they arrive on this recirc
*/
- epg_id_t gr_epg;
+ sclass_t gr_sclass;
/**
* The index of the EPG
@@ -59,7 +59,7 @@ typedef struct gpb_recirc_t_
index_t gr_ep;
} gbp_recirc_t;
-extern int gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext);
+extern int gbp_recirc_add (u32 sw_if_index, sclass_t sclass, u8 is_ext);
extern int gbp_recirc_delete (u32 sw_if_index);
typedef walk_rc_t (*gbp_recirc_cb_t) (gbp_recirc_t * gbpe, void *ctx);
diff --git a/src/plugins/gbp/gbp_route_domain.c b/src/plugins/gbp/gbp_route_domain.c
index 6a3f4fa7f1e..67b6915b463 100644
--- a/src/plugins/gbp/gbp_route_domain.c
+++ b/src/plugins/gbp/gbp_route_domain.c
@@ -15,7 +15,6 @@
#include <plugins/gbp/gbp_route_domain.h>
#include <plugins/gbp/gbp_endpoint.h>
-#include <plugins/gbp/gbp_sclass.h>
#include <vnet/dpo/dvr_dpo.h>
#include <vnet/fib/fib_table.h>
@@ -183,8 +182,6 @@ gbp_route_domain_add_and_lock (u32 rd_id,
&ADJ_BCAST_ADDR,
grd->grd_uu_sw_if_index[fproto],
rewrite);
-
- gbp_sclass_enable_ip (grd->grd_uu_sw_if_index[fproto]);
}
else
{
@@ -226,8 +223,6 @@ gbp_route_domain_unlock (index_t index)
fproto, FIB_SOURCE_PLUGIN_HI);
if (INDEX_INVALID != grd->grd_adj[fproto])
adj_unlock (grd->grd_adj[fproto]);
- if (~0 != grd->grd_uu_sw_if_index[fproto])
- gbp_sclass_disable_ip (grd->grd_uu_sw_if_index[fproto]);
}
gbp_route_domain_db_remove (grd);
diff --git a/src/plugins/gbp/gbp_sclass.c b/src/plugins/gbp/gbp_sclass.c
deleted file mode 100644
index 481ee886976..00000000000
--- a/src/plugins/gbp/gbp_sclass.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2018 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <plugins/gbp/gbp_sclass.h>
-#include <vnet/l2/l2_input.h>
-#include <vnet/l2/l2_output.h>
-
-gbp_sclass_main_t gbp_sclass_main;
-
-void
-gbp_sclass_enable_l2 (u32 sw_if_index)
-{
- l2input_intf_bitmap_enable (sw_if_index, L2INPUT_FEAT_GBP_SCLASS_2_ID, 1);
- l2output_intf_bitmap_enable (sw_if_index, L2OUTPUT_FEAT_GBP_ID_2_SCLASS, 1);
-}
-
-void
-gbp_sclass_disable_l2 (u32 sw_if_index)
-{
- l2input_intf_bitmap_enable (sw_if_index, L2INPUT_FEAT_GBP_SCLASS_2_ID, 0);
- l2output_intf_bitmap_enable (sw_if_index, L2OUTPUT_FEAT_GBP_ID_2_SCLASS, 0);
-}
-
-void
-gbp_sclass_enable_ip (u32 sw_if_index)
-{
- vnet_feature_enable_disable ("ip4-unicast",
- "ip4-gbp-sclass-2-id", sw_if_index, 1, 0, 0);
- vnet_feature_enable_disable ("ip6-unicast",
- "ip6-gbp-sclass-2-id", sw_if_index, 1, 0, 0);
- vnet_feature_enable_disable ("ip4-output",
- "ip4-gbp-id-2-sclass", sw_if_index, 1, 0, 0);
- vnet_feature_enable_disable ("ip6-output",
- "ip6-gbp-id-2-sclass", sw_if_index, 1, 0, 0);
-}
-
-void
-gbp_sclass_disable_ip (u32 sw_if_index)
-{
- vnet_feature_enable_disable ("ip4-unicast",
- "ip4-gbp-sclass-2-id", sw_if_index, 0, 0, 0);
- vnet_feature_enable_disable ("ip6-unicast",
- "ip6-gbp-sclass-2-id", sw_if_index, 0, 0, 0);
- vnet_feature_enable_disable ("ip4-output",
- "ip4-gbp-id-2-sclass", sw_if_index, 0, 0, 0);
- vnet_feature_enable_disable ("ip6-output",
- "ip6-gbp-id-2-sclass", sw_if_index, 0, 0, 0);
-}
-
-static clib_error_t *
-gbp_sclass_init (vlib_main_t * vm)
-{
- gbp_sclass_main_t *glm = &gbp_sclass_main;
- vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "l2-gbp-sclass-2-id");
-
- /* Initialize the feature next-node indices */
- feat_bitmap_init_next_nodes (vm,
- node->index,
- L2INPUT_N_FEAT,
- l2input_get_feat_names (),
- glm->gel_l2_input_feat_next);
-
- node = vlib_get_node_by_name (vm, (u8 *) "l2-gbp-id-2-sclass");
- feat_bitmap_init_next_nodes (vm,
- node->index,
- L2OUTPUT_N_FEAT,
- l2output_get_feat_names (),
- glm->gel_l2_output_feat_next);
-
- return (NULL);
-}
-
-VLIB_INIT_FUNCTION (gbp_sclass_init);
-
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/plugins/gbp/gbp_sclass.h b/src/plugins/gbp/gbp_sclass.h
deleted file mode 100644
index 75e35c36bdf..00000000000
--- a/src/plugins/gbp/gbp_sclass.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2018 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __GBP_SCLASS_H__
-#define __GBP_SCLASS_H__
-
-#include <plugins/gbp/gbp.h>
-
-/**
- * Grouping of global data for the GBP source EPG classification feature
- */
-typedef struct gbp_sclass_main_t_
-{
- /**
- * Next nodes for L2 output features
- */
- u32 gel_l2_input_feat_next[32];
- u32 gel_l2_output_feat_next[32];
-} gbp_sclass_main_t;
-
-extern gbp_sclass_main_t gbp_sclass_main;
-
-extern void gbp_sclass_enable_l2 (u32 sw_if_index);
-extern void gbp_sclass_disable_l2 (u32 sw_if_index);
-extern void gbp_sclass_enable_ip (u32 sw_if_index);
-extern void gbp_sclass_disable_ip (u32 sw_if_index);
-
-#endif
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/plugins/gbp/gbp_sclass_node.c b/src/plugins/gbp/gbp_sclass_node.c
deleted file mode 100644
index 35b23844fd6..00000000000
--- a/src/plugins/gbp/gbp_sclass_node.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright (c) 2018 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <plugins/gbp/gbp_sclass.h>
-#include <vnet/l2/l2_input.h>
-#include <vnet/l2/l2_output.h>
-
-#define foreach_gbp_sclass \
- _(DROP, "drop")
-
-typedef enum
-{
-#define _(sym,str) GBP_SCLASS_NEXT_##sym,
- foreach_gbp_sclass
-#undef _
- GBP_SCLASS_N_NEXT,
-} gbp_sclass_next_t;
-
-typedef struct gbp_sclass_trace_t_
-{
- /* per-pkt trace data */
- u32 epg;
- u32 sclass;
-} gbp_sclass_trace_t;
-
-static_always_inline uword
-gbp_sclass_inline (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame, int is_id_2_sclass, int is_l2)
-{
- u32 n_left_from, *from, *to_next, next_index;
- gbp_sclass_main_t *glm;
-
- glm = &gbp_sclass_main;
- next_index = 0;
- n_left_from = frame->n_vectors;
- from = vlib_frame_vector_args (frame);
-
- while (n_left_from > 0)
- {
- u32 n_left_to_next;
-
- vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
-
- while (n_left_from > 0 && n_left_to_next > 0)
- {
- gbp_sclass_next_t next0;
- vlib_buffer_t *b0;
- epg_id_t epg0;
- u16 sclass0;
- u32 bi0;
-
- next0 = GBP_SCLASS_NEXT_DROP;
- bi0 = from[0];
- to_next[0] = bi0;
- from += 1;
- to_next += 1;
- n_left_from -= 1;
- n_left_to_next -= 1;
-
- b0 = vlib_get_buffer (vm, bi0);
-
- if (is_id_2_sclass)
- {
- // output direction - convert from the SRC-EPD to the sclass
- gbp_endpoint_group_t *gg;
-
- epg0 = vnet_buffer2 (b0)->gbp.src_epg;
- gg = gbp_epg_get (epg0);
-
- if (NULL != gg)
- {
- sclass0 = vnet_buffer2 (b0)->gbp.sclass = gg->gg_sclass;
- if (is_l2)
- next0 =
- vnet_l2_feature_next (b0, glm->gel_l2_output_feat_next,
- L2OUTPUT_FEAT_GBP_ID_2_SCLASS);
- else
- vnet_feature_next (&next0, b0);
- }
- else
- sclass0 = 0;
- }
- else
- {
- /* input direction - convert from the sclass to the SRC-EGD */
- sclass0 = vnet_buffer2 (b0)->gbp.sclass;
- vnet_buffer2 (b0)->gbp.src_epg =
- gbp_epg_sclass_2_id (vnet_buffer2 (b0)->gbp.sclass);
- epg0 = vnet_buffer2 (b0)->gbp.src_epg;
-
- if (EPG_INVALID != epg0)
- {
- if (is_l2)
- next0 =
- vnet_l2_feature_next (b0, glm->gel_l2_input_feat_next,
- L2INPUT_FEAT_GBP_SCLASS_2_ID);
- else
- vnet_feature_next (&next0, b0);
- }
- }
-
- if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED)))
- {
- gbp_sclass_trace_t *t =
- vlib_add_trace (vm, node, b0, sizeof (*t));
- t->epg = epg0;
- t->sclass = sclass0;
- }
-
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
- to_next, n_left_to_next,
- bi0, next0);
- }
-
- vlib_put_next_frame (vm, node, next_index, n_left_to_next);
- }
-
- return frame->n_vectors;
-}
-
-VLIB_NODE_FN (l2_gbp_id_2_sclass_node) (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- return (gbp_sclass_inline (vm, node, frame, 1, 1));
-}
-
-VLIB_NODE_FN (l2_gbp_sclass_2_id_node) (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- return (gbp_sclass_inline (vm, node, frame, 0, 1));
-}
-
-VLIB_NODE_FN (ip4_gbp_id_2_sclass_node) (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- return (gbp_sclass_inline (vm, node, frame, 1, 0));
-}
-
-VLIB_NODE_FN (ip4_gbp_sclass_2_id_node) (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- return (gbp_sclass_inline (vm, node, frame, 0, 0));
-}
-
-VLIB_NODE_FN (ip6_gbp_id_2_sclass_node) (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- return (gbp_sclass_inline (vm, node, frame, 1, 0));
-}
-
-VLIB_NODE_FN (ip6_gbp_sclass_2_id_node) (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- return (gbp_sclass_inline (vm, node, frame, 0, 0));
-}
-
-/* packet trace format function */
-static u8 *
-format_gbp_sclass_trace (u8 * s, va_list * args)
-{
- CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
- CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
- gbp_sclass_trace_t *t = va_arg (*args, gbp_sclass_trace_t *);
-
- s = format (s, "epg:%d sclass:%d", t->epg, t->sclass);
-
- return s;
-}
-
-/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (l2_gbp_id_2_sclass_node) = {
- .name = "l2-gbp-id-2-sclass",
- .vector_size = sizeof (u32),
- .format_trace = format_gbp_sclass_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_next_nodes = GBP_SCLASS_N_NEXT,
-
- .next_nodes = {
- [GBP_SCLASS_NEXT_DROP] = "error-drop",
- },
-};
-VLIB_REGISTER_NODE (l2_gbp_sclass_2_id_node) = {
- .name = "l2-gbp-sclass-2-id",
- .vector_size = sizeof (u32),
- .format_trace = format_gbp_sclass_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_next_nodes = GBP_SCLASS_N_NEXT,
-
- .next_nodes = {
- [GBP_SCLASS_NEXT_DROP] = "error-drop",
- },
-};
-
-VLIB_REGISTER_NODE (ip4_gbp_id_2_sclass_node) = {
- .name = "ip4-gbp-id-2-sclass",
- .vector_size = sizeof (u32),
- .format_trace = format_gbp_sclass_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_next_nodes = GBP_SCLASS_N_NEXT,
-
- .next_nodes = {
- [GBP_SCLASS_NEXT_DROP] = "error-drop",
- },
-};
-VLIB_REGISTER_NODE (ip4_gbp_sclass_2_id_node) = {
- .name = "ip4-gbp-sclass-2-id",
- .vector_size = sizeof (u32),
- .format_trace = format_gbp_sclass_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_next_nodes = GBP_SCLASS_N_NEXT,
-
- .next_nodes = {
- [GBP_SCLASS_NEXT_DROP] = "error-drop",
- },
-};
-
-VLIB_REGISTER_NODE (ip6_gbp_id_2_sclass_node) = {
- .name = "ip6-gbp-id-2-sclass",
- .vector_size = sizeof (u32),
- .format_trace = format_gbp_sclass_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_next_nodes = GBP_SCLASS_N_NEXT,
-
- .next_nodes = {
- [GBP_SCLASS_NEXT_DROP] = "error-drop",
- },
-};
-VLIB_REGISTER_NODE (ip6_gbp_sclass_2_id_node) = {
- .name = "ip6-gbp-sclass-2-id",
- .vector_size = sizeof (u32),
- .format_trace = format_gbp_sclass_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_next_nodes = GBP_SCLASS_N_NEXT,
-
- .next_nodes = {
- [GBP_SCLASS_NEXT_DROP] = "error-drop",
- },
-};
-
-
-VNET_FEATURE_INIT (ip4_gbp_sclass_2_id_feat, static) =
-{
- .arc_name = "ip4-unicast",
- .node_name = "ip4-gbp-sclass-2-id",
- .runs_before = VNET_FEATURES ("gbp-learn-ip4"),
-};
-VNET_FEATURE_INIT (ip6_gbp_sclass_2_id_feat, static) =
-{
- .arc_name = "ip6-unicast",
- .node_name = "ip6-gbp-sclass-2-id",
- .runs_before = VNET_FEATURES ("gbp-learn-ip6"),
-};
-VNET_FEATURE_INIT (ip4_gbp_id_2_sclass_feat, static) =
-{
- .arc_name = "ip4-output",
- .node_name = "ip4-gbp-id-2-sclass",
-};
-VNET_FEATURE_INIT (ip6_gbp_id_2_sclass_feat, static) =
-{
- .arc_name = "ip6-output",
- .node_name = "ip6-gbp-id-2-sclass",
-};
-/* *INDENT-ON* */
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/plugins/gbp/gbp_subnet.c b/src/plugins/gbp/gbp_subnet.c
index 0c8d3aee0a7..5e56c8200b9 100644
--- a/src/plugins/gbp/gbp_subnet.c
+++ b/src/plugins/gbp/gbp_subnet.c
@@ -43,12 +43,12 @@ typedef struct gbp_subnet_t_
{
struct
{
- epg_id_t gs_epg;
+ sclass_t gs_sclass;
u32 gs_sw_if_index;
} gs_stitched_external;
struct
{
- epg_id_t gs_epg;
+ sclass_t gs_sclass;
} gs_l3_out;
};
@@ -155,15 +155,15 @@ gbp_subnet_internal_add (gbp_subnet_t * gs)
}
static int
-gbp_subnet_external_add (gbp_subnet_t * gs, u32 sw_if_index, epg_id_t epg)
+gbp_subnet_external_add (gbp_subnet_t * gs, u32 sw_if_index, sclass_t sclass)
{
dpo_id_t gpd = DPO_INVALID;
- gs->gs_stitched_external.gs_epg = epg;
+ gs->gs_stitched_external.gs_sclass = sclass;
gs->gs_stitched_external.gs_sw_if_index = sw_if_index;
gbp_policy_dpo_add_or_lock (fib_proto_to_dpo (gs->gs_key->gsk_pfx.fp_proto),
- gs->gs_stitched_external.gs_epg,
+ gs->gs_stitched_external.gs_sclass,
gs->gs_stitched_external.gs_sw_if_index, &gpd);
gs->gs_fei = fib_table_entry_special_dpo_update (gs->gs_key->gsk_fib_index,
@@ -179,14 +179,14 @@ gbp_subnet_external_add (gbp_subnet_t * gs, u32 sw_if_index, epg_id_t epg)
}
static int
-gbp_subnet_l3_out_add (gbp_subnet_t * gs, u32 sw_if_index, epg_id_t epg)
+gbp_subnet_l3_out_add (gbp_subnet_t * gs, u32 sw_if_index, sclass_t sclass)
{
dpo_id_t gpd = DPO_INVALID;
- gs->gs_l3_out.gs_epg = epg;
+ gs->gs_l3_out.gs_sclass = sclass;
gbp_policy_dpo_add_or_lock (fib_proto_to_dpo (gs->gs_key->gsk_pfx.fp_proto),
- gs->gs_l3_out.gs_epg, ~0, &gpd);
+ gs->gs_l3_out.gs_sclass, ~0, &gpd);
gs->gs_fei = fib_table_entry_special_dpo_add (gs->gs_key->gsk_fib_index,
&gs->gs_key->gsk_pfx,
@@ -238,7 +238,7 @@ gbp_subnet_del (u32 rd_id, const fib_prefix_t * pfx)
int
gbp_subnet_add (u32 rd_id,
const fib_prefix_t * pfx,
- gbp_subnet_type_t type, u32 sw_if_index, epg_id_t epg)
+ gbp_subnet_type_t type, u32 sw_if_index, sclass_t sclass)
{
gbp_route_domain_t *grd;
index_t grdi, gsi;
@@ -273,13 +273,13 @@ gbp_subnet_add (u32 rd_id,
rv = gbp_subnet_internal_add (gs);
break;
case GBP_SUBNET_STITCHED_EXTERNAL:
- rv = gbp_subnet_external_add (gs, sw_if_index, epg);
+ rv = gbp_subnet_external_add (gs, sw_if_index, sclass);
break;
case GBP_SUBNET_TRANSPORT:
rv = gbp_subnet_transport_add (gs);
break;
case GBP_SUBNET_L3_OUT:
- rv = gbp_subnet_l3_out_add (gs, sw_if_index, epg);
+ rv = gbp_subnet_l3_out_add (gs, sw_if_index, sclass);
break;
}
@@ -292,9 +292,9 @@ gbp_subnet_walk (gbp_subnet_cb_t cb, void *ctx)
gbp_route_domain_t *grd;
gbp_subnet_t *gs;
u32 sw_if_index;
- epg_id_t epg;
+ sclass_t sclass;
- epg = EPG_INVALID;
+ sclass = SCLASS_INVALID;
sw_if_index = ~0;
/* *INDENT-OFF* */
@@ -310,15 +310,15 @@ gbp_subnet_walk (gbp_subnet_cb_t cb, void *ctx)
break;
case GBP_SUBNET_STITCHED_EXTERNAL:
sw_if_index = gs->gs_stitched_external.gs_sw_if_index;
- epg = gs->gs_stitched_external.gs_epg;
+ sclass = gs->gs_stitched_external.gs_sclass;
break;
case GBP_SUBNET_L3_OUT:
- epg = gs->gs_l3_out.gs_epg;
+ sclass = gs->gs_l3_out.gs_sclass;
break;
}
if (WALK_STOP == cb (grd->grd_id, &gs->gs_key->gsk_pfx,
- gs->gs_type, sw_if_index, epg, ctx))
+ gs->gs_type, sw_if_index, sclass, ctx))
break;
}));
/* *INDENT-ON* */
@@ -373,12 +373,12 @@ format_gbp_subnet (u8 * s, va_list * args)
case GBP_SUBNET_TRANSPORT:
break;
case GBP_SUBNET_STITCHED_EXTERNAL:
- s = format (s, " {epg:%d %U}", gs->gs_stitched_external.gs_epg,
+ s = format (s, " {sclass:%d %U}", gs->gs_stitched_external.gs_sclass,
format_vnet_sw_if_index_name,
vnet_get_main (), gs->gs_stitched_external.gs_sw_if_index);
break;
case GBP_SUBNET_L3_OUT:
- s = format (s, " {epg:%d}", gs->gs_l3_out.gs_epg);
+ s = format (s, " {sclass:%d}", gs->gs_l3_out.gs_sclass);
break;
}
diff --git a/src/plugins/gbp/gbp_subnet.h b/src/plugins/gbp/gbp_subnet.h
index 5fbd4b23df0..b792a1bafcb 100644
--- a/src/plugins/gbp/gbp_subnet.h
+++ b/src/plugins/gbp/gbp_subnet.h
@@ -29,7 +29,7 @@ typedef enum gbp_subnet_type_t_
extern int gbp_subnet_add (u32 rd_id,
const fib_prefix_t * pfx,
gbp_subnet_type_t type,
- u32 sw_if_index, epg_id_t epg);
+ u32 sw_if_index, sclass_t sclass);
extern int gbp_subnet_del (u32 rd_id, const fib_prefix_t * pfx);
@@ -37,7 +37,7 @@ typedef walk_rc_t (*gbp_subnet_cb_t) (u32 rd_id,
const fib_prefix_t * pfx,
gbp_subnet_type_t type,
u32 sw_if_index,
- epg_id_t epg, void *ctx);
+ sclass_t sclass, void *ctx);
extern void gbp_subnet_walk (gbp_subnet_cb_t cb, void *ctx);
diff --git a/src/plugins/gbp/gbp_types.h b/src/plugins/gbp/gbp_types.h
index 0faa74b694e..5bd9735e08b 100644
--- a/src/plugins/gbp/gbp_types.h
+++ b/src/plugins/gbp/gbp_types.h
@@ -18,8 +18,10 @@
#include <vnet/vnet.h>
-typedef u16 epg_id_t;
-#define EPG_INVALID ((u16)~0)
+typedef u32 vnid_t;
+#define VNID_INVALID ((u16)~0)
+
+typedef u16 sclass_t;
#define SCLASS_INVALID ((u16)~0)
#endif
diff --git a/src/plugins/gbp/gbp_vxlan.c b/src/plugins/gbp/gbp_vxlan.c
index c0e88fdda8e..286345ed8fa 100644
--- a/src/plugins/gbp/gbp_vxlan.c
+++ b/src/plugins/gbp/gbp_vxlan.c
@@ -18,7 +18,6 @@
#include <plugins/gbp/gbp_learn.h>
#include <plugins/gbp/gbp_bridge_domain.h>
#include <plugins/gbp/gbp_route_domain.h>
-#include <plugins/gbp/gbp_sclass.h>
#include <vnet/vxlan-gbp/vxlan_gbp.h>
#include <vlibmemory/api.h>
@@ -169,9 +168,8 @@ gdb_vxlan_dep_add (gbp_vxlan_tunnel_t * gt,
vxr->vxr_itf = gbp_itf_add_and_lock (vxr->vxr_sw_if_index,
gt->gt_bd_index);
- ofeat = (L2OUTPUT_FEAT_GBP_POLICY_MAC |
- L2OUTPUT_FEAT_GBP_ID_2_SCLASS);
- ifeat = L2INPUT_FEAT_GBP_SCLASS_2_ID;
+ ofeat = L2OUTPUT_FEAT_GBP_POLICY_MAC;
+ ifeat = L2INPUT_FEAT_NONE;
if (!(gbd->gb_flags & GBP_BD_FLAG_DO_NOT_LEARN))
ifeat |= L2INPUT_FEAT_GBP_LEARN;
@@ -193,7 +191,6 @@ gdb_vxlan_dep_add (gbp_vxlan_tunnel_t * gt,
grd->grd_table_id[fproto], 1);
gbp_learn_enable (vxr->vxr_sw_if_index, GBP_LEARN_MODE_L3);
- gbp_sclass_enable_ip (vxr->vxr_sw_if_index);
}
}
@@ -283,7 +280,6 @@ gdb_vxlan_dep_del (index_t vxri)
FOR_EACH_FIB_IP_PROTOCOL (fproto)
ip_table_bind (fproto, vxr->vxr_sw_if_index, 0, 0);
- gbp_sclass_disable_ip (vxr->vxr_sw_if_index);
gbp_learn_disable (vxr->vxr_sw_if_index, GBP_LEARN_MODE_L3);
}
@@ -541,7 +537,6 @@ gbp_vxlan_tunnel_add (u32 vni, gbp_vxlan_tunnel_layer_t layer,
gt->gt_itf = gbp_itf_add_and_lock (gt->gt_sw_if_index,
gt->gt_bd_index);
gbp_learn_enable (gt->gt_sw_if_index, GBP_LEARN_MODE_L2);
- gbp_sclass_enable_l2 (gt->gt_sw_if_index);
}
else
{
@@ -554,7 +549,6 @@ gbp_vxlan_tunnel_add (u32 vni, gbp_vxlan_tunnel_layer_t layer,
grd->grd_vni_sw_if_index = gt->gt_sw_if_index;
gbp_learn_enable (gt->gt_sw_if_index, GBP_LEARN_MODE_L3);
- gbp_sclass_enable_ip (gt->gt_sw_if_index);
ip4_sw_interface_enable_disable (gt->gt_sw_if_index, 1);
ip6_sw_interface_enable_disable (gt->gt_sw_if_index, 1);
@@ -620,7 +614,6 @@ gbp_vxlan_tunnel_del (u32 vni)
if (GBP_VXLAN_TUN_L2 == gt->gt_layer)
{
gbp_learn_disable (gt->gt_sw_if_index, GBP_LEARN_MODE_L2);
- gbp_sclass_disable_l2 (gt->gt_sw_if_index);
gbp_itf_unlock (gt->gt_itf);
gbp_bridge_domain_unlock (gt->gt_gbd);
}
@@ -635,7 +628,6 @@ gbp_vxlan_tunnel_del (u32 vni)
ip6_sw_interface_enable_disable (gt->gt_sw_if_index, 0);
gbp_learn_disable (gt->gt_sw_if_index, GBP_LEARN_MODE_L3);
- gbp_sclass_disable_ip (gt->gt_sw_if_index);
gbp_route_domain_unlock (gt->gt_grd);
}
diff --git a/src/plugins/gbp/gbp_vxlan_node.c b/src/plugins/gbp/gbp_vxlan_node.c
index c49f74af879..413a9f47e1b 100644
--- a/src/plugins/gbp/gbp_vxlan_node.c
+++ b/src/plugins/gbp/gbp_vxlan_node.c
@@ -17,7 +17,6 @@
#include <plugins/gbp/gbp_learn.h>
#include <plugins/gbp/gbp_bridge_domain.h>
#include <plugins/gbp/gbp_route_domain.h>
-#include <plugins/gbp/gbp_sclass.h>
#include <vnet/vxlan-gbp/vxlan_gbp.h>
#include <vlibmemory/api.h>