diff options
author | Danny Kukawka <danny.kukawka@bisect.de> | 2012-02-09 04:48:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-02-13 00:46:41 -0500 |
commit | 1a0d6ae5795c376bae6d012fb25e8341e4c6d5f2 (patch) | |
tree | 476d4b0b06ed78ec57f73f8dde182afc083b2b43 /drivers/net/ethernet/intel | |
parent | c8585bd89e2e3c87eab6ca711e09b3af20fd469b (diff) |
rename dev_hw_addr_random and remove redundant second
Renamed dev_hw_addr_random to eth_hw_addr_random() to reflect that
this function only assign a random ethernet address (MAC). Removed
the second parameter (u8 *hwaddr), it's redundant since the also
given net_device already contains net_device->dev_addr.
Set it directly.
Adapt igbvf and ixgbevf to the changed function.
Small fix for ixgbevf_probe(): if ixgbevf_sw_init() fails
(which means the device got no dev_addr) handle the error and
jump to err_sw_init as already done by igbvf in similar case.
Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r-- | drivers/net/ethernet/intel/igbvf/netdev.c | 11 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 28 |
2 files changed, 24 insertions, 15 deletions
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index 446297ff0104..92956e80fd1b 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c | |||
@@ -2712,18 +2712,19 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, | |||
2712 | dev_info(&pdev->dev, | 2712 | dev_info(&pdev->dev, |
2713 | "PF still in reset state, assigning new address." | 2713 | "PF still in reset state, assigning new address." |
2714 | " Is the PF interface up?\n"); | 2714 | " Is the PF interface up?\n"); |
2715 | dev_hw_addr_random(adapter->netdev, hw->mac.addr); | 2715 | eth_hw_addr_random(netdev); |
2716 | memcpy(adapter->hw.mac.addr, netdev->dev_addr, | ||
2717 | netdev->addr_len); | ||
2716 | } else { | 2718 | } else { |
2717 | err = hw->mac.ops.read_mac_addr(hw); | 2719 | err = hw->mac.ops.read_mac_addr(hw); |
2718 | if (err) { | 2720 | if (err) { |
2719 | dev_err(&pdev->dev, "Error reading MAC address\n"); | 2721 | dev_err(&pdev->dev, "Error reading MAC address\n"); |
2720 | goto err_hw_init; | 2722 | goto err_hw_init; |
2721 | } | 2723 | } |
2724 | memcpy(netdev->dev_addr, adapter->hw.mac.addr, | ||
2725 | netdev->addr_len); | ||
2722 | } | 2726 | } |
2723 | 2727 | ||
2724 | memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len); | ||
2725 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); | ||
2726 | |||
2727 | if (!is_valid_ether_addr(netdev->perm_addr)) { | 2728 | if (!is_valid_ether_addr(netdev->perm_addr)) { |
2728 | dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", | 2729 | dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", |
2729 | netdev->dev_addr); | 2730 | netdev->dev_addr); |
@@ -2731,6 +2732,8 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, | |||
2731 | goto err_hw_init; | 2732 | goto err_hw_init; |
2732 | } | 2733 | } |
2733 | 2734 | ||
2735 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); | ||
2736 | |||
2734 | setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, | 2737 | setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, |
2735 | (unsigned long) adapter); | 2738 | (unsigned long) adapter); |
2736 | 2739 | ||
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 58c04b69ce70..e10221dcebb1 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -2199,13 +2199,17 @@ static int __devinit ixgbevf_sw_init(struct ixgbevf_adapter *adapter) | |||
2199 | if (err) { | 2199 | if (err) { |
2200 | dev_info(&pdev->dev, | 2200 | dev_info(&pdev->dev, |
2201 | "PF still in reset state, assigning new address\n"); | 2201 | "PF still in reset state, assigning new address\n"); |
2202 | dev_hw_addr_random(adapter->netdev, hw->mac.addr); | 2202 | eth_hw_addr_random(adapter->netdev); |
2203 | memcpy(adapter->hw.mac.addr, adapter->netdev->dev_addr, | ||
2204 | adapter->netdev->addr_len); | ||
2203 | } else { | 2205 | } else { |
2204 | err = hw->mac.ops.init_hw(hw); | 2206 | err = hw->mac.ops.init_hw(hw); |
2205 | if (err) { | 2207 | if (err) { |
2206 | pr_err("init_shared_code failed: %d\n", err); | 2208 | pr_err("init_shared_code failed: %d\n", err); |
2207 | goto out; | 2209 | goto out; |
2208 | } | 2210 | } |
2211 | memcpy(adapter->netdev->dev_addr, adapter->hw.mac.addr, | ||
2212 | adapter->netdev->addr_len); | ||
2209 | } | 2213 | } |
2210 | 2214 | ||
2211 | /* Enable dynamic interrupt throttling rates */ | 2215 | /* Enable dynamic interrupt throttling rates */ |
@@ -2224,6 +2228,7 @@ static int __devinit ixgbevf_sw_init(struct ixgbevf_adapter *adapter) | |||
2224 | adapter->flags |= IXGBE_FLAG_RX_CSUM_ENABLED; | 2228 | adapter->flags |= IXGBE_FLAG_RX_CSUM_ENABLED; |
2225 | 2229 | ||
2226 | set_bit(__IXGBEVF_DOWN, &adapter->state); | 2230 | set_bit(__IXGBEVF_DOWN, &adapter->state); |
2231 | return 0; | ||
2227 | 2232 | ||
2228 | out: | 2233 | out: |
2229 | return err; | 2234 | return err; |
@@ -3394,6 +3399,17 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev, | |||
3394 | 3399 | ||
3395 | /* setup the private structure */ | 3400 | /* setup the private structure */ |
3396 | err = ixgbevf_sw_init(adapter); | 3401 | err = ixgbevf_sw_init(adapter); |
3402 | if (err) | ||
3403 | goto err_sw_init; | ||
3404 | |||
3405 | /* The HW MAC address was set and/or determined in sw_init */ | ||
3406 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); | ||
3407 | |||
3408 | if (!is_valid_ether_addr(netdev->dev_addr)) { | ||
3409 | pr_err("invalid MAC address\n"); | ||
3410 | err = -EIO; | ||
3411 | goto err_sw_init; | ||
3412 | } | ||
3397 | 3413 | ||
3398 | netdev->hw_features = NETIF_F_SG | | 3414 | netdev->hw_features = NETIF_F_SG | |
3399 | NETIF_F_IP_CSUM | | 3415 | NETIF_F_IP_CSUM | |
@@ -3418,16 +3434,6 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev, | |||
3418 | 3434 | ||
3419 | netdev->priv_flags |= IFF_UNICAST_FLT; | 3435 | netdev->priv_flags |= IFF_UNICAST_FLT; |
3420 | 3436 | ||
3421 | /* The HW MAC address was set and/or determined in sw_init */ | ||
3422 | memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len); | ||
3423 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); | ||
3424 | |||
3425 | if (!is_valid_ether_addr(netdev->dev_addr)) { | ||
3426 | pr_err("invalid MAC address\n"); | ||
3427 | err = -EIO; | ||
3428 | goto err_sw_init; | ||
3429 | } | ||
3430 | |||
3431 | init_timer(&adapter->watchdog_timer); | 3437 | init_timer(&adapter->watchdog_timer); |
3432 | adapter->watchdog_timer.function = ixgbevf_watchdog; | 3438 | adapter->watchdog_timer.function = ixgbevf_watchdog; |
3433 | adapter->watchdog_timer.data = (unsigned long)adapter; | 3439 | adapter->watchdog_timer.data = (unsigned long)adapter; |