From 7ad43a4184e614557c4076fbd5292b103534670a Mon Sep 17 00:00:00 2001 From: Mohsin Kazmi Date: Tue, 27 Feb 2024 12:00:20 +0000 Subject: af_packet: fix the device input feature arc support Type: fix Signed-off-by: Mohsin Kazmi Change-Id: I1c900bbe441c6797215f16e99b71149904aa745f --- src/plugins/af_packet/node.c | 45 +++++++++++++------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/plugins/af_packet/node.c b/src/plugins/af_packet/node.c index da01492a232..279f11c0183 100644 --- a/src/plugins/af_packet/node.c +++ b/src/plugins/af_packet/node.c @@ -275,20 +275,13 @@ af_packet_v3_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node, u32 num_pkts = 0; u32 rx_frame_offset = 0; block_desc_t *bd = 0; - vlib_buffer_t bt = {}; + u32 sw_if_index = apif->sw_if_index; u8 is_ip = (apif->mode == AF_PACKET_IF_MODE_IP); if (is_ip) next_index = VNET_DEVICE_INPUT_NEXT_IP4_INPUT; else - { - next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; - if (PREDICT_FALSE (apif->per_interface_next_index != ~0)) - next_index = apif->per_interface_next_index; - - /* redirect if feature path enabled */ - vnet_feature_start_device_input (apif->sw_if_index, &next_index, &bt); - } + next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; if ((((block_desc_t *) (block_start = rx_queue->rx_ring[block])) ->hdr.bh1.block_status & @@ -416,8 +409,7 @@ af_packet_v3_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node, { b0->total_length_not_including_first_buffer = 0; b0->flags = VLIB_BUFFER_TOTAL_LENGTH_VALID; - vnet_buffer (b0)->sw_if_index[VLIB_RX] = - apif->sw_if_index; + vnet_buffer (b0)->sw_if_index[VLIB_RX] = sw_if_index; vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~0; first_b0 = b0; first_bi0 = bi0; @@ -475,10 +467,9 @@ af_packet_v3_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node, next0 = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; if (PREDICT_FALSE (apif->per_interface_next_index != ~0)) next0 = apif->per_interface_next_index; - /* copy feature arc data from template */ - first_b0->current_config_index = bt.current_config_index; - vnet_buffer (first_b0)->feature_arc_index = - vnet_buffer (&bt)->feature_arc_index; + /* redirect if feature path enabled */ + vnet_feature_start_device_input (sw_if_index, &next0, + first_b0); } } @@ -583,22 +574,13 @@ af_packet_v2_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node, u32 thread_index = vm->thread_index; u32 n_buffer_bytes = vlib_buffer_get_default_data_size (vm); u32 min_bufs = rx_queue->rx_req->req.tp_frame_size / n_buffer_bytes; + u32 sw_if_index = apif->sw_if_index; u8 is_ip = (apif->mode == AF_PACKET_IF_MODE_IP); - vlib_buffer_t bt = {}; if (is_ip) - { - next_index = VNET_DEVICE_INPUT_NEXT_IP4_INPUT; - } + next_index = VNET_DEVICE_INPUT_NEXT_IP4_INPUT; else - { - next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; - if (PREDICT_FALSE (apif->per_interface_next_index != ~0)) - next_index = apif->per_interface_next_index; - - /* redirect if feature path enabled */ - vnet_feature_start_device_input (apif->sw_if_index, &next_index, &bt); - } + next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; n_free_bufs = vec_len (apm->rx_buffers[thread_index]); if (PREDICT_FALSE (n_free_bufs < VLIB_FRAME_SIZE)) @@ -680,7 +662,7 @@ af_packet_v2_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node, { b0->total_length_not_including_first_buffer = 0; b0->flags = VLIB_BUFFER_TOTAL_LENGTH_VALID; - vnet_buffer (b0)->sw_if_index[VLIB_RX] = apif->sw_if_index; + vnet_buffer (b0)->sw_if_index[VLIB_RX] = sw_if_index; vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~0; first_bi0 = bi0; first_b0 = vlib_get_buffer (vm, first_bi0); @@ -739,10 +721,9 @@ af_packet_v2_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node, next0 = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; if (PREDICT_FALSE (apif->per_interface_next_index != ~0)) next0 = apif->per_interface_next_index; - /* copy feature arc data from template */ - first_b0->current_config_index = bt.current_config_index; - vnet_buffer (first_b0)->feature_arc_index = - vnet_buffer (&bt)->feature_arc_index; + /* redirect if feature path enabled */ + vnet_feature_start_device_input (sw_if_index, &next0, + first_b0); } } -- cgit 1.2.3-korg