26 .class_name =
"interface",
27 .subclass_name =
"runtime",
30 #define log_debug(fmt, ...) vlib_log_debug (if_rxq_log.class, fmt, __VA_ARGS__) 31 #define log_err(fmt, ...) vlib_log_err (if_rxq_log.class, fmt, __VA_ARGS__) 34 [VLIB_NODE_STATE_DISABLED] =
"disabled",
35 [VLIB_NODE_STATE_POLLING] =
"polling",
36 [VLIB_NODE_STATE_INTERRUPT] =
"interrupt",
69 u16 *per_thread_node_adaptive = 0;
70 int something_changed_on_rx = 0;
71 int something_changed_on_tx = 0;
75 log_debug (
"update node '%U' triggered by interface %v",
80 VLIB_NODE_STATE_DISABLED);
99 per_thread_node_state[
ti] = VLIB_NODE_STATE_POLLING;
100 per_thread_node_adaptive[
ti] = 0;
103 if (per_thread_node_state[ti] == VLIB_NODE_STATE_POLLING)
108 per_thread_node_state[
ti] = VLIB_NODE_STATE_INTERRUPT;
111 per_thread_node_adaptive[
ti] = 1;
129 if (per_thread_node_state[ti] != VLIB_NODE_STATE_POLLING)
139 for (
int i = 0;
i < n_threads;
i++)
146 if (per_thread_node_state[i] != old_state)
148 something_changed_on_rx = 1;
149 log_debug (
"state changed for node %U on thread %u from %s to %s",
156 if (something_changed_on_rx == 0)
161 something_changed_on_rx = 1;
163 vec_len (d[i]) *
sizeof (**d)))
164 something_changed_on_rx = 1;
166 something_changed_on_rx = 1;
176 something_changed_on_tx = 1;
192 log_debug (
"tx queue data changed for interface %v, thread %u " 193 "(queue_id %u -> %u, n_threads %u -> %u)",
196 something_changed_on_tx = 1;
205 if (something_changed_on_rx || something_changed_on_tx)
212 log_debug (
"%s",
"already running under the barrier");
220 if (something_changed_on_rx)
222 for (
int i = 0;
i < n_threads;
i++)
240 last_int =
clib_max (last_int, int_num);
246 per_thread_node_adaptive[i]);
254 if (something_changed_on_tx)
259 new_out_runtimes = t;
266 log_debug (
"skipping update of node '%U', no changes detected",
279 for (
int i = 0;
i < n_threads;
i++)
284 vec_free (per_thread_node_adaptive);
vnet_hw_if_output_node_runtime_t * output_node_thread_runtimes
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static_always_inline int clib_interrupt_get_n_int(void *d)
vnet_hw_if_tx_frame_t frame
#define log_debug(fmt,...)
vnet_interface_output_runtime_t * rt
static_always_inline vnet_hw_if_tx_queue_t * vnet_hw_if_get_tx_queue(vnet_main_t *vnm, u32 queue_index)
format_function_t format_vlib_node_name
#define pool_foreach(VAR, POOL)
Iterate through pool.
vnet_interface_main_t interface_main
#define vec_add2_aligned(V, P, N, A)
Add N elements to end of vector V, return pointer to new elements in P.
#define clib_bitmap_foreach(i, ai)
Macro to iterate across set bits in a bitmap.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
static_always_inline void vnet_hw_if_rx_queue_set_int_pending(vnet_main_t *vnm, u32 queue_index)
static int poll_data_sort(void *a1, void *a2)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
#define vlib_worker_thread_barrier_sync(X)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static vlib_node_state_t vlib_node_get_state(vlib_main_t *vm, u32 node_index)
Get node dispatch state.
static_always_inline void clib_interrupt_free(void **data)
u8 vlib_worker_thread_barrier_held(void)
Return true if the wroker thread barrier is held.
vnet_hw_if_rxq_poll_vector_t * rxq_poll_vector
__clib_export void clib_interrupt_resize(void **data, uword n_int)
static void * vlib_node_get_runtime_data(vlib_main_t *vm, u32 node_index)
Get node runtime private data by node index.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
void vnet_hw_if_update_runtime_data(vnet_main_t *vnm, u32 hw_if_index)
#define VLIB_NODE_FLAG_ADAPTIVE_MODE
vnet_hw_if_rx_queue_t * hw_if_rx_queues
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
vnet_interface_main_t * im
static_always_inline void clib_interrupt_clear(void *in, int int_num)
static void vlib_node_set_flag(vlib_main_t *vm, u32 node_index, u16 flag, u8 enable)
#define clib_bitmap_free(v)
Free a bitmap.
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
static_always_inline int clib_interrupt_get_next(void *in, int last)
static u32 vlib_get_n_threads()
static vlib_main_t * vlib_get_main(void)
static uword clib_bitmap_count_set_bits(uword *ai)
Return the number of set bits in a bitmap.
static vlib_main_t * vlib_get_main_by_index(u32 thread_index)
#define vec_dup_aligned(V, A)
Return copy of vector (no header, alignment specified).
VLIB_REGISTER_LOG_CLASS(if_rxq_log, static)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
static char * node_state_str[]
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
#define CLIB_CACHE_LINE_BYTES