summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/node.c
diff options
context:
space:
mode:
authorSteven <sluong@cisco.com>2017-05-15 09:33:11 -0700
committerNeale Ranns <nranns@cisco.com>2017-05-15 19:09:51 +0000
commite50ed1de1e22dfa04de26fa2a471a703c1b6ed8f (patch)
tree019c8b0139c4b34e5880e003fc202f479f8bfaff /src/plugins/memif/node.c
parent12059c9b6da0536a74d3003cebed61225a8a8ee7 (diff)
memif: migrate memif to use vnet device infra APIs
Migrate memif to use vnet device infra APIs. No new function is added. Change-Id: I70e440d2ae1e673876365041f31fe78997aceecf Signed-off-by: Steven <sluong@cisco.com>
Diffstat (limited to 'src/plugins/memif/node.c')
-rw-r--r--src/plugins/memif/node.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c
index cee1f3d1b7b..2690dc4e0ec 100644
--- a/src/plugins/memif/node.c
+++ b/src/plugins/memif/node.c
@@ -331,26 +331,26 @@ memif_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 thread_index = vlib_get_thread_index ();
memif_main_t *nm = &memif_main;
memif_if_t *mif;
-
- /* *INDENT-OFF* */
- pool_foreach (mif, nm->interfaces,
- ({
- if (mif->flags & MEMIF_IF_FLAG_ADMIN_UP &&
- mif->flags & MEMIF_IF_FLAG_CONNECTED &&
- (mif->if_index % nm->input_cpu_count) ==
- (thread_index - nm->input_cpu_first_index))
- {
- if (mif->flags & MEMIF_IF_FLAG_IS_SLAVE)
- n_rx_packets +=
- memif_device_input_inline (vm, node, frame, mif,
- MEMIF_RING_M2S);
- else
- n_rx_packets +=
- memif_device_input_inline (vm, node, frame, mif,
- MEMIF_RING_S2M);
- }
- }));
- /* *INDENT-ON* */
+ vnet_device_input_runtime_t *rt = (void *) node->runtime_data;
+ vnet_device_and_queue_t *dq;
+ memif_ring_type_t type;
+
+ foreach_device_and_queue (dq, rt->devices_and_queues)
+ {
+ mif = vec_elt_at_index (nm->interfaces, dq->dev_instance);
+ if (mif->flags & MEMIF_IF_FLAG_ADMIN_UP &&
+ mif->flags & MEMIF_IF_FLAG_CONNECTED &&
+ (mif->if_index % nm->input_cpu_count) ==
+ (thread_index - nm->input_cpu_first_index))
+ {
+ if (mif->flags & MEMIF_IF_FLAG_IS_SLAVE)
+ type = MEMIF_RING_M2S;
+ else
+ type = MEMIF_RING_S2M;
+ n_rx_packets +=
+ memif_device_input_inline (vm, node, frame, mif, type);
+ }
+ }
return n_rx_packets;
}