Adds a new field to net device to hold the permanent hardware address, and adds a new generic ethtool_op function to get that address.
Signed-off-by: Jon Wetzel <[EMAIL PROTECTED]> Signed-off-by: John W. Linville <[EMAIL PROTECTED]> --- linux-2.6.12.3/include/linux/netdevice.h 2005-07-28 17:29:21.000000000 -0500 +++ linux-2.6.12.3-jw/include/linux/netdevice.h 2005-07-28 17:25:02.000000000 -0500 @@ -336,6 +336,7 @@ /* Interface address info. */ unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */ + unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ unsigned char addr_len; /* hardware address length */ unsigned short dev_id; /* for shared network cards */ --- linux-2.6.12.3/include/linux/ethtool.h 2005-07-15 16:18:57.000000000 -0500 +++ linux-2.6.12.3-jw/include/linux/ethtool.h 2005-08-01 13:17:03.000000000 -0500 @@ -250,6 +250,12 @@ u64 data[0]; }; +struct ethtool_perm_addr { + u32 cmd; /* ETHTOOLGPERMADDR */ + int size; + char data[0]; +} + struct net_device; /* Some generic methods drivers may use in their ethtool_ops */ @@ -261,6 +267,8 @@ int ethtool_op_set_sg(struct net_device *dev, u32 data); u32 ethtool_op_get_tso(struct net_device *dev); int ethtool_op_set_tso(struct net_device *dev, u32 data); +int ethtool_op_get_perm_addr(struct net_device *dev, int len, + struct ethtool_addr *addr); /** * ðtool_ops - Alter and report network device settings --- linux-2.6.12.3/net/core/ethtool.c 2005-07-15 16:18:57.000000000 -0500 +++ linux-2.6.12.3-jw/net/core/ethtool.c 2005-08-01 13:14:49.000000000 -0500 @@ -81,6 +81,16 @@ return 0; } +int ethtool_op_get_perm_addr(struct net_device *dev, int len, struct ethtool_addr *addr) +{ + if ( len < MAX_ADDR_LEN ) + return -ETOOSMALL; + + memcpy(addr->data, dev->perm_addr, MAX_ADDR_LEN); + return 0; +} + + /* Handlers for each ethtool command */ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) @@ -826,6 +836,7 @@ EXPORT_SYMBOL(dev_ethtool); EXPORT_SYMBOL(ethtool_op_get_link); +EXPORT_SYMBOL_GPL(ethtool_op_get_perm_addr); EXPORT_SYMBOL(ethtool_op_get_sg); EXPORT_SYMBOL(ethtool_op_get_tso); EXPORT_SYMBOL(ethtool_op_get_tx_csum); @@ -833,3 +844,4 @@ EXPORT_SYMBOL(ethtool_op_set_tso); EXPORT_SYMBOL(ethtool_op_set_tx_csum); EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum); + - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html