From 6c4dae27e75fc668f86c9cca0f3f58273b680621 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Tue, 9 Jan 2018 06:39:23 -0800 Subject: 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 --- src/vnet/devices/tap/tapv2_api.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/vnet/devices/tap/tapv2_api.c') 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); -- cgit 1.2.3-korg