vnet_hw_if_rx_queue_t *rxq;
vnet_hw_if_rxq_poll_vector_t *pv, **d = 0;
vlib_node_state_t *per_thread_node_state = 0;
- u32 n_threads = vec_len (vlib_mains);
+ u32 n_threads = vlib_get_n_threads ();
+ u16 *per_thread_node_adaptive = 0;
int something_changed = 0;
clib_bitmap_t *pending_int = 0;
int last_int = -1;
vec_validate (d, n_threads - 1);
vec_validate_init_empty (per_thread_node_state, n_threads - 1,
VLIB_NODE_STATE_DISABLED);
+ vec_validate_init_empty (per_thread_node_adaptive, n_threads - 1, 0);
/* find out desired node state on each thread */
pool_foreach (rxq, im->hw_if_rx_queues)
continue;
if (rxq->mode == VNET_HW_IF_RX_MODE_POLLING)
- per_thread_node_state[ti] = VLIB_NODE_STATE_POLLING;
+ {
+ per_thread_node_state[ti] = VLIB_NODE_STATE_POLLING;
+ per_thread_node_adaptive[ti] = 0;
+ }
if (per_thread_node_state[ti] == VLIB_NODE_STATE_POLLING)
continue;
if (rxq->mode == VNET_HW_IF_RX_MODE_INTERRUPT ||
rxq->mode == VNET_HW_IF_RX_MODE_ADAPTIVE)
per_thread_node_state[ti] = VLIB_NODE_STATE_INTERRUPT;
+
+ if (rxq->mode == VNET_HW_IF_RX_MODE_ADAPTIVE)
+ per_thread_node_adaptive[ti] = 1;
}
/* construct per-thread polling vectors */
pool_foreach (rxq, im->hw_if_rx_queues)
{
u32 ti = rxq->thread_index;
- uword flags;
hi = vnet_get_hw_interface (vnm, rxq->hw_if_index);
if (hi->input_node_index != node_index)
continue;
- flags = vnet_sw_interface_get_flags (vnm, hi->sw_if_index);
- if ((flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) == 0)
- {
- log_debug ("skip interface %v (admin down)", hi->name);
- continue;
- }
-
if (rxq->mode == VNET_HW_IF_RX_MODE_INTERRUPT ||
rxq->mode == VNET_HW_IF_RX_MODE_ADAPTIVE)
last_int = clib_max (last_int, rxq - im->hw_if_rx_queues);
* unnecesary barrier */
for (int i = 0; i < n_threads; i++)
{
+ vlib_main_t *ovm = vlib_get_main_by_index (i);
vlib_node_state_t old_state;
vec_sort_with_function (d[i], poll_data_sort);
- old_state = vlib_node_get_state (vlib_mains[i], node_index);
+ old_state = vlib_node_get_state (ovm, node_index);
if (per_thread_node_state[i] != old_state)
{
something_changed = 1;
if (something_changed == 0)
{
vnet_hw_if_rx_node_runtime_t *rt;
- rt = vlib_node_get_runtime_data (vlib_mains[i], node_index);
+ rt = vlib_node_get_runtime_data (ovm, node_index);
if (vec_len (rt->rxq_poll_vector) != vec_len (d[i]))
something_changed = 1;
else if (memcmp (d[i], rt->rxq_poll_vector,
for (int i = 0; i < n_threads; i++)
{
- vlib_main_t *vm = vlib_mains[i];
+ vlib_main_t *vm = vlib_get_main_by_index (i);
vnet_hw_if_rx_node_runtime_t *rt;
rt = vlib_node_get_runtime_data (vm, node_index);
pv = rt->rxq_poll_vector;
{
clib_interrupt_clear (in, int_num);
pending_int = clib_bitmap_set (pending_int, int_num, 1);
+ last_int = clib_max (last_int, int_num);
}
}
vlib_node_set_state (vm, node_index, per_thread_node_state[i]);
+ vlib_node_set_flag (vm, node_index, VLIB_NODE_FLAG_ADAPTIVE_MODE,
+ per_thread_node_adaptive[i]);
if (last_int >= 0)
clib_interrupt_resize (&rt->rxq_interrupts, last_int + 1);
vec_free (d);
vec_free (per_thread_node_state);
+ vec_free (per_thread_node_adaptive);
}