mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[ETH]: ether address compare
Expose faster ether compare for use by protocols and other driver. And change name to be more consistent with other ether address manipulation routines in same file Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
parent
e83b860539
commit
360ac8e2f1
2 changed files with 18 additions and 15 deletions
|
@ -104,6 +104,22 @@ static inline void random_ether_addr(u8 *addr)
|
|||
addr [0] &= 0xfe; /* clear multicast bit */
|
||||
addr [0] |= 0x02; /* set local assignment bit (IEEE802) */
|
||||
}
|
||||
|
||||
/**
|
||||
* compare_ether_addr - Compare two Ethernet addresses
|
||||
* @addr1: Pointer to a six-byte array containing the Ethernet address
|
||||
* @addr2 Pointer other six-byte array containing the Ethernet address
|
||||
*
|
||||
* Compare two ethernet addresses, returns 0 if equal
|
||||
*/
|
||||
static inline unsigned compare_ether_addr(const u8 *_a, const u8 *_b)
|
||||
{
|
||||
const u16 *a = (const u16 *) _a;
|
||||
const u16 *b = (const u16 *) _b;
|
||||
|
||||
BUILD_BUG_ON(ETH_ALEN != 6);
|
||||
return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
|
||||
}
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _LINUX_ETHERDEVICE_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue