summaryrefslogtreecommitdiffstats
path: root/src/plugins/vmxnet3
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/vmxnet3
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/vmxnet3')
-rw-r--r--src/plugins/vmxnet3/input.c24
-rw-r--r--src/plugins/vmxnet3/vmxnet3.c28
-rw-r--r--src/plugins/vmxnet3/vmxnet3.h1
3 files changed, 27 insertions, 26 deletions
diff --git a/src/plugins/vmxnet3/input.c b/src/plugins/vmxnet3/input.c
index bed4c1e3292..affc3691af1 100644
--- a/src/plugins/vmxnet3/input.c
+++ b/src/plugins/vmxnet3/input.c
@@ -23,7 +23,7 @@
#include <vnet/ip/ip6_packet.h>
#include <vnet/ip/ip4_packet.h>
#include <vnet/udp/udp_packet.h>
-
+#include <vnet/interface/rx_queue_funcs.h>
#include <vmxnet3/vmxnet3.h>
#define foreach_vmxnet3_input_error \
@@ -469,17 +469,17 @@ VLIB_NODE_FN (vmxnet3_input_node) (vlib_main_t * vm,
{
u32 n_rx = 0;
vmxnet3_main_t *vmxm = &vmxnet3_main;
- 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)
- {
- vmxnet3_device_t *vd;
- vd = vec_elt_at_index (vmxm->devices, dq->dev_instance);
- if ((vd->flags & VMXNET3_DEVICE_F_ADMIN_UP) == 0)
- continue;
- n_rx += vmxnet3_device_input_inline (vm, node, frame, vd, dq->queue_id);
- }
+ vnet_hw_if_rxq_poll_vector_t *pv = vnet_hw_if_get_rxq_poll_vector (vm, node);
+ vnet_hw_if_rxq_poll_vector_t *pve;
+
+ vec_foreach (pve, pv)
+ {
+ vmxnet3_device_t *vd;
+ vd = vec_elt_at_index (vmxm->devices, pve->dev_instance);
+ if ((vd->flags & VMXNET3_DEVICE_F_ADMIN_UP) == 0)
+ continue;
+ n_rx += vmxnet3_device_input_inline (vm, node, frame, vd, pve->queue_id);
+ }
return n_rx;
}
diff --git a/src/plugins/vmxnet3/vmxnet3.c b/src/plugins/vmxnet3/vmxnet3.c
index 8ec10cd1a73..2c7b970d58f 100644
--- a/src/plugins/vmxnet3/vmxnet3.c
+++ b/src/plugins/vmxnet3/vmxnet3.c
@@ -19,7 +19,7 @@
#include <vnet/ethernet/ethernet.h>
#include <vnet/plugin/plugin.h>
#include <vpp/app/version.h>
-
+#include <vnet/interface/rx_queue_funcs.h>
#include <vmxnet3/vmxnet3.h>
#define PCI_VENDOR_ID_VMWARE 0x15ad
@@ -540,9 +540,10 @@ vmxnet3_rxq_irq_handler (vlib_main_t * vm, vlib_pci_dev_handle_t h, u16 line)
uword pd = vlib_pci_get_private_data (vm, h);
vmxnet3_device_t *vd = pool_elt_at_index (vmxm->devices, pd);
u16 qid = line;
+ vmxnet3_rxq_t *rxq = vec_elt_at_index (vd->rxqs, qid);
if (vec_len (vd->rxqs) > qid && vd->rxqs[qid].int_mode != 0)
- vnet_device_input_set_interrupt_pending (vnm, vd->hw_if_index, qid);
+ vnet_hw_if_rx_queue_set_int_pending (vnm, rxq->queue_index);
}
static void
@@ -812,25 +813,26 @@ vmxnet3_create_if (vlib_main_t * vm, vmxnet3_create_if_args_t * args)
hw->flags |= (VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
- vnet_hw_interface_set_input_node (vnm, vd->hw_if_index,
- vmxnet3_input_node.index);
+ vnet_hw_if_set_input_node (vnm, vd->hw_if_index, vmxnet3_input_node.index);
/* Disable interrupts */
vmxnet3_disable_interrupt (vd);
vec_foreach_index (qid, vd->rxqs)
{
vmxnet3_rxq_t *rxq = vec_elt_at_index (vd->rxqs, qid);
- u32 thread_index;
- u32 numa_node;
+ u32 qi, fi;
- vnet_hw_interface_assign_rx_thread (vnm, vd->hw_if_index, qid, ~0);
- thread_index = vnet_get_device_input_thread_index (vnm, vd->hw_if_index,
- qid);
- numa_node = vlib_mains[thread_index]->numa_node;
+ qi = vnet_hw_if_register_rx_queue (vnm, vd->hw_if_index, qid,
+ VNET_HW_IF_RXQ_THREAD_ANY);
+ fi = vlib_pci_get_msix_file_index (vm, vd->pci_dev_handle, qid);
+ vnet_hw_if_set_rx_queue_file_index (vnm, qi, fi);
+ rxq->queue_index = qi;
rxq->buffer_pool_index =
- vlib_buffer_pool_get_default_for_numa (vm, numa_node);
+ vnet_hw_if_get_rx_queue_numa_node (vnm, rxq->queue_index);
vmxnet3_rxq_refill_ring0 (vm, vd, rxq);
vmxnet3_rxq_refill_ring1 (vm, vd, rxq);
}
+ vnet_hw_if_update_runtime_data (vnm, vd->hw_if_index);
+
vd->flags |= VMXNET3_DEVICE_F_INITIALIZED;
vmxnet3_enable_interrupt (vd);
@@ -855,7 +857,7 @@ vmxnet3_delete_if (vlib_main_t * vm, vmxnet3_device_t * vd)
vnet_main_t *vnm = vnet_get_main ();
vmxnet3_main_t *vmxm = &vmxnet3_main;
u32 i, bi;
- u16 desc_idx, qid;
+ u16 desc_idx;
/* Quiesce the device */
vmxnet3_reg_write (vd, 1, VMXNET3_REG_CMD, VMXNET3_CMD_QUIESCE_DEV);
@@ -866,8 +868,6 @@ vmxnet3_delete_if (vlib_main_t * vm, vmxnet3_device_t * vd)
if (vd->hw_if_index)
{
vnet_hw_interface_set_flags (vnm, vd->hw_if_index, 0);
- vec_foreach_index (qid, vd->rxqs)
- vnet_hw_interface_unassign_rx_thread (vnm, vd->hw_if_index, qid);
ethernet_delete_interface (vnm, vd->hw_if_index);
}
diff --git a/src/plugins/vmxnet3/vmxnet3.h b/src/plugins/vmxnet3/vmxnet3.h
index 8790e0f136e..e8d2be0e552 100644
--- a/src/plugins/vmxnet3/vmxnet3.h
+++ b/src/plugins/vmxnet3/vmxnet3.h
@@ -516,6 +516,7 @@ typedef struct
u16 size;
u8 int_mode;
u8 buffer_pool_index;
+ u32 queue_index;
vmxnet3_rx_ring rx_ring[VMXNET3_RX_RING_SIZE];
vmxnet3_rx_desc *rx_desc[VMXNET3_RX_RING_SIZE];
vmxnet3_rx_comp *rx_comp;