aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBruce Allan <bruce.w.allan@intel.com>2012-04-13 23:28:50 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-05-02 04:58:53 -0400
commit69e1e0197ce739d86ca33fd275962d6cbd1b107a (patch)
tree23b34df1c0fbe7d941146489655d26c028b0f31f /drivers
parentcb17aab916b0467faecf241c9b3b396b6da045d9 (diff)
e1000e: fix .ndo_set_rx_mode for 82579
Secondary unicast and multicast addresses are added to the Receive Address registers (RAR) for most parts supported by the driver. For 82579, there is only one actual RAR and a number of Shared Receive Address registers (SHRAR) that are shared among the driver and f/w which can be reserved and write-protected by the f/w. On this device, use the SHRARs that are not taken by f/w for the additional addresses. Add a MAC ops function pointer infrastructure (similar to other MAC operations in the driver) for setting RARs, introduce a new rar_set function for 82579 and convert the existing code that sets RARs on other devices to a generic rar_set function. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/intel/e1000e/80003es2lan.c1
-rw-r--r--drivers/net/ethernet/intel/e1000e/82571.c4
-rw-r--r--drivers/net/ethernet/intel/e1000e/e1000.h2
-rw-r--r--drivers/net/ethernet/intel/e1000e/hw.h5
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.c72
-rw-r--r--drivers/net/ethernet/intel/e1000e/mac.c10
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c12
7 files changed, 92 insertions, 14 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/80003es2lan.c b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
index a212846a6574..66f9877bc4ec 100644
--- a/drivers/net/ethernet/intel/e1000e/80003es2lan.c
+++ b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
@@ -1439,6 +1439,7 @@ static const struct e1000_mac_operations es2_mac_ops = {
1439 /* setup_physical_interface dependent on media type */ 1439 /* setup_physical_interface dependent on media type */
1440 .setup_led = e1000e_setup_led_generic, 1440 .setup_led = e1000e_setup_led_generic,
1441 .config_collision_dist = e1000e_config_collision_dist_generic, 1441 .config_collision_dist = e1000e_config_collision_dist_generic,
1442 .rar_set = e1000e_rar_set_generic,
1442}; 1443};
1443 1444
1444static const struct e1000_phy_operations es2_phy_ops = { 1445static const struct e1000_phy_operations es2_phy_ops = {
diff --git a/drivers/net/ethernet/intel/e1000e/82571.c b/drivers/net/ethernet/intel/e1000e/82571.c
index d0ea316731fc..7b02e87b0b65 100644
--- a/drivers/net/ethernet/intel/e1000e/82571.c
+++ b/drivers/net/ethernet/intel/e1000e/82571.c
@@ -1762,7 +1762,8 @@ void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state)
1762 * incoming packets directed to this port are dropped. 1762 * incoming packets directed to this port are dropped.
1763 * Eventually the LAA will be in RAR[0] and RAR[14]. 1763 * Eventually the LAA will be in RAR[0] and RAR[14].
1764 */ 1764 */
1765 e1000e_rar_set(hw, hw->mac.addr, hw->mac.rar_entry_count - 1); 1765 hw->mac.ops.rar_set(hw, hw->mac.addr,
1766 hw->mac.rar_entry_count - 1);
1766} 1767}
1767 1768
1768/** 1769/**
@@ -1926,6 +1927,7 @@ static const struct e1000_mac_operations e82571_mac_ops = {
1926 .setup_led = e1000e_setup_led_generic, 1927 .setup_led = e1000e_setup_led_generic,
1927 .config_collision_dist = e1000e_config_collision_dist_generic, 1928 .config_collision_dist = e1000e_config_collision_dist_generic,
1928 .read_mac_addr = e1000_read_mac_addr_82571, 1929 .read_mac_addr = e1000_read_mac_addr_82571,
1930 .rar_set = e1000e_rar_set_generic,
1929}; 1931};
1930 1932
1931static const struct e1000_phy_operations e82_phy_ops_igp = { 1933static const struct e1000_phy_operations e82_phy_ops_igp = {
diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
index 1dc2067d3f28..1da9bfacc216 100644
--- a/drivers/net/ethernet/intel/e1000e/e1000.h
+++ b/drivers/net/ethernet/intel/e1000e/e1000.h
@@ -576,7 +576,7 @@ extern void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count);
576extern void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw, 576extern void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw,
577 u8 *mc_addr_list, 577 u8 *mc_addr_list,
578 u32 mc_addr_count); 578 u32 mc_addr_count);
579extern void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index); 579extern void e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index);
580extern s32 e1000e_set_fc_watermarks(struct e1000_hw *hw); 580extern s32 e1000e_set_fc_watermarks(struct e1000_hw *hw);
581extern void e1000e_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop); 581extern void e1000e_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop);
582extern s32 e1000e_get_hw_semaphore(struct e1000_hw *hw); 582extern s32 e1000e_get_hw_semaphore(struct e1000_hw *hw);
diff --git a/drivers/net/ethernet/intel/e1000e/hw.h b/drivers/net/ethernet/intel/e1000e/hw.h
index 3a5acb54cd4e..00a0ebb41b8d 100644
--- a/drivers/net/ethernet/intel/e1000e/hw.h
+++ b/drivers/net/ethernet/intel/e1000e/hw.h
@@ -200,6 +200,10 @@ enum e1e_registers {
200#define E1000_RA (E1000_RAL(0)) 200#define E1000_RA (E1000_RAL(0))
201 E1000_RAH_BASE = 0x05404, /* Receive Address High - RW */ 201 E1000_RAH_BASE = 0x05404, /* Receive Address High - RW */
202#define E1000_RAH(_n) (E1000_RAH_BASE + ((_n) * 8)) 202#define E1000_RAH(_n) (E1000_RAH_BASE + ((_n) * 8))
203 E1000_SHRAL_BASE = 0x05438, /* Shared Receive Address Low - RW */
204#define E1000_SHRAL(_n) (E1000_SHRAL_BASE + ((_n) * 8))
205 E1000_SHRAH_BASE = 0x0543C, /* Shared Receive Address High - RW */
206#define E1000_SHRAH(_n) (E1000_SHRAH_BASE + ((_n) * 8))
203 E1000_VFTA = 0x05600, /* VLAN Filter Table Array - RW Array */ 207 E1000_VFTA = 0x05600, /* VLAN Filter Table Array - RW Array */
204 E1000_WUC = 0x05800, /* Wakeup Control - RW */ 208 E1000_WUC = 0x05800, /* Wakeup Control - RW */
205 E1000_WUFC = 0x05808, /* Wakeup Filter Control - RW */ 209 E1000_WUFC = 0x05808, /* Wakeup Filter Control - RW */
@@ -782,6 +786,7 @@ struct e1000_mac_operations {
782 s32 (*setup_led)(struct e1000_hw *); 786 s32 (*setup_led)(struct e1000_hw *);
783 void (*write_vfta)(struct e1000_hw *, u32, u32); 787 void (*write_vfta)(struct e1000_hw *, u32, u32);
784 void (*config_collision_dist)(struct e1000_hw *); 788 void (*config_collision_dist)(struct e1000_hw *);
789 void (*rar_set)(struct e1000_hw *, u8 *, u32);
785 s32 (*read_mac_addr)(struct e1000_hw *); 790 s32 (*read_mac_addr)(struct e1000_hw *);
786}; 791};
787 792
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index 4c8b0fb6534f..ca34ebfeb83e 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -115,6 +115,7 @@
115#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL 115#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
116 116
117#define E1000_ICH_RAR_ENTRIES 7 117#define E1000_ICH_RAR_ENTRIES 7
118#define E1000_PCH2_RAR_ENTRIES 5 /* RAR[0], SHRA[0-3] */
118 119
119#define PHY_PAGE_SHIFT 5 120#define PHY_PAGE_SHIFT 5
120#define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \ 121#define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \
@@ -259,6 +260,7 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link);
259static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw); 260static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw);
260static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw); 261static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw);
261static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw); 262static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw);
263static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index);
262static s32 e1000_k1_workaround_lv(struct e1000_hw *hw); 264static s32 e1000_k1_workaround_lv(struct e1000_hw *hw);
263static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate); 265static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate);
264 266
@@ -672,8 +674,11 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw)
672 mac->ops.led_on = e1000_led_on_ich8lan; 674 mac->ops.led_on = e1000_led_on_ich8lan;
673 mac->ops.led_off = e1000_led_off_ich8lan; 675 mac->ops.led_off = e1000_led_off_ich8lan;
674 break; 676 break;
675 case e1000_pchlan:
676 case e1000_pch2lan: 677 case e1000_pch2lan:
678 mac->rar_entry_count = E1000_PCH2_RAR_ENTRIES;
679 mac->ops.rar_set = e1000_rar_set_pch2lan;
680 /* fall-through */
681 case e1000_pchlan:
677 /* check management mode */ 682 /* check management mode */
678 mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan; 683 mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan;
679 /* ID LED init */ 684 /* ID LED init */
@@ -1048,6 +1053,70 @@ static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw)
1048} 1053}
1049 1054
1050/** 1055/**
1056 * e1000_rar_set_pch2lan - Set receive address register
1057 * @hw: pointer to the HW structure
1058 * @addr: pointer to the receive address
1059 * @index: receive address array register
1060 *
1061 * Sets the receive address array register at index to the address passed
1062 * in by addr. For 82579, RAR[0] is the base address register that is to
1063 * contain the MAC address but RAR[1-6] are reserved for manageability (ME).
1064 * Use SHRA[0-3] in place of those reserved for ME.
1065 **/
1066static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
1067{
1068 u32 rar_low, rar_high;
1069
1070 /*
1071 * HW expects these in little endian so we reverse the byte order
1072 * from network order (big endian) to little endian
1073 */
1074 rar_low = ((u32)addr[0] |
1075 ((u32)addr[1] << 8) |
1076 ((u32)addr[2] << 16) | ((u32)addr[3] << 24));
1077
1078 rar_high = ((u32)addr[4] | ((u32)addr[5] << 8));
1079
1080 /* If MAC address zero, no need to set the AV bit */
1081 if (rar_low || rar_high)
1082 rar_high |= E1000_RAH_AV;
1083
1084 if (index == 0) {
1085 ew32(RAL(index), rar_low);
1086 e1e_flush();
1087 ew32(RAH(index), rar_high);
1088 e1e_flush();
1089 return;
1090 }
1091
1092 if (index < hw->mac.rar_entry_count) {
1093 s32 ret_val;
1094
1095 ret_val = e1000_acquire_swflag_ich8lan(hw);
1096 if (ret_val)
1097 goto out;
1098
1099 ew32(SHRAL(index - 1), rar_low);
1100 e1e_flush();
1101 ew32(SHRAH(index - 1), rar_high);
1102 e1e_flush();
1103
1104 e1000_release_swflag_ich8lan(hw);
1105
1106 /* verify the register updates */
1107 if ((er32(SHRAL(index - 1)) == rar_low) &&
1108 (er32(SHRAH(index - 1)) == rar_high))
1109 return;
1110
1111 e_dbg("SHRA[%d] might be locked by ME - FWSM=0x%8.8x\n",
1112 (index - 1), er32(FWSM));
1113 }
1114
1115out:
1116 e_dbg("Failed to write receive address at index %d\n", index);
1117}
1118
1119/**
1051 * e1000_check_reset_block_ich8lan - Check if PHY reset is blocked 1120 * e1000_check_reset_block_ich8lan - Check if PHY reset is blocked
1052 * @hw: pointer to the HW structure 1121 * @hw: pointer to the HW structure
1053 * 1122 *
@@ -4100,6 +4169,7 @@ static const struct e1000_mac_operations ich8_mac_ops = {
4100 .setup_physical_interface= e1000_setup_copper_link_ich8lan, 4169 .setup_physical_interface= e1000_setup_copper_link_ich8lan,
4101 /* id_led_init dependent on mac type */ 4170 /* id_led_init dependent on mac type */
4102 .config_collision_dist = e1000e_config_collision_dist_generic, 4171 .config_collision_dist = e1000e_config_collision_dist_generic,
4172 .rar_set = e1000e_rar_set_generic,
4103}; 4173};
4104 4174
4105static const struct e1000_phy_operations ich8_phy_ops = { 4175static const struct e1000_phy_operations ich8_phy_ops = {
diff --git a/drivers/net/ethernet/intel/e1000e/mac.c b/drivers/net/ethernet/intel/e1000e/mac.c
index d8327499305f..026e8b3ab52e 100644
--- a/drivers/net/ethernet/intel/e1000e/mac.c
+++ b/drivers/net/ethernet/intel/e1000e/mac.c
@@ -143,12 +143,12 @@ void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
143 /* Setup the receive address */ 143 /* Setup the receive address */
144 e_dbg("Programming MAC Address into RAR[0]\n"); 144 e_dbg("Programming MAC Address into RAR[0]\n");
145 145
146 e1000e_rar_set(hw, hw->mac.addr, 0); 146 hw->mac.ops.rar_set(hw, hw->mac.addr, 0);
147 147
148 /* Zero out the other (rar_entry_count - 1) receive addresses */ 148 /* Zero out the other (rar_entry_count - 1) receive addresses */
149 e_dbg("Clearing RAR[1-%u]\n", rar_count - 1); 149 e_dbg("Clearing RAR[1-%u]\n", rar_count - 1);
150 for (i = 1; i < rar_count; i++) 150 for (i = 1; i < rar_count; i++)
151 e1000e_rar_set(hw, mac_addr, i); 151 hw->mac.ops.rar_set(hw, mac_addr, i);
152} 152}
153 153
154/** 154/**
@@ -215,13 +215,13 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
215 * same as the normal permanent MAC address stored by the HW into the 215 * same as the normal permanent MAC address stored by the HW into the
216 * RAR. Do this by mapping this address into RAR0. 216 * RAR. Do this by mapping this address into RAR0.
217 */ 217 */
218 e1000e_rar_set(hw, alt_mac_addr, 0); 218 hw->mac.ops.rar_set(hw, alt_mac_addr, 0);
219 219
220 return 0; 220 return 0;
221} 221}
222 222
223/** 223/**
224 * e1000e_rar_set - Set receive address register 224 * e1000e_rar_set_generic - Set receive address register
225 * @hw: pointer to the HW structure 225 * @hw: pointer to the HW structure
226 * @addr: pointer to the receive address 226 * @addr: pointer to the receive address
227 * @index: receive address array register 227 * @index: receive address array register
@@ -229,7 +229,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
229 * Sets the receive address array register at index to the address passed 229 * Sets the receive address array register at index to the address passed
230 * in by addr. 230 * in by addr.
231 **/ 231 **/
232void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) 232void e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
233{ 233{
234 u32 rar_low, rar_high; 234 u32 rar_low, rar_high;
235 235
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 140fee14b313..c0e211b500cf 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -3209,7 +3209,7 @@ static int e1000e_write_uc_addr_list(struct net_device *netdev)
3209 netdev_for_each_uc_addr(ha, netdev) { 3209 netdev_for_each_uc_addr(ha, netdev) {
3210 if (!rar_entries) 3210 if (!rar_entries)
3211 break; 3211 break;
3212 e1000e_rar_set(hw, ha->addr, rar_entries--); 3212 hw->mac.ops.rar_set(hw, ha->addr, rar_entries--);
3213 count++; 3213 count++;
3214 } 3214 }
3215 } 3215 }
@@ -4018,6 +4018,7 @@ static int e1000_close(struct net_device *netdev)
4018static int e1000_set_mac(struct net_device *netdev, void *p) 4018static int e1000_set_mac(struct net_device *netdev, void *p)
4019{ 4019{
4020 struct e1000_adapter *adapter = netdev_priv(netdev); 4020 struct e1000_adapter *adapter = netdev_priv(netdev);
4021 struct e1000_hw *hw = &adapter->hw;
4021 struct sockaddr *addr = p; 4022 struct sockaddr *addr = p;
4022 4023
4023 if (!is_valid_ether_addr(addr->sa_data)) 4024 if (!is_valid_ether_addr(addr->sa_data))
@@ -4026,7 +4027,7 @@ static int e1000_set_mac(struct net_device *netdev, void *p)
4026 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); 4027 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
4027 memcpy(adapter->hw.mac.addr, addr->sa_data, netdev->addr_len); 4028 memcpy(adapter->hw.mac.addr, addr->sa_data, netdev->addr_len);
4028 4029
4029 e1000e_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); 4030 hw->mac.ops.rar_set(&adapter->hw, adapter->hw.mac.addr, 0);
4030 4031
4031 if (adapter->flags & FLAG_RESET_OVERWRITES_LAA) { 4032 if (adapter->flags & FLAG_RESET_OVERWRITES_LAA) {
4032 /* activate the work around */ 4033 /* activate the work around */
@@ -4040,9 +4041,8 @@ static int e1000_set_mac(struct net_device *netdev, void *p)
4040 * are dropped. Eventually the LAA will be in RAR[0] and 4041 * are dropped. Eventually the LAA will be in RAR[0] and
4041 * RAR[14] 4042 * RAR[14]
4042 */ 4043 */
4043 e1000e_rar_set(&adapter->hw, 4044 hw->mac.ops.rar_set(&adapter->hw, adapter->hw.mac.addr,
4044 adapter->hw.mac.addr, 4045 adapter->hw.mac.rar_entry_count - 1);
4045 adapter->hw.mac.rar_entry_count - 1);
4046 } 4046 }
4047 4047
4048 return 0; 4048 return 0;
@@ -4621,7 +4621,7 @@ link_up:
4621 * reset from the other port. Set the appropriate LAA in RAR[0] 4621 * reset from the other port. Set the appropriate LAA in RAR[0]
4622 */ 4622 */
4623 if (e1000e_get_laa_state_82571(hw)) 4623 if (e1000e_get_laa_state_82571(hw))
4624 e1000e_rar_set(hw, adapter->hw.mac.addr, 0); 4624 hw->mac.ops.rar_set(hw, adapter->hw.mac.addr, 0);
4625 4625
4626 if (adapter->flags2 & FLAG2_CHECK_PHY_HANG) 4626 if (adapter->flags2 & FLAG2_CHECK_PHY_HANG)
4627 e1000e_check_82574_phy_workaround(adapter); 4627 e1000e_check_82574_phy_workaround(adapter);