_(VNET_GET_SUMMARY_STATS, vnet_get_summary_stats) \
_(RESET_FIB, reset_fib) \
_(CREATE_LOOPBACK, create_loopback) \
+_(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \
_(CONTROL_PING, control_ping) \
_(CLI_REQUEST, cli_request) \
_(CLI_INBAND, cli_inband) \
} resolve_t;
static vlib_node_registration_t vpe_resolver_process_node;
-vpe_api_main_t vpe_api_main;
+extern vpe_api_main_t vpe_api_main;
static int arp_change_delete_callback (u32 pool_index, u8 * notused);
static int nd_change_delete_callback (u32 pool_index, u8 * notused);
/* Clean up all registrations belonging to the indicated client */
-int
-vl_api_memclnt_delete_callback (u32 client_index)
+static clib_error_t *
+memclnt_delete_callback (u32 client_index)
{
vpe_api_main_t *vam = &vpe_api_main;
vpe_client_registration_t *rp;
return 0;
}
+VL_MSG_API_REAPER_FUNCTION (memclnt_delete_callback);
+
pub_sub_handler (oam_events, OAM_EVENTS);
#define RESOLUTION_EVENT 1
uword *p;
vnet_interface_main_t *im = &vnm->interface_main;
u64 sup_and_sub_key;
- u64 *kp;
unix_shared_memory_queue_t *q;
clib_error_t *error;
goto out;
}
- kp = clib_mem_alloc (sizeof (*kp));
- *kp = sup_and_sub_key;
-
memset (&template, 0, sizeof (template));
template.type = VNET_SW_INTERFACE_TYPE_SUB;
template.sup_sw_if_index = hi->sw_if_index;
rv = VNET_API_ERROR_INVALID_REGISTRATION;
goto out;
}
+
+ u64 *kp = clib_mem_alloc (sizeof (*kp));
+ *kp = sup_and_sub_key;
+
hash_set (hi->sub_interface_sw_if_index_by_id, id, sw_if_index);
hash_set_mem (im->sw_if_index_by_sup_and_sub, kp, sw_if_index);
return;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_CREATE_VLAN_SUBIF_REPLY);
+ rmp->_vl_msg_id = htons (VL_API_CREATE_VLAN_SUBIF_REPLY);
rmp->context = mp->context;
- rmp->retval = ntohl (rv);
- rmp->sw_if_index = ntohl (sw_if_index);
+ rmp->retval = htonl (rv);
+ rmp->sw_if_index = htonl (sw_if_index);
vl_msg_api_send_shmem (q, (u8 *) & rmp);
}
uword *p;
vnet_interface_main_t *im = &vnm->interface_main;
u64 sup_and_sub_key;
- u64 *kp;
clib_error_t *error;
VALIDATE_SW_IF_INDEX (mp);
goto out;
}
- kp = clib_mem_alloc (sizeof (*kp));
- *kp = sup_and_sub_key;
-
memset (&template, 0, sizeof (template));
template.type = VNET_SW_INTERFACE_TYPE_SUB;
template.sup_sw_if_index = sw_if_index;
goto out;
}
+ u64 *kp = clib_mem_alloc (sizeof (*kp));
+ *kp = sup_and_sub_key;
+
hash_set (hi->sub_interface_sw_if_index_by_id, sub_id, sw_if_index);
hash_set_mem (im->sw_if_index_by_sup_and_sub, kp, sw_if_index);
int rv = 0;
vnet_main_t *vnm = vnet_get_main ();
vl_api_proxy_arp_intfc_enable_disable_reply_t *rmp;
- vnet_sw_interface_t *si;
- u32 sw_if_index;
VALIDATE_SW_IF_INDEX (mp);
- sw_if_index = ntohl (mp->sw_if_index);
-
- if (pool_is_free_index (vnm->interface_main.sw_interfaces, sw_if_index))
- {
- rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
- goto out;
- }
-
- si = vnet_get_sw_interface (vnm, sw_if_index);
+ vnet_sw_interface_t *si =
+ vnet_get_sw_interface (vnm, ntohl (mp->sw_if_index));
ASSERT (si);
{
which = cm - im->combined_sw_if_counters;
- for (i = 0; i < vec_len (cm->maxi); i++)
+ for (i = 0; i < vlib_combined_counter_n_counters (cm); i++)
{
vlib_get_combined_counter (cm, i, &v);
total_pkts[which] += v.packets;
u32 sw_if_index;
int rv;
- rv = vnet_create_loopback_interface (&sw_if_index, mp->mac_address);
+ rv = vnet_create_loopback_interface (&sw_if_index, mp->mac_address, 0, 0);
/* *INDENT-OFF* */
REPLY_MACRO2(VL_API_CREATE_LOOPBACK_REPLY,
/* *INDENT-ON* */
}
+static void vl_api_create_loopback_instance_t_handler
+ (vl_api_create_loopback_instance_t * mp)
+{
+ vl_api_create_loopback_instance_reply_t *rmp;
+ u32 sw_if_index;
+ u8 is_specified = mp->is_specified;
+ u32 user_instance = ntohl (mp->user_instance);
+ int rv;
+
+ rv = vnet_create_loopback_interface (&sw_if_index, mp->mac_address,
+ is_specified, user_instance);
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2(VL_API_CREATE_LOOPBACK_INSTANCE_REPLY,
+ ({
+ rmp->sw_if_index = ntohl (sw_if_index);
+ }));
+ /* *INDENT-ON* */
+}
+
static void
vl_api_delete_loopback_t_handler (vl_api_delete_loopback_t * mp)
{
vlib_main_t *vm = vlib_get_main ();
vl_api_classify_set_interface_ip_table_reply_t *rmp;
int rv;
- u32 table_index, sw_if_index;
-
- table_index = ntohl (mp->table_index);
- sw_if_index = ntohl (mp->sw_if_index);
VALIDATE_SW_IF_INDEX (mp);
+ u32 table_index = ntohl (mp->table_index);
+ u32 sw_if_index = ntohl (mp->sw_if_index);
+
if (mp->is_ipv6)
rv = vnet_set_ip6_classify_intfc (vm, sw_if_index, table_index);
else
}
else
{ /* same mac */
- if (sw_if_index == event->sw_if_index &&
+ if (sw_if_index == ntohl(event->sw_if_index) &&
(!event->mac_ip ||
/* for BD case, also check IP address with 10 sec timeout */
(address == event->address &&
/* *INDENT-ON* */
arp_event_last_time = now;
- event->sw_if_index = sw_if_index;
+ event->sw_if_index = htonl (sw_if_index);
if (event->mac_ip)
event->address = address;
return 0;
}
else
{ /* same mac */
- if (sw_if_index == event->sw_if_index &&
+ if (sw_if_index == ntohl(event->sw_if_index) &&
(!event->mac_ip ||
/* for BD case, also check IP address with 10 sec timeout */
(ip6_address_is_equal (address,
/* *INDENT-ON* */
nd_event_last_time = now;
- event->sw_if_index = sw_if_index;
+ event->sw_if_index = htonl (sw_if_index);
if (event->mac_ip)
clib_memcpy (event->address, address, sizeof (event->address));
return 0;
vlib_main_t *vm = vlib_get_main ();
vl_api_input_acl_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);
+ u32 ip4_table_index = ntohl (mp->ip4_table_index);
+ u32 ip6_table_index = ntohl (mp->ip6_table_index);
+ u32 l2_table_index = ntohl (mp->l2_table_index);
+ u32 sw_if_index = ntohl (mp->sw_if_index);
+
rv = vnet_set_input_acl_intfc (vm, sw_if_index, ip4_table_index,
ip6_table_index, l2_table_index, mp->is_add);
{
vl_api_feature_enable_disable_reply_t *rmp;
int rv = 0;
- u8 *arc_name, *feature_name;
VALIDATE_SW_IF_INDEX (mp);
- arc_name = format (0, "%s%c", mp->arc_name, 0);
- feature_name = format (0, "%s%c", mp->feature_name, 0);
+ u8 *arc_name = format (0, "%s%c", mp->arc_name, 0);
+ u8 *feature_name = format (0, "%s%c", mp->feature_name, 0);
- vnet_feature_registration_t *reg;
- reg =
+ vnet_feature_registration_t *reg =
vnet_get_feature_reg ((const char *) arc_name,
(const char *) feature_name);
if (reg == 0)
rv = VNET_API_ERROR_INVALID_VALUE;
else
{
- u32 sw_if_index;
+ u32 sw_if_index = ntohl (mp->sw_if_index);
clib_error_t *error = 0;
- sw_if_index = ntohl (mp->sw_if_index);
if (reg->enable_disable_cb)
error = reg->enable_disable_cb (sw_if_index, mp->enable);
if (!error)
am->oam_events_registration_hash = hash_create (0, sizeof (uword));
am->bfd_events_registration_hash = hash_create (0, sizeof (uword));
- vl_api_init (vm);
vl_set_memory_region_name ("/vpe-api");
vl_enable_disable_memory_api (vm, 1 /* enable it */ );