From 19ff0c3699342b512c03362b3815df684a661f49 Mon Sep 17 00:00:00 2001 From: Mohammed Hawari Date: Wed, 10 Feb 2021 09:20:51 +0100 Subject: dpdk: implement interrupt mode Change-Id: I6ababc99ecf559327a4370914580c98d32680175 Type: feature Signed-off-by: Mohammed Hawari --- src/plugins/dpdk/device/device.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/plugins/dpdk/device/device.c') diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c index 6466b443633..95678e9b0e2 100644 --- a/src/plugins/dpdk/device/device.c +++ b/src/plugins/dpdk/device/device.c @@ -694,6 +694,25 @@ done: return err; } +static clib_error_t * +dpdk_interface_rx_mode_change (vnet_main_t *vnm, u32 hw_if_index, u32 qid, + vnet_hw_if_rx_mode mode) +{ + dpdk_main_t *xm = &dpdk_main; + vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index); + dpdk_device_t *xd = vec_elt_at_index (xm->devices, hw->dev_instance); + int rv = 0; + if (!(xd->flags & DPDK_DEVICE_FLAG_INT_SUPPORTED)) + return clib_error_return (0, "unsupported op (is the interface up?)", rv); + if (mode == VNET_HW_IF_RX_MODE_POLLING) + rv = rte_eth_dev_rx_intr_disable (xd->port_id, qid); + else + rv = rte_eth_dev_rx_intr_enable (xd->port_id, qid); + if (rv) + return clib_error_return (0, "dpdk_interface_rx_mode_change err %d", rv); + return 0; +} + /* *INDENT-OFF* */ VNET_DEVICE_CLASS (dpdk_device_class) = { .name = "dpdk", @@ -711,6 +730,7 @@ VNET_DEVICE_CLASS (dpdk_device_class) = { .format_flow = format_dpdk_flow, .flow_ops_function = dpdk_flow_ops_fn, .set_rss_queues_function = dpdk_interface_set_rss_queues, + .rx_mode_change_function = dpdk_interface_rx_mode_change, }; /* *INDENT-ON* */ -- cgit 1.2.3-korg