This patch gives the e1000 driver the ability to retreive the permanent hardware address of its device, via the framework established in part 1 of this patch series. This patch fills in the new perm_addr field on probing, and implements the get_perm_addr ethtool.
This patch has been tested in conjunction with the first. Using a copy of ethtool modified to use the new get_perm_addr function, the correct hardware address was returned. Signed-off-by: Jon Wetzel <[EMAIL PROTECTED]> --- linux-2.6.12.2/drivers/net/e1000/e1000_main.c 2005-06-29 18:00:53.000000000 -0500 +++ linux-2.6.12.2-jw/drivers/net/e1000/e1000_main.c 2005-07-14 15:24:32.000000000 -0500 @@ -622,8 +622,9 @@ if(e1000_read_mac_addr(&adapter->hw)) DPRINTK(PROBE, ERR, "EEPROM Read Error\n"); memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); + memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len); - if(!is_valid_ether_addr(netdev->dev_addr)) { + if(!is_valid_ether_addr(netdev->perm_addr)) { DPRINTK(PROBE, ERR, "Invalid MAC Address\n"); err = -EIO; goto err_eeprom; --- linux-2.6.12.2/drivers/net/e1000/e1000_ethtool.c 2005-06-29 18:00:53.000000000 -0500 +++ linux-2.6.12.2-jw/drivers/net/e1000/e1000_ethtool.c 2005-07-14 15:21:28.000000000 -0500 @@ -1663,6 +1663,13 @@ } } +static int +e1000_get_perm_addr(struct net_device *netdev, struct ethtool_addr *eaddr) +{ + memcpy(eaddr->addr, netdev->perm_addr, ETH_MAX_ADDR_LEN); + return 0; +} + struct ethtool_ops e1000_ethtool_ops = { .get_settings = e1000_get_settings, .set_settings = e1000_set_settings, @@ -1698,6 +1705,7 @@ .phys_id = e1000_phys_id, .get_stats_count = e1000_get_stats_count, .get_ethtool_stats = e1000_get_ethtool_stats, + .get_perm_addr = e1000_get_perm_addr, }; void e1000_set_ethtool_ops(struct net_device *netdev) - 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