summaryrefslogtreecommitdiffstats
path: root/include/linux/etherdevice.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-09-03 20:57:57 -0400
committerDavid S. Miller <davem@davemloft.net>2013-09-03 20:57:57 -0400
commit61c8106e296cbb51eec11f5cb0ffd6ac30672f55 (patch)
tree758a813e35f67ff4007a1f38bb12923315d7f1cf /include/linux/etherdevice.h
parent5a17a390de7bdbcfff9b8f344273a886ca4cf8bf (diff)
parent314cb11b493e7b8cfc7e2db01ad8e4e8bc0a259d (diff)
Merge branch 'addr_assign_type'
Bjørn Mork says: ==================== net: set addr_assign_type when inheriting a dev_addr Copying the dev_addr from a parent device is an operation common to a number of drivers. The addr_assign_type should be updated accordingly, either by reusing the value from the source device or explicitly indicating that the address is stolen by setting addr_assign_type to NET_ADDR_STOLEN. This patch set adds a helper copying both the dev_addr and the addr_assign_type, and use this helper in drivers which don't currently set the addr_assign_type. Using NET_ADDR_STOLEN might be more appropriate in some of these cases. Please let me know, and I'll update the patch accordingly. Changes in v2: - assuming addr_len == ETH_ALEN to allow optimized memcpy - dropped the vt6656 patch due to addr_len being unset in that driver ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/etherdevice.h')
-rw-r--r--include/linux/etherdevice.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index c623861964e..d8b512496e5 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -199,6 +199,21 @@ static inline void eth_hw_addr_random(struct net_device *dev)
}
/**
+ * eth_hw_addr_inherit - Copy dev_addr from another net_device
+ * @dst: pointer to net_device to copy dev_addr to
+ * @src: pointer to net_device to copy dev_addr from
+ *
+ * Copy the Ethernet address from one net_device to another along with
+ * the address attributes (addr_assign_type).
+ */
+static inline void eth_hw_addr_inherit(struct net_device *dst,
+ struct net_device *src)
+{
+ dst->addr_assign_type = src->addr_assign_type;
+ memcpy(dst->dev_addr, src->dev_addr, ETH_ALEN);
+}
+
+/**
* compare_ether_addr - Compare two Ethernet addresses
* @addr1: Pointer to a six-byte array containing the Ethernet address
* @addr2: Pointer other six-byte array containing the Ethernet address