aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/etherdevice.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/etherdevice.h')
-rw-r--r--include/linux/etherdevice.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 17460c85df7b..5f49a30eb6f2 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -48,8 +48,10 @@ static inline void eth_copy_and_sum (struct sk_buff *dest,
48} 48}
49 49
50/** 50/**
51 * is_zero_ether_addr - Determine if give Ethernet address is all 51 * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
52 * zeros. 52 * @addr: Pointer to a six-byte array containing the Ethernet address
53 *
54 * Return true if the address is all zeroes.
53 */ 55 */
54static inline int is_zero_ether_addr(const u8 *addr) 56static inline int is_zero_ether_addr(const u8 *addr)
55{ 57{
@@ -57,9 +59,7 @@ static inline int is_zero_ether_addr(const u8 *addr)
57} 59}
58 60
59/** 61/**
60 * is_multicast_ether_addr - Determine if the given Ethernet address is a 62 * is_multicast_ether_addr - Determine if the Ethernet address is a multicast.
61 * multicast address.
62 *
63 * @addr: Pointer to a six-byte array containing the Ethernet address 63 * @addr: Pointer to a six-byte array containing the Ethernet address
64 * 64 *
65 * Return true if the address is a multicast address. 65 * Return true if the address is a multicast address.
@@ -69,6 +69,12 @@ static inline int is_multicast_ether_addr(const u8 *addr)
69 return ((addr[0] != 0xff) && (0x01 & addr[0])); 69 return ((addr[0] != 0xff) && (0x01 & addr[0]));
70} 70}
71 71
72/**
73 * is_broadcast_ether_addr - Determine if the Ethernet address is broadcast
74 * @addr: Pointer to a six-byte array containing the Ethernet address
75 *
76 * Return true if the address is the broadcast address.
77 */
72static inline int is_broadcast_ether_addr(const u8 *addr) 78static inline int is_broadcast_ether_addr(const u8 *addr)
73{ 79{
74 return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff; 80 return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff;
@@ -107,14 +113,14 @@ static inline void random_ether_addr(u8 *addr)
107/** 113/**
108 * compare_ether_addr - Compare two Ethernet addresses 114 * compare_ether_addr - Compare two Ethernet addresses
109 * @addr1: Pointer to a six-byte array containing the Ethernet address 115 * @addr1: Pointer to a six-byte array containing the Ethernet address
110 * @addr2 Pointer other six-byte array containing the Ethernet address 116 * @addr2: Pointer other six-byte array containing the Ethernet address
111 * 117 *
112 * Compare two ethernet addresses, returns 0 if equal 118 * Compare two ethernet addresses, returns 0 if equal
113 */ 119 */
114static inline unsigned compare_ether_addr(const u8 *_a, const u8 *_b) 120static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
115{ 121{
116 const u16 *a = (const u16 *) _a; 122 const u16 *a = (const u16 *) addr1;
117 const u16 *b = (const u16 *) _b; 123 const u16 *b = (const u16 *) addr2;
118 124
119 BUILD_BUG_ON(ETH_ALEN != 6); 125 BUILD_BUG_ON(ETH_ALEN != 6);
120 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; 126 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;