diff options
Diffstat (limited to 'src/vnet/unix/tuntap.c')
-rw-r--r-- | src/vnet/unix/tuntap.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c index 4a848349ae1..f1102dc321e 100644 --- a/src/vnet/unix/tuntap.c +++ b/src/vnet/unix/tuntap.c @@ -172,7 +172,7 @@ tuntap_tx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) /* Re-set iovecs if present. */ if (tm->threads[thread_index].iovecs) - _vec_len (tm->threads[thread_index].iovecs) = 0; + vec_set_len (tm->threads[thread_index].iovecs, 0); /** VLIB buffer chain -> Unix iovec(s). */ vec_add2 (tm->threads[thread_index].iovecs, iov, 1); @@ -217,14 +217,12 @@ tuntap_tx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) return n_packets; } -/* *INDENT-OFF* */ VLIB_REGISTER_NODE (tuntap_tx_node,static) = { .function = tuntap_tx, .name = "tuntap-tx", .type = VLIB_NODE_TYPE_INTERNAL, .vector_size = 4, }; -/* *INDENT-ON* */ /** * @brief TUNTAP receive node @@ -260,7 +258,7 @@ tuntap_rx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vlib_buffer_alloc (vm, tm->threads[thread_index].rx_buffers + n_left, VLIB_FRAME_SIZE - n_left); - _vec_len (tm->threads[thread_index].rx_buffers) = n_left + n_alloc; + vec_set_len (tm->threads[thread_index].rx_buffers, n_left + n_alloc); } } @@ -324,7 +322,7 @@ tuntap_rx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) + VNET_INTERFACE_COUNTER_RX, thread_index, tm->sw_if_index, 1, n_bytes_in_packet); - _vec_len (tm->threads[thread_index].rx_buffers) = i_rx; + vec_set_len (tm->threads[thread_index].rx_buffers, i_rx); } b = vlib_get_buffer (vm, bi); @@ -366,7 +364,7 @@ tuntap_rx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) next_index = VNET_DEVICE_INPUT_NEXT_DROP; } - vnet_feature_start_device_input_x1 (tm->sw_if_index, &next_index, b); + vnet_feature_start_device_input (tm->sw_if_index, &next_index, b); vlib_set_next_frame_buffer (vm, node, next_index, bi); @@ -385,7 +383,6 @@ static char *tuntap_rx_error_strings[] = { "unknown packet type", }; -/* *INDENT-OFF* */ VLIB_REGISTER_NODE (tuntap_rx_node,static) = { .function = tuntap_rx, .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED, @@ -397,7 +394,6 @@ VLIB_REGISTER_NODE (tuntap_rx_node,static) = { .n_errors = 1, .error_strings = tuntap_rx_error_strings, }; -/* *INDENT-ON* */ /** * @brief Gets called when file descriptor is ready from epoll. @@ -624,12 +620,12 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input) if (have_normal_interface) { vnet_main_t *vnm = vnet_get_main (); - error = ethernet_register_interface - (vnm, tuntap_dev_class.index, 0 /* device instance */ , - tm->ether_dst_mac /* ethernet address */ , - &tm->hw_if_index, 0 /* flag change */ ); - if (error) - clib_error_report (error); + vnet_eth_interface_registration_t eir = {}; + + eir.dev_class_index = tuntap_dev_class.index; + eir.address = tm->ether_dst_mac; + tm->hw_if_index = vnet_eth_register_interface (vnm, &eir); + tm->sw_if_index = tm->hw_if_index; vm->os_punt_frame = tuntap_nopunt_frame; } @@ -912,7 +908,7 @@ tuntap_punt_frame (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { tuntap_tx (vm, node, frame); - vlib_frame_free (vm, node, frame); + vlib_frame_free (vm, frame); } /** @@ -930,15 +926,13 @@ tuntap_nopunt_frame (vlib_main_t * vm, u32 *buffers = vlib_frame_vector_args (frame); uword n_packets = frame->n_vectors; vlib_buffer_free (vm, buffers, n_packets); - vlib_frame_free (vm, node, frame); + vlib_frame_free (vm, frame); } -/* *INDENT-OFF* */ VNET_HW_INTERFACE_CLASS (tuntap_interface_class,static) = { .name = "tuntap", .flags = VNET_HW_INTERFACE_CLASS_FLAG_P2P, }; -/* *INDENT-ON* */ /** * @brief Format tun/tap interface name @@ -984,13 +978,11 @@ tuntap_intfc_tx (vlib_main_t * vm, return n_buffers; } -/* *INDENT-OFF* */ VNET_DEVICE_CLASS (tuntap_dev_class,static) = { .name = "tuntap", .tx_function = tuntap_intfc_tx, .format_device_name = format_tuntap_interface_name, }; -/* *INDENT-ON* */ /** * @brief tun/tap node init @@ -1025,12 +1017,10 @@ tuntap_init (vlib_main_t * vm) return 0; } -/* *INDENT-OFF* */ VLIB_INIT_FUNCTION (tuntap_init) = { .runs_after = VLIB_INITS("ip4_init"), }; -/* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON |