aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_cli.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2023-11-03 13:47:05 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2023-11-08 13:28:19 +0000
commitb8dd9815ef01b804f6a9b4aa47e486b8823a0c50 (patch)
tree1281dff1f5f1c4f0cae98fd8ddd3493e9e44c799 /src/vnet/interface_cli.c
parent29d07dbef986dd5ebe180b6bfcac9089946e95df (diff)
dev: interrupt mode support
Type: improvement Change-Id: I4a0578598182339bcf76e6b01da76b590a06f773 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/interface_cli.c')
-rw-r--r--src/vnet/interface_cli.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c
index 74ac32522d7..b2410b82c05 100644
--- a/src/vnet/interface_cli.c
+++ b/src/vnet/interface_cli.c
@@ -54,6 +54,9 @@
#include <vnet/interface/rx_queue_funcs.h>
#include <vnet/interface/tx_queue_funcs.h>
#include <vnet/hash/hash.h>
+#include <vnet/dev/dev.h>
+#include <vnet/dev/dev_funcs.h>
+
static int
compare_interface_names (void *a1, void *a2)
{
@@ -1516,6 +1519,33 @@ set_hw_interface_change_rx_mode (vnet_main_t * vnm, u32 hw_if_index,
clib_error_t *error = 0;
vnet_hw_interface_t *hw;
u32 *queue_indices = 0;
+ vnet_dev_port_t *port;
+
+ port = vnet_dev_get_port_from_hw_if_index (hw_if_index);
+
+ if (port)
+ {
+ vlib_main_t *vm = vlib_get_main ();
+ vnet_dev_rv_t rv;
+
+ vnet_dev_port_cfg_change_req_t req = {
+ .type = mode == VNET_HW_IF_RX_MODE_POLLING ?
+ VNET_DEV_PORT_CFG_RXQ_INTR_MODE_DISABLE :
+ VNET_DEV_PORT_CFG_RXQ_INTR_MODE_ENABLE,
+ .queue_id = queue_id_valid ? queue_id : 0,
+ .all_queues = queue_id_valid ? 0 : 1,
+ };
+
+ if ((rv = vnet_dev_port_cfg_change_req_validate (vm, port, &req)))
+ return vnet_dev_port_err (
+ vm, port, rv, "rx queue interupt mode enable/disable not supported");
+
+ if ((rv = vnet_dev_process_port_cfg_change_req (vm, port, &req)))
+ return vnet_dev_port_err (
+ vm, port, rv,
+ "device failed to enable/disable queue interrupt mode");
+ return 0;
+ }
hw = vnet_get_hw_interface (vnm, hw_if_index);