From a0e8d9669e980c673f5302e7bff0c06b31d46b56 Mon Sep 17 00:00:00 2001 From: Steven Luong Date: Mon, 18 May 2020 17:12:56 -0700 Subject: virtio: add vhost sw_if_index filter for sw_interface_vhost_user_dump The filter sw_if_index was in the API sw_interface_vhost_user_dump. But it was never implemented in the backend. This patch is to add the backend, vat, and custom dump support for the filter. Type: feature Signed-off-by: Steven Luong Change-Id: Iaa41a7e11bfbcbb4c60092375e4b0dcf0950077b --- src/vnet/devices/virtio/vhost_user.api | 2 +- src/vnet/devices/virtio/vhost_user_api.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/vnet/devices') diff --git a/src/vnet/devices/virtio/vhost_user.api b/src/vnet/devices/virtio/vhost_user.api index 127b0a27fc7..338fd710bc0 100644 --- a/src/vnet/devices/virtio/vhost_user.api +++ b/src/vnet/devices/virtio/vhost_user.api @@ -115,7 +115,7 @@ define sw_interface_vhost_user_details }; /** \brief Vhost-user interface dump request - @param sw_if_index - filter by sw_if_index UNIMPLEMENTED + @param sw_if_index - filter by sw_if_index */ define sw_interface_vhost_user_dump { diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c index 67365334d95..80fe5548efd 100644 --- a/src/vnet/devices/virtio/vhost_user_api.c +++ b/src/vnet/devices/virtio/vhost_user_api.c @@ -211,7 +211,7 @@ static void filter_sw_if_index = htonl (mp->sw_if_index); if (filter_sw_if_index != ~0) - return; /* UNIMPLEMENTED */ + VALIDATE_SW_IF_INDEX (mp); rv = vhost_user_dump_ifs (vnm, vm, &ifaces); if (rv) @@ -219,8 +219,11 @@ static void vec_foreach (vuid, ifaces) { - send_sw_interface_vhost_user_details (am, reg, vuid, mp->context); + if ((filter_sw_if_index == ~0) || + (vuid->sw_if_index == filter_sw_if_index)) + send_sw_interface_vhost_user_details (am, reg, vuid, mp->context); } + BAD_SW_IF_INDEX_LABEL; vec_free (ifaces); } -- cgit 1.2.3-korg