aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/pipe/pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/devices/pipe/pipe.c')
-rw-r--r--src/vnet/devices/pipe/pipe.c59
1 files changed, 30 insertions, 29 deletions
diff --git a/src/vnet/devices/pipe/pipe.c b/src/vnet/devices/pipe/pipe.c
index 9d388862229..6154a66f5c4 100644
--- a/src/vnet/devices/pipe/pipe.c
+++ b/src/vnet/devices/pipe/pipe.c
@@ -359,35 +359,37 @@ pipe_rx (vlib_main_t * vm,
pipe0 = &pipe_main.pipes[sw_if_index0];
pipe1 = &pipe_main.pipes[sw_if_index1];
+ 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 + vnet_buffer (b0)->l2.l2_len;
+ vnet_buffer (b0)->l2_hdr_offset + sizeof (ethernet_header_t);
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;
+ 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;
is_l20 = pipe0->subint.flags & SUBINT_CONFIG_L2;
is_l21 = pipe1->subint.flags & SUBINT_CONFIG_L2;
+
+ /*
+ * from discussion with Neale - we do not support the tagged traffic.
+ * So assume a simple ethernet header
+ */
+ vnet_buffer (b0)->l2.l2_len = sizeof (ethernet_header_t);
+ vnet_buffer (b1)->l2.l2_len = sizeof (ethernet_header_t);
+ vlib_buffer_advance (b0, is_l20 ? 0 : sizeof (ethernet_header_t));
+ vlib_buffer_advance (b1, is_l21 ? 0 : sizeof (ethernet_header_t));
+
pipe_determine_next_node (&ethernet_main, is_l20, type0, b0,
&next0);
pipe_determine_next_node (&ethernet_main, is_l21, type1, b1,
&next1);
- if (!is_l20)
- vlib_buffer_advance (b0, sizeof (ethernet_header_t));
- else
- {
- u32 eth_start = vnet_buffer (b0)->l2_hdr_offset;
- vnet_buffer (b0)->l2.l2_len = b0->current_data - eth_start;
- }
- if (!is_l21)
- vlib_buffer_advance (b1, sizeof (ethernet_header_t));
- else
- {
- u32 eth_start = vnet_buffer (b1)->l2_hdr_offset;
- vnet_buffer (b1)->l2.l2_len = b1->current_data - eth_start;
- }
-
vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
to_next, n_left_to_next,
bi0, bi1, next0, next1);
@@ -416,22 +418,21 @@ pipe_rx (vlib_main_t * vm,
type0 = clib_net_to_host_u16 (e0->type);
pipe0 = &pipe_main.pipes[sw_if_index0];
+ vnet_buffer (b0)->l2_hdr_offset = b0->current_data;
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;
+ 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;
is_l20 = pipe0->subint.flags & SUBINT_CONFIG_L2;
+
+ vnet_buffer (b0)->l2.l2_len = sizeof (ethernet_header_t);
+ vlib_buffer_advance (b0, is_l20 ? 0 : sizeof (ethernet_header_t));
+
pipe_determine_next_node (&ethernet_main, is_l20, type0, b0,
&next0);
- if (!is_l20)
- vlib_buffer_advance (b0, sizeof (ethernet_header_t));
- else
- {
- u32 eth_start = vnet_buffer (b0)->l2_hdr_offset;
- vnet_buffer (b0)->l2.l2_len = b0->current_data - eth_start;
- }
-
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
to_next, n_left_to_next,
bi0, next0);