]> Pileus Git - ~andy/linux/commitdiff
etherdevice.h: Add is_unicast_ether_addr function
authorTobias Klauser <tklauser@distanz.ch>
Wed, 12 Jan 2011 22:14:56 +0000 (22:14 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 14 Jan 2011 05:49:56 +0000 (21:49 -0800)
From a check for !is_multicast_ether_addr it is not always obvious that
we're checking for a unicast address. So add this helper function to
make those code paths easier to read.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/etherdevice.h

index bec8b82889bfa7217952cdbb6a76f2a2fe8af041..ab68f785fd196fb73ef062a67b9ad195d84bcd13 100644 (file)
@@ -98,6 +98,17 @@ static inline int is_broadcast_ether_addr(const u8 *addr)
        return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff;
 }
 
+/**
+ * is_unicast_ether_addr - Determine if the Ethernet address is unicast
+ * @addr: Pointer to a six-byte array containing the Ethernet address
+ *
+ * Return true if the address is a unicast address.
+ */
+static inline int is_unicast_ether_addr(const u8 *addr)
+{
+       return !is_multicast_ether_addr(addr);
+}
+
 /**
  * is_valid_ether_addr - Determine if the given Ethernet address is valid
  * @addr: Pointer to a six-byte array containing the Ethernet address