aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/etherdevice.h
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2013-03-17 22:40:50 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2013-03-17 22:40:50 -0400
commit688d794c4c3f8b08c814381ee2edd3ede5856056 (patch)
treeef680add71e2a9588d07d8b594edbc1b5cd127d7 /include/linux/etherdevice.h
parent16142655269aaf580488e074eabfdcf0fb4e3687 (diff)
parenta937536b868b8369b98967929045f1df54234323 (diff)
Merge tag 'v3.9-rc3' into next
Merge with mainline to bring in module_platform_driver_probe() and devm_ioremap_resource().
Diffstat (limited to 'include/linux/etherdevice.h')
-rw-r--r--include/linux/etherdevice.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index b006ba0a9f42..c623861964e4 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -40,6 +40,8 @@ extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh,
40extern void eth_header_cache_update(struct hh_cache *hh, 40extern void eth_header_cache_update(struct hh_cache *hh,
41 const struct net_device *dev, 41 const struct net_device *dev,
42 const unsigned char *haddr); 42 const unsigned char *haddr);
43extern int eth_prepare_mac_addr_change(struct net_device *dev, void *p);
44extern void eth_commit_mac_addr_change(struct net_device *dev, void *p);
43extern int eth_mac_addr(struct net_device *dev, void *p); 45extern int eth_mac_addr(struct net_device *dev, void *p);
44extern int eth_change_mtu(struct net_device *dev, int new_mtu); 46extern int eth_change_mtu(struct net_device *dev, int new_mtu);
45extern int eth_validate_addr(struct net_device *dev); 47extern int eth_validate_addr(struct net_device *dev);
@@ -51,6 +53,26 @@ extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
51#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) 53#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1)
52#define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count) 54#define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count)
53 55
56/* Reserved Ethernet Addresses per IEEE 802.1Q */
57static const u8 eth_reserved_addr_base[ETH_ALEN] __aligned(2) =
58{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 };
59
60/**
61 * is_link_local_ether_addr - Determine if given Ethernet address is link-local
62 * @addr: Pointer to a six-byte array containing the Ethernet address
63 *
64 * Return true if address is link local reserved addr (01:80:c2:00:00:0X) per
65 * IEEE 802.1Q 8.6.3 Frame filtering.
66 */
67static inline bool is_link_local_ether_addr(const u8 *addr)
68{
69 __be16 *a = (__be16 *)addr;
70 static const __be16 *b = (const __be16 *)eth_reserved_addr_base;
71 static const __be16 m = cpu_to_be16(0xfff0);
72
73 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | ((a[2] ^ b[2]) & m)) == 0;
74}
75
54/** 76/**
55 * is_zero_ether_addr - Determine if give Ethernet address is all zeros. 77 * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
56 * @addr: Pointer to a six-byte array containing the Ethernet address 78 * @addr: Pointer to a six-byte array containing the Ethernet address
@@ -172,7 +194,7 @@ static inline void eth_zero_addr(u8 *addr)
172 */ 194 */
173static inline void eth_hw_addr_random(struct net_device *dev) 195static inline void eth_hw_addr_random(struct net_device *dev)
174{ 196{
175 dev->addr_assign_type |= NET_ADDR_RANDOM; 197 dev->addr_assign_type = NET_ADDR_RANDOM;
176 eth_random_addr(dev->dev_addr); 198 eth_random_addr(dev->dev_addr);
177} 199}
178 200