summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/af_packet/node.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-03-20 16:34:15 +0100
committerDamjan Marion <damarion@cisco.com>2017-03-20 16:34:15 +0100
commiteb743fad56b32cb20ad2d2cadc4760f9c25be5e1 (patch)
tree4e5b6cd7b7635ee7269ab33300188de7fd42595d /src/vnet/devices/af_packet/node.c
parent95475a3661b95150c8d1e60a3942b91c2b5d06bc (diff)
vnet: add device-input threadplacement infra
This change adds two new debug CLI command: - "show interface placmenet" to display which thread (main or worker) is responsible for processing interface rx queue vpp# show interface placement Thread 0 (vpp_main): node af-packet-input: host-vpp1 queue 0 Thread 1 (vpp_wk_0): node af-packet-input: host-virbr0 queue 0 Thread 2 (vpp_wk_1): node af-packet-input: host-vpp2 queue 0 host-lxcbr0 queue 0 - "set interface placmenet" to assign thread (main or worker) which process specific interface rx queue vpp# set interface placement host-vpp1 queue 0 main Change-Id: Id4dd00cf2b05e10fae2125ac7cb4411b446c5e9c Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/devices/af_packet/node.c')
-rw-r--r--src/vnet/devices/af_packet/node.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c
index ab7fd80005f..ba337f3f70b 100644
--- a/src/vnet/devices/af_packet/node.c
+++ b/src/vnet/devices/af_packet/node.c
@@ -246,20 +246,18 @@ static uword
af_packet_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
- int i;
u32 n_rx_packets = 0;
- u32 cpu_index = os_get_cpu_number ();
af_packet_main_t *apm = &af_packet_main;
- af_packet_if_t *apif;
+ vnet_device_input_runtime_t *rt = (void *) node->runtime_data;
+ vnet_device_and_queue_t *dq;
- for (i = 0; i < vec_len (apm->interfaces); i++)
- {
- apif = vec_elt_at_index (apm->interfaces, i);
- if (apif->is_admin_up &&
- (i % apm->input_cpu_count) ==
- (cpu_index - apm->input_cpu_first_index))
- n_rx_packets += af_packet_device_input_fn (vm, node, frame, apif);
- }
+ vec_foreach (dq, rt->devices_and_queues)
+ {
+ af_packet_if_t *apif;
+ apif = vec_elt_at_index (apm->interfaces, dq->dev_instance);
+ if (apif->is_admin_up)
+ n_rx_packets += af_packet_device_input_fn (vm, node, frame, apif);
+ }
return n_rx_packets;
}
@@ -271,9 +269,6 @@ VLIB_REGISTER_NODE (af_packet_input_node) = {
.sibling_of = "device-input",
.format_trace = format_af_packet_input_trace,
.type = VLIB_NODE_TYPE_INPUT,
- /**
- * default state is INTERRUPT mode, switch to POLLING if worker threads are enabled
- */
.state = VLIB_NODE_STATE_INTERRUPT,
.n_errors = AF_PACKET_INPUT_N_ERROR,
.error_strings = af_packet_input_error_strings,