compat: Backport eth_broadcast_addr()
authorOzan Çağlayan <ozancag@gmail.com>
Thu, 23 Aug 2012 11:37:27 +0000 (14:37 +0300)
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>
Thu, 23 Aug 2012 12:01:40 +0000 (16:01 +0400)
This backports:

commit ad7eee98bef92481581060801bdfd1b25a6106c0
Author: Johannes Berg <johannes.berg@intel.com>
Commit: David S. Miller <davem@davemloft.net>

    etherdevice: introduce eth_broadcast_addr

    A lot of code has either the memset or an inefficient copy
    from a static array that contains the all-ones broadcast
    address. Introduce eth_broadcast_addr() to fill an address
    with all ones, making the code clearer and allowing us to
    get rid of some constant arrays.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
$ git describe --contains ad7eee98bef92481581060801bdfd1b25a6106c0
v3.6-rc1~125^2~252

Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
include/linux/compat-3.6.h

index 63753cde564d37a9d669392d20913332994f7661..97b59933f53a836df319610da0bf5dec02c040f5 100644 (file)
 #include <net/genetlink.h>
 #include <linux/etherdevice.h>
 
+/**
+ * eth_broadcast_addr - Assign broadcast address
+ * @addr: Pointer to a six-byte array containing the Ethernet address
+ *
+ * Assign the broadcast address to the given address array.
+ */
+static inline void eth_broadcast_addr(u8 *addr)
+{
+       memset(addr, 0xff, ETH_ALEN);
+}
+
 /**
  * eth_random_addr - Generate software assigned random Ethernet address
  * @addr: Pointer to a six-byte array containing the Ethernet address