summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/memif/memif.c35
-rw-r--r--src/plugins/memif/node.c84
-rw-r--r--src/plugins/memif/private.h1
3 files changed, 59 insertions, 61 deletions
diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c
index 7f228832344..6bfb7b37163 100644
--- a/src/plugins/memif/memif.c
+++ b/src/plugins/memif/memif.c
@@ -36,6 +36,7 @@
#include <vppinfra/linux/syscall.h>
#include <vnet/plugin/plugin.h>
#include <vnet/ethernet/ethernet.h>
+#include <vnet/interface/rx_queue_funcs.h>
#include <vpp/app/version.h>
#include <memif/memif.h>
#include <memif/private.h>
@@ -138,12 +139,6 @@ memif_disconnect (memif_if_t * mif, clib_error_t * err)
mq = vec_elt_at_index (mif->rx_queues, i);
if (mq->ring)
{
- int rv;
- rv = vnet_hw_interface_unassign_rx_thread (vnm, mif->hw_if_index, i);
- if (rv)
- memif_log_warn (mif,
- "Unable to unassign interface %d, queue %d: rc=%d",
- mif->hw_if_index, i, rv);
if (mif->flags & MEMIF_IF_FLAG_ZERO_COPY)
{
memif_disconnect_free_zc_queue_buffer(mq, 1);
@@ -151,6 +146,8 @@ memif_disconnect (memif_if_t * mif, clib_error_t * err)
mq->ring = 0;
}
}
+ vnet_hw_if_unregister_all_rx_queues (vnm, mif->hw_if_index);
+ vnet_hw_if_update_runtime_data (vnm, mif->hw_if_index);
/* *INDENT-OFF* */
vec_foreach_index (i, mif->tx_queues)
@@ -222,7 +219,7 @@ memif_int_fd_read_ready (clib_file_t * uf)
return 0;
}
- vnet_device_input_set_interrupt_pending (vnm, mif->hw_if_index, qid);
+ vnet_hw_if_rx_queue_set_int_pending (vnm, mq->queue_index);
mq->int_count++;
return 0;
@@ -285,6 +282,7 @@ memif_connect (memif_if_t * mif)
{
memif_queue_t *mq = vec_elt_at_index (mif->rx_queues, i);
u32 ti;
+ u32 qi;
int rv;
mq->ring = mif->regions[mq->region].shm + mq->offset;
@@ -293,7 +291,9 @@ memif_connect (memif_if_t * mif)
err = clib_error_return (0, "wrong cookie on tx ring %u", i);
goto error;
}
-
+ qi = vnet_hw_if_register_rx_queue (vnm, mif->hw_if_index, i,
+ VNET_HW_IF_RXQ_THREAD_ANY);
+ mq->queue_index = qi;
if (mq->int_fd > -1)
{
template.file_descriptor = mq->int_fd;
@@ -302,26 +302,27 @@ memif_connect (memif_if_t * mif)
format_memif_device_name,
mif->dev_instance, i);
memif_file_add (&mq->int_clib_file_index, &template);
+ vnet_hw_if_set_rx_queue_file_index (vnm, qi,
+ mq->int_clib_file_index);
}
- vnet_hw_interface_assign_rx_thread (vnm, mif->hw_if_index, i, ~0);
- ti = vnet_get_device_input_thread_index (vnm, mif->hw_if_index, i);
+ ti = vnet_hw_if_get_rx_queue_thread_index (vnm, qi);
mq->buffer_pool_index =
vlib_buffer_pool_get_default_for_numa (vm, vlib_mains[ti]->numa_node);
- rv = vnet_hw_interface_set_rx_mode (vnm, mif->hw_if_index, i,
- VNET_HW_IF_RX_MODE_DEFAULT);
+ rv = vnet_hw_if_set_rx_queue_mode (vnm, qi, VNET_HW_IF_RX_MODE_DEFAULT);
+ vnet_hw_if_update_runtime_data (vnm, mif->hw_if_index);
+
if (rv)
memif_log_err
(mif, "Warning: unable to set rx mode for interface %d queue %d: "
"rc=%d", mif->hw_if_index, i, rv);
else
{
- vnet_hw_if_rx_mode rxmode;
- vnet_hw_interface_get_rx_mode (vnm, mif->hw_if_index, i, &rxmode);
+ vnet_hw_if_rx_mode rxmode = vnet_hw_if_get_rx_queue_mode (vnm, qi);
if (rxmode == VNET_HW_IF_RX_MODE_POLLING)
mq->ring->flags |= MEMIF_RING_FLAG_MASK_INT;
else
- vnet_device_input_set_interrupt_pending (vnm, mif->hw_if_index, i);
+ vnet_hw_if_rx_queue_set_int_pending (vnm, qi);
}
}
/* *INDENT-ON* */
@@ -1048,9 +1049,7 @@ memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args)
hw = vnet_get_hw_interface (vnm, mif->hw_if_index);
hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
- vnet_hw_interface_set_input_node (vnm, mif->hw_if_index,
- memif_input_node.index);
-
+ vnet_hw_if_set_input_node (vnm, mif->hw_if_index, memif_input_node.index);
mhash_set (&msf->dev_instance_by_id, &mif->id, mif->dev_instance, 0);
if (pool_elts (mm->interfaces) == 1)
diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c
index 7b341e4b077..270fd59ca47 100644
--- a/src/plugins/memif/node.c
+++ b/src/plugins/memif/node.c
@@ -24,7 +24,7 @@
#include <vlib/vlib.h>
#include <vlib/unix/unix.h>
#include <vnet/ethernet/ethernet.h>
-#include <vnet/devices/devices.h>
+#include <vnet/interface/rx_queue_funcs.h>
#include <vnet/feature/feature.h>
#include <memif/memif.h>
@@ -876,51 +876,49 @@ VLIB_NODE_FN (memif_input_node) (vlib_main_t * vm,
{
u32 n_rx = 0;
memif_main_t *mm = &memif_main;
- vnet_device_input_runtime_t *rt = (void *) node->runtime_data;
- vnet_device_and_queue_t *dq;
memif_interface_mode_t mode_ip = MEMIF_INTERFACE_MODE_IP;
memif_interface_mode_t mode_eth = MEMIF_INTERFACE_MODE_ETHERNET;
- foreach_device_and_queue (dq, rt->devices_and_queues)
- {
- memif_if_t *mif;
- mif = vec_elt_at_index (mm->interfaces, dq->dev_instance);
- if ((mif->flags & MEMIF_IF_FLAG_ADMIN_UP) &&
- (mif->flags & MEMIF_IF_FLAG_CONNECTED))
- {
- if (mif->flags & MEMIF_IF_FLAG_ZERO_COPY)
- {
- if (mif->mode == MEMIF_INTERFACE_MODE_IP)
- n_rx += memif_device_input_zc_inline (vm, node, frame, mif,
- dq->queue_id, mode_ip);
- else
- n_rx += memif_device_input_zc_inline (vm, node, frame, mif,
- dq->queue_id, mode_eth);
- }
- else if (mif->flags & MEMIF_IF_FLAG_IS_SLAVE)
- {
- if (mif->mode == MEMIF_INTERFACE_MODE_IP)
- n_rx += memif_device_input_inline (vm, node, frame, mif,
- MEMIF_RING_M2S, dq->queue_id,
- mode_ip);
- else
- n_rx += memif_device_input_inline (vm, node, frame, mif,
- MEMIF_RING_M2S, dq->queue_id,
- mode_eth);
- }
- else
- {
- if (mif->mode == MEMIF_INTERFACE_MODE_IP)
- n_rx += memif_device_input_inline (vm, node, frame, mif,
- MEMIF_RING_S2M, dq->queue_id,
- mode_ip);
- else
- n_rx += memif_device_input_inline (vm, node, frame, mif,
- MEMIF_RING_S2M, dq->queue_id,
- mode_eth);
- }
- }
- }
+ 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++)
+ {
+ memif_if_t *mif;
+ u32 qid;
+ mif = vec_elt_at_index (mm->interfaces, pv[i].dev_instance);
+ qid = pv[i].queue_id;
+ if ((mif->flags & MEMIF_IF_FLAG_ADMIN_UP) &&
+ (mif->flags & MEMIF_IF_FLAG_CONNECTED))
+ {
+ if (mif->flags & MEMIF_IF_FLAG_ZERO_COPY)
+ {
+ if (mif->mode == MEMIF_INTERFACE_MODE_IP)
+ n_rx += memif_device_input_zc_inline (vm, node, frame, mif,
+ qid, mode_ip);
+ else
+ n_rx += memif_device_input_zc_inline (vm, node, frame, mif,
+ qid, mode_eth);
+ }
+ else if (mif->flags & MEMIF_IF_FLAG_IS_SLAVE)
+ {
+ if (mif->mode == MEMIF_INTERFACE_MODE_IP)
+ n_rx += memif_device_input_inline (
+ vm, node, frame, mif, MEMIF_RING_M2S, qid, mode_ip);
+ else
+ n_rx += memif_device_input_inline (
+ vm, node, frame, mif, MEMIF_RING_M2S, qid, mode_eth);
+ }
+ else
+ {
+ if (mif->mode == MEMIF_INTERFACE_MODE_IP)
+ n_rx += memif_device_input_inline (
+ vm, node, frame, mif, MEMIF_RING_S2M, qid, mode_ip);
+ else
+ n_rx += memif_device_input_inline (
+ vm, node, frame, mif, MEMIF_RING_S2M, qid, mode_eth);
+ }
+ }
+ }
return n_rx;
}
diff --git a/src/plugins/memif/private.h b/src/plugins/memif/private.h
index daa96d0f412..a53aca5a823 100644
--- a/src/plugins/memif/private.h
+++ b/src/plugins/memif/private.h
@@ -132,6 +132,7 @@ typedef struct
/* queue type */
memif_ring_type_t type;
+ u32 queue_index;
} memif_queue_t;
#define foreach_memif_if_flag \