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 71 rmp->
index = ntohl(index);
80 vl_api_map_del_domain_reply_t *rmp;
92 vl_api_map_del_domain_reply_t *rmp;
110 u32 map_domain_index;
122 map_domain_index = d - mm->domains;
123 de = vec_elt_at_index(mm->domain_extras, map_domain_index);
124 int tag_len = clib_min(ARRAY_LEN(rmp->tag), vec_len(de->tag) + 1);
127 rmp = vl_msg_api_alloc (sizeof (*rmp) + tag_len);
129 rmp->_vl_msg_id = htons(VL_API_MAP_DOMAIN_DETAILS + mm->msg_id_base);
130 rmp->context = mp->context;
131 rmp->domain_index = htonl(map_domain_index);
132 clib_memcpy(&rmp->ip6_prefix.address, &d->ip6_prefix, sizeof(rmp->ip6_prefix.address));
133 clib_memcpy(&rmp->ip4_prefix.address, &d->ip4_prefix, sizeof(rmp->ip4_prefix.address));
134 clib_memcpy(&rmp->ip6_src.address, &d->ip6_src, sizeof(rmp->ip6_src.address));
135 rmp->ip6_prefix.len = d->ip6_prefix_len;
136 rmp->ip4_prefix.len = d->ip4_prefix_len;
137 rmp->ip6_src.len = d->ip6_src_len;
138 rmp->ea_bits_len = d->ea_bits_len;
139 rmp->psid_offset = d->psid_offset;
140 rmp->psid_length = d->psid_length;
141 rmp->flags = d->flags;
142 rmp->mtu = htons(d->mtu);
143 memcpy(rmp->tag, de->tag, tag_len-1);
144 rmp->tag[tag_len-1] =
'\0';
146 vl_api_send_msg (reg, (u8 *) rmp);
184 rmp->_vl_msg_id = ntohs (VL_API_MAP_RULE_DETAILS + mm->
msg_id_base);
185 rmp->
psid = htons (i);
209 rmp->_vl_msg_id = htons (VL_API_MAP_SUMMARY_STATS_REPLY + mm->
msg_id_base);
220 clib_memset (total_bytes, 0,
sizeof (total_bytes));
230 total_pkts[which] += v.
packets;
231 total_bytes[which] += v.
bytes;
241 clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_RX]);
245 clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_TX]);
276 vl_api_map_param_set_fragmentation_reply_t *rmp;
281 REPLY_MACRO (VL_API_MAP_PARAM_SET_FRAGMENTATION_REPLY);
290 if (icmp_src_address == 0)
303 vl_api_map_param_set_icmp_reply_t *rmp;
326 vl_api_map_param_set_icmp6_reply_t *rmp;
340 vl_api_map_param_add_del_pre_resolve_reply_t *rmp;
346 REPLY_MACRO (VL_API_MAP_PARAM_ADD_DEL_PRE_RESOLVE_REPLY);
355 f64 ht_ratio,
u32 * reass,
u32 * packets)
357 u32 ps_reass = 0, ps_packets = 0;
358 u32 ht_reass = 0, ht_packets = 0;
362 if (pool_size != (
u16) ~ 0)
367 (pool_size, &ps_reass, &ps_packets))
379 if (lifetime_ms != (
u16) ~ 0)
404 if (pool_size != (
u16) ~ 0)
409 (pool_size, &ps_reass, &ps_packets))
421 if (lifetime_ms != (
u16) ~ 0)
446 *reass = ps_reass + ht_reass;
449 *packets = ps_packets + ht_packets;
460 vl_api_map_param_set_reassembly_reply_t *rmp;
461 u32 reass = 0, packets = 0;
472 clib_net_to_host_u32 (mp->
buffers),
473 ht_ratio, &reass, &packets);
479 REPLY_MACRO (VL_API_MAP_PARAM_SET_REASSEMBLY_REPLY);
499 vl_api_map_param_set_security_check_reply_t *rmp;
504 REPLY_MACRO (VL_API_MAP_PARAM_SET_SECURITY_CHECK_REPLY);
524 vl_api_map_param_set_traffic_class_reply_t *rmp;
529 REPLY_MACRO (VL_API_MAP_PARAM_SET_TRAFFIC_CLASS_REPLY);
548 vl_api_map_param_set_tcp_reply_t *rmp;
568 rmp->_vl_msg_id = htons (VL_API_MAP_PARAM_GET_REPLY + mm->
msg_id_base);
616 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
618 is_enable = ! !is_enable;
633 if (is_translation ==
false)
636 is_enable ? 1 : 0, 0, 0);
638 is_enable ? 1 : 0, 0, 0);
646 is_enable ? 1 : 0, 0, 0);
648 is_enable ? 1 : 0, 0, 0);
662 vl_api_map_if_enable_disable_reply_t *rmp;
676 #define foreach_map_plugin_api_msg \ 677 _(MAP_ADD_DOMAIN, map_add_domain) \ 678 _(MAP_DEL_DOMAIN, map_del_domain) \ 679 _(MAP_ADD_DEL_RULE, map_add_del_rule) \ 680 _(MAP_DOMAIN_DUMP, map_domain_dump) \ 681 _(MAP_RULE_DUMP, map_rule_dump) \ 682 _(MAP_IF_ENABLE_DISABLE, map_if_enable_disable) \ 683 _(MAP_SUMMARY_STATS, map_summary_stats) \ 684 _(MAP_PARAM_SET_FRAGMENTATION, map_param_set_fragmentation) \ 685 _(MAP_PARAM_SET_ICMP, map_param_set_icmp) \ 686 _(MAP_PARAM_SET_ICMP6, map_param_set_icmp6) \ 687 _(MAP_PARAM_ADD_DEL_PRE_RESOLVE, map_param_add_del_pre_resolve) \ 688 _(MAP_PARAM_SET_REASSEMBLY, map_param_set_reassembly) \ 689 _(MAP_PARAM_SET_SECURITY_CHECK, map_param_set_security_check) \ 690 _(MAP_PARAM_SET_TRAFFIC_CLASS, map_param_set_traffic_class) \ 691 _(MAP_PARAM_SET_TCP, map_param_set_tcp) \ 692 _(MAP_PARAM_GET, map_param_get) 694 #define vl_msg_name_crc_list 696 #undef vl_msg_name_crc_list 701 #define _(id,n,crc) \ 702 vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + mm->msg_id_base); 703 foreach_vl_msg_name_crc_map;
718 vl_msg_api_set_handlers((VL_API_##N + mm->msg_id_base), \ 720 vl_api_##n##_t_handler, \ 722 vl_api_##n##_t_endian, \ 723 vl_api_##n##_t_print, \ 724 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)
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, u8 *tag)
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.
vl_api_interface_index_t sw_if_index
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)
Details about a single MAP domain.
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).
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
static f64 clib_net_to_host_f64(f64 x)
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.