/* *INDENT-OFF* */
VLIB_REGISTER_LOG_CLASS (if_default_log, static) = {
.class_name = "interface",
- .default_syslog_level = VLIB_LOG_LEVEL_DEBUG,
};
/* *INDENT-ON* */
{
vlib_node_t *n = vlib_get_node (vm, node_index);
- n->function = dev_class->tx_function;
n->format_trace = dev_class->format_tx_trace;
/// XXX: Update this to use counter structure
vnet_config_main_t *cm;
u32 hw_index, i;
char *tx_node_name = NULL, *output_node_name = NULL;
- vlib_node_function_t *output_node = vnet_interface_output_node_get (vm);
+ vlib_node_t *if_out_node =
+ vlib_get_node (vm, vnet_interface_output_node.index);
pool_get (im->hw_interfaces, hw);
clib_memset (hw, 0, sizeof (*hw));
hw->min_packet_bytes = 0;
vnet_sw_interface_set_mtu (vnm, hw->sw_if_index, 0);
- if (dev_class->tx_function == 0)
+ if (dev_class->tx_function == 0 && dev_class->tx_fn_registrations == 0)
goto no_output_nodes; /* No output/tx nodes to create */
tx_node_name = (char *) format (0, "%v-tx", hw->name);
/* The new class may differ from the old one.
* Functions have to be updated. */
node = vlib_get_node (vm, hw->output_node_index);
- node->function = output_node;
node->format_trace = format_vnet_interface_output_trace;
+ node->node_fn_registrations = if_out_node->node_fn_registrations;
+ node->function = if_out_node->function;
+
/* *INDENT-OFF* */
foreach_vlib_main ({
nrt = vlib_node_get_runtime (this_vlib_main, hw->output_node_index);
/* *INDENT-ON* */
node = vlib_get_node (vm, hw->tx_node_index);
- node->function = dev_class->tx_function;
+ if (dev_class->tx_fn_registrations)
+ {
+ node->node_fn_registrations = dev_class->tx_fn_registrations;
+ node->function = vlib_node_get_preferred_node_fn_variant (
+ vm, dev_class->tx_fn_registrations);
+ }
+ else
+ node->function = dev_class->tx_function;
node->format_trace = dev_class->format_tx_trace;
/* *INDENT-OFF* */
foreach_vlib_main ({
r.flags = VLIB_NODE_FLAG_IS_OUTPUT;
r.name = tx_node_name;
- r.function = dev_class->tx_function;
+ if (dev_class->tx_fn_registrations)
+ {
+ r.function = 0;
+ r.node_fn_registrations = dev_class->tx_fn_registrations;
+ }
+ else
+ r.function = dev_class->tx_function;
hw->tx_node_index = vlib_register_node (vm, &r);
r.flags = 0;
r.name = output_node_name;
- r.function = output_node;
r.format_trace = format_vnet_interface_output_trace;
+ if (if_out_node->node_fn_registrations)
+ {
+ r.function = 0;
+ r.node_fn_registrations = if_out_node->node_fn_registrations;
+ }
+ else
+ r.function = if_out_node->function;
{
static char *e[] = {
vec_free (hw->name);
vec_free (hw->hw_address);
vec_free (hw->input_node_thread_index_by_queue);
- vec_free (hw->dq_runtime_index_by_queue);
vec_free (hw->rx_queue_indices);
pool_put (im->hw_interfaces, hw);
}
c->index = vec_len (im->device_classes);
hash_set_mem (im->device_class_by_name, c->name, c->index);
+ /* to avoid confusion, please remove ".tx_function" statement
+ from VNET_DEVICE_CLASS() if using function candidates */
+ ASSERT (c->tx_fn_registrations == 0 || c->tx_function == 0);
+
if (c->tx_fn_registrations)
- {
- vlib_node_fn_registration_t *fnr = c->tx_fn_registrations;
- int priority = -1;
-
- /* to avoid confusion, please remove ".tx_function" statement
- from VNET_DEVICE_CLASS() if using function candidates */
- ASSERT (c->tx_function == 0);
-
- while (fnr)
- {
- if (fnr->priority > priority)
- {
- priority = fnr->priority;
- c->tx_function = fnr->function;
- }
- fnr = fnr->next_registration;
- }
- }
+ c->tx_function = vlib_node_get_preferred_node_fn_variant (
+ vm, c->tx_fn_registrations);
vec_add1 (im->device_classes, c[0]);
c = c->next_class_registration;