Lines Matching defs:addr
35 int device_get_mac_address(struct device *dev, char *addr);
37 int fwnode_get_mac_address(struct fwnode_handle *fwnode, char *addr);
82 * @addr: Pointer to a six-byte array containing the Ethernet address
84 * Return: true if address is link local reserved addr (01:80:c2:00:00:0X) per
87 * Please note: addr must be aligned to u16.
89 static inline bool is_link_local_ether_addr(const u8 *addr)
91 __be16 *a = (__be16 *)addr;
96 return (((*(const u32 *)addr) ^ (*(const u32 *)b)) |
105 * @addr: Pointer to a six-byte array containing the Ethernet address
109 * Please note: addr must be aligned to u16.
111 static inline bool is_zero_ether_addr(const u8 *addr)
114 return ((*(const u32 *)addr) | (*(const u16 *)(addr + 4))) == 0;
116 return (*(const u16 *)(addr + 0) |
117 *(const u16 *)(addr + 2) |
118 *(const u16 *)(addr + 4)) == 0;
124 * @addr: Pointer to a six-byte array containing the Ethernet address
129 static inline bool is_multicast_ether_addr(const u8 *addr)
132 u32 a = *(const u32 *)addr;
134 u16 a = *(const u16 *)addr;
143 static inline bool is_multicast_ether_addr_64bits(const u8 *addr)
147 return 0x01 & ((*(const u64 *)addr) >> 56);
149 return 0x01 & (*(const u64 *)addr);
152 return is_multicast_ether_addr(addr);
158 * @addr: Pointer to a six-byte array containing the Ethernet address
162 static inline bool is_local_ether_addr(const u8 *addr)
164 return 0x02 & addr[0];
169 * @addr: Pointer to a six-byte array containing the Ethernet address
173 * Please note: addr must be aligned to u16.
175 static inline bool is_broadcast_ether_addr(const u8 *addr)
177 return (*(const u16 *)(addr + 0) &
178 *(const u16 *)(addr + 2) &
179 *(const u16 *)(addr + 4)) == 0xffff;
184 * @addr: Pointer to a six-byte array containing the Ethernet address
188 static inline bool is_unicast_ether_addr(const u8 *addr)
190 return !is_multicast_ether_addr(addr);
195 * @addr: Pointer to a six-byte array containing the Ethernet address
202 * Please note: addr must be aligned to u16.
204 static inline bool is_valid_ether_addr(const u8 *addr)
208 return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
231 * @addr: Pointer to a six-byte array containing the Ethernet address
236 static inline void eth_random_addr(u8 *addr)
238 get_random_bytes(addr, ETH_ALEN);
239 addr[0] &= 0xfe; /* clear multicast bit */
240 addr[0] |= 0x02; /* set local assignment bit (IEEE802) */
245 * @addr: Pointer to a six-byte array containing the Ethernet address
249 static inline void eth_broadcast_addr(u8 *addr)
251 memset(addr, 0xff, ETH_ALEN);
256 * @addr: Pointer to a six-byte array containing the Ethernet address
260 static inline void eth_zero_addr(u8 *addr)
262 memset(addr, 0x00, ETH_ALEN);
276 u8 addr[ETH_ALEN];
278 eth_random_addr(addr);
279 __dev_addr_set(dev, addr, ETH_ALEN);
291 return ether_crc(ETH_ALEN, ha->addr);
319 * @addr: address to assign
323 static inline void eth_hw_addr_set(struct net_device *dev, const u8 *addr)
325 __dev_addr_set(dev, addr, ETH_ALEN);
437 static inline bool ether_addr_is_ipv4_mcast(const u8 *addr)
441 return ether_addr_equal_masked(addr, eth_ipv4_mcast_addr_base, mask);
444 static inline bool ether_addr_is_ipv6_mcast(const u8 *addr)
448 return ether_addr_equal_masked(addr, eth_ipv6_mcast_addr_base, mask);
451 static inline bool ether_addr_is_ip_mcast(const u8 *addr)
453 return ether_addr_is_ipv4_mcast(addr) ||
454 ether_addr_is_ipv6_mcast(addr);
459 * @addr: Pointer to a six-byte array containing the Ethernet address
463 static inline u64 ether_addr_to_u64(const u8 *addr)
469 u = u << 8 | addr[i];
477 * @addr: Pointer to a six-byte array to contain the Ethernet address
479 static inline void u64_to_ether_addr(u64 u, u8 *addr)
484 addr[i] = u & 0xff;
492 * @addr: Pointer to a six-byte array containing Ethernet address to decrement
494 static inline void eth_addr_dec(u8 *addr)
496 u64 u = ether_addr_to_u64(addr);
499 u64_to_ether_addr(u, addr);
504 * @addr: Pointer to a six-byte array containing Ethernet address to increment.
506 static inline void eth_addr_inc(u8 *addr)
508 u64 u = ether_addr_to_u64(addr);
511 u64_to_ether_addr(u, addr);
518 * @addr: Pointer to a six-byte array containing Ethernet address to increment.
520 static inline void eth_addr_add(u8 *addr, long offset)
522 u64 u = ether_addr_to_u64(addr);
525 u64_to_ether_addr(u, addr);
531 * @addr: Pointer to a six-byte array containing the Ethernet address
540 const u8 addr[6 + 2])
547 res = ether_addr_equal_64bits(addr, ha->addr);
607 u8 addr[ETH_ALEN];
610 u64_to_ether_addr(u, addr);
611 eth_hw_addr_set(dev, addr);