aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/avf
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-11-06 23:25:57 +0100
committerDamjan Marion <dmarion@me.com>2021-01-21 13:20:10 +0000
commit941005336ee8cec614a856089f3d873f7d98135c (patch)
tree2a9287e8a16cfbfecac80251637658a4cf93db66 /src/plugins/avf
parent1e4309538dd178827fc2a5efb3ceb80a4b1f1a8f (diff)
interface: rx queue infra rework, part one
Type: improvement Change-Id: I4008cadfd5141f921afbdc09a3ebcd1dcf88eb29 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/avf')
-rw-r--r--src/plugins/avf/avf.h1
-rw-r--r--src/plugins/avf/device.c24
-rw-r--r--src/plugins/avf/input.c25
3 files changed, 32 insertions, 18 deletions
diff --git a/src/plugins/avf/avf.h b/src/plugins/avf/avf.h
index 025fa6ea4e9..b3fcc259206 100644
--- a/src/plugins/avf/avf.h
+++ b/src/plugins/avf/avf.h
@@ -164,6 +164,7 @@ typedef struct
u16 n_enqueued;
u8 int_mode;
u8 buffer_pool_index;
+ u32 queue_index;
} avf_rxq_t;
typedef struct
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index ffd372d7a56..139f1c99ebb 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -20,6 +20,7 @@
#include <vlib/unix/unix.h>
#include <vlib/pci/pci.h>
#include <vnet/ethernet/ethernet.h>
+#include <vnet/interface/rx_queue_funcs.h>
#include <avf/avf.h>
@@ -1373,6 +1374,7 @@ avf_irq_n_handler (vlib_main_t * vm, vlib_pci_dev_handle_t h, u16 line)
vnet_main_t *vnm = vnet_get_main ();
uword pd = vlib_pci_get_private_data (vm, h);
avf_device_t *ad = avf_get_device (pd);
+ avf_rxq_t *rxq = vec_elt_at_index (ad->rxqs, line - 1);
if (ad->flags & AVF_DEVICE_F_ELOG)
{
@@ -1396,8 +1398,8 @@ avf_irq_n_handler (vlib_main_t * vm, vlib_pci_dev_handle_t h, u16 line)
line--;
- if (ad->flags & AVF_DEVICE_F_RX_INT && ad->rxqs[line].int_mode)
- vnet_device_input_set_interrupt_pending (vnm, ad->hw_if_index, line);
+ if (ad->flags & AVF_DEVICE_F_RX_INT && rxq->int_mode)
+ vnet_hw_if_rx_queue_set_int_pending (vnm, rxq->queue_index);
avf_irq_n_set_state (ad, line, AVF_IRQ_STATE_ENABLED);
}
@@ -1415,7 +1417,6 @@ avf_delete_if (vlib_main_t * vm, avf_device_t * ad, int with_barrier)
if (with_barrier)
vlib_worker_thread_barrier_sync (vm);
vnet_hw_interface_set_flags (vnm, ad->hw_if_index, 0);
- vnet_hw_interface_unassign_rx_thread (vnm, ad->hw_if_index, 0);
ethernet_delete_interface (vnm, ad->hw_if_index);
if (with_barrier)
vlib_worker_thread_barrier_release (vm);
@@ -1660,11 +1661,22 @@ avf_create_if (vlib_main_t * vm, avf_create_if_args_t * args)
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, ad->hw_if_index);
hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
- vnet_hw_interface_set_input_node (vnm, ad->hw_if_index,
- avf_input_node.index);
+ vnet_hw_if_set_input_node (vnm, ad->hw_if_index, avf_input_node.index);
for (i = 0; i < ad->n_rx_queues; i++)
- vnet_hw_interface_assign_rx_thread (vnm, ad->hw_if_index, i, ~0);
+ {
+ u32 qi, fi;
+ qi = vnet_hw_if_register_rx_queue (vnm, ad->hw_if_index, i,
+ VNET_HW_IF_RXQ_THREAD_ANY);
+
+ if (ad->flags & AVF_DEVICE_F_RX_INT)
+ {
+ fi = vlib_pci_get_msix_file_index (vm, ad->pci_dev_handle, i + 1);
+ vnet_hw_if_set_rx_queue_file_index (vnm, qi, fi);
+ }
+ ad->rxqs[i].queue_index = qi;
+ }
+ vnet_hw_if_update_runtime_data (vnm, ad->hw_if_index);
if (pool_elts (am->devices) == 1)
vlib_process_signal_event (vm, avf_process_node.index,
diff --git a/src/plugins/avf/input.c b/src/plugins/avf/input.c
index 85f97ca3e49..5041f6ef4e7 100644
--- a/src/plugins/avf/input.c
+++ b/src/plugins/avf/input.c
@@ -19,7 +19,7 @@
#include <vlib/unix/unix.h>
#include <vlib/pci/pci.h>
#include <vnet/ethernet/ethernet.h>
-#include <vnet/devices/devices.h>
+#include <vnet/interface/rx_queue_funcs.h>
#include <avf/avf.h>
@@ -473,17 +473,18 @@ VLIB_NODE_FN (avf_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
u32 n_rx = 0;
- vnet_device_input_runtime_t *rt = (void *) node->runtime_data;
- vnet_device_and_queue_t *dq;
-
- foreach_device_and_queue (dq, rt->devices_and_queues)
- {
- avf_device_t *ad;
- ad = avf_get_device (dq->dev_instance);
- if ((ad->flags & AVF_DEVICE_F_ADMIN_UP) == 0)
- continue;
- n_rx += avf_device_input_inline (vm, node, frame, ad, dq->queue_id);
- }
+ vnet_hw_if_rxq_poll_vector_t *pv;
+
+ pv = vnet_hw_if_get_rxq_poll_vector (vm, node);
+
+ for (int i = 0; i < vec_len (pv); i++)
+ {
+ avf_device_t *ad = avf_get_device (pv[i].dev_instance);
+ if ((ad->flags & AVF_DEVICE_F_ADMIN_UP) == 0)
+ continue;
+ n_rx += avf_device_input_inline (vm, node, frame, ad, pv[i].queue_id);
+ }
+
return n_rx;
}