85 *sw_if_index = key->
key[1];
97 clib_bihash_search_16_8 (&gbp_ep_by_mac_itf_db.
gte_table, &key, &value);
109 key->
key[0] = ip->as_u64[0];
110 key->
key[1] = ip->as_u64[1];
118 ip->as_u64[0] = key->
key[0];
119 ip->as_u64[1] = key->
key[1];
120 *sw_if_index = key->
key[2];
131 rv = clib_bihash_search_24_8 (&gbp_ep_by_ip_itf_db.
gte_table, &key, &value);
160 rv = clib_bihash_add_del_16_8 (&gbp_ep_by_mac_itf_db.
gte_table, &key, 1);
175 rv = clib_bihash_add_del_24_8 (&gbp_ep_by_ip_itf_db.
gte_table, &key, 1);
203 clib_bihash_add_del_16_8 (&gbp_ep_by_mac_itf_db.
gte_table, &key, 0);
213 clib_bihash_add_del_24_8 (&gbp_ep_by_ip_itf_db.
gte_table, &key, 0);
232 return (gbpe - gbp_endpoint_pool);
237 const ip46_address_t *
ips,
241 const ip46_address_t *ip;
248 return (VNET_API_ERROR_NO_SUCH_ENTRY);
352 const ip46_address_t *ip;
400 else if (
unformat (input,
"epg %d", &epg_id))
402 else if (
unformat (input,
"handle %d", &handle))
416 if (~0 == sw_if_index)
451 .path =
"gbp endpoint",
452 .short_help =
"gbp endpoint [del] <interface> epg <ID> ip <IP> mac <MAC>",
462 const ip46_address_t *ip;
467 s =
format (s,
"[@%d] ", gbpei);
470 s =
format (s,
", IPs:[");
509 sw_if_index, kvp->
value);
526 sw_if_index, kvp->
value);
540 if (
unformat (input,
"%d", &handle))
542 else if (
unformat (input,
"db", &handle))
555 clib_bihash_foreach_key_value_pair_24_8 (&gbp_ep_by_ip_itf_db.
gte_table,
557 clib_bihash_foreach_key_value_pair_16_8
566 gbp_ep_by_itf_db.
gte_vec[sw_if_index]);
587 .path =
"show gbp endpoint",
588 .short_help =
"show gbp endpoint\n",
593 #define GBP_EP_HASH_NUM_BUCKETS (2 * 1024) 594 #define GBP_EP_HASH_MEMORY_SIZE (1 << 20) 599 clib_bihash_init_24_8 (&gbp_ep_by_ip_itf_db.
gte_table,
600 "GBP Endpoints - IP/Interface",
603 clib_bihash_init_16_8 (&gbp_ep_by_mac_itf_db.
gte_table,
604 "GBP Endpoints - MAC/Interface",
u32 ge_sw_if_index
The interface on which the EP is connected.
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static bool gbp_endpoint_add_mac_itf(const mac_address_t *mac, u32 sw_if_index, index_t gbpei)
static void gbp_endpoint_mk_key_mac_itf(const mac_address_t *mac, u32 sw_if_index, clib_bihash_kv_16_8_t *key)
#define vec_foreach_index(var, v)
Iterate over vector indices.
static gbp_endpoint_t * gbp_endpoint_get(index_t gbpei)
Get the endpoint from a port/interface.
A Group Based Policy Endpoint.
gbp_endpoint_t * gbp_endpoint_find_itf(u32 sw_if_index)
#define GBP_EP_HASH_NUM_BUCKETS
vnet_main_t * vnet_get_main(void)
static void gbp_endpoint_walk_mac_itf(const clib_bihash_kv_16_8_t *kvp, void *arg)
static void gbp_endpoint_walk_ip_itf(const clib_bihash_kv_24_8_t *kvp, void *arg)
void gbp_endpoint_delete(u32 handle)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
mac_address_t ge_mac
MAC address of the endpoint.
static_always_inline int mac_address_is_zero(const mac_address_t *mac)
unformat_function_t unformat_vnet_sw_interface
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
format_function_t format_vnet_sw_if_index_name
enum walk_rc_t_ walk_rc_t
Walk return code.
gbp_endpoint_t * gbp_endpoint_pool
Pool of GBP endpoints.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
clib_bihash_24_8_t gte_table
#define VLIB_INIT_FUNCTION(x)
gbp_endpoint_group_t * gbp_endpoint_group_find(epg_id_t epg_id)
#define clib_error_return(e, args...)
static void gbp_endpoint_extract_key_ip_itf(const clib_bihash_kv_24_8_t *key, ip46_address_t *ip, u32 *sw_if_index)
void l2output_intf_bitmap_enable(u32 sw_if_index, u32 feature_bitmap, u32 enable)
Enable (or disable) the feature in the bitmap for the given interface.
static void gbp_endpoint_add_itf(u32 sw_if_index, index_t gbpei)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static walk_rc_t gbp_endpoint_show_one(gbp_endpoint_t *gbpe, void *ctx)
#define pool_put(P, E)
Free an object E in pool P.
gbp_ep_by_mac_itf_db_t gbp_ep_by_mac_itf_db
gbp_ep_by_itf_db_t gbp_ep_by_itf_db
DP functions and databases.
clib_bihash_16_8_t gte_table
static void gbp_endpoint_del_ip_itf(const ip46_address_t *ip, u32 sw_if_index)
An Endpoint Group representation.
#define ip46_address_initializer
gbp_endpoint_t * gbp_endpoint_find_ip_itf(const ip46_address_t *ip, u32 sw_if_index)
Interface to source EPG DB - a per-interface vector.
#define ip46_address_is_ip4(ip46)
static void gbp_endpoint_del_itf(u32 sw_if_index)
void gbp_endpoint_walk(gbp_endpoint_cb_t cb, void *ctx)
#define vec_free(V)
Free vector's memory (no header).
static_always_inline void mac_address_from_u64(u64 u, mac_address_t *mac)
ip46_address_t * ge_ips
A vector of ip addresses that below to the endpoint.
int gbp_endpoint_update(u32 sw_if_index, const ip46_address_t *ips, const mac_address_t *mac, epg_id_t epg_id, u32 *handle)
void send_ip6_na_w_addr(vlib_main_t *vm, const ip6_address_t *addr, u32 sw_if_index)
static_always_inline void ip46_address_copy(ip46_address_t *dst, const ip46_address_t *src)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
uword unformat_mac_address(unformat_input_t *input, va_list *args)
static clib_error_t * gbp_endpoint_init(vlib_main_t *vm)
walk_rc_t(* gbp_endpoint_cb_t)(gbp_endpoint_t *gbpe, void *ctx)
void send_ip4_garp_w_addr(vlib_main_t *vm, const ip4_address_t *ip4_addr, u32 sw_if_index)
#define VLIB_CLI_COMMAND(x,...)
static void gbp_endpoint_del_mac_itf(const mac_address_t *mac, u32 sw_if_index)
u8 * format_gbp_endpoint(u8 *s, va_list *args)
const mac_address_t ZERO_MAC_ADDRESS
u32 gepg_uplink_sw_if_index
the uplink interface dedicated to the EPG
gbp_endpoint_t * gbp_endpoint_find_mac_itf(const mac_address_t *mac, u32 sw_if_index)
static clib_error_t * gbp_endpoint_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void gbp_endpoint_mk_key_ip_itf(const ip46_address_t *ip, u32 sw_if_index, clib_bihash_kv_24_8_t *key)
static vlib_main_t * vlib_get_main(void)
#define ip46_address_reset(ip46)
gbp_ep_by_ip_itf_db_t gbp_ep_by_ip_itf_db
static_always_inline u64 mac_address_as_u64(const mac_address_t *mac)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
epg_id_t ge_epg_id
The endpoint's designated EPG.
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
u8 * format_mac_address_t(u8 *s, va_list *args)
static bool gbp_endpoint_add_ip_itf(const ip46_address_t *ip, u32 sw_if_index, index_t gbpei)
static index_t gbp_endpoint_index(const gbp_endpoint_t *gbpe)
vl_api_address_t ips[n_ips]
#define vec_foreach(var, vec)
Vector iterator.
static void gbp_endpoint_extract_key_mac_itf(const clib_bihash_kv_16_8_t *key, mac_address_t *mac, u32 *sw_if_index)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
#define GBP_EP_HASH_MEMORY_SIZE
static clib_error_t * gbp_endpoint_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)