summaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/faces/udp/face_udp_node.c
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-02-19 18:46:36 +0100
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-02-20 18:03:16 +0100
commit1c5106f66a6749266cb1d228eda98413c80cbf1f (patch)
tree40bd4c7c42eaabd3fd038caa8f9e2fe432f9a434 /hicn-plugin/src/faces/udp/face_udp_node.c
parent286fd55fc0cf620747209570a32b79d97d50d9b4 (diff)
[HICN-71]
- Handling the case in which a pushed data hit an existing pit entry (created after the data has gone through the data_pcslookup_node). In this case the data packet is forwarded to the data_fwd_node - Handling the case in which the hash table (in pcs) is full and it is not possible to allocate another bucket. In this case the packet is dropped. - Copying packets whose length is less than 128B. VPP prevents to create a chain of vlib_buffer where the first, or middle, vlib_buffer are holding less then 128B. [HICN-72] - Assign a /128 subnet to the producer app face. Change-Id: I6c19d6d127774a7f59ac69ac965d4bcd6a72becc Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/faces/udp/face_udp_node.c')
-rw-r--r--hicn-plugin/src/faces/udp/face_udp_node.c74
1 files changed, 61 insertions, 13 deletions
diff --git a/hicn-plugin/src/faces/udp/face_udp_node.c b/hicn-plugin/src/faces/udp/face_udp_node.c
index ac7a63731..a8851ad79 100644
--- a/hicn-plugin/src/faces/udp/face_udp_node.c
+++ b/hicn-plugin/src/faces/udp/face_udp_node.c
@@ -54,7 +54,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_udp4_input_trace_t;
+ u8 packet_data[128 - 1 * sizeof (u32)];
+}
+hicn_face_udp4_input_trace_t;
typedef enum
{
@@ -70,7 +72,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_udp6_input_trace_t;
+ u8 packet_data[128 - 1 * sizeof (u32)];
+}
+hicn_face_udp6_input_trace_t;
typedef enum
{
@@ -163,7 +167,10 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_CONTENT; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
- } \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
+ } \
\
\
/* Verify speculative enqueue, maybe switch current next frame */ \
@@ -279,6 +286,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_CONTENT; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \
@@ -289,6 +299,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_CONTENT; \
t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
t->next_index = next1; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b1), \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -343,8 +356,11 @@ hicn_face_udp4_input_format_trace (u8 * s, va_list * args)
hicn_face_udp4_input_trace_t *t =
va_arg (*args, hicn_face_udp4_input_trace_t *);
- s = format (s, "FACE_UDP4_INPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s, "FACE_UDP4_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ t->packet_data[0] == 4 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -421,8 +437,11 @@ hicn_face_udp6_input_format_trace (u8 * s, va_list * args)
hicn_face_udp6_input_trace_t *t =
va_arg (*args, hicn_face_udp6_input_trace_t *);
- s = format (s, "FACE_UDP6_INPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s, "FACE_UDP6_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ t->packet_data[0] == 4 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -551,7 +570,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_udp4_output_trace_t;
+ u8 packet_data[128 - 1 * sizeof (u32)];
+}
+hicn_face_udp4_output_trace_t;
/* Trace context struct */
typedef struct
@@ -559,7 +580,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_udp6_output_trace_t;
+ u8 packet_data[128 - 1 * sizeof (u32)];
+}
+hicn_face_udp6_output_trace_t;
#define HICN_FACE_UDP_ENCAP_IP4 hicn_face_udp4_encap
#define HICN_FACE_UDP_ENCAP_IP6 hicn_face_udp6_encap
@@ -615,6 +638,9 @@ typedef struct
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
to_next[0] = bi0; \
@@ -699,8 +725,24 @@ typedef struct
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
+ \
+ if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \
+ (b1->flags & VLIB_BUFFER_IS_TRACED))) \
+ { \
+ TRACE_OUTPUT_PKT_UDP##ipv *t = \
+ vlib_add_trace (vm, node, b0, sizeof (*t)); \
+ t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
+ t->next_index = next1; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b1), \
+ sizeof (t->packet_data)); \
+ } \
/* Verify speculative enqueue, maybe switch current next frame */ \
vlib_validate_buffer_enqueue_x2 (vm, node, next_index, \
to_next, n_left_to_next, \
@@ -755,8 +797,11 @@ hicn_face_udp4_output_format_trace (u8 * s, va_list * args)
hicn_face_udp4_output_trace_t *t =
va_arg (*args, hicn_face_udp4_output_trace_t *);
- s = format (s, "FACE_UDP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s, "FACE_UDP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ t->packet_data[0] == 4 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -828,8 +873,11 @@ hicn_face_udp6_output_format_trace (u8 * s, va_list * args)
hicn_face_udp6_output_trace_t *t =
va_arg (*args, hicn_face_udp6_output_trace_t *);
- s = format (s, "FACE_UDP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s, "FACE_UDP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%u",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ t->packet_data[0] == 4 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}