1 From 22896639af98ebc721a94ed71fc3acf2fb4a24dc Mon Sep 17 00:00:00 2001
2 From: Alexander Duyck <alexander.h.duyck@intel.com>
3 Date: Mon, 5 Oct 2009 06:34:25 +0000
4 Subject: igb: change how we handle alternate mac addresses
6 From: Alexander Duyck <alexander.h.duyck@intel.com>
8 commit 22896639af98ebc721a94ed71fc3acf2fb4a24dc upstream.
10 This patch allows us to treat the alternate mac address as though it is the
11 physical address on the adapter. This is accomplished by letting the
12 alt_mac_address function to only fail on an NVM error. If no errors occur
13 and the alternate mac address is not present then RAR0 is read as the
16 Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
17 Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
19 Cc: Brandon Philips <bphilips@suse.de>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
23 drivers/net/igb/e1000_82575.c | 13 +++++++++++--
24 drivers/net/igb/e1000_hw.h | 2 ++
25 drivers/net/igb/e1000_mac.c | 17 +++++++++--------
26 3 files changed, 22 insertions(+), 10 deletions(-)
28 --- a/drivers/net/igb/e1000_82575.c
29 +++ b/drivers/net/igb/e1000_82575.c
30 @@ -1168,9 +1168,18 @@ static s32 igb_read_mac_addr_82575(struc
34 - if (igb_check_alt_mac_addr(hw))
35 - ret_val = igb_read_mac_addr(hw);
37 + * If there's an alternate MAC address place it in RAR0
38 + * so that it will override the Si installed default perm
41 + ret_val = igb_check_alt_mac_addr(hw);
45 + ret_val = igb_read_mac_addr(hw);
51 --- a/drivers/net/igb/e1000_hw.h
52 +++ b/drivers/net/igb/e1000_hw.h
53 @@ -53,6 +53,8 @@ struct e1000_hw;
55 #define E1000_FUNC_1 1
57 +#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3
62 --- a/drivers/net/igb/e1000_mac.c
63 +++ b/drivers/net/igb/e1000_mac.c
64 @@ -185,13 +185,12 @@ s32 igb_check_alt_mac_addr(struct e1000_
67 if (nvm_alt_mac_addr_offset == 0xFFFF) {
68 - ret_val = -(E1000_NOT_IMPLEMENTED);
69 + /* There is no Alternate MAC Address */
73 if (hw->bus.func == E1000_FUNC_1)
74 - nvm_alt_mac_addr_offset += ETH_ALEN/sizeof(u16);
76 + nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN1;
77 for (i = 0; i < ETH_ALEN; i += 2) {
78 offset = nvm_alt_mac_addr_offset + (i >> 1);
79 ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
80 @@ -206,14 +205,16 @@ s32 igb_check_alt_mac_addr(struct e1000_
82 /* if multicast bit is set, the alternate address will not be used */
83 if (alt_mac_addr[0] & 0x01) {
84 - ret_val = -(E1000_NOT_IMPLEMENTED);
85 + hw_dbg("Ignoring Alternate Mac Address with MC bit set\n");
89 - for (i = 0; i < ETH_ALEN; i++)
90 - hw->mac.addr[i] = hw->mac.perm_addr[i] = alt_mac_addr[i];
92 - hw->mac.ops.rar_set(hw, hw->mac.perm_addr, 0);
94 + * We have a valid alternate MAC address, and we want to treat it the
95 + * same as the normal permanent MAC address stored by the HW into the
96 + * RAR. Do this by mapping this address into RAR0.
98 + hw->mac.ops.rar_set(hw, alt_mac_addr, 0);