|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
28 #define _(sym,string) string,
47 #define GBP_CONTRACT_DBG(...) \
48 vlib_log_notice (gc_logger, __VA_ARGS__);
52 .
name =
"gbp-contracts-permit",
53 .stat_segment_name =
"/net/gbp/contract/permit",
57 .
name =
"gbp-contracts-drop",
58 .stat_segment_name =
"/net/gbp/contract/drop",
162 s =
format (s,
"%U, %U, %U EP:%d",
177 #define _(v,a) case GBP_RULE_##v: return (format (s, "%s", a));
182 return (
format (s,
"unknown"));
192 #define _(v,a) case GBP_HASH_MODE_##v: return (format (s, "%s", a));
197 return (
format (s,
"unknown"));
207 #define _(v,a) case GBP_POLICY_NODE_##v: return (format (s, "%s", a));
212 return (
format (s,
"unknown"));
229 case GBP_RULE_PERMIT:
232 case GBP_RULE_REDIRECT:
252 &gu->
gu_dpo[pnode][fproto], 8);
268 old_ai = gnh->
gnh_ai[fproto];
279 ETHERNET_TYPE_IP4 : ETHERNET_TYPE_IP6));
297 switch (gu_hash_mode)
299 case GBP_HASH_MODE_SRC_IP:
300 return IP_FLOW_HASH_SRC_ADDR;
301 case GBP_HASH_MODE_DST_IP:
302 return IP_FLOW_HASH_DST_ADDR;
303 case GBP_HASH_MODE_SYMMETRIC:
304 return (IP_FLOW_HASH_SRC_ADDR | IP_FLOW_HASH_DST_ADDR |
305 IP_FLOW_HASH_PROTO | IP_FLOW_HASH_SYMMETRIC);
321 u32 policy_nodes[] = {
352 paths[ii].path_weight = 1;
354 dproto, gnh->
gnh_ai[fproto]);
484 if (~0 ==
gm->gbp_acl_user_id)
487 gm->gbp_acl_user_id =
488 gm->acl_plugin.register_user_module (
"GBP ACL",
"src-epg",
"dst-epg");
523 gm->acl_plugin.get_lookup_context_index (
gm->gbp_acl_user_id,
527 gm->acl_plugin.set_acl_vec_for_context (gc->
gc_lc_index, acl_vec);
561 return (VNET_API_ERROR_NO_SUCH_ENTRY);
632 .path =
"gbp contract",
634 "gbp contract [del] src-epg <ID> dst-epg <ID> acl-index <ACL>",
660 s =
format (s,
"[%d] %U: acl-index:%d",
663 s =
format (s,
"\n rules:");
669 s =
format (s,
"\n allowed-ethertypes:");
673 int host_et = clib_net_to_host_u16 (*et);
675 s =
format (s,
"0x%x, ", host_et);
679 s =
format (s,
"\n stats:");
750 .path =
"show gbp contract",
751 .short_help =
"show gbp contract [src <SRC>] [dst <DST>]\n",
gbp_next_hop_t * gbp_next_hop_pool
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
int(* gbp_contract_cb_t)(gbp_contract_t *gbpe, void *ctx)
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
enum gbp_policy_node_t_ gbp_policy_node_t
void gbp_rule_free(index_t gui)
static void gbp_contract_rules_free(index_t *rules)
static int gbp_contract_next_hop_resolve(index_t gui, index_t gnhi)
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
static clib_error_t * acl_plugin_exports_init(acl_plugin_methods_t *m)
static gbp_rule_t * gbp_rule_get(index_t gui)
static clib_error_t * gbp_contract_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void gbp_endpoint_child_remove(index_t gei, u32 sibling)
gbp_contract_key_t gc_key
source and destination EPGs
void gbp_endpoint_unlock(gbp_endpoint_src_t src, index_t gei)
char * gbp_contract_error_strings[]
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
vlib_main_t vlib_node_runtime_t * node
A FIB graph nodes virtual function table.
#define clib_error_return(e, args...)
index_t load_balance_create(u32 n_buckets, dpo_proto_t lb_proto, flow_hash_config_t fhc)
#define FIB_NODE_INDEX_INVALID
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
gbp_contract_db_t gbp_contract_db
Single contract DB instance.
u8 * format_gbp_bridge_domain(u8 *s, va_list *args)
gbp_contract_t * gbp_contract_pool
static gbp_endpoint_t * gbp_endpoint_get(index_t gbpei)
Get the endpoint from a port/interface.
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static fib_node_t * gbp_next_hop_get_node(fib_node_index_t index)
char * name
The counter collection's name.
vl_api_gbp_next_hop_t nhs[8]
static gbp_bridge_domain_t * gbp_bridge_domain_get(index_t i)
vlib_log_class_t gc_logger
u16 allowed_ethertypes[16]
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
#define pool_put_index(p, i)
Free pool element with given index.
acl_plugin_methods_t acl_plugin
int gbp_contract_delete(gbp_scope_t scope, sclass_t sclass, sclass_t dclass)
void load_balance_multipath_update(const dpo_id_t *dpo, const load_balance_path_t *raw_nhs, load_balance_flags_t flags)
#define hash_set(h, key, value)
vl_api_address_t ips[n_ips]
static u8 * format_gbp_next_hop(u8 *s, va_list *args)
u8 * format_gbp_rule_action(u8 *s, va_list *args)
#define pool_foreach(VAR, POOL)
Iterate through pool.
enum gbp_hash_mode_t_ gbp_hash_mode_t
static_always_inline void mac_address_copy(mac_address_t *dst, const mac_address_t *src)
static u8 * format_gbp_policy_node(u8 *s, va_list *args)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 gbp_endpoint_child_add(index_t gei, fib_node_type_t type, fib_node_index_t index)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Combined counter to hold both packets and byte differences.
u8 * format_mac_address_t(u8 *s, va_list *args)
enum flow_hash_config_t_ flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
adj_index_t adj_nbr_add_or_lock_w_rewrite(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index, u8 *rewrite)
Add (and lock) a new or lock an existing neighbour adjacency.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
static void gbp_next_hop_last_lock_gone(fib_node_t *node)
u32 fib_node_index_t
A typedef of a node index.
#define vec_foreach_index(var, v)
Iterate over vector indices.
static_always_inline void mac_address_to_bytes(const mac_address_t *mac, u8 *bytes)
uword * gc_hash
We can form a u64 key from the pair, so use a simple hash table.
static u8 * format_gbp_hash_mode(u8 *s, va_list *args)
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
u32 gbp_itf_get_sw_if_index(gbp_itf_hdl_t hdl)
static int dpo_id_is_valid(const dpo_id_t *dpoi)
Return true if the DPO object is valid, i.e.
vnet_link_t fib_proto_to_link(fib_protocol_t proto)
Convert from a protocol to a link type.
sclass_t gck_src
source and destination EPGs for which the ACL applies
static flow_hash_config_t gbp_contract_mk_lb_hp(gbp_hash_mode_t gu_hash_mode)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
static void gbp_contract_mk_lbs(index_t *guis)
void dpo_stack_from_node(u32 child_node_index, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child parent relationship.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static void gbp_contract_resolve(index_t *guis)
counter_t packets
packet counter
index_t gnh_ai[FIB_PROTOCOL_IP_MAX]
@ FIB_NODE_BACK_WALK_CONTINUE
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static u8 * format_gbp_contract_key(u8 *s, va_list *args)
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
static_always_inline void ip46_address_copy(ip46_address_t *dst, const ip46_address_t *src)
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject.
static vlib_cli_command_t gbp_contract_cli_node
(constructor) VLIB_CLI_COMMAND (gbp_contract_cli_node)
EPG src,dst pair to ACL mapping table, aka contract DB.
u8 * format_gbp_contract(u8 *s, va_list *args)
@ DPO_LOAD_BALANCE
load-balancing over a choice of [un]equal cost paths
static gbp_next_hop_t * gbp_next_hop_from_fib_node(fib_node_t *node)
static gbp_next_hop_t * gbp_next_hop_get(index_t gui)
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
#define vec_free(V)
Free vector's memory (no header).
int gbp_contract_update(gbp_scope_t scope, sclass_t sclass, sclass_t dclass, u32 acl_index, index_t *rules, u16 *allowed_ethertypes, u32 *stats_index)
static void gbp_contract_rule_resolve(index_t gui)
enum gbp_rule_action_t_ gbp_rule_action_t
fib_node_type_t gbp_next_hop_fib_type
int 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, sclass_t sclass, gbp_endpoint_flags_t flags, const ip46_address_t *tun_src, const ip46_address_t *tun_dst, u32 *handle)
vlib_combined_counter_main_t gbp_contract_permit_counters
description fragment has unexpected format
A collection of combined counters.
format_function_t format_ip46_address
static void gbp_contract_mk_adj(gbp_next_hop_t *gnh, fib_protocol_t fproto)
#define VLIB_INIT_FUNCTION(x)
gbp_hash_mode_t gu_hash_mode
counter_t bytes
byte counter
vlib_node_registration_t ip4_gbp_policy_dpo_node
(constructor) VLIB_REGISTER_NODE (ip4_gbp_policy_dpo_node)
vl_api_gbp_rule_t rules[n_rules]
#define vec_foreach(var, vec)
Vector iterator.
static clib_error_t * gbp_contract_init(vlib_main_t *vm)
#define FOR_EACH_GBP_POLICY_NODE(pnode)
static void gbp_contract_mk_one_lb(index_t gui)
A bridge Domain Representation.
gbp_rule_t * gbp_rule_pool
An node in the FIB graph.
#define hash_unset(h, key)
dpo_id_t gu_dpo[GBP_POLICY_N_NODES][FIB_PROTOCOL_IP_MAX]
DPO of the load-balance object used to redirect.
index_t gbp_rule_alloc(gbp_rule_action_t action, gbp_hash_mode_t hash_mode, index_t *nhs)
static gbp_contract_t * gbp_contract_get(index_t gci)
index_t * gc_rules
The ACL to apply for packets from the source to the destination EPG.
void fib_node_init(fib_node_t *node, fib_node_type_t type)
u32 gb_uu_fwd_sw_if_index
The BD's MAC spine-proxy interface (optional)
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
@ foreach_gbp_rule_action
void gbp_contract_walk(gbp_contract_cb_t cb, void *ctx)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
@ foreach_gbp_policy_node
vlib_combined_counter_main_t gbp_contract_drop_counters
A Group Based Policy Contract.
static fib_node_back_walk_rc_t gbp_next_hop_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Context passed between object during a back walk.
static vlib_cli_command_t gbp_contract_show_node
(constructor) VLIB_CLI_COMMAND (gbp_contract_show_node)
static u8 * format_gbp_rule(u8 *s, va_list *args)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
u16 * gc_allowed_ethertypes
An ethertype whitelist.
#define GBP_CONTRACT_DBG(...)
A Group Based Policy Endpoint.
#define foreach_gbp_contract_error
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
index_t gbp_next_hop_alloc(const ip46_address_t *ip, index_t grd, const mac_address_t *mac, index_t gbd)
static const fib_node_vft_t gbp_next_hop_vft
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
static clib_error_t * gbp_contract_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vl_api_mac_event_action_t action
Group Base Policy (GBP) defines:
One path from an [EU]CMP set that the client wants to add to a load-balance object.
vlib_node_registration_t gbp_policy_port_node
(constructor) VLIB_REGISTER_NODE (gbp_policy_port_node)
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
fib_node_type_t fib_node_register_new_type(const fib_node_vft_t *vft)
Create a new FIB node type and Register the function table for it.
gbp_rule_action_t gu_action
static void gbp_contract_mk_lb(index_t gui, fib_protocol_t fproto)
void gbp_route_domain_unlock(index_t index)
const mac_address_t * gbp_route_domain_get_local_mac(void)
void gbp_bridge_domain_unlock(index_t gbdi)
vlib_node_registration_t ip6_gbp_policy_dpo_node
(constructor) VLIB_REGISTER_NODE (ip6_gbp_policy_dpo_node)