LISP - Bug fix, can`t remove static remote mapping
[vpp.git] / vpp / vpp-api / api.c
index feb1a61..c06045f 100644 (file)
@@ -66,6 +66,7 @@
 #include <vlibmemory/api.h>
 #include <vnet/classify/vnet_classify.h>
 #include <vnet/classify/input_acl.h>
+#include <vnet/classify/policer_classify.h>
 #include <vnet/l2/l2_classify.h>
 #include <vnet/vxlan/vxlan.h>
 #include <vnet/gre/gre.h>
@@ -264,6 +265,7 @@ _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS,                          \
 _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered)            \
 _(CREATE_LOOPBACK, create_loopback)                                    \
 _(CONTROL_PING, control_ping)                                           \
+_(NOPRINT_CONTROL_PING, noprint_control_ping)                           \
 _(CLI_REQUEST, cli_request)                                             \
 _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit)                      \
 _(L2_PATCH_ADD_DEL, l2_patch_add_del)                                  \
@@ -338,12 +340,12 @@ _(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency)                       \
 _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set)                 \
 _(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map)               \
 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump)                         \
+_(LISP_LOCATOR_DUMP, lisp_locator_dump)                                 \
 _(LISP_LOCAL_EID_TABLE_DUMP, lisp_local_eid_table_dump)                 \
 _(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump)                           \
 _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump)                       \
 _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump)                     \
-_(LISP_ENABLE_DISABLE_STATUS_DUMP,                                      \
-  lisp_enable_disable_status_dump)                                      \
+_(SHOW_LISP_STATUS, show_lisp_status)                                   \
 _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS,                                   \
   lisp_add_del_map_request_itr_rlocs)                                   \
 _(LISP_GET_MAP_REQUEST_ITR_RLOCS, lisp_get_map_request_itr_rlocs)       \
@@ -353,6 +355,8 @@ _(AF_PACKET_CREATE, af_packet_create)                                   \
 _(AF_PACKET_DELETE, af_packet_delete)                                   \
 _(POLICER_ADD_DEL, policer_add_del)                                     \
 _(POLICER_DUMP, policer_dump)                                           \
+_(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface)       \
+_(POLICER_CLASSIFY_DUMP, policer_classify_dump)                         \
 _(NETMAP_CREATE, netmap_create)                                         \
 _(NETMAP_DELETE, netmap_delete)                                         \
 _(MPLS_GRE_TUNNEL_DUMP, mpls_gre_tunnel_dump)                           \
@@ -3342,6 +3346,18 @@ static void vl_api_control_ping_t_handler
     }));
 }
 
+static void vl_api_noprint_control_ping_t_handler
+(vl_api_noprint_control_ping_t *mp)
+{
+    vl_api_noprint_control_ping_reply_t * rmp;
+    int rv = 0;
+
+    REPLY_MACRO2(VL_API_NOPRINT_CONTROL_PING_REPLY,
+    ({
+        rmp->vpe_pid = ntohl (getpid());
+    }));
+}
+
 static void shmem_cli_output (uword arg, u8 * buffer, uword buffer_bytes)
 {
     u8 **shmem_vecp = (u8 **)arg;
@@ -4774,27 +4790,52 @@ static void vl_api_vxlan_gpe_tunnel_dump_t_handler
     }
 }
 
+/** Used for transferring locators via VPP API */
+typedef CLIB_PACKED(struct
+{
+    u32 sw_if_index; /**< locator sw_if_index */
+    u8 priority; /**< locator priority */
+    u8 weight;   /**< locator weight */
+}) ls_locator_t;
+
 static void
 vl_api_lisp_add_del_locator_set_t_handler(vl_api_lisp_add_del_locator_set_t *mp)
 {
     vl_api_lisp_add_del_locator_set_reply_t *rmp;
     int rv = 0;
     vnet_lisp_add_del_locator_set_args_t _a, *a = &_a;
+    locator_t locator;
+    ls_locator_t *ls_loc;
     u32 ls_index = ~0;
     u8 *locator_name = NULL;
+    int i;
 
     memset(a, 0, sizeof(a[0]));
 
     locator_name = format(0, "%s", mp->locator_set_name);
 
     a->name = locator_name;
-    a->locators = NULL;
     a->is_add = mp->is_add;
     a->local = 1;
 
+    memset(&locator, 0, sizeof(locator));
+    for (i = 0; i < mp->locator_num; i++) {
+        ls_loc = &((ls_locator_t *) mp->locators)[i];
+        VALIDATE_SW_IF_INDEX(ls_loc);
+
+        locator.sw_if_index = htonl(ls_loc->sw_if_index);
+        locator.priority = ls_loc->priority;
+        locator.weight = ls_loc->weight;
+        locator.local = 1;
+        vec_add1(a->locators, locator);
+    }
+
     rv = vnet_lisp_add_del_locator_set(a, &ls_index);
 
+    BAD_SW_IF_INDEX_LABEL;
+
     vec_free(locator_name);
+    vec_free(a->locators);
 
     REPLY_MACRO(VL_API_LISP_ADD_DEL_LOCATOR_SET_REPLY);
 }
@@ -4861,11 +4902,13 @@ vl_api_lisp_add_del_local_eid_t_handler(
         gid_address_type (&eid) = GID_ADDR_IP_PREFIX;
         ip_address_set(ip_eid, mp->eid, IP4);
         ip_prefix_len(prefp) = mp->prefix_len;
+        ip_prefix_normalize(prefp);
         break;
       case 1: /* ipv6 */
         gid_address_type (&eid) = GID_ADDR_IP_PREFIX;
         ip_address_set(ip_eid, mp->eid, IP6);
         ip_prefix_len(prefp) = mp->prefix_len;
+        ip_prefix_normalize(prefp);
         break;
       case 2: /* l2 mac */
         gid_address_type (&eid) = GID_ADDR_MAC;
@@ -4933,6 +4976,7 @@ lisp_gpe_add_del_fwd_entry_set_address(
         ip_addr_version(ip_eid) = IP4;
     }
     ip_prefix_len(prefp) = mp->eid_prefix_len;
+    ip_prefix_normalize(prefp);
 
     if (mp->address_is_ipv6) {
         clib_memcpy(&ip_addr_v6(slocator), mp->source_ip_address,
@@ -5087,23 +5131,6 @@ typedef CLIB_PACKED(struct
   u8 addr[16]; /**< IPv4/IPv6 address */
 }) rloc_t;
 
-static void
-send_lisp_locator_set_details_set_address
-(vl_api_lisp_locator_set_details_t *rmp,
- gid_address_t *gid_address)
-{
-    ip_prefix_t *ip_addr;
-
-    if (gid_address_type(gid_address) != GID_ADDR_IP_PREFIX) {
-        return;
-    }
-
-    ip_addr = &gid_address_ippref(gid_address);
-    rmp->prefix_len = ip_prefix_len(ip_addr);
-    rmp->is_ipv6 = ip_prefix_version(ip_addr);
-    ip_address_copy_addr(rmp->ip_address, &ip_prefix_addr(ip_addr));
-}
-
 static void
 vl_api_lisp_add_del_remote_mapping_t_handler (
     vl_api_lisp_add_del_remote_mapping_t *mp)
@@ -5112,42 +5139,30 @@ vl_api_lisp_add_del_remote_mapping_t_handler (
     locator_t rloc, * rlocs = 0;
     vl_api_lisp_add_del_remote_mapping_reply_t * rmp;
     int rv = 0;
-    gid_address_t _seid, * seid = &_seid;
-    gid_address_t _deid, * deid = &_deid;
-    ip_prefix_t * seid_pref = &gid_address_ippref(seid);
-    ip_prefix_t * deid_pref = &gid_address_ippref(deid);
-
-    /* TODO remove seid from API */
-    memset (seid, 0, sizeof (seid[0]));
-    memset (deid, 0, sizeof (deid[0]));
-    ip_address_t * seid_addr = &ip_prefix_addr(seid_pref);
-    ip_address_t * deid_addr = &ip_prefix_addr(deid_pref);
-    ip_prefix_len(seid_pref) = mp->seid_len;
-    ip_prefix_len(deid_pref) = mp->deid_len;
-    u8 * seid_mac = gid_address_mac (seid);
-    u8 * deid_mac = gid_address_mac (deid);
-    gid_address_vni (seid) = ntohl (mp->vni);
-    gid_address_vni (deid) = ntohl (mp->vni);
+    gid_address_t _eid, * eid = &_eid;
+    ip_prefix_t * eid_pref = &gid_address_ippref(eid);
+
+    memset (eid, 0, sizeof (eid[0]));
+    ip_address_t * eid_addr = &ip_prefix_addr(eid_pref);
+    ip_prefix_len(eid_pref) = mp->eid_len;
+    u8 * eid_mac = gid_address_mac (eid);
+    gid_address_vni (eid) = ntohl (mp->vni);
 
     switch (mp->eid_type)
       {
       case 0: /* ipv4 */
-        gid_address_type(seid) = GID_ADDR_IP_PREFIX;
-        gid_address_type(deid) = GID_ADDR_IP_PREFIX;
-        ip_address_set (seid_addr, mp->seid, IP4);
-        ip_address_set (deid_addr, mp->deid, IP4);
+        gid_address_type(eid) = GID_ADDR_IP_PREFIX;
+        ip_address_set (eid_addr, mp->eid, IP4);
+        ip_prefix_normalize (eid_pref);
         break;
       case 1: /* ipv6 */
-        gid_address_type(seid) = GID_ADDR_IP_PREFIX;
-        gid_address_type(deid) = GID_ADDR_IP_PREFIX;
-        ip_address_set (seid_addr, mp->seid, IP6);
-        ip_address_set (deid_addr, mp->deid, IP6);
+        gid_address_type(eid) = GID_ADDR_IP_PREFIX;
+        ip_address_set (eid_addr, mp->eid, IP6);
+        ip_prefix_normalize (eid_pref);
         break;
       case 2: /* l2 mac */
-        gid_address_type(seid) = GID_ADDR_MAC;
-        gid_address_type(deid) = GID_ADDR_MAC;
-        clib_memcpy (seid_mac, mp->seid, 6);
-        clib_memcpy (deid_mac, mp->deid, 6);
+        gid_address_type(eid) = GID_ADDR_MAC;
+        clib_memcpy (eid_mac, mp->eid, 6);
         break;
       default:
         rv = VNET_API_ERROR_INVALID_EID_TYPE;
@@ -5168,26 +5183,23 @@ vl_api_lisp_add_del_remote_mapping_t_handler (
 
     if (!mp->is_add) {
         vnet_lisp_add_del_adjacency_args_t _a, * a = &_a;
-        gid_address_copy(&a->deid, deid);
+        gid_address_copy(&a->deid, eid);
         a->is_add = 0;
         rv = vnet_lisp_add_del_adjacency (a);
-    } else {
-        /* NOTE: for now this works as a static remote mapping, i.e.,
-         * not authoritative and ttl infinite. */
-        rv = vnet_lisp_add_del_mapping (deid, rlocs, mp->action, 0, ~0,
-                                        mp->is_add, 0);
-
-        /* TODO remove once CSIT switched to lisp_add_del_adjacency */
-        vnet_lisp_add_del_adjacency_args_t _a, * a = &_a;
-        gid_address_copy(&a->seid, seid);
-        gid_address_copy(&a->deid, deid);
-        a->is_add = 1;
-        vnet_lisp_add_del_adjacency (a);
+        if (rv) {
+          goto out;
+        }
     }
 
+    /* NOTE: for now this works as a static remote mapping, i.e.,
+     * not authoritative and ttl infinite. */
+    rv = vnet_lisp_add_del_mapping (eid, rlocs, mp->action, 0, ~0,
+                                    mp->is_add, 0);
+
     if (mp->del_all)
       vnet_lisp_clear_all_remote_adjacencies ();
 
+out:
     vec_free (rlocs);
 send_reply:
     REPLY_MACRO(VL_API_LISP_ADD_DEL_REMOTE_MAPPING_REPLY);
@@ -5222,12 +5234,16 @@ vl_api_lisp_add_del_adjacency_t_handler (
         gid_address_type(&a->deid) = GID_ADDR_IP_PREFIX;
         ip_address_set (seid_addr, mp->seid, IP4);
         ip_address_set (deid_addr, mp->deid, IP4);
+        ip_prefix_normalize (seid_pref);
+        ip_prefix_normalize (deid_pref);
         break;
       case 1: /* ipv6 */
         gid_address_type(&a->seid) = GID_ADDR_IP_PREFIX;
         gid_address_type(&a->deid) = GID_ADDR_IP_PREFIX;
         ip_address_set (seid_addr, mp->seid, IP6);
         ip_address_set (deid_addr, mp->deid, IP6);
+        ip_prefix_normalize (seid_pref);
+        ip_prefix_normalize (deid_pref);
         break;
       case 2: /* l2 mac */
         gid_address_type(&a->seid) = GID_ADDR_MAC;
@@ -5247,43 +5263,92 @@ send_reply:
     REPLY_MACRO(VL_API_LISP_ADD_DEL_ADJACENCY_REPLY);
 }
 
+static void
+send_lisp_locator_details (lisp_cp_main_t *lcm,
+                           locator_t *loc,
+                           unix_shared_memory_queue_t *q,
+                           u32 context)
+{
+    vl_api_lisp_locator_details_t *rmp;
+
+    rmp = vl_msg_api_alloc (sizeof (*rmp));
+    memset (rmp, 0, sizeof (*rmp));
+    rmp->_vl_msg_id = ntohs(VL_API_LISP_LOCATOR_DETAILS);
+    rmp->context = context;
+
+    rmp->local = loc->local;
+    if (loc->local) {
+        rmp->sw_if_index = ntohl(loc->sw_if_index);
+    } else {
+        rmp->is_ipv6 = gid_address_ip_version(&loc->address);
+        ip_address_copy_addr(rmp->ip_address, &gid_address_ip(&loc->address));
+    }
+    rmp->priority = loc->priority;
+    rmp->weight = loc->weight;
+
+    vl_msg_api_send_shmem (q, (u8 *)&rmp);
+}
+
+static void
+vl_api_lisp_locator_dump_t_handler (vl_api_lisp_locator_dump_t *mp)
+{
+    unix_shared_memory_queue_t * q = 0;
+    lisp_cp_main_t * lcm = vnet_lisp_cp_get_main();
+    locator_set_t * lsit = 0;
+    locator_t * loc = 0;
+    u32 ls_index = ~0, * locit = 0;
+    u8 filter;
+
+    q = vl_api_client_index_to_input_queue (mp->client_index);
+    if (q == 0) {
+        return;
+    }
+
+    ls_index = htonl(mp->locator_set_index);
+
+    lsit = pool_elt_at_index(lcm->locator_set_pool, ls_index);
+
+    filter = mp->filter;
+    if (filter && !((1 == filter && lsit->local) ||
+                    (2 == filter && !lsit->local))) {
+          return;
+      }
+
+    vec_foreach(locit, lsit->locator_indices) {
+        loc = pool_elt_at_index(lcm->locator_pool, locit[0]);
+        send_lisp_locator_details(lcm, loc, q, mp->context);
+    };
+}
+
 static void
 send_lisp_locator_set_details (lisp_cp_main_t *lcm,
                                locator_set_t *lsit,
                                unix_shared_memory_queue_t *q,
                                u32 context,
-                               u32 index)
+                               u32 ls_index)
 {
     vl_api_lisp_locator_set_details_t *rmp;
-    locator_t *loc = NULL;
-    u32 * locit = NULL;
-    u8 * str = NULL;
+    u8 * str = 0;
 
-    vec_foreach (locit, lsit->locator_indices) {
-        loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
-        rmp = vl_msg_api_alloc (sizeof (*rmp));
-        memset (rmp, 0, sizeof (*rmp));
-        rmp->_vl_msg_id = ntohs(VL_API_LISP_LOCATOR_SET_DETAILS);
-        rmp->local = lsit->local;
-        if (lsit->local) {
-            ASSERT(lsit->name != NULL);
-            strncpy((char *) rmp->locator_set_name,
-                    (char *) lsit->name, ARRAY_LEN(rmp->locator_set_name) - 1);
-            rmp->sw_if_index = htonl(loc->sw_if_index);
-        } else {
-            str = format(0, "remote-%d", index);
-            strncpy((char *) rmp->locator_set_name, (char *) str,
-                    ARRAY_LEN(rmp->locator_set_name) - 1);
-            send_lisp_locator_set_details_set_address(rmp, &loc->address);
-
-            vec_free(str);
-        }
-        rmp->priority = loc->priority;
-        rmp->weight = loc->weight;
-        rmp->context = context;
+    rmp = vl_msg_api_alloc (sizeof (*rmp));
+    memset (rmp, 0, sizeof (*rmp));
+    rmp->_vl_msg_id = ntohs(VL_API_LISP_LOCATOR_SET_DETAILS);
+    rmp->context = context;
 
-        vl_msg_api_send_shmem (q, (u8 *)&rmp);
+    rmp->local = lsit->local;
+    rmp->locator_set_index= htonl(ls_index);
+    if (lsit->local) {
+      ASSERT(lsit->name != NULL);
+      strncpy((char *) rmp->locator_set_name,
+              (char *) lsit->name, ARRAY_LEN(rmp->locator_set_name) - 1);
+    } else {
+      str = format(0, "remote-%d", ls_index);
+      strncpy((char *) rmp->locator_set_name, (char *) str,
+              ARRAY_LEN(rmp->locator_set_name) - 1);
+      vec_free(str);
     }
+
+    vl_msg_api_send_shmem (q, (u8 *)&rmp);
 }
 
 static void
@@ -5293,15 +5358,23 @@ vl_api_lisp_locator_set_dump_t_handler (vl_api_lisp_locator_set_dump_t *mp)
     lisp_cp_main_t * lcm = vnet_lisp_cp_get_main();
     locator_set_t * lsit = NULL;
     u32 index;
+    u8 filter;
 
     q = vl_api_client_index_to_input_queue (mp->client_index);
     if (q == 0) {
         return;
     }
 
+    filter = mp->filter;
     index = 0;
     pool_foreach (lsit, lcm->locator_set_pool,
         ({
+            if (filter && !((1 == filter && lsit->local) ||
+                            (2 == filter && !lsit->local))) {
+                index++;
+                continue;
+            }
+
             send_lisp_locator_set_details(lcm, lsit, q, mp->context, index++);
         }));
 }
@@ -5557,34 +5630,23 @@ vl_api_lisp_eid_table_map_dump_t_handler (
 }
 
 static void
-send_lisp_enable_disable_details (unix_shared_memory_queue_t *q,
-                                      u32 context)
-{
-    vl_api_lisp_enable_disable_status_details_t *rmp = NULL;
-
-    rmp = vl_msg_api_alloc (sizeof (*rmp));
-    memset (rmp, 0, sizeof (*rmp));
-    rmp->_vl_msg_id = ntohs(VL_API_LISP_ENABLE_DISABLE_STATUS_DETAILS);
-
-    rmp->gpe_status = vnet_lisp_gpe_enable_disable_status ();
-    rmp->feature_status = vnet_lisp_enable_disable_status ();
-    rmp->context = context;
-
-    vl_msg_api_send_shmem (q, (u8 *)&rmp);
-}
-
-static void
-vl_api_lisp_enable_disable_status_dump_t_handler
-(vl_api_lisp_enable_disable_status_dump_t *mp)
+vl_api_show_lisp_status_t_handler
+(vl_api_show_lisp_status_t *mp)
 {
     unix_shared_memory_queue_t * q = NULL;
+    vl_api_show_lisp_status_reply_t *rmp = NULL;
+    int rv = 0;
 
     q = vl_api_client_index_to_input_queue (mp->client_index);
     if (q == 0) {
         return;
     }
 
-    send_lisp_enable_disable_details(q, mp->context);
+    REPLY_MACRO2(VL_API_SHOW_LISP_STATUS_REPLY,
+    ({
+      rmp->gpe_status = vnet_lisp_gpe_enable_disable_status ();
+      rmp->feature_status = vnet_lisp_enable_disable_status ();
+    }));
 }
 
 static void
@@ -6435,6 +6497,7 @@ vl_api_policer_add_del_t_handler
     u8 *name = NULL;
     sse2_qos_pol_cfg_params_st cfg;
     clib_error_t * error;
+    u32 policer_index;
 
     name = format(0, "%s", mp->name);
 
@@ -6452,13 +6515,20 @@ vl_api_policer_add_del_t_handler
     cfg.exceed_action.dscp = mp->exceed_dscp;
     cfg.violate_action.action_type = mp->violate_action_type;
     cfg.violate_action.dscp = mp->violate_dscp;
+    cfg.color_aware = mp->color_aware;
 
-    error = policer_add_del(vm, name, &cfg, mp->is_add);
+    error = policer_add_del(vm, name, &cfg, &policer_index, mp->is_add);
 
     if (error)
       rv = VNET_API_ERROR_UNSPECIFIED;
 
-    REPLY_MACRO(VL_API_POLICER_ADD_DEL_REPLY);
+    REPLY_MACRO2(VL_API_POLICER_ADD_DEL_REPLY,
+    ({
+        if (rv == 0 &&  mp->is_add)
+          rmp->policer_index = ntohl(policer_index);
+        else
+          rmp->policer_index = ~0;
+    }));
 }
 
 static void
@@ -6545,6 +6615,75 @@ vl_api_policer_dump_t_handler
     }
 }
 
+static void
+vl_api_policer_classify_set_interface_t_handler
+(vl_api_policer_classify_set_interface_t * mp)
+{
+    vlib_main_t *vm = vlib_get_main();
+    vl_api_policer_classify_set_interface_reply_t * rmp;
+    int rv;
+    u32 sw_if_index, ip4_table_index, ip6_table_index, l2_table_index;
+
+    ip4_table_index = ntohl(mp->ip4_table_index);
+    ip6_table_index = ntohl(mp->ip6_table_index);
+    l2_table_index = ntohl(mp->l2_table_index);
+    sw_if_index = ntohl(mp->sw_if_index);
+
+    VALIDATE_SW_IF_INDEX(mp);
+
+    rv = vnet_set_policer_classify_intfc(vm, sw_if_index, ip4_table_index,
+                                         ip6_table_index, l2_table_index,
+                                         mp->is_add);
+
+    BAD_SW_IF_INDEX_LABEL;
+
+    REPLY_MACRO(VL_API_POLICER_CLASSIFY_SET_INTERFACE_REPLY);
+}
+
+static void
+send_policer_classify_details (u32 sw_if_index,
+                               u32 table_index,
+                               unix_shared_memory_queue_t *q,
+                               u32 context)
+{
+    vl_api_policer_classify_details_t * mp;
+
+    mp = vl_msg_api_alloc (sizeof (*mp));
+    memset (mp, 0, sizeof (*mp));
+    mp->_vl_msg_id = ntohs (VL_API_POLICER_CLASSIFY_DETAILS);
+    mp->context = context;
+    mp->sw_if_index= htonl(sw_if_index);
+    mp->table_index= htonl(table_index);
+
+    vl_msg_api_send_shmem (q, (u8 *)&mp);
+}
+
+static void
+vl_api_policer_classify_dump_t_handler
+(vl_api_policer_classify_dump_t *mp)
+{
+    unix_shared_memory_queue_t * q;
+    policer_classify_main_t * pcm = &policer_classify_main;
+    u32 * vec_tbl;
+    int i;
+
+    q = vl_api_client_index_to_input_queue (mp->client_index);
+    if (q == 0)
+        return;
+
+    vec_tbl = pcm->classify_table_index_by_sw_if_index[mp->type];
+
+    if (vec_len(vec_tbl)) {
+        for (i = 0; i < vec_len (vec_tbl); i++) {
+            if (vec_elt(vec_tbl, i) == ~0)
+                continue;
+
+            send_policer_classify_details(i, vec_elt(vec_tbl, i), q,
+                                          mp->context);
+        }
+    }
+}
+
 static void
 vl_api_netmap_create_t_handler
 (vl_api_netmap_create_t *mp)