diff options
Diffstat (limited to 'vnet/vnet/ip/ip4_input.c')
-rw-r--r-- | vnet/vnet/ip/ip4_input.c | 47 |
1 files changed, 14 insertions, 33 deletions
diff --git a/vnet/vnet/ip/ip4_input.c b/vnet/vnet/ip/ip4_input.c index 268f7afa..a3620de8 100644 --- a/vnet/vnet/ip/ip4_input.c +++ b/vnet/vnet/ip/ip4_input.c @@ -108,11 +108,10 @@ ip4_input_inline (vlib_main_t * vm, { vlib_buffer_t * p0, * p1; ip4_header_t * ip0, * ip1; - vnet_feature_config_main_t * cm0, * cm1; - u32 sw_if_index0, pi0, ip_len0, cur_len0, next0; - u32 sw_if_index1, pi1, ip_len1, cur_len1, next1; + u32 sw_if_index0, pi0, ip_len0, cur_len0, next0 = 0; + u32 sw_if_index1, pi1, ip_len1, cur_len1, next1 = 0; i32 len_diff0, len_diff1; - u8 error0, error1, cast0, cast1; + u8 error0, error1, arc0, arc1; /* Prefetch next iteration. */ { @@ -144,26 +143,14 @@ ip4_input_inline (vlib_main_t * vm, sw_if_index0 = vnet_buffer (p0)->sw_if_index[VLIB_RX]; sw_if_index1 = vnet_buffer (p1)->sw_if_index[VLIB_RX]; - cast0 = ip4_address_is_multicast (&ip0->dst_address) ? VNET_IP_RX_MULTICAST_FEAT : VNET_IP_RX_UNICAST_FEAT; - cast1 = ip4_address_is_multicast (&ip1->dst_address) ? VNET_IP_RX_MULTICAST_FEAT : VNET_IP_RX_UNICAST_FEAT; - - cm0 = lm->feature_config_mains + cast0; - cm1 = lm->feature_config_mains + cast1; - - p0->current_config_index = vec_elt (cm0->config_index_by_sw_if_index, sw_if_index0); - p1->current_config_index = vec_elt (cm1->config_index_by_sw_if_index, sw_if_index1); + arc0 = ip4_address_is_multicast (&ip0->dst_address) ? lm->mcast_feature_arc_index : lm->ucast_feature_arc_index; + arc1 = ip4_address_is_multicast (&ip1->dst_address) ? lm->mcast_feature_arc_index : lm->ucast_feature_arc_index; vnet_buffer (p0)->ip.adj_index[VLIB_RX] = ~0; vnet_buffer (p1)->ip.adj_index[VLIB_RX] = ~0; - vnet_get_config_data (&cm0->config_main, - &p0->current_config_index, - &next0, - /* # bytes of config data */ 0); - vnet_get_config_data (&cm1->config_main, - &p1->current_config_index, - &next1, - /* # bytes of config data */ 0); + vnet_feature_arc_start (arc0, sw_if_index0, &next0, p0); + vnet_feature_arc_start (arc1, sw_if_index1, &next1, p1); vlib_increment_simple_counter (cm, cpu_index, sw_if_index0, 1); vlib_increment_simple_counter (cm, cpu_index, sw_if_index1, 1); @@ -195,8 +182,8 @@ ip4_input_inline (vlib_main_t * vm, error1 = ip4_get_fragment_offset (ip1) == 1 ? IP4_ERROR_FRAGMENT_OFFSET_ONE : error1; /* TTL < 1? Drop it. */ - error0 = (ip0->ttl < 1 && cast0 == VNET_IP_RX_UNICAST_FEAT) ? IP4_ERROR_TIME_EXPIRED : error0; - error1 = (ip1->ttl < 1 && cast1 == VNET_IP_RX_UNICAST_FEAT) ? IP4_ERROR_TIME_EXPIRED : error1; + error0 = (ip0->ttl < 1 && arc0 == lm->ucast_feature_arc_index) ? IP4_ERROR_TIME_EXPIRED : error0; + error1 = (ip1->ttl < 1 && arc1 == lm->ucast_feature_arc_index) ? IP4_ERROR_TIME_EXPIRED : error1; /* Verify lengths. */ ip_len0 = clib_net_to_host_u16 (ip0->length); @@ -245,10 +232,9 @@ ip4_input_inline (vlib_main_t * vm, { vlib_buffer_t * p0; ip4_header_t * ip0; - vnet_feature_config_main_t * cm0; - u32 sw_if_index0, pi0, ip_len0, cur_len0, next0; + u32 sw_if_index0, pi0, ip_len0, cur_len0, next0 = 0; i32 len_diff0; - u8 error0, cast0; + u8 error0, arc0; pi0 = from[0]; to_next[0] = pi0; @@ -262,14 +248,9 @@ ip4_input_inline (vlib_main_t * vm, sw_if_index0 = vnet_buffer (p0)->sw_if_index[VLIB_RX]; - cast0 = ip4_address_is_multicast (&ip0->dst_address) ? VNET_IP_RX_MULTICAST_FEAT : VNET_IP_RX_UNICAST_FEAT; - cm0 = lm->feature_config_mains + cast0; - p0->current_config_index = vec_elt (cm0->config_index_by_sw_if_index, sw_if_index0); + arc0 = ip4_address_is_multicast (&ip0->dst_address) ? lm->mcast_feature_arc_index : lm->ucast_feature_arc_index; vnet_buffer (p0)->ip.adj_index[VLIB_RX] = ~0; - vnet_get_config_data (&cm0->config_main, - &p0->current_config_index, - &next0, - /* # bytes of config data */ 0); + vnet_feature_arc_start (arc0, sw_if_index0, &next0, p0); vlib_increment_simple_counter (cm, cpu_index, sw_if_index0, 1); @@ -294,7 +275,7 @@ ip4_input_inline (vlib_main_t * vm, error0 = ip4_get_fragment_offset (ip0) == 1 ? IP4_ERROR_FRAGMENT_OFFSET_ONE : error0; /* TTL < 1? Drop it. */ - error0 = (ip0->ttl < 1 && cast0 == VNET_IP_RX_UNICAST_FEAT) ? IP4_ERROR_TIME_EXPIRED : error0; + error0 = (ip0->ttl < 1 && arc0 == lm->ucast_feature_arc_index) ? IP4_ERROR_TIME_EXPIRED : error0; /* Verify lengths. */ ip_len0 = clib_net_to_host_u16 (ip0->length); |