aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/device.c
diff options
context:
space:
mode:
authorMohammed Hawari <mohammed@hawari.fr>2021-02-10 09:20:51 +0100
committerDamjan Marion <dmarion@me.com>2021-03-15 17:31:10 +0000
commit19ff0c3699342b512c03362b3815df684a661f49 (patch)
treebecd8952d4be2e9d6a18d9450e2e03e155f968b2 /src/plugins/dpdk/device/device.c
parent4376ab2a926b36c1131588069a8a9cdd2520073d (diff)
dpdk: implement interrupt mode
Change-Id: I6ababc99ecf559327a4370914580c98d32680175 Type: feature Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
Diffstat (limited to 'src/plugins/dpdk/device/device.c')
-rw-r--r--src/plugins/dpdk/device/device.c20
1 files changed, 20 insertions, 0 deletions
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* */