aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-06-28 20:20:02 -0400
committerDavid S. Miller <davem@davemloft.net>2015-06-28 20:20:02 -0400
commitebc032391c814a12cb13813b741a00bfb8617b75 (patch)
tree919fcd68e26b098639bc73fe69d48204906c0fe8
parentda1da284d7b271c77007e6dd6fa1fff54eaa7492 (diff)
parent40746eb14c6b44f4d635c2f4cf8c67550db9b3ab (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue
Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates 2015-06-26 This series contains fixes for igb, e1000e and i40evf. Todd disables IPv6 extension header processing due to a hardware errata and bumps the driver version. Yanir provides six fixes for e1000e. First is a fix for a locking issue where we were not always taking the pci_bus_sem semaphore all the time when calling pci_disable_link_state_locked(), so fix the code to only call pci_disable_link_state_locked() when the semaphore has been acquired, otherwise call pci_disable_link_state(). A previous fix for i219 where the hardware prevented ULP entry caused EEE in Sx not the be enabled, so modify the code flow that allows both ULP and EEE in Sx. Fix an issue when running 10/100 full duplex on i219 where CRC errors were occurring by increasing the IPG from 8 to 0xC as per the hardware developers. Fix a data corruption issue found on some platforms by increasing the minimum gap between the PHY FIFO read and write pointers. Fix i219, which does not require the K1 workaround for LPT devices. Mitch provides a i40evf fix for a panic when changing MTU. Down was requesting queue disables, but then exited immediately without waiting for the queues to actually be disabled. This could allow any function called after i40evf_down() to run immediately, including i40evf_up(), and causes a memory leak. Fixed the issue by removing the whole reinit_locked function which allows for the driver to handle the state changes by requesting reset from the periodic timer. The second fix resolves an issue where RSS was being configured as though it is using the maximum number of queue. This can cause the device to drop a lot of receive traffic, as the packets get assigned to non-functional queues. This is resolved by only configuring RSS with the number of active queues. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.c126
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c38
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_txrx.c4
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf.h1
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c6
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_main.c110
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_82575.c12
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_defines.h3
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c2
9 files changed, 198 insertions, 104 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index b074b9a667b3..91a5a0ae9cd7 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -237,17 +237,19 @@ static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw)
237 if (ret_val) 237 if (ret_val)
238 return false; 238 return false;
239out: 239out:
240 if ((hw->mac.type == e1000_pch_lpt) || 240 if ((hw->mac.type == e1000_pch_lpt) || (hw->mac.type == e1000_pch_spt)) {
241 (hw->mac.type == e1000_pch_spt)) { 241 /* Only unforce SMBus if ME is not active */
242 /* Unforce SMBus mode in PHY */ 242 if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
243 e1e_rphy_locked(hw, CV_SMB_CTRL, &phy_reg); 243 /* Unforce SMBus mode in PHY */
244 phy_reg &= ~CV_SMB_CTRL_FORCE_SMBUS; 244 e1e_rphy_locked(hw, CV_SMB_CTRL, &phy_reg);
245 e1e_wphy_locked(hw, CV_SMB_CTRL, phy_reg); 245 phy_reg &= ~CV_SMB_CTRL_FORCE_SMBUS;
246 e1e_wphy_locked(hw, CV_SMB_CTRL, phy_reg);
246 247
247 /* Unforce SMBus mode in MAC */ 248 /* Unforce SMBus mode in MAC */
248 mac_reg = er32(CTRL_EXT); 249 mac_reg = er32(CTRL_EXT);
249 mac_reg &= ~E1000_CTRL_EXT_FORCE_SMBUS; 250 mac_reg &= ~E1000_CTRL_EXT_FORCE_SMBUS;
250 ew32(CTRL_EXT, mac_reg); 251 ew32(CTRL_EXT, mac_reg);
252 }
251 } 253 }
252 254
253 return true; 255 return true;
@@ -1087,6 +1089,7 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx)
1087 u32 mac_reg; 1089 u32 mac_reg;
1088 s32 ret_val = 0; 1090 s32 ret_val = 0;
1089 u16 phy_reg; 1091 u16 phy_reg;
1092 u16 oem_reg = 0;
1090 1093
1091 if ((hw->mac.type < e1000_pch_lpt) || 1094 if ((hw->mac.type < e1000_pch_lpt) ||
1092 (hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPT_I217_LM) || 1095 (hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPT_I217_LM) ||
@@ -1128,33 +1131,37 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx)
1128 if (ret_val) 1131 if (ret_val)
1129 goto out; 1132 goto out;
1130 1133
1134 /* Force SMBus mode in PHY */
1135 ret_val = e1000_read_phy_reg_hv_locked(hw, CV_SMB_CTRL, &phy_reg);
1136 if (ret_val)
1137 goto release;
1138 phy_reg |= CV_SMB_CTRL_FORCE_SMBUS;
1139 e1000_write_phy_reg_hv_locked(hw, CV_SMB_CTRL, phy_reg);
1140
1141 /* Force SMBus mode in MAC */
1142 mac_reg = er32(CTRL_EXT);
1143 mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS;
1144 ew32(CTRL_EXT, mac_reg);
1145
1131 /* Si workaround for ULP entry flow on i127/rev6 h/w. Enable 1146 /* Si workaround for ULP entry flow on i127/rev6 h/w. Enable
1132 * LPLU and disable Gig speed when entering ULP 1147 * LPLU and disable Gig speed when entering ULP
1133 */ 1148 */
1134 if ((hw->phy.type == e1000_phy_i217) && (hw->phy.revision == 6)) { 1149 if ((hw->phy.type == e1000_phy_i217) && (hw->phy.revision == 6)) {
1135 ret_val = e1000_read_phy_reg_hv_locked(hw, HV_OEM_BITS, 1150 ret_val = e1000_read_phy_reg_hv_locked(hw, HV_OEM_BITS,
1136 &phy_reg); 1151 &oem_reg);
1137 if (ret_val) 1152 if (ret_val)
1138 goto release; 1153 goto release;
1154
1155 phy_reg = oem_reg;
1139 phy_reg |= HV_OEM_BITS_LPLU | HV_OEM_BITS_GBE_DIS; 1156 phy_reg |= HV_OEM_BITS_LPLU | HV_OEM_BITS_GBE_DIS;
1157
1140 ret_val = e1000_write_phy_reg_hv_locked(hw, HV_OEM_BITS, 1158 ret_val = e1000_write_phy_reg_hv_locked(hw, HV_OEM_BITS,
1141 phy_reg); 1159 phy_reg);
1160
1142 if (ret_val) 1161 if (ret_val)
1143 goto release; 1162 goto release;
1144 } 1163 }
1145 1164
1146 /* Force SMBus mode in PHY */
1147 ret_val = e1000_read_phy_reg_hv_locked(hw, CV_SMB_CTRL, &phy_reg);
1148 if (ret_val)
1149 goto release;
1150 phy_reg |= CV_SMB_CTRL_FORCE_SMBUS;
1151 e1000_write_phy_reg_hv_locked(hw, CV_SMB_CTRL, phy_reg);
1152
1153 /* Force SMBus mode in MAC */
1154 mac_reg = er32(CTRL_EXT);
1155 mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS;
1156 ew32(CTRL_EXT, mac_reg);
1157
1158 /* Set Inband ULP Exit, Reset to SMBus mode and 1165 /* Set Inband ULP Exit, Reset to SMBus mode and
1159 * Disable SMBus Release on PERST# in PHY 1166 * Disable SMBus Release on PERST# in PHY
1160 */ 1167 */
@@ -1166,10 +1173,15 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx)
1166 if (to_sx) { 1173 if (to_sx) {
1167 if (er32(WUFC) & E1000_WUFC_LNKC) 1174 if (er32(WUFC) & E1000_WUFC_LNKC)
1168 phy_reg |= I218_ULP_CONFIG1_WOL_HOST; 1175 phy_reg |= I218_ULP_CONFIG1_WOL_HOST;
1176 else
1177 phy_reg &= ~I218_ULP_CONFIG1_WOL_HOST;
1169 1178
1170 phy_reg |= I218_ULP_CONFIG1_STICKY_ULP; 1179 phy_reg |= I218_ULP_CONFIG1_STICKY_ULP;
1180 phy_reg &= ~I218_ULP_CONFIG1_INBAND_EXIT;
1171 } else { 1181 } else {
1172 phy_reg |= I218_ULP_CONFIG1_INBAND_EXIT; 1182 phy_reg |= I218_ULP_CONFIG1_INBAND_EXIT;
1183 phy_reg &= ~I218_ULP_CONFIG1_STICKY_ULP;
1184 phy_reg &= ~I218_ULP_CONFIG1_WOL_HOST;
1173 } 1185 }
1174 e1000_write_phy_reg_hv_locked(hw, I218_ULP_CONFIG1, phy_reg); 1186 e1000_write_phy_reg_hv_locked(hw, I218_ULP_CONFIG1, phy_reg);
1175 1187
@@ -1181,6 +1193,15 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx)
1181 /* Commit ULP changes in PHY by starting auto ULP configuration */ 1193 /* Commit ULP changes in PHY by starting auto ULP configuration */
1182 phy_reg |= I218_ULP_CONFIG1_START; 1194 phy_reg |= I218_ULP_CONFIG1_START;
1183 e1000_write_phy_reg_hv_locked(hw, I218_ULP_CONFIG1, phy_reg); 1195 e1000_write_phy_reg_hv_locked(hw, I218_ULP_CONFIG1, phy_reg);
1196
1197 if ((hw->phy.type == e1000_phy_i217) && (hw->phy.revision == 6) &&
1198 to_sx && (er32(STATUS) & E1000_STATUS_LU)) {
1199 ret_val = e1000_write_phy_reg_hv_locked(hw, HV_OEM_BITS,
1200 oem_reg);
1201 if (ret_val)
1202 goto release;
1203 }
1204
1184release: 1205release:
1185 hw->phy.ops.release(hw); 1206 hw->phy.ops.release(hw);
1186out: 1207out:
@@ -1379,16 +1400,20 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1379 if (((hw->mac.type == e1000_pch2lan) || 1400 if (((hw->mac.type == e1000_pch2lan) ||
1380 (hw->mac.type == e1000_pch_lpt) || 1401 (hw->mac.type == e1000_pch_lpt) ||
1381 (hw->mac.type == e1000_pch_spt)) && link) { 1402 (hw->mac.type == e1000_pch_spt)) && link) {
1382 u32 reg; 1403 u16 speed, duplex;
1383 1404
1384 reg = er32(STATUS); 1405 e1000e_get_speed_and_duplex_copper(hw, &speed, &duplex);
1385 tipg_reg = er32(TIPG); 1406 tipg_reg = er32(TIPG);
1386 tipg_reg &= ~E1000_TIPG_IPGT_MASK; 1407 tipg_reg &= ~E1000_TIPG_IPGT_MASK;
1387 1408
1388 if (!(reg & (E1000_STATUS_FD | E1000_STATUS_SPEED_MASK))) { 1409 if (duplex == HALF_DUPLEX && speed == SPEED_10) {
1389 tipg_reg |= 0xFF; 1410 tipg_reg |= 0xFF;
1390 /* Reduce Rx latency in analog PHY */ 1411 /* Reduce Rx latency in analog PHY */
1391 emi_val = 0; 1412 emi_val = 0;
1413 } else if (hw->mac.type == e1000_pch_spt &&
1414 duplex == FULL_DUPLEX && speed != SPEED_1000) {
1415 tipg_reg |= 0xC;
1416 emi_val = 1;
1392 } else { 1417 } else {
1393 1418
1394 /* Roll back the default values */ 1419 /* Roll back the default values */
@@ -1412,14 +1437,59 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1412 1437
1413 if (ret_val) 1438 if (ret_val)
1414 return ret_val; 1439 return ret_val;
1440
1441 if (hw->mac.type == e1000_pch_spt) {
1442 u16 data;
1443 u16 ptr_gap;
1444
1445 if (speed == SPEED_1000) {
1446 ret_val = hw->phy.ops.acquire(hw);
1447 if (ret_val)
1448 return ret_val;
1449
1450 ret_val = e1e_rphy_locked(hw,
1451 PHY_REG(776, 20),
1452 &data);
1453 if (ret_val) {
1454 hw->phy.ops.release(hw);
1455 return ret_val;
1456 }
1457
1458 ptr_gap = (data & (0x3FF << 2)) >> 2;
1459 if (ptr_gap < 0x18) {
1460 data &= ~(0x3FF << 2);
1461 data |= (0x18 << 2);
1462 ret_val =
1463 e1e_wphy_locked(hw,
1464 PHY_REG(776, 20),
1465 data);
1466 }
1467 hw->phy.ops.release(hw);
1468 if (ret_val)
1469 return ret_val;
1470 }
1471 }
1472 }
1473
1474 /* I217 Packet Loss issue:
1475 * ensure that FEXTNVM4 Beacon Duration is set correctly
1476 * on power up.
1477 * Set the Beacon Duration for I217 to 8 usec
1478 */
1479 if ((hw->mac.type == e1000_pch_lpt) || (hw->mac.type == e1000_pch_spt)) {
1480 u32 mac_reg;
1481
1482 mac_reg = er32(FEXTNVM4);
1483 mac_reg &= ~E1000_FEXTNVM4_BEACON_DURATION_MASK;
1484 mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_8USEC;
1485 ew32(FEXTNVM4, mac_reg);
1415 } 1486 }
1416 1487
1417 /* Work-around I218 hang issue */ 1488 /* Work-around I218 hang issue */
1418 if ((hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPTLP_I218_LM) || 1489 if ((hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPTLP_I218_LM) ||
1419 (hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPTLP_I218_V) || 1490 (hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPTLP_I218_V) ||
1420 (hw->adapter->pdev->device == E1000_DEV_ID_PCH_I218_LM3) || 1491 (hw->adapter->pdev->device == E1000_DEV_ID_PCH_I218_LM3) ||
1421 (hw->adapter->pdev->device == E1000_DEV_ID_PCH_I218_V3) || 1492 (hw->adapter->pdev->device == E1000_DEV_ID_PCH_I218_V3)) {
1422 (hw->mac.type == e1000_pch_spt)) {
1423 ret_val = e1000_k1_workaround_lpt_lp(hw, link); 1493 ret_val = e1000_k1_workaround_lpt_lp(hw, link);
1424 if (ret_val) 1494 if (ret_val)
1425 return ret_val; 1495 return ret_val;
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index e62b9dcb91fe..89d788d8f263 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -6354,13 +6354,14 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
6354} 6354}
6355 6355
6356/** 6356/**
6357 * e1000e_disable_aspm - Disable ASPM states 6357 * __e1000e_disable_aspm - Disable ASPM states
6358 * @pdev: pointer to PCI device struct 6358 * @pdev: pointer to PCI device struct
6359 * @state: bit-mask of ASPM states to disable 6359 * @state: bit-mask of ASPM states to disable
6360 * @locked: indication if this context holds pci_bus_sem locked.
6360 * 6361 *
6361 * Some devices *must* have certain ASPM states disabled per hardware errata. 6362 * Some devices *must* have certain ASPM states disabled per hardware errata.
6362 **/ 6363 **/
6363static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state) 6364static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state, int locked)
6364{ 6365{
6365 struct pci_dev *parent = pdev->bus->self; 6366 struct pci_dev *parent = pdev->bus->self;
6366 u16 aspm_dis_mask = 0; 6367 u16 aspm_dis_mask = 0;
@@ -6399,7 +6400,10 @@ static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state)
6399 "L1" : ""); 6400 "L1" : "");
6400 6401
6401#ifdef CONFIG_PCIEASPM 6402#ifdef CONFIG_PCIEASPM
6402 pci_disable_link_state_locked(pdev, state); 6403 if (locked)
6404 pci_disable_link_state_locked(pdev, state);
6405 else
6406 pci_disable_link_state(pdev, state);
6403 6407
6404 /* Double-check ASPM control. If not disabled by the above, the 6408 /* Double-check ASPM control. If not disabled by the above, the
6405 * BIOS is preventing that from happening (or CONFIG_PCIEASPM is 6409 * BIOS is preventing that from happening (or CONFIG_PCIEASPM is
@@ -6422,6 +6426,32 @@ static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state)
6422 aspm_dis_mask); 6426 aspm_dis_mask);
6423} 6427}
6424 6428
6429/**
6430 * e1000e_disable_aspm - Disable ASPM states.
6431 * @pdev: pointer to PCI device struct
6432 * @state: bit-mask of ASPM states to disable
6433 *
6434 * This function acquires the pci_bus_sem!
6435 * Some devices *must* have certain ASPM states disabled per hardware errata.
6436 **/
6437static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state)
6438{
6439 __e1000e_disable_aspm(pdev, state, 0);
6440}
6441
6442/**
6443 * e1000e_disable_aspm_locked Disable ASPM states.
6444 * @pdev: pointer to PCI device struct
6445 * @state: bit-mask of ASPM states to disable
6446 *
6447 * This function must be called with pci_bus_sem acquired!
6448 * Some devices *must* have certain ASPM states disabled per hardware errata.
6449 **/
6450static void e1000e_disable_aspm_locked(struct pci_dev *pdev, u16 state)
6451{
6452 __e1000e_disable_aspm(pdev, state, 1);
6453}
6454
6425#ifdef CONFIG_PM 6455#ifdef CONFIG_PM
6426static int __e1000_resume(struct pci_dev *pdev) 6456static int __e1000_resume(struct pci_dev *pdev)
6427{ 6457{
@@ -6435,7 +6465,7 @@ static int __e1000_resume(struct pci_dev *pdev)
6435 if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1) 6465 if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1)
6436 aspm_disable_flag |= PCIE_LINK_STATE_L1; 6466 aspm_disable_flag |= PCIE_LINK_STATE_L1;
6437 if (aspm_disable_flag) 6467 if (aspm_disable_flag)
6438 e1000e_disable_aspm(pdev, aspm_disable_flag); 6468 e1000e_disable_aspm_locked(pdev, aspm_disable_flag);
6439 6469
6440 pci_set_master(pdev); 6470 pci_set_master(pdev);
6441 6471
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index f54996f19629..395f32f226c0 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -484,6 +484,8 @@ int i40evf_setup_tx_descriptors(struct i40e_ring *tx_ring)
484 if (!dev) 484 if (!dev)
485 return -ENOMEM; 485 return -ENOMEM;
486 486
487 /* warn if we are about to overwrite the pointer */
488 WARN_ON(tx_ring->tx_bi);
487 bi_size = sizeof(struct i40e_tx_buffer) * tx_ring->count; 489 bi_size = sizeof(struct i40e_tx_buffer) * tx_ring->count;
488 tx_ring->tx_bi = kzalloc(bi_size, GFP_KERNEL); 490 tx_ring->tx_bi = kzalloc(bi_size, GFP_KERNEL);
489 if (!tx_ring->tx_bi) 491 if (!tx_ring->tx_bi)
@@ -644,6 +646,8 @@ int i40evf_setup_rx_descriptors(struct i40e_ring *rx_ring)
644 struct device *dev = rx_ring->dev; 646 struct device *dev = rx_ring->dev;
645 int bi_size; 647 int bi_size;
646 648
649 /* warn if we are about to overwrite the pointer */
650 WARN_ON(rx_ring->rx_bi);
647 bi_size = sizeof(struct i40e_rx_buffer) * rx_ring->count; 651 bi_size = sizeof(struct i40e_rx_buffer) * rx_ring->count;
648 rx_ring->rx_bi = kzalloc(bi_size, GFP_KERNEL); 652 rx_ring->rx_bi = kzalloc(bi_size, GFP_KERNEL);
649 if (!rx_ring->rx_bi) 653 if (!rx_ring->rx_bi)
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf.h b/drivers/net/ethernet/intel/i40evf/i40evf.h
index 1b98c25b3092..fea3b75a9a35 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf.h
+++ b/drivers/net/ethernet/intel/i40evf/i40evf.h
@@ -264,7 +264,6 @@ extern const char i40evf_driver_version[];
264 264
265int i40evf_up(struct i40evf_adapter *adapter); 265int i40evf_up(struct i40evf_adapter *adapter);
266void i40evf_down(struct i40evf_adapter *adapter); 266void i40evf_down(struct i40evf_adapter *adapter);
267void i40evf_reinit_locked(struct i40evf_adapter *adapter);
268void i40evf_reset(struct i40evf_adapter *adapter); 267void i40evf_reset(struct i40evf_adapter *adapter);
269void i40evf_set_ethtool_ops(struct net_device *netdev); 268void i40evf_set_ethtool_ops(struct net_device *netdev);
270void i40evf_update_stats(struct i40evf_adapter *adapter); 269void i40evf_update_stats(struct i40evf_adapter *adapter);
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
index f4e77665bc54..2b53c870e7f1 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
@@ -267,8 +267,10 @@ static int i40evf_set_ringparam(struct net_device *netdev,
267 adapter->tx_desc_count = new_tx_count; 267 adapter->tx_desc_count = new_tx_count;
268 adapter->rx_desc_count = new_rx_count; 268 adapter->rx_desc_count = new_rx_count;
269 269
270 if (netif_running(netdev)) 270 if (netif_running(netdev)) {
271 i40evf_reinit_locked(adapter); 271 adapter->flags |= I40EVF_FLAG_RESET_NEEDED;
272 schedule_work(&adapter->reset_task);
273 }
272 274
273 return 0; 275 return 0;
274} 276}
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 7c53aca4b5a6..4ab4ebba07a1 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -170,7 +170,8 @@ static void i40evf_tx_timeout(struct net_device *netdev)
170 struct i40evf_adapter *adapter = netdev_priv(netdev); 170 struct i40evf_adapter *adapter = netdev_priv(netdev);
171 171
172 adapter->tx_timeout_count++; 172 adapter->tx_timeout_count++;
173 if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING)) { 173 if (!(adapter->flags & (I40EVF_FLAG_RESET_PENDING |
174 I40EVF_FLAG_RESET_NEEDED))) {
174 adapter->flags |= I40EVF_FLAG_RESET_NEEDED; 175 adapter->flags |= I40EVF_FLAG_RESET_NEEDED;
175 schedule_work(&adapter->reset_task); 176 schedule_work(&adapter->reset_task);
176 } 177 }
@@ -1460,7 +1461,7 @@ static void i40evf_configure_rss(struct i40evf_adapter *adapter)
1460 for (i = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) { 1461 for (i = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
1461 lut = 0; 1462 lut = 0;
1462 for (j = 0; j < 4; j++) { 1463 for (j = 0; j < 4; j++) {
1463 if (cqueue == adapter->vsi_res->num_queue_pairs) 1464 if (cqueue == adapter->num_active_queues)
1464 cqueue = 0; 1465 cqueue = 0;
1465 lut |= ((cqueue) << (8 * j)); 1466 lut |= ((cqueue) << (8 * j));
1466 cqueue++; 1467 cqueue++;
@@ -1470,8 +1471,8 @@ static void i40evf_configure_rss(struct i40evf_adapter *adapter)
1470 i40e_flush(hw); 1471 i40e_flush(hw);
1471} 1472}
1472 1473
1473#define I40EVF_RESET_WAIT_MS 100 1474#define I40EVF_RESET_WAIT_MS 10
1474#define I40EVF_RESET_WAIT_COUNT 200 1475#define I40EVF_RESET_WAIT_COUNT 500
1475/** 1476/**
1476 * i40evf_reset_task - Call-back task to handle hardware reset 1477 * i40evf_reset_task - Call-back task to handle hardware reset
1477 * @work: pointer to work_struct 1478 * @work: pointer to work_struct
@@ -1495,10 +1496,17 @@ static void i40evf_reset_task(struct work_struct *work)
1495 &adapter->crit_section)) 1496 &adapter->crit_section))
1496 usleep_range(500, 1000); 1497 usleep_range(500, 1000);
1497 1498
1499 i40evf_misc_irq_disable(adapter);
1498 if (adapter->flags & I40EVF_FLAG_RESET_NEEDED) { 1500 if (adapter->flags & I40EVF_FLAG_RESET_NEEDED) {
1499 dev_info(&adapter->pdev->dev, "Requesting reset from PF\n"); 1501 adapter->flags &= ~I40EVF_FLAG_RESET_NEEDED;
1502 /* Restart the AQ here. If we have been reset but didn't
1503 * detect it, or if the PF had to reinit, our AQ will be hosed.
1504 */
1505 i40evf_shutdown_adminq(hw);
1506 i40evf_init_adminq(hw);
1500 i40evf_request_reset(adapter); 1507 i40evf_request_reset(adapter);
1501 } 1508 }
1509 adapter->flags |= I40EVF_FLAG_RESET_PENDING;
1502 1510
1503 /* poll until we see the reset actually happen */ 1511 /* poll until we see the reset actually happen */
1504 for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) { 1512 for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) {
@@ -1507,10 +1515,10 @@ static void i40evf_reset_task(struct work_struct *work)
1507 if ((rstat_val != I40E_VFR_VFACTIVE) && 1515 if ((rstat_val != I40E_VFR_VFACTIVE) &&
1508 (rstat_val != I40E_VFR_COMPLETED)) 1516 (rstat_val != I40E_VFR_COMPLETED))
1509 break; 1517 break;
1510 msleep(I40EVF_RESET_WAIT_MS); 1518 usleep_range(500, 1000);
1511 } 1519 }
1512 if (i == I40EVF_RESET_WAIT_COUNT) { 1520 if (i == I40EVF_RESET_WAIT_COUNT) {
1513 adapter->flags &= ~I40EVF_FLAG_RESET_PENDING; 1521 dev_info(&adapter->pdev->dev, "Never saw reset\n");
1514 goto continue_reset; /* act like the reset happened */ 1522 goto continue_reset; /* act like the reset happened */
1515 } 1523 }
1516 1524
@@ -1518,11 +1526,12 @@ static void i40evf_reset_task(struct work_struct *work)
1518 for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) { 1526 for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) {
1519 rstat_val = rd32(hw, I40E_VFGEN_RSTAT) & 1527 rstat_val = rd32(hw, I40E_VFGEN_RSTAT) &
1520 I40E_VFGEN_RSTAT_VFR_STATE_MASK; 1528 I40E_VFGEN_RSTAT_VFR_STATE_MASK;
1521 if ((rstat_val == I40E_VFR_VFACTIVE) || 1529 if (rstat_val == I40E_VFR_VFACTIVE)
1522 (rstat_val == I40E_VFR_COMPLETED))
1523 break; 1530 break;
1524 msleep(I40EVF_RESET_WAIT_MS); 1531 msleep(I40EVF_RESET_WAIT_MS);
1525 } 1532 }
1533 /* extra wait to make sure minimum wait is met */
1534 msleep(I40EVF_RESET_WAIT_MS);
1526 if (i == I40EVF_RESET_WAIT_COUNT) { 1535 if (i == I40EVF_RESET_WAIT_COUNT) {
1527 struct i40evf_mac_filter *f, *ftmp; 1536 struct i40evf_mac_filter *f, *ftmp;
1528 struct i40evf_vlan_filter *fv, *fvtmp; 1537 struct i40evf_vlan_filter *fv, *fvtmp;
@@ -1534,11 +1543,10 @@ static void i40evf_reset_task(struct work_struct *work)
1534 1543
1535 if (netif_running(adapter->netdev)) { 1544 if (netif_running(adapter->netdev)) {
1536 set_bit(__I40E_DOWN, &adapter->vsi.state); 1545 set_bit(__I40E_DOWN, &adapter->vsi.state);
1537 i40evf_irq_disable(adapter);
1538 i40evf_napi_disable_all(adapter);
1539 netif_tx_disable(netdev);
1540 netif_tx_stop_all_queues(netdev);
1541 netif_carrier_off(netdev); 1546 netif_carrier_off(netdev);
1547 netif_tx_disable(netdev);
1548 i40evf_napi_disable_all(adapter);
1549 i40evf_irq_disable(adapter);
1542 i40evf_free_traffic_irqs(adapter); 1550 i40evf_free_traffic_irqs(adapter);
1543 i40evf_free_all_tx_resources(adapter); 1551 i40evf_free_all_tx_resources(adapter);
1544 i40evf_free_all_rx_resources(adapter); 1552 i40evf_free_all_rx_resources(adapter);
@@ -1550,6 +1558,7 @@ static void i40evf_reset_task(struct work_struct *work)
1550 list_del(&f->list); 1558 list_del(&f->list);
1551 kfree(f); 1559 kfree(f);
1552 } 1560 }
1561
1553 list_for_each_entry_safe(fv, fvtmp, &adapter->vlan_filter_list, 1562 list_for_each_entry_safe(fv, fvtmp, &adapter->vlan_filter_list,
1554 list) { 1563 list) {
1555 list_del(&fv->list); 1564 list_del(&fv->list);
@@ -1564,22 +1573,27 @@ static void i40evf_reset_task(struct work_struct *work)
1564 i40evf_shutdown_adminq(hw); 1573 i40evf_shutdown_adminq(hw);
1565 adapter->netdev->flags &= ~IFF_UP; 1574 adapter->netdev->flags &= ~IFF_UP;
1566 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); 1575 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);
1576 adapter->flags &= ~I40EVF_FLAG_RESET_PENDING;
1577 dev_info(&adapter->pdev->dev, "Reset task did not complete, VF disabled\n");
1567 return; /* Do not attempt to reinit. It's dead, Jim. */ 1578 return; /* Do not attempt to reinit. It's dead, Jim. */
1568 } 1579 }
1569 1580
1570continue_reset: 1581continue_reset:
1571 adapter->flags &= ~I40EVF_FLAG_RESET_PENDING;
1572
1573 i40evf_irq_disable(adapter);
1574
1575 if (netif_running(adapter->netdev)) { 1582 if (netif_running(adapter->netdev)) {
1576 i40evf_napi_disable_all(adapter);
1577 netif_tx_disable(netdev);
1578 netif_tx_stop_all_queues(netdev);
1579 netif_carrier_off(netdev); 1583 netif_carrier_off(netdev);
1584 netif_tx_stop_all_queues(netdev);
1585 i40evf_napi_disable_all(adapter);
1580 } 1586 }
1587 i40evf_irq_disable(adapter);
1581 1588
1582 adapter->state = __I40EVF_RESETTING; 1589 adapter->state = __I40EVF_RESETTING;
1590 adapter->flags &= ~I40EVF_FLAG_RESET_PENDING;
1591
1592 /* free the Tx/Rx rings and descriptors, might be better to just
1593 * re-use them sometime in the future
1594 */
1595 i40evf_free_all_rx_resources(adapter);
1596 i40evf_free_all_tx_resources(adapter);
1583 1597
1584 /* kill and reinit the admin queue */ 1598 /* kill and reinit the admin queue */
1585 if (i40evf_shutdown_adminq(hw)) 1599 if (i40evf_shutdown_adminq(hw))
@@ -1603,6 +1617,7 @@ continue_reset:
1603 adapter->aq_required = I40EVF_FLAG_AQ_ADD_MAC_FILTER; 1617 adapter->aq_required = I40EVF_FLAG_AQ_ADD_MAC_FILTER;
1604 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER; 1618 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
1605 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); 1619 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);
1620 i40evf_misc_irq_enable(adapter);
1606 1621
1607 mod_timer(&adapter->watchdog_timer, jiffies + 2); 1622 mod_timer(&adapter->watchdog_timer, jiffies + 2);
1608 1623
@@ -1624,7 +1639,10 @@ continue_reset:
1624 goto reset_err; 1639 goto reset_err;
1625 1640
1626 i40evf_irq_enable(adapter, true); 1641 i40evf_irq_enable(adapter, true);
1642 } else {
1643 adapter->state = __I40EVF_DOWN;
1627 } 1644 }
1645
1628 return; 1646 return;
1629reset_err: 1647reset_err:
1630 dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n"); 1648 dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n");
@@ -1667,6 +1685,11 @@ static void i40evf_adminq_task(struct work_struct *work)
1667 memset(event.msg_buf, 0, I40EVF_MAX_AQ_BUF_SIZE); 1685 memset(event.msg_buf, 0, I40EVF_MAX_AQ_BUF_SIZE);
1668 } while (pending); 1686 } while (pending);
1669 1687
1688 if ((adapter->flags &
1689 (I40EVF_FLAG_RESET_PENDING | I40EVF_FLAG_RESET_NEEDED)) ||
1690 adapter->state == __I40EVF_RESETTING)
1691 goto freedom;
1692
1670 /* check for error indications */ 1693 /* check for error indications */
1671 val = rd32(hw, hw->aq.arq.len); 1694 val = rd32(hw, hw->aq.arq.len);
1672 oldval = val; 1695 oldval = val;
@@ -1702,6 +1725,7 @@ static void i40evf_adminq_task(struct work_struct *work)
1702 if (oldval != val) 1725 if (oldval != val)
1703 wr32(hw, hw->aq.asq.len, val); 1726 wr32(hw, hw->aq.asq.len, val);
1704 1727
1728freedom:
1705 kfree(event.msg_buf); 1729 kfree(event.msg_buf);
1706out: 1730out:
1707 /* re-enable Admin queue interrupt cause */ 1731 /* re-enable Admin queue interrupt cause */
@@ -1897,47 +1921,6 @@ static struct net_device_stats *i40evf_get_stats(struct net_device *netdev)
1897} 1921}
1898 1922
1899/** 1923/**
1900 * i40evf_reinit_locked - Software reinit
1901 * @adapter: board private structure
1902 *
1903 * Reinititalizes the ring structures in response to a software configuration
1904 * change. Roughly the same as close followed by open, but skips releasing
1905 * and reallocating the interrupts.
1906 **/
1907void i40evf_reinit_locked(struct i40evf_adapter *adapter)
1908{
1909 struct net_device *netdev = adapter->netdev;
1910 int err;
1911
1912 WARN_ON(in_interrupt());
1913
1914 i40evf_down(adapter);
1915
1916 /* allocate transmit descriptors */
1917 err = i40evf_setup_all_tx_resources(adapter);
1918 if (err)
1919 goto err_reinit;
1920
1921 /* allocate receive descriptors */
1922 err = i40evf_setup_all_rx_resources(adapter);
1923 if (err)
1924 goto err_reinit;
1925
1926 i40evf_configure(adapter);
1927
1928 err = i40evf_up_complete(adapter);
1929 if (err)
1930 goto err_reinit;
1931
1932 i40evf_irq_enable(adapter, true);
1933 return;
1934
1935err_reinit:
1936 dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n");
1937 i40evf_close(netdev);
1938}
1939
1940/**
1941 * i40evf_change_mtu - Change the Maximum Transfer Unit 1924 * i40evf_change_mtu - Change the Maximum Transfer Unit
1942 * @netdev: network interface device structure 1925 * @netdev: network interface device structure
1943 * @new_mtu: new value for maximum frame size 1926 * @new_mtu: new value for maximum frame size
@@ -1952,9 +1935,10 @@ static int i40evf_change_mtu(struct net_device *netdev, int new_mtu)
1952 if ((new_mtu < 68) || (max_frame > I40E_MAX_RXBUFFER)) 1935 if ((new_mtu < 68) || (max_frame > I40E_MAX_RXBUFFER))
1953 return -EINVAL; 1936 return -EINVAL;
1954 1937
1955 /* must set new MTU before calling down or up */
1956 netdev->mtu = new_mtu; 1938 netdev->mtu = new_mtu;
1957 i40evf_reinit_locked(adapter); 1939 adapter->flags |= I40EVF_FLAG_RESET_NEEDED;
1940 schedule_work(&adapter->reset_task);
1941
1958 return 0; 1942 return 0;
1959} 1943}
1960 1944
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index 0f69ef81751a..b0182dd31346 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -1,5 +1,5 @@
1/* Intel(R) Gigabit Ethernet Linux driver 1/* Intel(R) Gigabit Ethernet Linux driver
2 * Copyright(c) 2007-2014 Intel Corporation. 2 * Copyright(c) 2007-2015 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -1900,8 +1900,8 @@ static void igb_clear_hw_cntrs_82575(struct e1000_hw *hw)
1900 * igb_rx_fifo_flush_82575 - Clean rx fifo after RX enable 1900 * igb_rx_fifo_flush_82575 - Clean rx fifo after RX enable
1901 * @hw: pointer to the HW structure 1901 * @hw: pointer to the HW structure
1902 * 1902 *
1903 * After rx enable if managability is enabled then there is likely some 1903 * After rx enable if manageability is enabled then there is likely some
1904 * bad data at the start of the fifo and possibly in the DMA fifo. This 1904 * bad data at the start of the fifo and possibly in the DMA fifo. This
1905 * function clears the fifos and flushes any packets that came in as rx was 1905 * function clears the fifos and flushes any packets that came in as rx was
1906 * being enabled. 1906 * being enabled.
1907 **/ 1907 **/
@@ -1910,6 +1910,11 @@ void igb_rx_fifo_flush_82575(struct e1000_hw *hw)
1910 u32 rctl, rlpml, rxdctl[4], rfctl, temp_rctl, rx_enabled; 1910 u32 rctl, rlpml, rxdctl[4], rfctl, temp_rctl, rx_enabled;
1911 int i, ms_wait; 1911 int i, ms_wait;
1912 1912
1913 /* disable IPv6 options as per hardware errata */
1914 rfctl = rd32(E1000_RFCTL);
1915 rfctl |= E1000_RFCTL_IPV6_EX_DIS;
1916 wr32(E1000_RFCTL, rfctl);
1917
1913 if (hw->mac.type != e1000_82575 || 1918 if (hw->mac.type != e1000_82575 ||
1914 !(rd32(E1000_MANC) & E1000_MANC_RCV_TCO_EN)) 1919 !(rd32(E1000_MANC) & E1000_MANC_RCV_TCO_EN))
1915 return; 1920 return;
@@ -1937,7 +1942,6 @@ void igb_rx_fifo_flush_82575(struct e1000_hw *hw)
1937 * incoming packets are rejected. Set enable and wait 2ms so that 1942 * incoming packets are rejected. Set enable and wait 2ms so that
1938 * any packet that was coming in as RCTL.EN was set is flushed 1943 * any packet that was coming in as RCTL.EN was set is flushed
1939 */ 1944 */
1940 rfctl = rd32(E1000_RFCTL);
1941 wr32(E1000_RFCTL, rfctl & ~E1000_RFCTL_LEF); 1945 wr32(E1000_RFCTL, rfctl & ~E1000_RFCTL_LEF);
1942 1946
1943 rlpml = rd32(E1000_RLPML); 1947 rlpml = rd32(E1000_RLPML);
diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h
index 217f8138851b..f8684aa285be 100644
--- a/drivers/net/ethernet/intel/igb/e1000_defines.h
+++ b/drivers/net/ethernet/intel/igb/e1000_defines.h
@@ -344,7 +344,8 @@
344#define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ 344#define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */
345 345
346/* Header split receive */ 346/* Header split receive */
347#define E1000_RFCTL_LEF 0x00040000 347#define E1000_RFCTL_IPV6_EX_DIS 0x00010000
348#define E1000_RFCTL_LEF 0x00040000
348 349
349/* Collision related configuration parameters */ 350/* Collision related configuration parameters */
350#define E1000_COLLISION_THRESHOLD 15 351#define E1000_COLLISION_THRESHOLD 15
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index f287186192bb..2f70a9b152bd 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -58,7 +58,7 @@
58 58
59#define MAJ 5 59#define MAJ 5
60#define MIN 2 60#define MIN 2
61#define BUILD 15 61#define BUILD 18
62#define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \ 62#define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \
63__stringify(BUILD) "-k" 63__stringify(BUILD) "-k"
64char igb_driver_name[] = "igb"; 64char igb_driver_name[] = "igb";