summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-09 06:39:23 -0800
committerDave Barach <openvpp@barachs.net>2018-01-11 19:46:01 +0000
commit6c4dae27e75fc668f86c9cca0f3f58273b680621 (patch)
tree88c2adee0a2eb2c5e48471da2ef010e46cc270ab /src/vnet/devices
parentf72212e00282712f5829a7f76a8cb6f486cdae60 (diff)
api: remove transport specific code from handlers
This does not update api client code. In other words, if the client assumes the transport is shmem based, this patch does not change that. Furthermore, code that checks queue size, for tail dropping, is not updated. Done for the following apis: Plugins - acl - gtpu - memif - nat - pppoe VNET - bfd - bier - tapv2 - vhost user - dhcp - flow - geneve - ip - punt - ipsec/ipsec-gre - l2 - l2tp - lisp-cp/one-cp - lisp-gpe - map - mpls - policer - session - span - udp - tap - vxlan/vxlan-gpe - interface VPP - api/api.c OAM - oam_api.c Stats - stats.c Change-Id: I0e33ecefb2bdab0295698c0add948068a5a83345 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/devices')
-rw-r--r--src/vnet/devices/tap/tapv2_api.c37
-rw-r--r--src/vnet/devices/virtio/vhost_user_api.c23
2 files changed, 31 insertions, 29 deletions
diff --git a/src/vnet/devices/tap/tapv2_api.c b/src/vnet/devices/tap/tapv2_api.c
index e161ed6c397..9f46884ca8c 100644
--- a/src/vnet/devices/tap/tapv2_api.c
+++ b/src/vnet/devices/tap/tapv2_api.c
@@ -54,7 +54,7 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp)
{
vlib_main_t *vm = vlib_get_main ();
vl_api_tap_create_v2_reply_t *rmp;
- svm_queue_t *q;
+ vl_api_registration_t *reg;
tap_create_if_args_t _a, *ap = &_a;
memset (ap, 0, sizeof (*ap));
@@ -98,9 +98,9 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp)
tap_create_if (vm, ap);
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (!q)
- return;
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;;
rmp = vl_msg_api_alloc (sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_TAP_CREATE_V2_REPLY);
@@ -108,12 +108,13 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp)
rmp->retval = ntohl (ap->rv);
rmp->sw_if_index = ntohl (ap->sw_if_index);
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
}
static void
tap_send_sw_interface_event_deleted (vpe_api_main_t * am,
- svm_queue_t * q, u32 sw_if_index)
+ vl_api_registration_t * reg,
+ u32 sw_if_index)
{
vl_api_sw_interface_event_t *mp;
@@ -125,7 +126,7 @@ tap_send_sw_interface_event_deleted (vpe_api_main_t * am,
mp->admin_up_down = 0;
mp->link_up_down = 0;
mp->deleted = 1;
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
}
static void
@@ -135,13 +136,13 @@ vl_api_tap_delete_v2_t_handler (vl_api_tap_delete_v2_t * mp)
int rv;
vpe_api_main_t *vam = &vpe_api_main;
vl_api_tap_delete_v2_reply_t *rmp;
- svm_queue_t *q;
+ vl_api_registration_t *reg;
u32 sw_if_index = ntohl (mp->sw_if_index);
rv = tap_delete_if (vm, sw_if_index);
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (!q)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
rmp = vl_msg_api_alloc (sizeof (*rmp));
@@ -149,15 +150,15 @@ vl_api_tap_delete_v2_t_handler (vl_api_tap_delete_v2_t * mp)
rmp->context = mp->context;
rmp->retval = ntohl (rv);
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (reg, (u8 *) rmp);
if (!rv)
- tap_send_sw_interface_event_deleted (vam, q, sw_if_index);
+ tap_send_sw_interface_event_deleted (vam, reg, sw_if_index);
}
static void
tap_send_sw_interface_details (vpe_api_main_t * am,
- svm_queue_t * q,
+ vl_api_registration_t * reg,
tap_interface_details_t * tap_if, u32 context)
{
vl_api_sw_interface_tap_v2_details_t *mp;
@@ -189,7 +190,7 @@ tap_send_sw_interface_details (vpe_api_main_t * am,
mp->host_ip6_prefix_len = tap_if->host_ip6_prefix_len;
mp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
}
static void
@@ -198,12 +199,12 @@ vl_api_sw_interface_tap_v2_dump_t_handler (vl_api_sw_interface_tap_v2_dump_t *
{
int rv;
vpe_api_main_t *am = &vpe_api_main;
- svm_queue_t *q;
+ vl_api_registration_t *reg;
tap_interface_details_t *tapifs = NULL;
tap_interface_details_t *tap_if = NULL;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
rv = tap_dump_ifs (&tapifs);
@@ -212,7 +213,7 @@ vl_api_sw_interface_tap_v2_dump_t_handler (vl_api_sw_interface_tap_v2_dump_t *
vec_foreach (tap_if, tapifs)
{
- tap_send_sw_interface_details (am, q, tap_if, mp->context);
+ tap_send_sw_interface_details (am, reg, tap_if, mp->context);
}
vec_free (tapifs);
diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c
index 9ddd3387a72..442d9146945 100644
--- a/src/vnet/devices/virtio/vhost_user_api.c
+++ b/src/vnet/devices/virtio/vhost_user_api.c
@@ -53,7 +53,7 @@ _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump)
*/
static void
send_sw_interface_event_deleted (vpe_api_main_t * am,
- svm_queue_t * q, u32 sw_if_index)
+ vl_api_registration_t * reg, u32 sw_if_index)
{
vl_api_sw_interface_event_t *mp;
@@ -65,7 +65,7 @@ send_sw_interface_event_deleted (vpe_api_main_t * am,
mp->admin_up_down = 0;
mp->link_up_down = 0;
mp->deleted = 1;
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
}
static void
@@ -127,6 +127,7 @@ vl_api_delete_vhost_user_if_t_handler (vl_api_delete_vhost_user_if_t * mp)
vl_api_delete_vhost_user_if_reply_t *rmp;
vpe_api_main_t *vam = &vpe_api_main;
u32 sw_if_index = ntohl (mp->sw_if_index);
+ vl_api_registration_t *reg;
vnet_main_t *vnm = vnet_get_main ();
vlib_main_t *vm = vlib_get_main ();
@@ -136,18 +137,18 @@ vl_api_delete_vhost_user_if_t_handler (vl_api_delete_vhost_user_if_t * mp)
REPLY_MACRO (VL_API_DELETE_VHOST_USER_IF_REPLY);
if (!rv)
{
- svm_queue_t *q = vl_api_client_index_to_input_queue (mp->client_index);
- if (!q)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
vnet_clear_sw_interface_tag (vnm, sw_if_index);
- send_sw_interface_event_deleted (vam, q, sw_if_index);
+ send_sw_interface_event_deleted (vam, reg, sw_if_index);
}
}
static void
send_sw_interface_vhost_user_details (vpe_api_main_t * am,
- svm_queue_t * q,
+ vl_api_registration_t * reg,
vhost_user_intf_details_t * vui,
u32 context)
{
@@ -169,7 +170,7 @@ send_sw_interface_vhost_user_details (vpe_api_main_t * am,
strncpy ((char *) mp->interface_name,
(char *) vui->if_name, ARRAY_LEN (mp->interface_name) - 1);
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_api_send_msg (reg, (u8 *) mp);
}
static void
@@ -182,10 +183,10 @@ static void
vlib_main_t *vm = vlib_get_main ();
vhost_user_intf_details_t *ifaces = NULL;
vhost_user_intf_details_t *vuid = NULL;
- svm_queue_t *q;
+ vl_api_registration_t *reg;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
return;
rv = vhost_user_dump_ifs (vnm, vm, &ifaces);
@@ -194,7 +195,7 @@ static void
vec_foreach (vuid, ifaces)
{
- send_sw_interface_vhost_user_details (am, q, vuid, mp->context);
+ send_sw_interface_vhost_user_details (am, reg, vuid, mp->context);
}
vec_free (ifaces);
}