diff options
author | Jarno Rajahalme <jrajahalme@nicira.com> | 2015-08-28 14:55:11 -0700 |
---|---|---|
committer | Jarno Rajahalme <jrajahalme@nicira.com> | 2015-08-28 14:55:11 -0700 |
commit | 74ff3298c8806bb09d0c7e40a25b889ab7564769 (patch) | |
tree | eb79e22f9460a0699825569a14710e393ee3358d /lib/ovs-lldp.h | |
parent | d8ef07e70995e56005e3bc55b86cdb7d0e2066e5 (diff) | |
download | openvswitch-74ff3298c8806bb09d0c7e40a25b889ab7564769.tar.gz |
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>
Diffstat (limited to 'lib/ovs-lldp.h')
-rw-r--r-- | lib/ovs-lldp.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ovs-lldp.h b/lib/ovs-lldp.h index 807590aaa..e780e5b56 100644 --- a/lib/ovs-lldp.h +++ b/lib/ovs-lldp.h @@ -88,7 +88,7 @@ bool lldp_should_process_flow(struct lldp *lldp, const struct flow *flow); bool lldp_configure(struct lldp *lldp, const struct smap *cfg); void lldp_process_packet(struct lldp *cfg, const struct dp_packet *); void lldp_put_packet(struct lldp *lldp, struct dp_packet *packet, - uint8_t eth_src[ETH_ADDR_LEN]); + const struct eth_addr eth_src); void lldpd_assign_cfg_to_protocols(struct lldpd *cfg); struct lldp * lldp_create(const struct netdev *netdev, const uint32_t mtu, const struct smap *cfg); |