aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ethernet
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-10-24 02:57:49 -0700
committerDamjan Marion <dmarion@me.com>2018-11-06 21:23:18 +0000
commit4d5b917b1a74461abaa30182d4bf5c7761572323 (patch)
treea92e08d4de07934dcb49c63661e0ddd74ad0c5a6 /src/vnet/ethernet
parent65ed2d0503bc8d9a6a66ca1ece87e3e876ff95cc (diff)
BD ARP entry use common API types
Change-Id: I29f20dbaf2c2d735faff297cee552ed648f6f61b Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/ethernet')
-rw-r--r--src/vnet/ethernet/mac_address.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/vnet/ethernet/mac_address.h b/src/vnet/ethernet/mac_address.h
index 8e1559b8654..7b4390dfb48 100644
--- a/src/vnet/ethernet/mac_address.h
+++ b/src/vnet/ethernet/mac_address.h
@@ -20,7 +20,11 @@
typedef struct mac_address_t_
{
- u8 bytes[6];
+ union
+ {
+ u8 bytes[6];
+ u64 as_u64;
+ };
} mac_address_t;
extern const mac_address_t ZERO_MAC_ADDRESS;
@@ -28,25 +32,29 @@ extern const mac_address_t ZERO_MAC_ADDRESS;
static_always_inline void
mac_address_from_bytes (mac_address_t * mac, const u8 * bytes)
{
- clib_memcpy (mac->bytes, bytes, sizeof (*mac));
+ /* zero out the last 2 bytes, then copy over only 6 */
+ mac->as_u64 = 0;
+ clib_memcpy (mac->bytes, bytes, 6);
}
static_always_inline int
mac_address_is_zero (const mac_address_t * mac)
{
- return (ethernet_mac_address_is_zero (mac->bytes));
+ return (0 == mac->as_u64);
}
static_always_inline u64
mac_address_as_u64 (const mac_address_t * mac)
{
- return (ethernet_mac_address_u64 (mac->bytes));
+ return (mac->as_u64);
}
static_always_inline void
mac_address_from_u64 (u64 u, mac_address_t * mac)
{
- ethernet_mac_address_from_u64 (u, mac->bytes);
+ mac->as_u64 = u;
+ mac->bytes[4] = 0;
+ mac->bytes[5] = 0;
}
extern uword unformat_mac_address_t (unformat_input_t * input,