aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/node.c
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/vnet/devices/virtio/node.c
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/vnet/devices/virtio/node.c')
-rw-r--r--src/vnet/devices/virtio/node.c48
1 files changed, 22 insertions, 26 deletions
diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c
index 1e75ca47586..788cc617f61 100644
--- a/src/vnet/devices/virtio/node.c
+++ b/src/vnet/devices/virtio/node.c
@@ -26,15 +26,14 @@
#include <vlib/vlib.h>
#include <vlib/unix/unix.h>
#include <vnet/ethernet/ethernet.h>
-#include <vnet/devices/devices.h>
#include <vnet/feature/feature.h>
#include <vnet/gso/gro_func.h>
+#include <vnet/interface/rx_queue_funcs.h>
#include <vnet/ip/ip4_packet.h>
#include <vnet/ip/ip6_packet.h>
#include <vnet/udp/udp_packet.h>
#include <vnet/devices/virtio/virtio.h>
-
#define foreach_virtio_input_error \
_(BUFFER_ALLOC, "buffer alloc error") \
_(UNKNOWN, "unknown")
@@ -638,30 +637,27 @@ VLIB_NODE_FN (virtio_input_node) (vlib_main_t * vm,
vlib_frame_t * frame)
{
u32 n_rx = 0;
- virtio_main_t *nm = &virtio_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)
- {
- virtio_if_t *vif;
- vif = vec_elt_at_index (nm->interfaces, dq->dev_instance);
- if (vif->flags & VIRTIO_IF_FLAG_ADMIN_UP)
- {
- if (vif->type == VIRTIO_IF_TYPE_TAP)
- n_rx += virtio_device_input_inline (vm, node, frame, vif,
- dq->queue_id,
- VIRTIO_IF_TYPE_TAP);
- else if (vif->type == VIRTIO_IF_TYPE_PCI)
- n_rx += virtio_device_input_inline (vm, node, frame, vif,
- dq->queue_id,
- VIRTIO_IF_TYPE_PCI);
- else if (vif->type == VIRTIO_IF_TYPE_TUN)
- n_rx += virtio_device_input_inline (vm, node, frame, vif,
- dq->queue_id,
- VIRTIO_IF_TYPE_TUN);
- }
- }
+ virtio_main_t *vim = &virtio_main;
+ vnet_hw_if_rxq_poll_vector_t *p,
+ *pv = vnet_hw_if_get_rxq_poll_vector (vm, node);
+
+ vec_foreach (p, pv)
+ {
+ virtio_if_t *vif;
+ vif = vec_elt_at_index (vim->interfaces, p->dev_instance);
+ if (vif->flags & VIRTIO_IF_FLAG_ADMIN_UP)
+ {
+ if (vif->type == VIRTIO_IF_TYPE_TAP)
+ n_rx += virtio_device_input_inline (
+ vm, node, frame, vif, p->queue_id, VIRTIO_IF_TYPE_TAP);
+ else if (vif->type == VIRTIO_IF_TYPE_PCI)
+ n_rx += virtio_device_input_inline (
+ vm, node, frame, vif, p->queue_id, VIRTIO_IF_TYPE_PCI);
+ else if (vif->type == VIRTIO_IF_TYPE_TUN)
+ n_rx += virtio_device_input_inline (
+ vm, node, frame, vif, p->queue_id, VIRTIO_IF_TYPE_TUN);
+ }
+ }
return n_rx;
}