aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/map/ip4_map_t.c
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-12-18 10:11:30 +0100
committerNeale Ranns <nranns@cisco.com>2018-12-18 11:54:08 +0000
commit02782d6ebd13ce02f2d3facebb54fec3c2137c88 (patch)
tree6960723f611aaaa4b04e03baf3050f6dc22f2400 /src/plugins/map/ip4_map_t.c
parente78ac9debbe364f1bd6c59eb368d1f6bd38dfa32 (diff)
MAP: Remove dual loop in MAP-T in preparation for refactor.
Change-Id: I3c77cadaa7b677073af00407f368bd48d703fdac Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/plugins/map/ip4_map_t.c')
-rw-r--r--src/plugins/map/ip4_map_t.c197
1 files changed, 0 insertions, 197 deletions
diff --git a/src/plugins/map/ip4_map_t.c b/src/plugins/map/ip4_map_t.c
index 3d52ba4f3ea..67df6a087b9 100644
--- a/src/plugins/map/ip4_map_t.c
+++ b/src/plugins/map/ip4_map_t.c
@@ -17,8 +17,6 @@
#include <vnet/ip/ip_frag.h>
#include <vnet/ip/ip4_to_ip6.h>
-#define IP4_MAP_T_DUAL_LOOP 1
-
typedef enum
{
IP4_MAPT_NEXT_MAPT_TCP_UDP,
@@ -320,72 +318,6 @@ ip4_map_t_tcp_udp (vlib_main_t * vm,
{
vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
-#ifdef IP4_MAP_T_DUAL_LOOP
- while (n_left_from >= 4 && n_left_to_next >= 2)
- {
- u32 pi0, pi1;
- vlib_buffer_t *p0, *p1;
- ip4_mapt_pseudo_header_t *pheader0, *pheader1;
- ip4_mapt_tcp_udp_next_t next0, next1;
-
- pi0 = to_next[0] = from[0];
- pi1 = to_next[1] = from[1];
- from += 2;
- n_left_from -= 2;
- to_next += 2;
- n_left_to_next -= 2;
-
- next0 = IP4_MAPT_TCP_UDP_NEXT_IP6_LOOKUP;
- next1 = IP4_MAPT_TCP_UDP_NEXT_IP6_LOOKUP;
- p0 = vlib_get_buffer (vm, pi0);
- p1 = vlib_get_buffer (vm, pi1);
-
- //Accessing pseudo header
- pheader0 = vlib_buffer_get_current (p0);
- pheader1 = vlib_buffer_get_current (p1);
- vlib_buffer_advance (p0, sizeof (*pheader0));
- vlib_buffer_advance (p1, sizeof (*pheader1));
-
- if (ip4_to_ip6_tcp_udp (p0, ip4_to_ip6_set_cb, pheader0))
- {
- p0->error = error_node->errors[MAP_ERROR_UNKNOWN];
- next0 = IP4_MAPT_TCP_UDP_NEXT_DROP;
- }
- else
- {
- if (vnet_buffer (p0)->map_t.mtu < p0->current_length)
- {
- //Send to fragmentation node if necessary
- vnet_buffer (p0)->ip_frag.mtu = vnet_buffer (p0)->map_t.mtu;
- vnet_buffer (p0)->ip_frag.next_index =
- IP6_FRAG_NEXT_IP6_LOOKUP;
- next0 = IP4_MAPT_TCP_UDP_NEXT_IP6_FRAG;
- }
- }
-
- if (ip4_to_ip6_tcp_udp (p1, ip4_to_ip6_set_cb, pheader1))
- {
- p1->error = error_node->errors[MAP_ERROR_UNKNOWN];
- next1 = IP4_MAPT_TCP_UDP_NEXT_DROP;
- }
- else
- {
- if (vnet_buffer (p1)->map_t.mtu < p1->current_length)
- {
- //Send to fragmentation node if necessary
- vnet_buffer (p1)->ip_frag.mtu = vnet_buffer (p1)->map_t.mtu;
- vnet_buffer (p1)->ip_frag.next_index =
- IP6_FRAG_NEXT_IP6_LOOKUP;
- next1 = IP4_MAPT_TCP_UDP_NEXT_IP6_FRAG;
- }
- }
-
- vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
- to_next, n_left_to_next, pi0, pi1,
- next0, next1);
- }
-#endif
-
while (n_left_from > 0 && n_left_to_next > 0)
{
u32 pi0;
@@ -498,135 +430,6 @@ ip4_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
{
vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
-#ifdef IP4_MAP_T_DUAL_LOOP
- while (n_left_from >= 4 && n_left_to_next >= 2)
- {
- u32 pi0, pi1;
- vlib_buffer_t *p0, *p1;
- ip4_header_t *ip40, *ip41;
- map_domain_t *d0, *d1;
- ip4_mapt_next_t next0 = 0, next1 = 0;
- u16 ip4_len0, ip4_len1;
- u8 error0, error1;
- i32 dst_port0, dst_port1;
- ip4_mapt_pseudo_header_t *pheader0, *pheader1;
-
- pi0 = to_next[0] = from[0];
- pi1 = to_next[1] = from[1];
- from += 2;
- n_left_from -= 2;
- to_next += 2;
- n_left_to_next -= 2;
- error0 = MAP_ERROR_NONE;
- error1 = MAP_ERROR_NONE;
-
- p0 = vlib_get_buffer (vm, pi0);
- p1 = vlib_get_buffer (vm, pi1);
- ip40 = vlib_buffer_get_current (p0);
- ip41 = vlib_buffer_get_current (p1);
- ip4_len0 = clib_host_to_net_u16 (ip40->length);
- ip4_len1 = clib_host_to_net_u16 (ip41->length);
-
- if (PREDICT_FALSE (p0->current_length < ip4_len0 ||
- ip40->ip_version_and_header_length != 0x45))
- {
- error0 = MAP_ERROR_UNKNOWN;
- next0 = IP4_MAPT_NEXT_DROP;
- }
-
- if (PREDICT_FALSE (p1->current_length < ip4_len1 ||
- ip41->ip_version_and_header_length != 0x45))
- {
- error1 = MAP_ERROR_UNKNOWN;
- next1 = IP4_MAPT_NEXT_DROP;
- }
-
- vnet_buffer (p0)->map_t.map_domain_index =
- vnet_buffer (p0)->ip.adj_index[VLIB_TX];
- d0 = ip4_map_get_domain (vnet_buffer (p0)->map_t.map_domain_index);
- vnet_buffer (p1)->map_t.map_domain_index =
- vnet_buffer (p1)->ip.adj_index[VLIB_TX];
- d1 = ip4_map_get_domain (vnet_buffer (p1)->map_t.map_domain_index);
-
- vnet_buffer (p0)->map_t.mtu = d0->mtu ? d0->mtu : ~0;
- vnet_buffer (p1)->map_t.mtu = d1->mtu ? d1->mtu : ~0;
-
- dst_port0 = -1;
- dst_port1 = -1;
-
- ip4_map_t_classify (p0, d0, ip40, ip4_len0, &dst_port0, &error0,
- &next0);
- ip4_map_t_classify (p1, d1, ip41, ip4_len1, &dst_port1, &error1,
- &next1);
-
- //Add MAP-T pseudo header in front of the packet
- vlib_buffer_advance (p0, -sizeof (*pheader0));
- vlib_buffer_advance (p1, -sizeof (*pheader1));
- pheader0 = vlib_buffer_get_current (p0);
- pheader1 = vlib_buffer_get_current (p1);
-
- //Save addresses within the packet
- ip4_map_t_embedded_address (d0, &pheader0->saddr,
- &ip40->src_address);
- ip4_map_t_embedded_address (d1, &pheader1->saddr,
- &ip41->src_address);
- pheader0->daddr.as_u64[0] =
- map_get_pfx_net (d0, ip40->dst_address.as_u32, (u16) dst_port0);
- pheader0->daddr.as_u64[1] =
- map_get_sfx_net (d0, ip40->dst_address.as_u32, (u16) dst_port0);
- pheader1->daddr.as_u64[0] =
- map_get_pfx_net (d1, ip41->dst_address.as_u32, (u16) dst_port1);
- pheader1->daddr.as_u64[1] =
- map_get_sfx_net (d1, ip41->dst_address.as_u32, (u16) dst_port1);
-
- if (PREDICT_FALSE
- (ip4_is_first_fragment (ip40) && (dst_port0 != -1)
- && (d0->ea_bits_len != 0 || !d0->rules)
- && ip4_map_fragment_cache (ip40, dst_port0)))
- {
- error0 = MAP_ERROR_FRAGMENT_MEMORY;
- }
-
- if (PREDICT_FALSE
- (ip4_is_first_fragment (ip41) && (dst_port1 != -1)
- && (d1->ea_bits_len != 0 || !d1->rules)
- && ip4_map_fragment_cache (ip41, dst_port1)))
- {
- error1 = MAP_ERROR_FRAGMENT_MEMORY;
- }
-
- if (PREDICT_TRUE
- (error0 == MAP_ERROR_NONE && next0 != IP4_MAPT_NEXT_MAPT_ICMP))
- {
- vlib_increment_combined_counter (cm + MAP_DOMAIN_COUNTER_TX,
- thread_index,
- vnet_buffer (p0)->
- map_t.map_domain_index, 1,
- clib_net_to_host_u16
- (ip40->length));
- }
-
- if (PREDICT_TRUE
- (error1 == MAP_ERROR_NONE && next1 != IP4_MAPT_NEXT_MAPT_ICMP))
- {
- vlib_increment_combined_counter (cm + MAP_DOMAIN_COUNTER_TX,
- thread_index,
- vnet_buffer (p1)->
- map_t.map_domain_index, 1,
- clib_net_to_host_u16
- (ip41->length));
- }
-
- next0 = (error0 != MAP_ERROR_NONE) ? IP4_MAPT_NEXT_DROP : next0;
- next1 = (error1 != MAP_ERROR_NONE) ? IP4_MAPT_NEXT_DROP : next1;
- p0->error = error_node->errors[error0];
- p1->error = error_node->errors[error1];
- vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_next,
- n_left_to_next, pi0, pi1, next0,
- next1);
- }
-#endif
-
while (n_left_from > 0 && n_left_to_next > 0)
{
u32 pi0;