38 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 45 #define foreach_vpe_api_msg \ 46 _(MAP_ADD_DOMAIN, map_add_domain) \ 47 _(MAP_DEL_DOMAIN, map_del_domain) \ 48 _(MAP_ADD_DEL_RULE, map_add_del_rule) \ 49 _(MAP_DOMAIN_DUMP, map_domain_dump) \ 50 _(MAP_RULE_DUMP, map_rule_dump) \ 51 _(MAP_SUMMARY_STATS, map_summary_stats) 66 ntohs (mp->
mtu), flags);
71 rmp->
index = ntohl(index);
79 vl_api_map_del_domain_reply_t *rmp;
90 vl_api_map_del_domain_reply_t *rmp;
121 rmp = vl_msg_api_alloc (sizeof (*rmp));
122 rmp->_vl_msg_id = ntohs(VL_API_MAP_DOMAIN_DETAILS);
123 rmp->domain_index = htonl(d - mm->domains);
124 rmp->ea_bits_len = d->ea_bits_len;
125 rmp->psid_offset = d->psid_offset;
126 rmp->psid_length = d->psid_length;
127 clib_memcpy(rmp->ip4_prefix, &d->ip4_prefix, sizeof(rmp->ip4_prefix));
128 rmp->ip4_prefix_len = d->ip4_prefix_len;
129 clib_memcpy(rmp->ip6_prefix, &d->ip6_prefix, sizeof(rmp->ip6_prefix));
130 rmp->ip6_prefix_len = d->ip6_prefix_len;
131 clib_memcpy(rmp->ip6_src, &d->ip6_src, sizeof(rmp->ip6_src));
132 rmp->ip6_src_len = d->ip6_src_len;
133 rmp->mtu = htons(d->mtu);
134 rmp->is_translation = (d->flags & MAP_DOMAIN_TRANSLATION);
135 rmp->context = mp->context;
137 vl_msg_api_send_shmem (q, (u8 *)&rmp);
176 memset (rmp, 0,
sizeof (*rmp));
177 rmp->_vl_msg_id = ntohs (VL_API_MAP_RULE_DETAILS);
178 rmp->
psid = htons (i);
202 rmp->_vl_msg_id = ntohs (VL_API_MAP_SUMMARY_STATS_REPLY);
212 memset (total_pkts, 0,
sizeof (total_pkts));
213 memset (total_bytes, 0,
sizeof (total_bytes));
223 total_pkts[which] += v.
packets;
224 total_bytes[which] += v.
bytes;
234 clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_RX]);
238 clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_TX]);
259 #define vl_msg_name_crc_list 261 #undef vl_msg_name_crc_list 266 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 267 foreach_vl_msg_name_crc_map;
277 vl_msg_api_set_handlers(VL_API_##N, #n, \ 278 vl_api_##n##_t_handler, \ 280 vl_api_##n##_t_endian, \ 281 vl_api_##n##_t_print, \ 282 sizeof(vl_api_##n##_t), 1);
sll srl srl sll sra u16x4 i
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)
#define foreach_vpe_api_msg
#define REPLY_MACRO2(t, body)
u64 map_error_counter_get(u32 node_index, map_error_t map_error)
static void map_domain_counter_unlock(map_main_t *mm)
Combined counter to hold both packets and byte differences.
u64 total_security_check[2]
vlib_node_registration_t ip4_map_node
(constructor) VLIB_REGISTER_NODE (ip4_map_node)
static void setup_message_id_table(api_main_t *am)
static void vl_api_map_add_del_rule_t_handler(vl_api_map_add_del_rule_t *mp)
static void vl_api_map_summary_stats_t_handler(vl_api_map_summary_stats_t *mp)
static void vl_api_map_add_domain_t_handler(vl_api_map_add_domain_t *mp)
VLIB_API_INIT_FUNCTION(map_api_hookup)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
vlib_combined_counter_main_t * domain_counters
static void vl_api_map_del_domain_t_handler(vl_api_map_del_domain_t *mp)
void * vl_msg_api_alloc(int nbytes)
int map_add_del_psid(u32 map_domain_index, u16 psid, ip6_address_t *tep, u8 is_add)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
counter_t packets
packet counter
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)
static clib_error_t * map_api_hookup(vlib_main_t *vm)
API main structure, used by both vpp and binary API clients.
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...
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)
#define clib_memcpy(a, b, c)
Reply for map_summary_stats request.
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
static void map_domain_counter_lock(map_main_t *mm)
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
Request for a single block of summary stats.
Reply for MAP domain add.
counter_t bytes
byte counter
A collection of combined counters.
#define vec_foreach(var, vec)
Vector iterator.
struct _unix_shared_memory_queue unix_shared_memory_queue_t
static uword pool_elts(void *v)
Number of active elements in a pool.