summaryrefslogtreecommitdiffstats
path: root/src/vnet/ethernet
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/ethernet
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/ethernet')
-rw-r--r--src/vnet/ethernet/arp.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/vnet/ethernet/arp.c b/src/vnet/ethernet/arp.c
index 75c7e20372a..2f81da32400 100644
--- a/src/vnet/ethernet/arp.c
+++ b/src/vnet/ethernet/arp.c
@@ -479,28 +479,30 @@ arp_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_ip4_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 11 bytes from the end of the MAC header - which is three
- * bytes into the desintation address. And we write 3 bytes.
- */
- adj->rewrite_header.dst_mcast_offset = 11;
- adj->rewrite_header.dst_mcast_n_bytes = 3;
-
- 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_ip4_mcast_dst_addr ());
+ offset = vec_len (rewrite) - 2;
+
+ /*
+ * 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 MAC desintation address. And we copy 23 bits
+ * from the address.
+ */
+ adj_mcast_update_rewrite (ai, rewrite, offset, 0x007fffff);
+ break;
+ }
case IP_LOOKUP_NEXT_DROP:
case IP_LOOKUP_NEXT_PUNT:
case IP_LOOKUP_NEXT_LOCAL: