userspace: Define and use struct eth_addr.
authorJarno Rajahalme <jrajahalme@nicira.com>
Fri, 28 Aug 2015 21:55:11 +0000 (14:55 -0700)
committerJarno Rajahalme <jrajahalme@nicira.com>
Fri, 28 Aug 2015 21:55:11 +0000 (14:55 -0700)
commit74ff3298c8806bb09d0c7e40a25b889ab7564769
treeeb79e22f9460a0699825569a14710e393ee3358d
parentd8ef07e70995e56005e3bc55b86cdb7d0e2066e5
userspace: Define and use struct eth_addr.

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: Jarno Rajahalme <jrajahalme@nicira.com>
79 files changed:
build-aux/check-structs
build-aux/extract-odp-netlink-h
include/openflow/openflow-1.0.h
include/openflow/openflow-1.1.h
include/openflow/openflow-1.4.h
include/openflow/openflow-common.h
include/openvswitch/types.h
lib/bfd.c
lib/bfd.h
lib/cfm.c
lib/cfm.h
lib/csum.c
lib/csum.h
lib/flow.c
lib/flow.h
lib/lacp.c
lib/lacp.h
lib/lldp/aa-structs.h
lib/lldp/lldp-tlv.h
lib/lldp/lldp.c
lib/lldp/lldpd-structs.h
lib/lldp/lldpd.c
lib/lldp/lldpd.h
lib/mac-learning.c
lib/mac-learning.h
lib/match.c
lib/match.h
lib/meta-flow.c
lib/meta-flow.h
lib/netdev-bsd.c
lib/netdev-dpdk.c
lib/netdev-dummy.c
lib/netdev-linux.c
lib/netdev-provider.h
lib/netdev-vport.c
lib/netdev-windows.c
lib/netdev.c
lib/netdev.h
lib/nx-match.c
lib/odp-execute.c
lib/odp-util.c
lib/ofp-actions.c
lib/ofp-actions.h
lib/ofp-parse.c
lib/ofp-parse.h
lib/ofp-util.c
lib/ofp-util.h
lib/ovs-lldp.c
lib/ovs-lldp.h
lib/packets.c
lib/packets.h
lib/rstp-state-machines.c
lib/rtnetlink.c
lib/rtnetlink.h
lib/sflow.h
lib/sflow_receiver.c
lib/stp.c
lib/tnl-arp-cache.c
lib/tnl-arp-cache.h
ofproto/bond.c
ofproto/bond.h
ofproto/fail-open.c
ofproto/in-band.c
ofproto/ofproto-dpif-ipfix.c
ofproto/ofproto-dpif-monitor.c
ofproto/ofproto-dpif-monitor.h
ofproto/ofproto-dpif-sflow.c
ofproto/ofproto-dpif-xlate.c
ofproto/ofproto-dpif.c
ofproto/ofproto.c
ofproto/tunnel.c
ofproto/tunnel.h
ovn/lib/lex.c
ovn/northd/ovn-northd.c
tests/test-aa.c
tests/test-classifier.c
tests/test-sflow.c
utilities/ovs-ofctl.c
vswitchd/bridge.c