summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-04-10 09:44:23 +0200
committerDave Wallace <dwallacelf@gmail.com>2019-04-10 13:06:45 +0000
commit2e1c8967faf4e9f7b45471df02e4e5b07fbb520a (patch)
tree172579d8d04927851d1781262bd2483fa9bf8643 /src/vnet/devices
parent13464f323a8bbd530bd85256de1c033781e098a7 (diff)
API: Fix shared memory only action handlers.
Some API action handlers called vl_msg_ai_send_shmem() directly. That breaks Unix domain socket API transport. A couple (bond / vhost) also tried to send a sw_interface_event directly, but did not send the message to all that had registred interest. That scheme never worked correctly. Refactored and improved the interface event code. Change-Id: Idb90edfd8703c6ae593b36b4eeb4d3ed7da5c808 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vnet/devices')
-rw-r--r--src/vnet/devices/tap/tapv2_api.c24
-rw-r--r--src/vnet/devices/virtio/vhost_user_api.c22
-rw-r--r--src/vnet/devices/virtio/virtio_api.c25
3 files changed, 1 insertions, 70 deletions
diff --git a/src/vnet/devices/tap/tapv2_api.c b/src/vnet/devices/tap/tapv2_api.c
index 1260afdd24f..40ff22eaeaa 100644
--- a/src/vnet/devices/tap/tapv2_api.c
+++ b/src/vnet/devices/tap/tapv2_api.c
@@ -137,30 +137,11 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp)
}
static void
-tap_send_sw_interface_event_deleted (vpe_api_main_t * am,
- vl_api_registration_t * reg,
- u32 sw_if_index)
-{
- vl_api_sw_interface_event_t *mp;
-
- mp = vl_msg_api_alloc (sizeof (*mp));
- clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT);
- mp->sw_if_index = ntohl (sw_if_index);
-
- mp->admin_up_down = 0;
- mp->link_up_down = 0;
- mp->deleted = 1;
- vl_api_send_msg (reg, (u8 *) mp);
-}
-
-static void
vl_api_tap_delete_v2_t_handler (vl_api_tap_delete_v2_t * mp)
{
vnet_main_t *vnm = vnet_get_main ();
vlib_main_t *vm = vlib_get_main ();
int rv;
- vpe_api_main_t *vam = &vpe_api_main;
vl_api_tap_delete_v2_reply_t *rmp;
vl_api_registration_t *reg;
u32 sw_if_index = ntohl (mp->sw_if_index);
@@ -179,10 +160,7 @@ vl_api_tap_delete_v2_t_handler (vl_api_tap_delete_v2_t * mp)
vl_api_send_msg (reg, (u8 *) rmp);
if (!rv)
- {
- vnet_clear_sw_interface_tag (vnm, sw_if_index);
- tap_send_sw_interface_event_deleted (vam, reg, sw_if_index);
- }
+ vnet_clear_sw_interface_tag (vnm, sw_if_index);
}
static void
diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c
index 8142cf352ed..4c765f30961 100644
--- a/src/vnet/devices/virtio/vhost_user_api.c
+++ b/src/vnet/devices/virtio/vhost_user_api.c
@@ -48,26 +48,6 @@ _(MODIFY_VHOST_USER_IF, modify_vhost_user_if) \
_(DELETE_VHOST_USER_IF, delete_vhost_user_if) \
_(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump)
-/*
- * WARNING: replicated pending api refactor completion
- */
-static void
-send_sw_interface_event_deleted (vpe_api_main_t * am,
- vl_api_registration_t * reg, u32 sw_if_index)
-{
- vl_api_sw_interface_event_t *mp;
-
- mp = vl_msg_api_alloc (sizeof (*mp));
- clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT);
- mp->sw_if_index = ntohl (sw_if_index);
-
- mp->admin_up_down = 0;
- mp->link_up_down = 0;
- mp->deleted = 1;
- vl_api_send_msg (reg, (u8 *) mp);
-}
-
static void
vl_api_create_vhost_user_if_t_handler (vl_api_create_vhost_user_if_t * mp)
{
@@ -135,7 +115,6 @@ vl_api_delete_vhost_user_if_t_handler (vl_api_delete_vhost_user_if_t * mp)
{
int rv = 0;
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;
@@ -152,7 +131,6 @@ vl_api_delete_vhost_user_if_t_handler (vl_api_delete_vhost_user_if_t * mp)
return;
vnet_clear_sw_interface_tag (vnm, sw_if_index);
- send_sw_interface_event_deleted (vam, reg, sw_if_index);
}
}
diff --git a/src/vnet/devices/virtio/virtio_api.c b/src/vnet/devices/virtio/virtio_api.c
index 238c6adfb43..ff123ae081c 100644
--- a/src/vnet/devices/virtio/virtio_api.c
+++ b/src/vnet/devices/virtio/virtio_api.c
@@ -86,24 +86,6 @@ vl_api_virtio_pci_create_t_handler (vl_api_virtio_pci_create_t * mp)
}
static void
-virtio_pci_send_sw_interface_event_deleted (vpe_api_main_t * am,
- vl_api_registration_t * reg,
- u32 sw_if_index)
-{
- vl_api_sw_interface_event_t *mp;
-
- mp = vl_msg_api_alloc (sizeof (*mp));
- clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_EVENT);
- mp->sw_if_index = htonl (sw_if_index);
-
- mp->admin_up_down = 0;
- mp->link_up_down = 0;
- mp->deleted = 1;
- vl_api_send_msg (reg, (u8 *) mp);
-}
-
-static void
vl_api_virtio_pci_delete_t_handler (vl_api_virtio_pci_delete_t * mp)
{
vnet_main_t *vnm = vnet_get_main ();
@@ -112,10 +94,8 @@ vl_api_virtio_pci_delete_t_handler (vl_api_virtio_pci_delete_t * mp)
int rv = 0;
vnet_hw_interface_t *hw;
virtio_if_t *vif;
- vpe_api_main_t *vam = &vpe_api_main;
vl_api_virtio_pci_delete_reply_t *rmp;
vl_api_registration_t *reg;
- u32 sw_if_index = ntohl (mp->sw_if_index);
hw = vnet_get_sup_hw_interface (vnm, htonl (mp->sw_if_index));
if (hw == NULL || virtio_device_class.index != hw->dev_class_index)
@@ -139,11 +119,6 @@ reply:
rmp->retval = htonl (rv);
vl_api_send_msg (reg, (u8 *) rmp);
-
- if (!rv)
- {
- virtio_pci_send_sw_interface_event_deleted (vam, reg, sw_if_index);
- }
}
static void