mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
types: New macros ETH_ADDR_C and ETH_ADDR64_C.
These macros expand to constants of type struct eth_addr and struct eth_addr64, respectively, and make it more convenient to initialize or assign to an Ethernet address object. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Mark Michelson <mmichels@redhat.com>
This commit is contained in:
@@ -168,6 +168,11 @@ struct eth_addr {
|
||||
};
|
||||
};
|
||||
|
||||
/* Ethernet address constant, e.g. ETH_ADDR_C(01,23,45,67,89,ab) is
|
||||
* 01:23:45:67:89:ab. */
|
||||
#define ETH_ADDR_C(A,B,C,D,E,F) (struct eth_addr) \
|
||||
{ { .ea = { 0x##A, 0x##B, 0x##C, 0x##D, 0x##E, 0x##F } } }
|
||||
|
||||
/* Similar to struct eth_addr, for EUI-64 addresses. */
|
||||
struct eth_addr64 {
|
||||
union {
|
||||
@@ -176,6 +181,12 @@ struct eth_addr64 {
|
||||
};
|
||||
};
|
||||
|
||||
/* EUI-64 address constant, e.g. ETH_ADDR_C(01,23,45,67,89,ab,cd,ef) is
|
||||
* 01:23:45:67:89:ab:cd:ef. */
|
||||
#define ETH_ADDR64_C(A,B,C,D,E,F,G,H) (struct eth_addr64) \
|
||||
{ { .ea64 = { 0x##A, 0x##B, 0x##C, 0x##D, \
|
||||
0x##E, 0x##F, 0x##G, 0x##H} } }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user