GTPU_ENCAP_N_NEXT,
} gtpu_encap_next_t;
-typedef struct {
- u32 tunnel_index;
- u32 teid;
-} gtpu_encap_trace_t;
-
-u8 * format_gtpu_encap_trace (u8 * s, va_list * args)
-{
- CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
- CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
- gtpu_encap_trace_t * t
- = va_arg (*args, gtpu_encap_trace_t *);
-
- s = format (s, "GTPU encap to gtpu_tunnel%d teid %d",
- t->tunnel_index, t->teid);
- return s;
-}
-
#define foreach_fixed_header4_offset \
_(0) _(1) _(2) _(3)
stats_n_packets += 4;
stats_n_bytes += len0 + len1 + len2 + len3;
+ /* save inner packet flow_hash for load-balance node */
+ vnet_buffer (b0)->ip.flow_hash = flow_hash0;
+ vnet_buffer (b1)->ip.flow_hash = flow_hash1;
+ vnet_buffer (b2)->ip.flow_hash = flow_hash2;
+ vnet_buffer (b3)->ip.flow_hash = flow_hash3;
+
/* Batch stats increment on the same gtpu tunnel so counter is not
incremented per packet. Note stats are still incremented for deleted
and admin-down tunnel where packets are dropped. It is not worthwhile
gtpu_encap_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
tr->tunnel_index = t0 - gtm->tunnels;
- tr->teid = t0->teid;
+ tr->tteid = t0->tteid;
}
if (PREDICT_FALSE(b1->flags & VLIB_BUFFER_IS_TRACED))
gtpu_encap_trace_t *tr =
vlib_add_trace (vm, node, b1, sizeof (*tr));
tr->tunnel_index = t1 - gtm->tunnels;
- tr->teid = t1->teid;
+ tr->tteid = t1->tteid;
+ }
+
+ if (PREDICT_FALSE(b2->flags & VLIB_BUFFER_IS_TRACED))
+ {
+ gtpu_encap_trace_t *tr =
+ vlib_add_trace (vm, node, b2, sizeof (*tr));
+ tr->tunnel_index = t2 - gtm->tunnels;
+ tr->tteid = t2->tteid;
+ }
+
+ if (PREDICT_FALSE(b3->flags & VLIB_BUFFER_IS_TRACED))
+ {
+ gtpu_encap_trace_t *tr =
+ vlib_add_trace (vm, node, b3, sizeof (*tr));
+ tr->tunnel_index = t3 - gtm->tunnels;
+ tr->tteid = t3->tteid;
}
vlib_validate_buffer_enqueue_x4 (vm, node, next_index,
stats_n_packets += 1;
stats_n_bytes += len0;
+ /* save inner packet flow_hash for load-balance node */
+ vnet_buffer (b0)->ip.flow_hash = flow_hash0;
+
/* Batch stats increment on the same gtpu tunnel so counter is not
incremented per packet. Note stats are still incremented for deleted
and admin-down tunnel where packets are dropped. It is not worthwhile
gtpu_encap_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
tr->tunnel_index = t0 - gtm->tunnels;
- tr->teid = t0->teid;
+ tr->tteid = t0->tteid;
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
to_next, n_left_to_next,
return from_frame->n_vectors;
}
-static uword
-gtpu4_encap (vlib_main_t * vm,
+VLIB_NODE_FN (gtpu4_encap_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
return gtpu_encap_inline (vm, node, from_frame, /* is_ip4 */ 1);
}
-static uword
-gtpu6_encap (vlib_main_t * vm,
+VLIB_NODE_FN (gtpu6_encap_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
}
VLIB_REGISTER_NODE (gtpu4_encap_node) = {
- .function = gtpu4_encap,
.name = "gtpu4-encap",
.vector_size = sizeof (u32),
.format_trace = format_gtpu_encap_trace,
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (gtpu4_encap_node, gtpu4_encap)
-
VLIB_REGISTER_NODE (gtpu6_encap_node) = {
- .function = gtpu6_encap,
.name = "gtpu6-encap",
.vector_size = sizeof (u32),
.format_trace = format_gtpu_encap_trace,
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (gtpu6_encap_node, gtpu6_encap)
-