diff options
author | Luca Muscariello <lumuscar+fdio@cisco.com> | 2019-02-21 08:43:48 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2019-02-21 08:43:48 +0000 |
commit | 0d0e74ffb9207cb56fcf4d5b034906a406c1bffa (patch) | |
tree | cb8ebc20768dd371800613e4797b02383f691b5b /hicn-plugin/src/faces/ip | |
parent | 7734174f81412b1544243d1d358ee2641dcdb3dd (diff) | |
parent | 1c5106f66a6749266cb1d228eda98413c80cbf1f (diff) |
Merge "[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."
Diffstat (limited to 'hicn-plugin/src/faces/ip')
-rw-r--r-- | hicn-plugin/src/faces/ip/dpo_ip.h | 4 | ||||
-rw-r--r-- | hicn-plugin/src/faces/ip/face_ip.c | 34 | ||||
-rw-r--r-- | hicn-plugin/src/faces/ip/face_ip_node.c | 56 | ||||
-rw-r--r-- | hicn-plugin/src/faces/ip/iface_ip_node.c | 39 |
4 files changed, 99 insertions, 34 deletions
diff --git a/hicn-plugin/src/faces/ip/dpo_ip.h b/hicn-plugin/src/faces/ip/dpo_ip.h index 426d5a146..164931a06 100644 --- a/hicn-plugin/src/faces/ip/dpo_ip.h +++ b/hicn-plugin/src/faces/ip/dpo_ip.h @@ -120,6 +120,10 @@ hicn_dpo_ip4_add_and_lock_from_remote (dpo_id_t * dpo, const ip4_address_t * remote_addr, u32 sw_if, u32 node_index) { + dpo->dpoi_type = DPO_FIRST; + dpo->dpoi_proto = DPO_PROTO_NONE; + dpo->dpoi_index = INDEX_INVALID; + dpo->dpoi_next_node = 0; /*All (complete) faces are indexed by remote addess as well */ hicn_face_t *face = hicn_face_ip4_get (remote_addr, sw_if, &hicn_face_ip_remote_hashtb); diff --git a/hicn-plugin/src/faces/ip/face_ip.c b/hicn-plugin/src/faces/ip/face_ip.c index c7f6a1ba1..c1e264e44 100644 --- a/hicn-plugin/src/faces/ip/face_ip.c +++ b/hicn-plugin/src/faces/ip/face_ip.c @@ -40,21 +40,17 @@ hicn_face_ip_init (vlib_main_t * vm) /* Default Strategy has index 0 and it always exists */ strategy_face_ip4_vlib_edge = vlib_node_add_next (vm, hicn_dpo_get_strategy_vft - (default_dpo. - hicn_dpo_get_type ())-> - get_strategy_node_index + (default_dpo.hicn_dpo_get_type + ())->get_strategy_node_index (), - hicn_face_ip4_output_node. - index); + hicn_face_ip4_output_node.index); strategy_face_ip6_vlib_edge = vlib_node_add_next (vm, hicn_dpo_get_strategy_vft - (default_dpo. - hicn_dpo_get_type ())-> - get_strategy_node_index + (default_dpo.hicn_dpo_get_type + ())->get_strategy_node_index (), - hicn_face_ip6_output_node. - index); + hicn_face_ip6_output_node.index); /* * Create and edge between al the other strategy nodes * and the ip_encap nodes. @@ -73,6 +69,17 @@ hicn_face_ip_init (vlib_main_t * vm) ASSERT (temp_index6 == strategy_face_ip6_vlib_edge); } + u32 temp_index4 = vlib_node_add_next (vm, + hicn_interest_hitpit_node.index, + hicn_face_ip4_output_node.index); + u32 temp_index6 = vlib_node_add_next (vm, + hicn_interest_hitpit_node.index, + hicn_face_ip6_output_node.index); + + ASSERT (temp_index4 == strategy_face_ip4_vlib_edge); + ASSERT (temp_index6 == strategy_face_ip6_vlib_edge); + + hicn_dpo_ip_module_init (); register_face_type (hicn_face_ip_type, &ip_vft, "ip"); @@ -224,8 +231,7 @@ hicn_face_ip_add (const ip46_address_t * local_addr, } retx_t *retx = vlib_process_signal_event_data (vlib_get_main (), - hicn_mapme_eventmgr_process_node. - index, + hicn_mapme_eventmgr_process_node.index, HICN_MAPME_EVENT_FACE_ADD, 1, sizeof (retx_t)); *retx = (retx_t) @@ -305,8 +311,8 @@ hicn_face_ip_get_dpo (hicn_face_t * face, dpo_id_t * dpo) hicn_face_ip_t *face_ip = (hicn_face_ip_t *) face->data; return hicn_dpo_ip_create_from_face (face, dpo, - ip46_address_is_ip4 (&face_ip-> - remote_addr) ? + ip46_address_is_ip4 + (&face_ip->remote_addr) ? strategy_face_ip4_vlib_edge : strategy_face_ip6_vlib_edge); } diff --git a/hicn-plugin/src/faces/ip/face_ip_node.c b/hicn-plugin/src/faces/ip/face_ip_node.c index b3577f65f..f0408860e 100644 --- a/hicn-plugin/src/faces/ip/face_ip_node.c +++ b/hicn-plugin/src/faces/ip/face_ip_node.c @@ -56,7 +56,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_face_ip4_input_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_face_ip4_input_trace_t; typedef enum { @@ -72,7 +74,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_face_ip6_input_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_face_ip6_input_trace_t; typedef enum { @@ -157,6 +161,9 @@ typedef enum 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)); \ } \ \ \ @@ -245,6 +252,9 @@ typedef enum 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) && \ @@ -255,6 +265,9 @@ typedef enum 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)); \ } \ \ \ @@ -310,8 +323,9 @@ hicn_face_ip4_input_format_trace (u8 * s, va_list * args) hicn_face_ip4_input_trace_t *t = va_arg (*args, hicn_face_ip4_input_trace_t *); - s = format (s, "FACE_IP4_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_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, + format_ip4_header, t->packet_data, sizeof (t->packet_data)); return (s); } @@ -389,8 +403,9 @@ hicn_face_ip6_input_format_trace (u8 * s, va_list * args) hicn_face_ip6_input_trace_t *t = va_arg (*args, hicn_face_ip6_input_trace_t *); - s = format (s, "FACE_IP6_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_IP6_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, + format_ip6_header, t->packet_data, sizeof (t->packet_data)); return (s); } @@ -468,7 +483,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_face_ip4_output_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_face_ip4_output_trace_t; /* Trace context struct */ typedef struct @@ -476,7 +493,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_face_ip6_output_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_face_ip6_output_trace_t; #define TRACE_OUTPUT_PKT_IP4 hicn_face_ip4_output_trace_t #define TRACE_OUTPUT_PKT_IP6 hicn_face_ip6_output_trace_t @@ -524,6 +543,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)); \ } \ \ \ @@ -591,6 +613,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)); \ } \ \ if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \ @@ -601,6 +626,9 @@ typedef struct 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)); \ } \ \ \ @@ -657,8 +685,10 @@ hicn_face_ip4_output_format_trace (u8 * s, va_list * args) hicn_face_ip4_output_trace_t *t = va_arg (*args, hicn_face_ip4_output_trace_t *); - s = format (s, "FACE_IP4_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_IP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, + format_ip4_header, t->packet_data, sizeof (t->packet_data)); return (s); } @@ -728,8 +758,10 @@ hicn_face_ip6_output_format_trace (u8 * s, va_list * args) hicn_face_ip6_output_trace_t *t = va_arg (*args, hicn_face_ip6_output_trace_t *); - s = format (s, "FACE_IP6_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_IP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, + format_ip6_header, t->packet_data, sizeof (t->packet_data)); return (s); } diff --git a/hicn-plugin/src/faces/ip/iface_ip_node.c b/hicn-plugin/src/faces/ip/iface_ip_node.c index 9ca00d7bf..a0baa7d8c 100644 --- a/hicn-plugin/src/faces/ip/iface_ip_node.c +++ b/hicn-plugin/src/faces/ip/iface_ip_node.c @@ -77,6 +77,7 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; + u8 packet_data[128 - 1 * sizeof (u32)]; } hicn_iface_ip4_input_trace_t; typedef enum @@ -93,6 +94,7 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; + u8 packet_data[128 - 1 * sizeof (u32)]; } hicn_iface_ip6_input_trace_t; typedef enum @@ -185,6 +187,10 @@ typedef enum 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)); \ + \ } \ \ \ @@ -270,6 +276,9 @@ typedef enum 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) && \ @@ -280,6 +289,9 @@ typedef enum 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 */ \ @@ -335,8 +347,8 @@ hicn_iface_ip4_input_format_trace (u8 * s, va_list * args) hicn_iface_ip4_input_trace_t *t = va_arg (*args, hicn_iface_ip4_input_trace_t *); - s = format (s, "IFACE_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = format (s, "IFACE_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, format_ip4_header, t->packet_data, sizeof (t->packet_data)); return (s); } @@ -412,8 +424,8 @@ hicn_iface_ip6_input_format_trace (u8 * s, va_list * args) hicn_iface_ip6_input_trace_t *t = va_arg (*args, hicn_iface_ip6_input_trace_t *); - s = format (s, "IFACE_IP6_INPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = format (s, "IFACE_IP6_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, format_ip6_header, t->packet_data, sizeof (t->packet_data)); return (s); } @@ -518,6 +530,7 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; + u8 packet_data[128 - 1 * sizeof (u32)]; } hicn_iface_ip4_output_trace_t; typedef enum @@ -533,6 +546,7 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; + u8 packet_data[128 - 1 * sizeof (u32)]; } hicn_iface_ip6_output_trace_t; typedef enum @@ -598,6 +612,9 @@ typedef enum 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)); \ } \ \ \ @@ -669,6 +686,9 @@ typedef enum 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) && \ @@ -679,6 +699,9 @@ typedef enum 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)); \ } \ \ \ @@ -735,8 +758,8 @@ hicn_iface_ip4_output_format_trace (u8 * s, va_list * args) hicn_iface_ip4_output_trace_t *t = va_arg (*args, hicn_iface_ip4_output_trace_t *); - s = format (s, "IFACE_IP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = format (s, "IFACE_IP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, format_ip4_header, t->packet_data, sizeof (t->packet_data)); return (s); } @@ -808,8 +831,8 @@ hicn_iface_ip6_output_format_trace (u8 * s, va_list * args) hicn_iface_ip6_output_trace_t *t = va_arg (*args, hicn_iface_ip6_output_trace_t *); - s = format (s, "IFACE_IP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = format (s, "IFACE_IP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, format_ip6_header, t->packet_data, sizeof (t->packet_data)); return (s); } |