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);
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);
206 memset (total_pkts, 0,
sizeof (total_pkts));
207 memset (total_bytes, 0,
sizeof (total_bytes));
217 total_pkts[which] += v.
packets;
218 total_bytes[which] += v.
bytes;
228 clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_RX]);
232 clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_TX]);
252 #define vl_msg_name_crc_list 254 #undef vl_msg_name_crc_list 259 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 260 foreach_vl_msg_name_crc_map;
270 vl_msg_api_set_handlers(VL_API_##N, #n, \ 271 vl_api_##n##_t_handler, \ 273 vl_api_##n##_t_endian, \ 274 vl_api_##n##_t_print, \ 275 sizeof(vl_api_##n##_t), 1);
u64 packets
packet counter
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)
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
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)
vlib_counter_t * maxi
Shared wide counter pairs.
u64 map_error_counter_get(u32 node_index, map_error_t map_error)
static void map_domain_counter_unlock(map_main_t *mm)
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
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)
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.
static void vl_api_map_rule_dump_t_handler(vl_api_map_rule_dump_t *mp)
static void vlib_get_combined_counter(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 mini co...
static clib_error_t * map_api_hookup(vlib_main_t *vm)
void * vl_msg_api_alloc(int nbytes)
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.
static void map_domain_counter_lock(map_main_t *mm)
Request for a single block of summary stats.
Reply for MAP domain add.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
A collection of combined counters.
#define vec_foreach(var, vec)
Vector iterator.
struct _unix_shared_memory_queue unix_shared_memory_queue_t
Reply for MAP domain del.
static uword pool_elts(void *v)
Number of active elements in a pool.