summaryrefslogtreecommitdiffstats
path: root/src/vnet/ethernet/ethernet.h
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-10-20 16:24:17 +0200
committerDamjan Marion <dmarion@me.com>2020-11-13 11:17:50 +0000
commitb44c77d01dcf9ebf80d7bcab097515ad8135bc05 (patch)
tree71070f6ea6b5dc989730e1775f6c7916a07938fc /src/vnet/ethernet/ethernet.h
parent41c0f45a56d4db5b2ee4ae4fff7f3f0571a23189 (diff)
ethernet: mac must support 64-bits loads
ethernet dataplane loads MAC addresses as 64-bits loads for efficiency. We must make sure it is valid, especially for the vector of secondary MACs. Type: fix Change-Id: I851e319b8a973c154e85ff9f05f3b8e385939788 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vnet/ethernet/ethernet.h')
-rw-r--r--src/vnet/ethernet/ethernet.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/vnet/ethernet/ethernet.h b/src/vnet/ethernet/ethernet.h
index afb932931b7..a83b0f39295 100644
--- a/src/vnet/ethernet/ethernet.h
+++ b/src/vnet/ethernet/ethernet.h
@@ -132,6 +132,17 @@ typedef u32 (ethernet_flag_change_function_t)
#define ETHERNET_MIN_PACKET_BYTES 64
#define ETHERNET_MAX_PACKET_BYTES 9216
+/* ethernet dataplane loads mac address as u64 for efficiency */
+typedef union ethernet_interface_address
+{
+ struct
+ {
+ mac_address_t mac;
+ u16 zero;
+ };
+ u64 as_u64;
+} ethernet_interface_address_t;
+
/* Ethernet interface instance. */
typedef struct ethernet_interface
{
@@ -160,10 +171,10 @@ typedef struct ethernet_interface
u32 driver_instance;
/* Ethernet (MAC) address for this interface. */
- u8 address[6];
+ ethernet_interface_address_t address;
/* Secondary MAC addresses for this interface */
- mac_address_t *secondary_addrs;
+ ethernet_interface_address_t *secondary_addrs;
} ethernet_interface_t;
extern vnet_hw_interface_class_t ethernet_hw_interface_class;