diff options
Diffstat (limited to 'include/linux/etherdevice.h')
| -rw-r--r-- | include/linux/etherdevice.h | 24 |
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, | |||
| 40 | extern void eth_header_cache_update(struct hh_cache *hh, | 40 | extern 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); |
| 43 | extern int eth_prepare_mac_addr_change(struct net_device *dev, void *p); | ||
| 44 | extern void eth_commit_mac_addr_change(struct net_device *dev, void *p); | ||
| 43 | extern int eth_mac_addr(struct net_device *dev, void *p); | 45 | extern int eth_mac_addr(struct net_device *dev, void *p); |
| 44 | extern int eth_change_mtu(struct net_device *dev, int new_mtu); | 46 | extern int eth_change_mtu(struct net_device *dev, int new_mtu); |
| 45 | extern int eth_validate_addr(struct net_device *dev); | 47 | extern 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 */ | ||
| 57 | static 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 | */ | ||
| 67 | static 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 | */ |
| 173 | static inline void eth_hw_addr_random(struct net_device *dev) | 195 | static 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 | ||
