diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2009-10-05 02:34:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-06 17:59:21 -0400 |
commit | 22896639af98ebc721a94ed71fc3acf2fb4a24dc (patch) | |
tree | dd411a3246a6a01e467873dafd4417f756b961c9 /drivers/net/igb | |
parent | 3272686c98da64d6eeaa2434782f42270b110758 (diff) |
igb: change how we handle alternate mac addresses
This patch allows us to treat the alternate mac address as though it is the
physical address on the adapter. This is accomplished by letting the
alt_mac_address function to only fail on an NVM error. If no errors occur
and the alternate mac address is not present then RAR0 is read as the
default mac address.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/igb')
-rw-r--r-- | drivers/net/igb/e1000_82575.c | 13 | ||||
-rw-r--r-- | drivers/net/igb/e1000_hw.h | 2 | ||||
-rw-r--r-- | drivers/net/igb/e1000_mac.c | 17 |
3 files changed, 22 insertions, 10 deletions
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c index e07f66c6a1cf..45063c25155a 100644 --- a/drivers/net/igb/e1000_82575.c +++ b/drivers/net/igb/e1000_82575.c | |||
@@ -1152,9 +1152,18 @@ static s32 igb_read_mac_addr_82575(struct e1000_hw *hw) | |||
1152 | { | 1152 | { |
1153 | s32 ret_val = 0; | 1153 | s32 ret_val = 0; |
1154 | 1154 | ||
1155 | if (igb_check_alt_mac_addr(hw)) | 1155 | /* |
1156 | ret_val = igb_read_mac_addr(hw); | 1156 | * If there's an alternate MAC address place it in RAR0 |
1157 | * so that it will override the Si installed default perm | ||
1158 | * address. | ||
1159 | */ | ||
1160 | ret_val = igb_check_alt_mac_addr(hw); | ||
1161 | if (ret_val) | ||
1162 | goto out; | ||
1163 | |||
1164 | ret_val = igb_read_mac_addr(hw); | ||
1157 | 1165 | ||
1166 | out: | ||
1158 | return ret_val; | 1167 | return ret_val; |
1159 | } | 1168 | } |
1160 | 1169 | ||
diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h index 4e7850d06147..fad7cf510cca 100644 --- a/drivers/net/igb/e1000_hw.h +++ b/drivers/net/igb/e1000_hw.h | |||
@@ -54,6 +54,8 @@ struct e1000_hw; | |||
54 | #define E1000_FUNC_0 0 | 54 | #define E1000_FUNC_0 0 |
55 | #define E1000_FUNC_1 1 | 55 | #define E1000_FUNC_1 1 |
56 | 56 | ||
57 | #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3 | ||
58 | |||
57 | enum e1000_mac_type { | 59 | enum e1000_mac_type { |
58 | e1000_undefined = 0, | 60 | e1000_undefined = 0, |
59 | e1000_82575, | 61 | e1000_82575, |
diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c index 986aa902f7ed..4969a5b1cf3c 100644 --- a/drivers/net/igb/e1000_mac.c +++ b/drivers/net/igb/e1000_mac.c | |||
@@ -185,13 +185,12 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw) | |||
185 | } | 185 | } |
186 | 186 | ||
187 | if (nvm_alt_mac_addr_offset == 0xFFFF) { | 187 | if (nvm_alt_mac_addr_offset == 0xFFFF) { |
188 | ret_val = -(E1000_NOT_IMPLEMENTED); | 188 | /* There is no Alternate MAC Address */ |
189 | goto out; | 189 | goto out; |
190 | } | 190 | } |
191 | 191 | ||
192 | if (hw->bus.func == E1000_FUNC_1) | 192 | if (hw->bus.func == E1000_FUNC_1) |
193 | nvm_alt_mac_addr_offset += ETH_ALEN/sizeof(u16); | 193 | nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN1; |
194 | |||
195 | for (i = 0; i < ETH_ALEN; i += 2) { | 194 | for (i = 0; i < ETH_ALEN; i += 2) { |
196 | offset = nvm_alt_mac_addr_offset + (i >> 1); | 195 | offset = nvm_alt_mac_addr_offset + (i >> 1); |
197 | ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); | 196 | ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); |
@@ -206,14 +205,16 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw) | |||
206 | 205 | ||
207 | /* if multicast bit is set, the alternate address will not be used */ | 206 | /* if multicast bit is set, the alternate address will not be used */ |
208 | if (alt_mac_addr[0] & 0x01) { | 207 | if (alt_mac_addr[0] & 0x01) { |
209 | ret_val = -(E1000_NOT_IMPLEMENTED); | 208 | hw_dbg("Ignoring Alternate Mac Address with MC bit set\n"); |
210 | goto out; | 209 | goto out; |
211 | } | 210 | } |
212 | 211 | ||
213 | for (i = 0; i < ETH_ALEN; i++) | 212 | /* |
214 | hw->mac.addr[i] = hw->mac.perm_addr[i] = alt_mac_addr[i]; | 213 | * We have a valid alternate MAC address, and we want to treat it the |
215 | 214 | * same as the normal permanent MAC address stored by the HW into the | |
216 | hw->mac.ops.rar_set(hw, hw->mac.perm_addr, 0); | 215 | * RAR. Do this by mapping this address into RAR0. |
216 | */ | ||
217 | hw->mac.ops.rar_set(hw, alt_mac_addr, 0); | ||
217 | 218 | ||
218 | out: | 219 | out: |
219 | return ret_val; | 220 | return ret_val; |