summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven <sluong@cisco.com>2017-12-03 23:40:54 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2017-12-04 20:18:21 +0000
commit35de3b3376d66fbd2b4d5dc849db2cdeabc892f4 (patch)
tree497f5c861fbc0a9f18311f78335eeacd104593cc
parent2e292c6f6489015460e3fee8ec567791c897108e (diff)
vnet: set vnet_buffer l2_hdr_offset and l3_hdr_offset
Changes made in ethernet_input to set l2_hdr_offset,l3_hdr_offset, and their corresponding flags. Please note that ethernet_input, as a critical DP, incurs a few extra cpu cycles due to this patch, but for a worthy cause. Change-Id: Ie9ae352ea62959d2779ebcca98a1898e3d9e1d6f Signed-off-by: Steven <sluong@cisco.com>
-rwxr-xr-xsrc/vnet/ethernet/node.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/vnet/ethernet/node.c b/src/vnet/ethernet/node.c
index f216216d3d7..3760877dc79 100755
--- a/src/vnet/ethernet/node.c
+++ b/src/vnet/ethernet/node.c
@@ -103,6 +103,7 @@ parse_header (ethernet_input_variant_t variant,
e0 = (void *) (b0->data + b0->current_data);
vnet_buffer (b0)->l2_hdr_offset = b0->current_data;
+ b0->flags |= VNET_BUFFER_F_L2_HDR_OFFSET_VALID;
vlib_buffer_advance (b0, sizeof (e0[0]));
@@ -425,6 +426,14 @@ ethernet_input_inline (vlib_main_t * vm,
vnet_buffer (b0)->l2_hdr_offset = b0->current_data;
vnet_buffer (b1)->l2_hdr_offset = b1->current_data;
+ vnet_buffer (b0)->l3_hdr_offset =
+ vnet_buffer (b0)->l2_hdr_offset + sizeof (ethernet_header_t);
+ vnet_buffer (b1)->l3_hdr_offset =
+ vnet_buffer (b1)->l2_hdr_offset + sizeof (ethernet_header_t);
+ b0->flags |= VNET_BUFFER_F_L2_HDR_OFFSET_VALID |
+ VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
+ b1->flags |= VNET_BUFFER_F_L2_HDR_OFFSET_VALID |
+ VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
if (PREDICT_TRUE (is_l20 != 0))
{
@@ -573,6 +582,12 @@ ethernet_input_inline (vlib_main_t * vm,
&next0);
determine_next_node (em, variant, is_l21, type1, b1, &error1,
&next1);
+ vnet_buffer (b0)->l3_hdr_offset = vnet_buffer (b0)->l2_hdr_offset +
+ vnet_buffer (b0)->l2.l2_len;
+ vnet_buffer (b1)->l3_hdr_offset = vnet_buffer (b1)->l2_hdr_offset +
+ vnet_buffer (b1)->l2.l2_len;
+ b0->flags |= VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
+ b1->flags |= VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
ship_it01:
b0->error = error_node->errors[error0];
@@ -644,6 +659,10 @@ ethernet_input_inline (vlib_main_t * vm,
}
vnet_buffer (b0)->l2_hdr_offset = b0->current_data;
+ vnet_buffer (b0)->l3_hdr_offset =
+ vnet_buffer (b0)->l2_hdr_offset + sizeof (ethernet_header_t);
+ b0->flags |= VNET_BUFFER_F_L2_HDR_OFFSET_VALID |
+ VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
if (PREDICT_TRUE (is_l20 != 0))
{
@@ -741,6 +760,9 @@ ethernet_input_inline (vlib_main_t * vm,
determine_next_node (em, variant, is_l20, type0, b0, &error0,
&next0);
+ vnet_buffer (b0)->l3_hdr_offset = vnet_buffer (b0)->l2_hdr_offset +
+ vnet_buffer (b0)->l2.l2_len;
+ b0->flags |= VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
ship_it0:
b0->error = error_node->errors[error0];