35 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 41 #define vl_api_version(n,v) static u32 api_version=(v); 45 #define REPLY_MSG_ID_BASE mm->msg_id_base 69 rmp->
index = ntohl(index);
78 vl_api_map_del_domain_reply_t *rmp;
90 vl_api_map_del_domain_reply_t *rmp;
119 rmp = vl_msg_api_alloc (sizeof (*rmp));
120 rmp->_vl_msg_id = htons(VL_API_MAP_DOMAIN_DETAILS + mm->msg_id_base);
121 rmp->context = mp->context;
122 rmp->domain_index = htonl(d - mm->domains);
123 clib_memcpy(&rmp->ip6_prefix.prefix, &d->ip6_prefix, sizeof(rmp->ip6_prefix.prefix));
124 clib_memcpy(&rmp->ip4_prefix.prefix, &d->ip4_prefix, sizeof(rmp->ip4_prefix.prefix));
125 clib_memcpy(&rmp->ip6_src.prefix, &d->ip6_src, sizeof(rmp->ip6_src.prefix));
126 rmp->ip6_prefix.len = d->ip6_prefix_len;
127 rmp->ip4_prefix.len = d->ip4_prefix_len;
128 rmp->ip6_src.len = d->ip6_src_len;
129 rmp->ea_bits_len = d->ea_bits_len;
130 rmp->psid_offset = d->psid_offset;
131 rmp->psid_length = d->psid_length;
132 rmp->flags = d->flags;
133 rmp->mtu = htons(d->mtu);
135 vl_api_send_msg (reg, (u8 *) rmp);
173 rmp->_vl_msg_id = ntohs (VL_API_MAP_RULE_DETAILS + mm->
msg_id_base);
174 rmp->
psid = htons (i);
198 rmp->_vl_msg_id = htons (VL_API_MAP_SUMMARY_STATS_REPLY + mm->
msg_id_base);
209 clib_memset (total_bytes, 0,
sizeof (total_bytes));
219 total_pkts[which] += v.
packets;
220 total_bytes[which] += v.
bytes;
230 clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_RX]);
234 clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_TX]);
265 vl_api_map_param_set_fragmentation_reply_t *rmp;
270 REPLY_MACRO (VL_API_MAP_PARAM_SET_FRAGMENTATION_REPLY);
279 if (icmp_src_address == 0)
292 vl_api_map_param_set_icmp_reply_t *rmp;
315 vl_api_map_param_set_icmp6_reply_t *rmp;
329 vl_api_map_param_add_del_pre_resolve_reply_t *rmp;
335 REPLY_MACRO (VL_API_MAP_PARAM_ADD_DEL_PRE_RESOLVE_REPLY);
344 f64 ht_ratio,
u32 * reass,
u32 * packets)
346 u32 ps_reass = 0, ps_packets = 0;
347 u32 ht_reass = 0, ht_packets = 0;
351 if (pool_size != (
u16) ~ 0)
356 (pool_size, &ps_reass, &ps_packets))
368 if (lifetime_ms != (
u16) ~ 0)
393 if (pool_size != (
u16) ~ 0)
398 (pool_size, &ps_reass, &ps_packets))
410 if (lifetime_ms != (
u16) ~ 0)
435 *reass = ps_reass + ht_reass;
438 *packets = ps_packets + ht_packets;
449 vl_api_map_param_set_reassembly_reply_t *rmp;
450 u32 reass = 0, packets = 0;
454 ht_ratio = (
f64) clib_net_to_host_u64 (mp->
ht_ratio);
461 clib_net_to_host_u32 (mp->
buffers),
462 ht_ratio, &reass, &packets);
468 REPLY_MACRO (VL_API_MAP_PARAM_SET_REASSEMBLY_REPLY);
488 vl_api_map_param_set_security_check_reply_t *rmp;
493 REPLY_MACRO (VL_API_MAP_PARAM_SET_SECURITY_CHECK_REPLY);
513 vl_api_map_param_set_traffic_class_reply_t *rmp;
518 REPLY_MACRO (VL_API_MAP_PARAM_SET_TRAFFIC_CLASS_REPLY);
537 vl_api_map_param_set_tcp_reply_t *rmp;
557 rmp->_vl_msg_id = htons (VL_API_MAP_PARAM_GET_REPLY + mm->
msg_id_base);
607 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
609 is_enable = ! !is_enable;
624 if (is_translation ==
false)
627 is_enable ? 1 : 0, 0, 0);
629 is_enable ? 1 : 0, 0, 0);
637 is_enable ? 1 : 0, 0, 0);
639 is_enable ? 1 : 0, 0, 0);
653 vl_api_map_if_enable_disable_reply_t *rmp;
667 #define foreach_map_plugin_api_msg \ 668 _(MAP_ADD_DOMAIN, map_add_domain) \ 669 _(MAP_DEL_DOMAIN, map_del_domain) \ 670 _(MAP_ADD_DEL_RULE, map_add_del_rule) \ 671 _(MAP_DOMAIN_DUMP, map_domain_dump) \ 672 _(MAP_RULE_DUMP, map_rule_dump) \ 673 _(MAP_IF_ENABLE_DISABLE, map_if_enable_disable) \ 674 _(MAP_SUMMARY_STATS, map_summary_stats) \ 675 _(MAP_PARAM_SET_FRAGMENTATION, map_param_set_fragmentation) \ 676 _(MAP_PARAM_SET_ICMP, map_param_set_icmp) \ 677 _(MAP_PARAM_SET_ICMP6, map_param_set_icmp6) \ 678 _(MAP_PARAM_ADD_DEL_PRE_RESOLVE, map_param_add_del_pre_resolve) \ 679 _(MAP_PARAM_SET_REASSEMBLY, map_param_set_reassembly) \ 680 _(MAP_PARAM_SET_SECURITY_CHECK, map_param_set_security_check) \ 681 _(MAP_PARAM_SET_TRAFFIC_CLASS, map_param_set_traffic_class) \ 682 _(MAP_PARAM_SET_TCP, map_param_set_tcp) \ 683 _(MAP_PARAM_GET, map_param_get) 685 #define vl_msg_name_crc_list 687 #undef vl_msg_name_crc_list 692 #define _(id,n,crc) \ 693 vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + mm->msg_id_base); 694 foreach_vl_msg_name_crc_map;
709 vl_msg_api_set_handlers((VL_API_##N + mm->msg_id_base), \ 711 vl_api_##n##_t_handler, \ 713 vl_api_##n##_t_endian, \ 714 vl_api_##n##_t_print, \ 715 sizeof(vl_api_##n##_t), 1);
static void vl_api_map_param_set_tcp_t_handler(vl_api_map_param_set_tcp_t *mp)
int map_add_del_psid(u32 map_domain_index, u16 psid, ip6_address_t *tep, bool is_add)
static void vl_api_map_if_enable_disable_t_handler(vl_api_map_if_enable_disable_t *mp)
u32 ip4_reass_conf_buffers
static void vl_api_map_param_set_icmp_t_handler(vl_api_map_param_set_icmp_t *mp)
#define MAP_IP6_REASS_CONF_BUFFERS_MAX
Set MAP traffic class parameters.
Add or Delete MAP rule from a domain (Only used for shared IPv4 per subscriber)
int map_delete_domain(u32 map_domain_index)
static void vl_api_map_domain_dump_t_handler(vl_api_map_domain_dump_t *mp)
vnet_interface_main_t interface_main
vl_api_ip6_prefix_t ip6_src
#define REPLY_MACRO2(t, body)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
Add/delete MAP pre-resolve IP addresses parameters.
u64 map_error_counter_get(u32 node_index, map_error_t map_error)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
static void vl_api_map_param_set_security_check_t_handler(vl_api_map_param_set_security_check_t *mp)
static void map_domain_counter_unlock(map_main_t *mm)
Combined counter to hold both packets and byte differences.
u64 total_security_check[2]
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
static void vl_api_map_param_set_traffic_class_t_handler(vl_api_map_param_set_traffic_class_t *mp)
vlib_node_registration_t ip4_map_node
(constructor) VLIB_REGISTER_NODE (ip4_map_node)
int map_param_set_traffic_class(bool copy, u8 tc)
uword * bm_trans_enabled_by_sw_if
#define MAP_ERR_BAD_HT_RATIO
void map_pre_resolve(ip4_address_t *ip4, ip6_address_t *ip6, bool is_del)
void * vl_msg_api_alloc(int nbytes)
static void vl_api_map_param_set_icmp6_t_handler(vl_api_map_param_set_icmp6_t *mp)
int map_ip6_reass_conf_ht_ratio(f32 ht_ratio, u32 *trashed_reass, u32 *dropped_packets)
static void vl_api_map_add_del_rule_t_handler(vl_api_map_add_del_rule_t *mp)
#define MAP_IP6_REASS_CONF_LIFETIME_MAX
static void vl_api_map_summary_stats_t_handler(vl_api_map_summary_stats_t *mp)
vl_api_ip6_address_t ip6_dst
#define clib_memcpy(d, s, n)
int map_param_set_security_check(bool enable, bool fragments)
#define MAP_ERR_BAD_BUFFERS_TOO_LARGE
#define MAP_IP4_REASS_MAX_FRAGMENTS_PER_REASSEMBLY
static void vl_api_map_add_domain_t_handler(vl_api_map_add_domain_t *mp)
vl_api_ip4_prefix_t ip4_prefix
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
vlib_combined_counter_main_t * domain_counters
ip4_address_t icmp4_src_address
Reply for map_param_get request.
#define MAP_IP4_REASS_CONF_LIFETIME_MAX
static void vl_api_map_del_domain_t_handler(vl_api_map_del_domain_t *mp)
Set MAP fragmentation parameters.
static void vl_api_map_param_add_del_pre_resolve_t_handler(vl_api_map_param_add_del_pre_resolve_t *mp)
#define MAP_IP6_REASS_CONF_POOL_SIZE_MAX
int map_param_set_icmp6(u8 enable_unreachable)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
int map_ip6_reass_conf_buffers(u32 buffers)
counter_t packets
packet counter
int map_if_enable_disable(bool is_enable, u32 sw_if_index, bool is_translation)
int map_ip4_reass_conf_lifetime(u16 lifetime_ms)
clib_error_t * map_plugin_api_hookup(vlib_main_t *vm)
bool icmp6_enable_unreachable
#define MAP_IP4_REASS_CONF_HT_RATIO_MAX
static void vl_api_map_rule_dump_t_handler(vl_api_map_rule_dump_t *mp)
u32 vlib_combined_counter_n_counters(const vlib_combined_counter_main_t *cm)
The number of counters (not the number of per-thread counters)
u16 ip4_reass_conf_pool_size
vl_api_ip4_address_t ip4_nh_address
static void vl_api_map_param_get_t_handler(vl_api_map_param_get_t *mp)
vl_api_ip4_address_t ip4_nh_address
int map_ip4_reass_conf_buffers(u32 buffers)
int map_ip6_reass_conf_lifetime(u16 lifetime_ms)
int map_ip4_reass_conf_pool_size(u16 pool_size, u32 *trashed_reass, u32 *dropped_packets)
#define MAP_ERR_BAD_BUFFERS
static void setup_message_id_table(map_main_t *mm, api_main_t *am)
int map_param_set_reassembly(bool is_ipv6, u16 lifetime_ms, u16 pool_size, u32 buffers, f64 ht_ratio, u32 *reass, u32 *packets)
API main structure, used by both vpp and binary API clients.
Request for a single block of MAP parameters.
int map_param_set_tcp(u16 tcp_mss)
An API client registration, only in vpp/vlib.
#define BAD_SW_IF_INDEX_LABEL
static void vl_api_map_param_set_fragmentation_t_handler(vl_api_map_param_set_fragmentation_t *mp)
u16 ip6_reass_conf_pool_size
Enable or disable a MAP interface.
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...
vl_api_ip6_address_t ip6_nh_address
uword * bm_encap_enabled_by_sw_if
#define vec_free(V)
Free vector's memory (no header).
int map_create_domain(ip4_address_t *ip4_prefix, u8 ip4_prefix_len, ip6_address_t *ip6_prefix, u8 ip6_prefix_len, ip6_address_t *ip6_src, u8 ip6_src_len, u8 ea_bits_len, u8 psid_offset, u8 psid_length, u32 *map_domain_index, u16 mtu, u8 flags)
Set MAP ICMP6 parameters.
Reply for map_summary_stats request.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
vl_api_ip6_address_t ip6_dst
int map_ip4_reass_conf_ht_ratio(f32 ht_ratio, u32 *trashed_reass, u32 *dropped_packets)
static void map_domain_counter_lock(map_main_t *mm)
f32 ip4_reass_conf_ht_ratio
int map_param_set_icmp(ip4_address_t *icmp_src_address)
int map_ip6_reass_conf_pool_size(u16 pool_size, u32 *trashed_reass, u32 *dropped_packets)
vl_api_ip6_address_t ip6_nh_address
Request for a single block of summary stats.
Reply for MAP domain add.
#define MAP_ERR_BAD_POOL_SIZE
#define foreach_map_plugin_api_msg
f32 ip6_reass_conf_ht_ratio
counter_t bytes
byte counter
Set MAP security-check parameters.
vl_api_ip4_address_t ip4_err_relay_src
u16 ip6_reass_conf_lifetime_ms
#define MAP_IP6_REASS_CONF_HT_RATIO_MAX
vnet_sw_interface_t * sw_interfaces
A collection of combined counters.
#define MAP_IP4_REASS_CONF_POOL_SIZE_MAX
vl_api_ip4_address_t icmp_ip4_err_relay_src
vl_api_ip6_prefix_t ip6_prefix
static void vl_api_map_param_set_reassembly_t_handler(vl_api_map_param_set_reassembly_t *mp)
#define MAP_IP6_REASS_MAX_FRAGMENTS_PER_REASSEMBLY
u16 ip4_reass_conf_lifetime_ms
#define vec_foreach(var, vec)
Vector iterator.
#define MAP_IP4_REASS_CONF_BUFFERS_MAX
#define MAP_ERR_BAD_LIFETIME
Set MAP reassembly parameters.
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
#define VALIDATE_SW_IF_INDEX(mp)
int map_param_set_fragmentation(bool inner, bool ignore_df)
u16 vl_msg_api_get_msg_ids(const char *name, int n)
u32 ip6_reass_conf_buffers
static uword pool_elts(void *v)
Number of active elements in a pool.