diff options
-rw-r--r-- | src/plugins/af_packet/node.c | 4 | ||||
-rw-r--r-- | src/plugins/af_xdp/input.c | 2 | ||||
-rw-r--r-- | src/plugins/avf/input.c | 2 | ||||
-rw-r--r-- | src/plugins/dpdk/device/node.c | 2 | ||||
-rw-r--r-- | src/plugins/marvell/pp2/input.c | 7 | ||||
-rw-r--r-- | src/plugins/memif/node.c | 28 | ||||
-rw-r--r-- | src/plugins/rdma/input.c | 2 | ||||
-rw-r--r-- | src/plugins/vmxnet3/input.c | 4 | ||||
-rw-r--r-- | src/vnet/devices/devices.c | 23 | ||||
-rw-r--r-- | src/vnet/devices/devices.h | 2 | ||||
-rw-r--r-- | src/vnet/devices/virtio/node.c | 2 | ||||
-rw-r--r-- | src/vnet/feature/feature.h | 111 | ||||
-rw-r--r-- | src/vnet/unix/tuntap.c | 2 |
13 files changed, 29 insertions, 162 deletions
diff --git a/src/plugins/af_packet/node.c b/src/plugins/af_packet/node.c index 8612863a780..d652a2d61c4 100644 --- a/src/plugins/af_packet/node.c +++ b/src/plugins/af_packet/node.c @@ -287,7 +287,7 @@ af_packet_v3_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node, next_index = apif->per_interface_next_index; /* redirect if feature path enabled */ - vnet_feature_start_device_input_x1 (apif->sw_if_index, &next_index, &bt); + vnet_feature_start_device_input (apif->sw_if_index, &next_index, &bt); } if ((((block_desc_t *) (block_start = rx_queue->rx_ring[block])) @@ -594,7 +594,7 @@ af_packet_v2_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node, next_index = apif->per_interface_next_index; /* redirect if feature path enabled */ - vnet_feature_start_device_input_x1 (apif->sw_if_index, &next_index, &bt); + vnet_feature_start_device_input (apif->sw_if_index, &next_index, &bt); } n_free_bufs = vec_len (apm->rx_buffers[thread_index]); diff --git a/src/plugins/af_xdp/input.c b/src/plugins/af_xdp/input.c index a90cbf5d332..0d890419696 100644 --- a/src/plugins/af_xdp/input.c +++ b/src/plugins/af_xdp/input.c @@ -296,7 +296,7 @@ af_xdp_device_input_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_copy_template (&bt, ad->buffer_template); next_index = ad->per_interface_next_index; if (PREDICT_FALSE (vnet_device_input_have_features (ad->sw_if_index))) - vnet_feature_start_device_input_x1 (ad->sw_if_index, &next_index, &bt); + vnet_feature_start_device_input (ad->sw_if_index, &next_index, &bt); vlib_get_new_next_frame (vm, node, next_index, to_next, n_left_to_next); diff --git a/src/plugins/avf/input.c b/src/plugins/avf/input.c index 1406d789e0b..3c3d6c07c2d 100644 --- a/src/plugins/avf/input.c +++ b/src/plugins/avf/input.c @@ -296,7 +296,7 @@ avf_device_input_inline (vlib_main_t *vm, vlib_node_runtime_t *node, next_index = ad->per_interface_next_index; if (PREDICT_FALSE (vnet_device_input_have_features (ad->sw_if_index))) - vnet_feature_start_device_input_x1 (ad->sw_if_index, &next_index, bt); + vnet_feature_start_device_input (ad->sw_if_index, &next_index, bt); vlib_get_new_next_frame (vm, node, next_index, to_next, n_left_to_next); diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c index b4600324551..045b3ff1ce6 100644 --- a/src/plugins/dpdk/device/node.c +++ b/src/plugins/dpdk/device/node.c @@ -396,7 +396,7 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd, /* as all packets belong to the same interface feature arc lookup can be don once and result stored in the buffer template */ if (PREDICT_FALSE (vnet_device_input_have_features (xd->sw_if_index))) - vnet_feature_start_device_input_x1 (xd->sw_if_index, &next_index, bt); + vnet_feature_start_device_input (xd->sw_if_index, &next_index, bt); if (xd->flags & DPDK_DEVICE_FLAG_MAYBE_MULTISEG) n_rx_bytes = dpdk_process_rx_burst (vm, ptd, n_rx_packets, 1, &or_flags); diff --git a/src/plugins/marvell/pp2/input.c b/src/plugins/marvell/pp2/input.c index 44f01355e39..106148db023 100644 --- a/src/plugins/marvell/pp2/input.c +++ b/src/plugins/marvell/pp2/input.c @@ -218,8 +218,8 @@ mrvl_pp2_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, { n_rx_bytes += mrvl_pp2_next_from_desc (node, d, b0, &next0); n_rx_bytes += mrvl_pp2_next_from_desc (node, d + 1, b1, &next1); - vnet_feature_start_device_input_x2 (ppif->sw_if_index, &next0, - &next1, b0, b1); + vnet_feature_start_device_input (ppif->sw_if_index, &next0, b0); + vnet_feature_start_device_input (ppif->sw_if_index, &next1, b1); } else { @@ -262,8 +262,7 @@ mrvl_pp2_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, if (PREDICT_TRUE (ppif->per_interface_next_index == ~0)) { n_rx_bytes += mrvl_pp2_next_from_desc (node, d, b0, &next0); - vnet_feature_start_device_input_x1 (ppif->sw_if_index, &next0, - b0); + vnet_feature_start_device_input (ppif->sw_if_index, &next0, b0); } else { diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c index 4d97ed22d64..1c678397ad7 100644 --- a/src/plugins/memif/node.c +++ b/src/plugins/memif/node.c @@ -640,8 +640,8 @@ memif_device_input_inline (vlib_main_t *vm, vlib_node_runtime_t *node, if (mif->per_interface_next_index != ~0) next_index = mif->per_interface_next_index; else - vnet_feature_start_device_input_x1 (mif->sw_if_index, &next_index, - &ptd->buffer_template); + vnet_feature_start_device_input (mif->sw_if_index, &next_index, + &ptd->buffer_template); vlib_get_new_next_frame (vm, node, next_index, to_next_bufs, n_left_to_next); @@ -903,14 +903,14 @@ memif_device_input_zc_inline (vlib_main_t *vm, vlib_node_runtime_t *node, { next0 = next1 = next2 = next3 = next_index; /* redirect if feature path enabled */ - vnet_feature_start_device_input_x1 (mif->sw_if_index, - &next0, b0); - vnet_feature_start_device_input_x1 (mif->sw_if_index, - &next1, b1); - vnet_feature_start_device_input_x1 (mif->sw_if_index, - &next2, b2); - vnet_feature_start_device_input_x1 (mif->sw_if_index, - &next3, b3); + vnet_feature_start_device_input (mif->sw_if_index, &next0, + b0); + vnet_feature_start_device_input (mif->sw_if_index, &next1, + b1); + vnet_feature_start_device_input (mif->sw_if_index, &next2, + b2); + vnet_feature_start_device_input (mif->sw_if_index, &next3, + b3); } } @@ -958,8 +958,8 @@ memif_device_input_zc_inline (vlib_main_t *vm, vlib_node_runtime_t *node, { next0 = next_index; /* redirect if feature path enabled */ - vnet_feature_start_device_input_x1 (mif->sw_if_index, - &next0, b0); + vnet_feature_start_device_input (mif->sw_if_index, &next0, + b0); } } @@ -1091,8 +1091,8 @@ CLIB_MARCH_FN (memif_dma_completion_cb, void, vlib_main_t *vm, if (mif->per_interface_next_index != ~0) next_index = mif->per_interface_next_index; else - vnet_feature_start_device_input_x1 (mif->sw_if_index, &next_index, - &ptd->buffer_template); + vnet_feature_start_device_input (mif->sw_if_index, &next_index, + &ptd->buffer_template); vlib_get_new_next_frame (vm, dma_info->node, next_index, to_next_bufs, n_left_to_next); diff --git a/src/plugins/rdma/input.c b/src/plugins/rdma/input.c index 827fc577484..8d2f447a73d 100644 --- a/src/plugins/rdma/input.c +++ b/src/plugins/rdma/input.c @@ -977,7 +977,7 @@ rdma_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, /* update buffer template for input feature arcs if any */ next_index = rd->per_interface_next_index; if (PREDICT_FALSE (vnet_device_input_have_features (rd->sw_if_index))) - vnet_feature_start_device_input_x1 (rd->sw_if_index, &next_index, &bt); + vnet_feature_start_device_input (rd->sw_if_index, &next_index, &bt); vlib_get_new_next_frame (vm, node, next_index, to_next, n_left_to_next); diff --git a/src/plugins/vmxnet3/input.c b/src/plugins/vmxnet3/input.c index a58e2c157be..ebf52d63ff1 100644 --- a/src/plugins/vmxnet3/input.c +++ b/src/plugins/vmxnet3/input.c @@ -377,8 +377,8 @@ vmxnet3_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, if (PREDICT_FALSE (vnet_device_input_have_features (vd->sw_if_index))) { - vnet_feature_start_device_input_x1 (vd->sw_if_index, - &next_index, hb); + vnet_feature_start_device_input (vd->sw_if_index, &next_index, + hb); known_next = 1; } diff --git a/src/vnet/devices/devices.c b/src/vnet/devices/devices.c index 1a4f02df6a8..bd3def9d324 100644 --- a/src/vnet/devices/devices.c +++ b/src/vnet/devices/devices.c @@ -40,29 +40,6 @@ VLIB_REGISTER_NODE (device_input_node) = { .next_nodes = VNET_DEVICE_INPUT_NEXT_NODES, }; -/* Table defines how much we need to advance current data pointer - in the buffer if we shortcut to l3 nodes */ - -const u32 __attribute__((aligned (CLIB_CACHE_LINE_BYTES))) -device_input_next_node_advance[((VNET_DEVICE_INPUT_N_NEXT_NODES / - CLIB_CACHE_LINE_BYTES) +1) * CLIB_CACHE_LINE_BYTES] = -{ - [VNET_DEVICE_INPUT_NEXT_IP4_INPUT] = sizeof (ethernet_header_t), - [VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT] = sizeof (ethernet_header_t), - [VNET_DEVICE_INPUT_NEXT_IP6_INPUT] = sizeof (ethernet_header_t), - [VNET_DEVICE_INPUT_NEXT_MPLS_INPUT] = sizeof (ethernet_header_t), -}; - -const u32 __attribute__((aligned (CLIB_CACHE_LINE_BYTES))) -device_input_next_node_flags[((VNET_DEVICE_INPUT_N_NEXT_NODES / - CLIB_CACHE_LINE_BYTES) +1) * CLIB_CACHE_LINE_BYTES] = -{ - [VNET_DEVICE_INPUT_NEXT_IP4_INPUT] = VNET_BUFFER_F_L3_HDR_OFFSET_VALID, - [VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT] = VNET_BUFFER_F_L3_HDR_OFFSET_VALID, - [VNET_DEVICE_INPUT_NEXT_IP6_INPUT] = VNET_BUFFER_F_L3_HDR_OFFSET_VALID, - [VNET_DEVICE_INPUT_NEXT_MPLS_INPUT] = VNET_BUFFER_F_L3_HDR_OFFSET_VALID, -}; - VNET_FEATURE_ARC_INIT (device_input, static) = { .arc_name = "device-input", diff --git a/src/vnet/devices/devices.h b/src/vnet/devices/devices.h index e54c7a29130..cadf1f857a6 100644 --- a/src/vnet/devices/devices.h +++ b/src/vnet/devices/devices.h @@ -67,8 +67,6 @@ typedef struct extern vnet_device_main_t vnet_device_main; extern vlib_node_registration_t device_input_node; -extern const u32 device_input_next_node_advance[]; -extern const u32 device_input_next_node_flags[]; static inline u64 vnet_get_aggregate_rx_packets (void) diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c index ec8b31038e5..b58c75360e3 100644 --- a/src/vnet/devices/virtio/node.c +++ b/src/vnet/devices/virtio/node.c @@ -271,7 +271,7 @@ virtio_device_input_gso_inline (vlib_main_t *vm, vlib_node_runtime_t *node, next_index = vif->per_interface_next_index; /* only for l2, redirect if feature path enabled */ - vnet_feature_start_device_input_x1 (vif->sw_if_index, &next_index, &bt); + vnet_feature_start_device_input (vif->sw_if_index, &next_index, &bt); } while (n_left) diff --git a/src/vnet/feature/feature.h b/src/vnet/feature/feature.h index a8235d3d9ee..b1917e8df13 100644 --- a/src/vnet/feature/feature.h +++ b/src/vnet/feature/feature.h @@ -344,8 +344,8 @@ vnet_device_input_have_features (u32 sw_if_index) } static_always_inline void -vnet_feature_start_device_input_x1 (u32 sw_if_index, u32 * next0, - vlib_buffer_t * b0) +vnet_feature_start_device_input (u32 sw_if_index, u32 *next0, + vlib_buffer_t *b0) { vnet_feature_main_t *fm = &feature_main; vnet_feature_config_main_t *cm; @@ -356,118 +356,11 @@ vnet_feature_start_device_input_x1 (u32 sw_if_index, u32 * next0, (clib_bitmap_get (fm->sw_if_index_has_features[feature_arc_index], sw_if_index))) { - /* - * Save next0 so that the last feature in the chain - * can skip ethernet-input if indicated... - */ - u16 adv; - - adv = device_input_next_node_advance[*next0]; - vlib_buffer_advance (b0, -adv); - - vnet_buffer (b0)->feature_arc_index = feature_arc_index; - b0->current_config_index = - vec_elt (cm->config_index_by_sw_if_index, sw_if_index); - vnet_get_config_data (&cm->config_main, &b0->current_config_index, - next0, /* # bytes of config data */ 0); - } -} - -static_always_inline void -vnet_feature_start_device_input_x2 (u32 sw_if_index, - u32 * next0, - u32 * next1, - vlib_buffer_t * b0, vlib_buffer_t * b1) -{ - vnet_feature_main_t *fm = &feature_main; - vnet_feature_config_main_t *cm; - u8 feature_arc_index = fm->device_input_feature_arc_index; - cm = &fm->feature_config_mains[feature_arc_index]; - - if (PREDICT_FALSE - (clib_bitmap_get - (fm->sw_if_index_has_features[feature_arc_index], sw_if_index))) - { - /* - * Save next0 so that the last feature in the chain - * can skip ethernet-input if indicated... - */ - u16 adv; - - adv = device_input_next_node_advance[*next0]; - vlib_buffer_advance (b0, -adv); - - adv = device_input_next_node_advance[*next1]; - vlib_buffer_advance (b1, -adv); - - vnet_buffer (b0)->feature_arc_index = feature_arc_index; - vnet_buffer (b1)->feature_arc_index = feature_arc_index; - b0->current_config_index = - vec_elt (cm->config_index_by_sw_if_index, sw_if_index); - b1->current_config_index = b0->current_config_index; - vnet_get_config_data (&cm->config_main, &b0->current_config_index, - next0, /* # bytes of config data */ 0); - vnet_get_config_data (&cm->config_main, &b1->current_config_index, - next1, /* # bytes of config data */ 0); - } -} - -static_always_inline void -vnet_feature_start_device_input_x4 (u32 sw_if_index, - u32 * next0, - u32 * next1, - u32 * next2, - u32 * next3, - vlib_buffer_t * b0, - vlib_buffer_t * b1, - vlib_buffer_t * b2, vlib_buffer_t * b3) -{ - vnet_feature_main_t *fm = &feature_main; - vnet_feature_config_main_t *cm; - u8 feature_arc_index = fm->device_input_feature_arc_index; - cm = &fm->feature_config_mains[feature_arc_index]; - - if (PREDICT_FALSE - (clib_bitmap_get - (fm->sw_if_index_has_features[feature_arc_index], sw_if_index))) - { - /* - * Save next0 so that the last feature in the chain - * can skip ethernet-input if indicated... - */ - u16 adv; - - adv = device_input_next_node_advance[*next0]; - vlib_buffer_advance (b0, -adv); - - adv = device_input_next_node_advance[*next1]; - vlib_buffer_advance (b1, -adv); - - adv = device_input_next_node_advance[*next2]; - vlib_buffer_advance (b2, -adv); - - adv = device_input_next_node_advance[*next3]; - vlib_buffer_advance (b3, -adv); - vnet_buffer (b0)->feature_arc_index = feature_arc_index; - vnet_buffer (b1)->feature_arc_index = feature_arc_index; - vnet_buffer (b2)->feature_arc_index = feature_arc_index; - vnet_buffer (b3)->feature_arc_index = feature_arc_index; - b0->current_config_index = vec_elt (cm->config_index_by_sw_if_index, sw_if_index); - b1->current_config_index = b0->current_config_index; - b2->current_config_index = b0->current_config_index; - b3->current_config_index = b0->current_config_index; - vnet_get_config_data (&cm->config_main, &b0->current_config_index, next0, /* # bytes of config data */ 0); - vnet_get_config_data (&cm->config_main, &b1->current_config_index, - next1, /* # bytes of config data */ 0); - vnet_get_config_data (&cm->config_main, &b2->current_config_index, - next2, /* # bytes of config data */ 0); - vnet_get_config_data (&cm->config_main, &b3->current_config_index, - next3, /* # bytes of config data */ 0); } } diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c index b75b1f670b9..6bb1d802574 100644 --- a/src/vnet/unix/tuntap.c +++ b/src/vnet/unix/tuntap.c @@ -366,7 +366,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); |