summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-03-15 04:22:25 -0700
committerFlorin Coras <florin.coras@gmail.com>2017-03-27 17:45:06 +0000
commit2e7fbcc08152da5c6a17ed80ba08cd37edec6c8c (patch)
tree09e4f98dcc45d4105c04f2ba4a5fbae2cc63ff7d /src/vnet/ip
parent70efbfcd49aaee207ff3d33ac60083fedd9f1eec (diff)
Mcast rewrite no memcpy
use a 32bit mask in the adjacency to AND with the IP address and OR into the rewrite. Change-Id: I80b0f246c18fd74f3e43c5d49e25833412f34665 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip4_forward.c6
-rw-r--r--src/vnet/ip/ip6_forward.c6
-rw-r--r--src/vnet/ip/ip6_neighbor.c43
-rw-r--r--src/vnet/ip/lookup.h1
4 files changed, 29 insertions, 27 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index 7352c2e718d..f2bc2a71851 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -2553,8 +2553,8 @@ ip4_rewrite_inline (vlib_main_t * vm,
/*
* copy bytes from the IP address into the MAC rewrite
*/
- vnet_fixup_one_header (adj0[0], &ip0->dst_address, ip0, 1);
- vnet_fixup_one_header (adj1[0], &ip1->dst_address, ip1, 1);
+ vnet_fixup_one_header (adj0[0], &ip0->dst_address, ip0);
+ vnet_fixup_one_header (adj1[0], &ip1->dst_address, ip1);
}
vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
@@ -2635,7 +2635,7 @@ ip4_rewrite_inline (vlib_main_t * vm,
/*
* copy bytes from the IP address into the MAC rewrite
*/
- vnet_fixup_one_header (adj0[0], &ip0->dst_address, ip0, 1);
+ vnet_fixup_one_header (adj0[0], &ip0->dst_address, ip0);
}
/* Update packet buffer attributes/set output interface. */
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 0b8691bf3dd..ecc3bd2cc6e 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -2087,8 +2087,8 @@ ip6_rewrite_inline (vlib_main_t * vm,
/*
* copy bytes from the IP address into the MAC rewrite
*/
- vnet_fixup_one_header (adj0[0], &ip0->dst_address, ip0, 0);
- vnet_fixup_one_header (adj1[0], &ip1->dst_address, ip1, 0);
+ vnet_fixup_one_header (adj0[0], &ip0->dst_address, ip0);
+ vnet_fixup_one_header (adj1[0], &ip1->dst_address, ip1);
}
vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
@@ -2197,7 +2197,7 @@ ip6_rewrite_inline (vlib_main_t * vm,
}
if (is_mcast)
{
- vnet_fixup_one_header (adj0[0], &ip0->dst_address, ip0, 0);
+ vnet_fixup_one_header (adj0[0], &ip0->dst_address, ip0);
}
p0->error = error_node->errors[error0];
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index 8d355ab2d2c..9b616630a71 100644
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -530,28 +530,29 @@ ip6_ethernet_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, u32 ai)
}
break;
case IP_LOOKUP_NEXT_MCAST:
- /*
- * Construct a partial rewrite from the known ethernet mcast dest MAC
- */
- adj_mcast_update_rewrite
- (ai,
- ethernet_build_rewrite (vnm,
- sw_if_index,
- adj->ia_link,
- ethernet_ip6_mcast_dst_addr ()));
-
- /*
- * Complete the remaining fields of the adj's rewrite to direct the
- * complete of the rewrite at switch time by copying in the IP
- * dst address's bytes.
- * Ofset is 12 bytes from the end of the MAC header - which is 2
- * bytes into the desintation address. And we write 4 bytes.
- */
- adj->rewrite_header.dst_mcast_offset = 12;
- adj->rewrite_header.dst_mcast_n_bytes = 4;
-
- break;
+ {
+ /*
+ * Construct a partial rewrite from the known ethernet mcast dest MAC
+ */
+ u8 *rewrite;
+ u8 offset;
+
+ rewrite = ethernet_build_rewrite (vnm,
+ sw_if_index,
+ adj->ia_link,
+ ethernet_ip6_mcast_dst_addr ());
+
+ /*
+ * Complete the remaining fields of the adj's rewrite to direct the
+ * complete of the rewrite at switch time by copying in the IP
+ * dst address's bytes.
+ * Ofset is 2 bytes into the desintation address. And we write 4 bytes.
+ */
+ offset = vec_len (rewrite) - 2;
+ adj_mcast_update_rewrite (ai, rewrite, offset, 0xffffffff);
+ break;
+ }
case IP_LOOKUP_NEXT_DROP:
case IP_LOOKUP_NEXT_PUNT:
case IP_LOOKUP_NEXT_LOCAL:
diff --git a/src/vnet/ip/lookup.h b/src/vnet/ip/lookup.h
index 48360b5b41f..f76ddb37863 100644
--- a/src/vnet/ip/lookup.h
+++ b/src/vnet/ip/lookup.h
@@ -55,6 +55,7 @@
#include <vnet/fib/fib_node.h>
#include <vnet/dpo/dpo.h>
#include <vnet/feature/feature.h>
+#include <vnet/rewrite.h>
/** @brief Common (IP4/IP6) next index stored in adjacency. */
typedef enum