diff options
| author | Ingo Molnar <mingo@elte.hu> | 2009-06-17 10:59:01 +0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-06-17 10:59:10 +0400 |
| commit | cc4949e1fdade5d063e9f8783cf0e2cc92041ce5 (patch) | |
| tree | 4023bd641bfe464efbde518fb504d6865c9df014 /include/linux/etherdevice.h | |
| parent | 28b4868820a56de661f54742ff91b78e12f1e582 (diff) | |
| parent | 300df7dc89cc276377fc020704e34875d5c473b6 (diff) | |
| download | linux-cc4949e1fdade5d063e9f8783cf0e2cc92041ce5.tar.xz | |
Merge branch 'linus' into x86/urgent
Merge reason: pull in latest to fix a bug in it.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/etherdevice.h')
| -rw-r--r-- | include/linux/etherdevice.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index a1f17abba7dc..3d7a6687d247 100644 --- a/include/linux/etherdevice.h +++ b/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__ */ /** |
