diff options
author | Joe Perches <joe@perches.com> | 2012-05-08 14:56:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-09 20:49:16 -0400 |
commit | a599b0f54d233d0f63d6be9a2ff0049d24751669 (patch) | |
tree | f2af4db8faa12de568e31d475f4680cb5e7d282d /include | |
parent | a49d1a905ed96c7a790d9535e2bc62d3f2f55a05 (diff) |
etherdevice.h: Add ether_addr_equal
Add a boolean function to check if 2 ethernet addresses
are the same.
This is to avoid any confusion about compare_ether_addr
returning an unsigned, and not being able to use the
compare_ether_addr function for sorting ala memcmp.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/etherdevice.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index c47631fac229..f3301140d28a 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
@@ -171,6 +171,18 @@ static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2) | |||
171 | return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; | 171 | return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; |
172 | } | 172 | } |
173 | 173 | ||
174 | /** | ||
175 | * ether_addr_equal - Compare two Ethernet addresses | ||
176 | * @addr1: Pointer to a six-byte array containing the Ethernet address | ||
177 | * @addr2: Pointer other six-byte array containing the Ethernet address | ||
178 | * | ||
179 | * Compare two ethernet addresses, returns true if equal | ||
180 | */ | ||
181 | static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2) | ||
182 | { | ||
183 | return !compare_ether_addr(addr1, addr2); | ||
184 | } | ||
185 | |||
174 | static inline unsigned long zap_last_2bytes(unsigned long value) | 186 | static inline unsigned long zap_last_2bytes(unsigned long value) |
175 | { | 187 | { |
176 | #ifdef __BIG_ENDIAN | 188 | #ifdef __BIG_ENDIAN |