diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-11-05 23:46:06 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-11-05 23:46:06 +0100 |
commit | a41984e726601b2f6cf61e3128aba84f7a85436c (patch) | |
tree | 6d1156eb0d5779bda12592eca6f2c9ca93722a09 /libdde-linux26/contrib/include/linux/etherdevice.h | |
parent | 573055eb4f44e819f983f083c52716bdec8edf14 (diff) |
sync with upstream packaging
Diffstat (limited to 'libdde-linux26/contrib/include/linux/etherdevice.h')
-rw-r--r-- | libdde-linux26/contrib/include/linux/etherdevice.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libdde-linux26/contrib/include/linux/etherdevice.h b/libdde-linux26/contrib/include/linux/etherdevice.h index 1cb0f0b9..fbb3836e 100644 --- a/libdde-linux26/contrib/include/linux/etherdevice.h +++ b/libdde-linux26/contrib/include/linux/etherdevice.h @@ -182,6 +182,33 @@ static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2], return compare_ether_addr(addr1, addr2); #endif } + +/** + * is_etherdev_addr - Tell if given Ethernet address belongs to the device. + * @dev: Pointer to a device structure + * @addr: Pointer to a six-byte array containing the Ethernet address + * + * Compare passed address with all addresses of the device. Return true if the + * address if one of the device addresses. + * + * Note that this function calls compare_ether_addr_64bits() so take care of + * the right padding. + */ +static inline bool is_etherdev_addr(const struct net_device *dev, + const u8 addr[6 + 2]) +{ + struct netdev_hw_addr *ha; + int res = 1; + + rcu_read_lock(); + for_each_dev_addr(dev, ha) { + res = compare_ether_addr_64bits(addr, ha->addr); + if (!res) + break; + } + rcu_read_unlock(); + return !res; +} #endif /* __KERNEL__ */ #endif /* _LINUX_ETHERDEVICE_H */ |