Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170437
b: refs/heads/master
c: 2289663
h: refs/heads/master
i:
  170435: f027253
v: v3
  • Loading branch information
Alexander Duyck authored and David S. Miller committed Oct 6, 2009
1 parent 030669d commit 451ab80
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3272686c98da64d6eeaa2434782f42270b110758
refs/heads/master: 22896639af98ebc721a94ed71fc3acf2fb4a24dc
13 changes: 11 additions & 2 deletions trunk/drivers/net/igb/e1000_82575.c
Original file line number Diff line number Diff line change
Expand Up @@ -1152,9 +1152,18 @@ static s32 igb_read_mac_addr_82575(struct e1000_hw *hw)
{
s32 ret_val = 0;

if (igb_check_alt_mac_addr(hw))
ret_val = igb_read_mac_addr(hw);
/*
* If there's an alternate MAC address place it in RAR0
* so that it will override the Si installed default perm
* address.
*/
ret_val = igb_check_alt_mac_addr(hw);
if (ret_val)
goto out;

ret_val = igb_read_mac_addr(hw);

out:
return ret_val;
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/net/igb/e1000_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ struct e1000_hw;
#define E1000_FUNC_0 0
#define E1000_FUNC_1 1

#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3

enum e1000_mac_type {
e1000_undefined = 0,
e1000_82575,
Expand Down
17 changes: 9 additions & 8 deletions trunk/drivers/net/igb/e1000_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,12 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)
}

if (nvm_alt_mac_addr_offset == 0xFFFF) {
ret_val = -(E1000_NOT_IMPLEMENTED);
/* There is no Alternate MAC Address */
goto out;
}

if (hw->bus.func == E1000_FUNC_1)
nvm_alt_mac_addr_offset += ETH_ALEN/sizeof(u16);

nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN1;
for (i = 0; i < ETH_ALEN; i += 2) {
offset = nvm_alt_mac_addr_offset + (i >> 1);
ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
Expand All @@ -206,14 +205,16 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)

/* if multicast bit is set, the alternate address will not be used */
if (alt_mac_addr[0] & 0x01) {
ret_val = -(E1000_NOT_IMPLEMENTED);
hw_dbg("Ignoring Alternate Mac Address with MC bit set\n");
goto out;
}

for (i = 0; i < ETH_ALEN; i++)
hw->mac.addr[i] = hw->mac.perm_addr[i] = alt_mac_addr[i];

hw->mac.ops.rar_set(hw, hw->mac.perm_addr, 0);
/*
* We have a valid alternate MAC address, and we want to treat it the
* same as the normal permanent MAC address stored by the HW into the
* RAR. Do this by mapping this address into RAR0.
*/
hw->mac.ops.rar_set(hw, alt_mac_addr, 0);

out:
return ret_val;
Expand Down

0 comments on commit 451ab80

Please sign in to comment.