tcp: avoid regrabing error node in input and output 60/26460/2
authorFlorin Coras <fcoras@cisco.com>
Thu, 9 Apr 2020 21:23:01 +0000 (21:23 +0000)
committerFlorin Coras <florin.coras@gmail.com>
Thu, 9 Apr 2020 21:21:57 +0000 (21:21 +0000)
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I2dd0187d069783ac8bc445a70f99934d91ae0e63

src/vnet/tcp/tcp_input.c
src/vnet/tcp/tcp_output.c

index 403acad..b82eab0 100755 (executable)
@@ -2836,11 +2836,9 @@ tcp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
   tcp_main_t *tm = vnet_get_tcp_main ();
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
   u16 nexts[VLIB_FRAME_SIZE], *next;
-  vlib_node_runtime_t *error_node;
 
   tcp_set_time_now (tcp_get_worker (thread_index));
 
-  error_node = vlib_node_get_runtime (vm, tcp_node_index (input, is_ip4));
   from = vlib_frame_vector_args (frame);
   n_left_from = frame->n_vectors;
   vlib_get_buffers (vm, from, bufs, n_left_from);
@@ -2876,8 +2874,8 @@ tcp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          vnet_buffer (b[0])->tcp.connection_index = tc0->c_c_index;
          vnet_buffer (b[1])->tcp.connection_index = tc1->c_c_index;
 
-         tcp_input_dispatch_buffer (tm, tc0, b[0], &next[0], error_node);
-         tcp_input_dispatch_buffer (tm, tc1, b[1], &next[1], error_node);
+         tcp_input_dispatch_buffer (tm, tc0, b[0], &next[0], node);
+         tcp_input_dispatch_buffer (tm, tc1, b[1], &next[1], node);
        }
       else
        {
@@ -2885,24 +2883,24 @@ tcp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
            {
              ASSERT (tcp_lookup_is_valid (tc0, b[0], tcp_buffer_hdr (b[0])));
              vnet_buffer (b[0])->tcp.connection_index = tc0->c_c_index;
-             tcp_input_dispatch_buffer (tm, tc0, b[0], &next[0], error_node);
+             tcp_input_dispatch_buffer (tm, tc0, b[0], &next[0], node);
            }
          else
            {
              tcp_input_set_error_next (tm, &next[0], &error0, is_ip4);
-             b[0]->error = error_node->errors[error0];
+             b[0]->error = node->errors[error0];
            }
 
          if (PREDICT_TRUE (tc1 != 0))
            {
              ASSERT (tcp_lookup_is_valid (tc1, b[1], tcp_buffer_hdr (b[1])));
              vnet_buffer (b[1])->tcp.connection_index = tc1->c_c_index;
-             tcp_input_dispatch_buffer (tm, tc1, b[1], &next[1], error_node);
+             tcp_input_dispatch_buffer (tm, tc1, b[1], &next[1], node);
            }
          else
            {
              tcp_input_set_error_next (tm, &next[1], &error1, is_ip4);
-             b[1]->error = error_node->errors[error1];
+             b[1]->error = node->errors[error1];
            }
        }
 
@@ -2928,12 +2926,12 @@ tcp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
        {
          ASSERT (tcp_lookup_is_valid (tc0, b[0], tcp_buffer_hdr (b[0])));
          vnet_buffer (b[0])->tcp.connection_index = tc0->c_c_index;
-         tcp_input_dispatch_buffer (tm, tc0, b[0], &next[0], error_node);
+         tcp_input_dispatch_buffer (tm, tc0, b[0], &next[0], node);
        }
       else
        {
          tcp_input_set_error_next (tm, &next[0], &error0, is_ip4);
-         b[0]->error = error_node->errors[error0];
+         b[0]->error = node->errors[error0];
        }
 
       b += 1;
index b1af535..a21c012 100644 (file)
@@ -2181,9 +2181,6 @@ tcp46_output_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
   u32 n_left_from, *from, thread_index = vm->thread_index;
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
   u16 nexts[VLIB_FRAME_SIZE], *next;
-  vlib_node_runtime_t *error_node;
-
-  error_node = vlib_node_get_runtime (vm, tcp_node_index (output, is_ip4));
 
   from = vlib_frame_vector_args (frame);
   n_left_from = frame->n_vectors;
@@ -2221,8 +2218,8 @@ tcp46_output_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          tcp_check_if_gso (tc0, b[0]);
          tcp_check_if_gso (tc1, b[1]);
 
-         tcp_output_handle_packet (tc0, b[0], error_node, &next[0], is_ip4);
-         tcp_output_handle_packet (tc1, b[1], error_node, &next[1], is_ip4);
+         tcp_output_handle_packet (tc0, b[0], node, &next[0], is_ip4);
+         tcp_output_handle_packet (tc1, b[1], node, &next[1], is_ip4);
        }
       else
        {
@@ -2230,24 +2227,22 @@ tcp46_output_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
            {
              tcp_output_push_ip (vm, b[0], tc0, is_ip4);
              tcp_check_if_gso (tc0, b[0]);
-             tcp_output_handle_packet (tc0, b[0], error_node, &next[0],
-                                       is_ip4);
+             tcp_output_handle_packet (tc0, b[0], node, &next[0], is_ip4);
            }
          else
            {
-             b[0]->error = error_node->errors[TCP_ERROR_INVALID_CONNECTION];
+             b[0]->error = node->errors[TCP_ERROR_INVALID_CONNECTION];
              next[0] = TCP_OUTPUT_NEXT_DROP;
            }
          if (tc1 != 0)
            {
              tcp_output_push_ip (vm, b[1], tc1, is_ip4);
              tcp_check_if_gso (tc1, b[1]);
-             tcp_output_handle_packet (tc1, b[1], error_node, &next[1],
-                                       is_ip4);
+             tcp_output_handle_packet (tc1, b[1], node, &next[1], is_ip4);
            }
          else
            {
-             b[1]->error = error_node->errors[TCP_ERROR_INVALID_CONNECTION];
+             b[1]->error = node->errors[TCP_ERROR_INVALID_CONNECTION];
              next[1] = TCP_OUTPUT_NEXT_DROP;
            }
        }
@@ -2273,11 +2268,11 @@ tcp46_output_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
        {
          tcp_output_push_ip (vm, b[0], tc0, is_ip4);
          tcp_check_if_gso (tc0, b[0]);
-         tcp_output_handle_packet (tc0, b[0], error_node, &next[0], is_ip4);
+         tcp_output_handle_packet (tc0, b[0], node, &next[0], is_ip4);
        }
       else
        {
-         b[0]->error = error_node->errors[TCP_ERROR_INVALID_CONNECTION];
+         b[0]->error = node->errors[TCP_ERROR_INVALID_CONNECTION];
          next[0] = TCP_OUTPUT_NEXT_DROP;
        }