]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.17/igb-change-how-we-handle-alternate-mac-addresses.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.17 / igb-change-how-we-handle-alternate-mac-addresses.patch
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
5
6 From: Alexander Duyck <alexander.h.duyck@intel.com>
7
8 commit 22896639af98ebc721a94ed71fc3acf2fb4a24dc upstream.
9
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
14 default mac address.
15
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>
21
22 ---
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(-)
27
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
31 {
32 s32 ret_val = 0;
33
34 - if (igb_check_alt_mac_addr(hw))
35 - ret_val = igb_read_mac_addr(hw);
36 + /*
37 + * If there's an alternate MAC address place it in RAR0
38 + * so that it will override the Si installed default perm
39 + * address.
40 + */
41 + ret_val = igb_check_alt_mac_addr(hw);
42 + if (ret_val)
43 + goto out;
44
45 + ret_val = igb_read_mac_addr(hw);
46 +
47 +out:
48 return ret_val;
49 }
50
51 --- a/drivers/net/igb/e1000_hw.h
52 +++ b/drivers/net/igb/e1000_hw.h
53 @@ -53,6 +53,8 @@ struct e1000_hw;
54
55 #define E1000_FUNC_1 1
56
57 +#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3
58 +
59 enum e1000_mac_type {
60 e1000_undefined = 0,
61 e1000_82575,
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_
65 }
66
67 if (nvm_alt_mac_addr_offset == 0xFFFF) {
68 - ret_val = -(E1000_NOT_IMPLEMENTED);
69 + /* There is no Alternate MAC Address */
70 goto out;
71 }
72
73 if (hw->bus.func == E1000_FUNC_1)
74 - nvm_alt_mac_addr_offset += ETH_ALEN/sizeof(u16);
75 -
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_
81
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");
86 goto out;
87 }
88
89 - for (i = 0; i < ETH_ALEN; i++)
90 - hw->mac.addr[i] = hw->mac.perm_addr[i] = alt_mac_addr[i];
91 -
92 - hw->mac.ops.rar_set(hw, hw->mac.perm_addr, 0);
93 + /*
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.
97 + */
98 + hw->mac.ops.rar_set(hw, alt_mac_addr, 0);
99
100 out:
101 return ret_val;