Skip to content
  • Jarno Rajahalme's avatar
    userspace: Define and use struct eth_addr. · 74ff3298
    Jarno Rajahalme authored
    
    
    Define struct eth_addr and use it instead of a uint8_t array for all
    ethernet addresses in OVS userspace.  The struct is always the right
    size, and it can be assigned without an explicit memcpy, which makes
    code more readable.
    
    "struct eth_addr" is a good type name for this as many utility
    functions are already named accordingly.
    
    struct eth_addr can be accessed as bytes as well as ovs_be16's, which
    makes the struct 16-bit aligned.  All use seems to be 16-bit aligned,
    so some algorithms on the ethernet addresses can be made a bit more
    efficient making use of this fact.
    
    As the struct fits into a register (in 64-bit systems) we pass it by
    value when possible.
    
    This patch also changes the few uses of Linux specific ETH_ALEN to
    OVS's own ETH_ADDR_LEN, and removes the OFP_ETH_ALEN, as it is no
    longer needed.
    
    This work stemmed from a desire to make all struct flow members
    assignable for unrelated exploration purposes.  However, I think this
    might be a nice code readability improvement by itself.
    
    Signed-off-by: default avatarJarno Rajahalme <jrajahalme@nicira.com>
    74ff3298