X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fip%2Fip4_forward.c;h=35ebaa436d1c58395038069d89bfb616c4c00eae;hb=dd2eff6d060c787e4a49863c9b97bde7215f7740;hp=4d0638209e5a6128a94b8ca2d7cff4d42928fd3c;hpb=01c1fa41f04fbc584165806d3f785cfbbd62cedc;p=vpp.git diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c index 4d0638209e5..35ebaa436d1 100644 --- a/src/vnet/ip/ip4_forward.c +++ b/src/vnet/ip/ip4_forward.c @@ -1479,10 +1479,10 @@ ip4_local_check_l4_csum_x2 (vlib_main_t * vm, vlib_buffer_t ** b, if (PREDICT_FALSE (ip4_local_need_csum_check (is_tcp_udp[0], b[0]) || ip4_local_need_csum_check (is_tcp_udp[1], b[1]))) { - if (is_tcp_udp[0]) + if (is_tcp_udp[0] && !ip4_local_csum_is_offloaded (b[0])) ip4_local_l4_csum_validate (vm, b[0], ih[0], is_udp[0], &error[0], &good_tcp_udp[0]); - if (is_tcp_udp[1]) + if (is_tcp_udp[1] && !ip4_local_csum_is_offloaded (b[1])) ip4_local_l4_csum_validate (vm, b[1], ih[1], is_udp[1], &error[1], &good_tcp_udp[1]); } @@ -1508,9 +1508,8 @@ ip4_local_set_next_and_error (vlib_node_runtime_t * error_node, next_index = *next; if (PREDICT_TRUE (error == (u8) IP4_ERROR_UNKNOWN_PROTOCOL)) { - vnet_feature_arc_start (arc_index, - vnet_buffer (b)->sw_if_index[VLIB_RX], - &next_index, b); + vnet_feature_arc_start ( + arc_index, vnet_buffer (b)->ip.rx_sw_if_index, &next_index, b); *next = next_index; } } @@ -1518,7 +1517,9 @@ ip4_local_set_next_and_error (vlib_node_runtime_t * error_node, typedef struct { + /* The src and fib-index together determine if packet n is the same as n-1 */ ip4_address_t src; + u32 fib_index; u32 lbi; u8 error; u8 first; @@ -1537,14 +1538,14 @@ ip4_local_check_src (vlib_buffer_t *b, ip4_header_t *ip0, vnet_buffer (b)->sw_if_index[VLIB_TX] != ~0 ? vnet_buffer (b)->sw_if_index[VLIB_TX] : vnet_buffer (b)->ip.fib_index; + vnet_buffer (b)->ip.rx_sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; if (is_receive_dpo) { receive_dpo_t *rd; rd = receive_dpo_get (vnet_buffer (b)->ip.adj_index[VLIB_TX]); - vnet_buffer (b)->ip.rx_sw_if_index = rd->rd_sw_if_index; + if (rd->rd_sw_if_index != ~0) + vnet_buffer (b)->ip.rx_sw_if_index = rd->rd_sw_if_index; } - else - vnet_buffer (b)->ip.rx_sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; /* * vnet_buffer()->ip.adj_index[VLIB_RX] will be set to the index of the @@ -1552,7 +1553,8 @@ ip4_local_check_src (vlib_buffer_t *b, ip4_header_t *ip0, * vnet_buffer()->ip.adj_index[VLIB_TX] will be set to the index of the * adjacency for the source address (the remote sender's address) */ - if (PREDICT_TRUE (last_check->src.as_u32 != ip0->src_address.as_u32) || + if (PREDICT_TRUE ((last_check->src.as_u32 != ip0->src_address.as_u32)) || + (last_check->fib_index != vnet_buffer (b)->ip.fib_index) || last_check->first) { lbi0 = ip4_fib_forwarding_lookup (vnet_buffer (b)->ip.fib_index, @@ -1588,6 +1590,7 @@ ip4_local_check_src (vlib_buffer_t *b, ip4_header_t *ip0, last_check->lbi = lbi0; last_check->error = *error0; last_check->first = 0; + last_check->fib_index = vnet_buffer (b)->ip.fib_index; } else { @@ -1622,20 +1625,22 @@ ip4_local_check_src_x2 (vlib_buffer_t **b, ip4_header_t **ip, vnet_buffer (b[1])->sw_if_index[VLIB_TX] : vnet_buffer (b[1])->ip.fib_index; + not_last_hit |= vnet_buffer (b[0])->ip.fib_index ^ last_check->fib_index; + not_last_hit |= vnet_buffer (b[1])->ip.fib_index ^ last_check->fib_index; + + vnet_buffer (b[0])->ip.rx_sw_if_index = + vnet_buffer (b[0])->sw_if_index[VLIB_RX]; + vnet_buffer (b[1])->ip.rx_sw_if_index = + vnet_buffer (b[1])->sw_if_index[VLIB_RX]; if (is_receive_dpo) { const receive_dpo_t *rd0, *rd1; rd0 = receive_dpo_get (vnet_buffer (b[0])->ip.adj_index[VLIB_TX]); rd1 = receive_dpo_get (vnet_buffer (b[1])->ip.adj_index[VLIB_TX]); - vnet_buffer (b[0])->ip.rx_sw_if_index = rd0->rd_sw_if_index; - vnet_buffer (b[1])->ip.rx_sw_if_index = rd1->rd_sw_if_index; - } - else - { - vnet_buffer (b[0])->ip.rx_sw_if_index = - vnet_buffer (b[0])->sw_if_index[VLIB_RX]; - vnet_buffer (b[1])->ip.rx_sw_if_index = - vnet_buffer (b[1])->sw_if_index[VLIB_RX]; + if (rd0->rd_sw_if_index != ~0) + vnet_buffer (b[0])->ip.rx_sw_if_index = rd0->rd_sw_if_index; + if (rd1->rd_sw_if_index != ~0) + vnet_buffer (b[1])->ip.rx_sw_if_index = rd1->rd_sw_if_index; } /* @@ -1684,6 +1689,7 @@ ip4_local_check_src_x2 (vlib_buffer_t **b, ip4_header_t **ip, last_check->lbi = lbi[1]; last_check->error = error[1]; last_check->first = 0; + last_check->fib_index = vnet_buffer (b[1])->ip.fib_index; } else { @@ -1753,10 +1759,11 @@ ip4_local_inline (vlib_main_t *vm, vlib_node_runtime_t *node, * member to make sure the .lbi is initialised for the first * packet. */ - .src = {.as_u32 = 0}, + .src = { .as_u32 = 0 }, .lbi = ~0, .error = IP4_ERROR_UNKNOWN_PROTOCOL, .first = 1, + .fib_index = 0, }; from = vlib_frame_vector_args (frame); @@ -1873,7 +1880,7 @@ VLIB_REGISTER_NODE (ip4_local_node) = .vector_size = sizeof (u32), .format_trace = format_ip4_forward_next_trace, .n_errors = IP4_N_ERROR, - .error_strings = ip4_error_strings, + .error_counters = ip4_error_counters, .n_next_nodes = IP_LOCAL_N_NEXT, .next_nodes = { @@ -2056,7 +2063,9 @@ ip4_ttl_inc (vlib_buffer_t * b, ip4_header_t * ip) ttl += 1; ip->ttl = ttl; - ASSERT (ip4_header_checksum_is_valid (ip)); + ASSERT (ip4_header_checksum_is_valid (ip) || + (vnet_buffer (b)->oflags & VNET_BUFFER_OFFLOAD_F_IP_CKSUM) || + (vnet_buffer (b)->oflags & VNET_BUFFER_OFFLOAD_F_OUTER_IP_CKSUM)); } /* Decrement TTL & update checksum.