Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ixgbe: Fix WoL functionality for 82599 KX4 devices

The current code writes the PME enabled bit in PCI config space which is
wrong. This was needed for pre-release hardware, and was not removed from
the driver. Also, we need to clear the WUS (wake up status) after we
resume. Otherwise we can't wake for the same event again since it's still
asserted in the hardware. Plus, the multicast lists were being written
improperly, causing multicast WoL to fail.

Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Waskiewicz Jr, Peter P and committed by
David S. Miller
495dce12 ae0e8e82

+6 -55
+2 -49
drivers/net/ixgbe/ixgbe_common.c
··· 50 50 static void ixgbe_enable_rar(struct ixgbe_hw *hw, u32 index); 51 51 static void ixgbe_disable_rar(struct ixgbe_hw *hw, u32 index); 52 52 static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr); 53 - static void ixgbe_add_mc_addr(struct ixgbe_hw *hw, u8 *mc_addr); 54 53 static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq); 55 54 56 55 /** ··· 1376 1377 * Clear accounting of old secondary address list, 1377 1378 * don't count RAR[0] 1378 1379 */ 1379 - uc_addr_in_use = hw->addr_ctrl.rar_used_count - 1380 - hw->addr_ctrl.mc_addr_in_rar_count - 1; 1380 + uc_addr_in_use = hw->addr_ctrl.rar_used_count - 1; 1381 1381 hw->addr_ctrl.rar_used_count -= uc_addr_in_use; 1382 1382 hw->addr_ctrl.overflow_promisc = 0; 1383 1383 ··· 1491 1493 } 1492 1494 1493 1495 /** 1494 - * ixgbe_add_mc_addr - Adds a multicast address. 1495 - * @hw: pointer to hardware structure 1496 - * @mc_addr: new multicast address 1497 - * 1498 - * Adds it to unused receive address register or to the multicast table. 1499 - **/ 1500 - static void ixgbe_add_mc_addr(struct ixgbe_hw *hw, u8 *mc_addr) 1501 - { 1502 - u32 rar_entries = hw->mac.num_rar_entries; 1503 - u32 rar; 1504 - 1505 - hw_dbg(hw, " MC Addr =%.2X %.2X %.2X %.2X %.2X %.2X\n", 1506 - mc_addr[0], mc_addr[1], mc_addr[2], 1507 - mc_addr[3], mc_addr[4], mc_addr[5]); 1508 - 1509 - /* 1510 - * Place this multicast address in the RAR if there is room, 1511 - * else put it in the MTA 1512 - */ 1513 - if (hw->addr_ctrl.rar_used_count < rar_entries) { 1514 - /* use RAR from the end up for multicast */ 1515 - rar = rar_entries - hw->addr_ctrl.mc_addr_in_rar_count - 1; 1516 - hw->mac.ops.set_rar(hw, rar, mc_addr, 0, IXGBE_RAH_AV); 1517 - hw_dbg(hw, "Added a multicast address to RAR[%d]\n", rar); 1518 - hw->addr_ctrl.rar_used_count++; 1519 - hw->addr_ctrl.mc_addr_in_rar_count++; 1520 - } else { 1521 - ixgbe_set_mta(hw, mc_addr); 1522 - } 1523 - 1524 - hw_dbg(hw, "ixgbe_add_mc_addr Complete\n"); 1525 - } 1526 - 1527 - /** 1528 1496 * ixgbe_update_mc_addr_list_generic - Updates MAC list of multicast addresses 1529 1497 * @hw: pointer to hardware structure 1530 1498 * @mc_addr_list: the list of new multicast addresses ··· 1506 1542 u32 mc_addr_count, ixgbe_mc_addr_itr next) 1507 1543 { 1508 1544 u32 i; 1509 - u32 rar_entries = hw->mac.num_rar_entries; 1510 1545 u32 vmdq; 1511 1546 1512 1547 /* ··· 1513 1550 * use. 1514 1551 */ 1515 1552 hw->addr_ctrl.num_mc_addrs = mc_addr_count; 1516 - hw->addr_ctrl.rar_used_count -= hw->addr_ctrl.mc_addr_in_rar_count; 1517 - hw->addr_ctrl.mc_addr_in_rar_count = 0; 1518 1553 hw->addr_ctrl.mta_in_use = 0; 1519 - 1520 - /* Zero out the other receive addresses. */ 1521 - hw_dbg(hw, "Clearing RAR[%d-%d]\n", hw->addr_ctrl.rar_used_count, 1522 - rar_entries - 1); 1523 - for (i = hw->addr_ctrl.rar_used_count; i < rar_entries; i++) { 1524 - IXGBE_WRITE_REG(hw, IXGBE_RAL(i), 0); 1525 - IXGBE_WRITE_REG(hw, IXGBE_RAH(i), 0); 1526 - } 1527 1554 1528 1555 /* Clear the MTA */ 1529 1556 hw_dbg(hw, " Clearing MTA\n"); ··· 1523 1570 /* Add the new addresses */ 1524 1571 for (i = 0; i < mc_addr_count; i++) { 1525 1572 hw_dbg(hw, " Adding the multicast addresses:\n"); 1526 - ixgbe_add_mc_addr(hw, next(hw, &mc_addr_list, &vmdq)); 1573 + ixgbe_set_mta(hw, next(hw, &mc_addr_list, &vmdq)); 1527 1574 } 1528 1575 1529 1576 /* Enable mta */
+4 -6
drivers/net/ixgbe/ixgbe_main.c
··· 3646 3646 3647 3647 ixgbe_reset(adapter); 3648 3648 3649 + IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0); 3650 + 3649 3651 if (netif_running(netdev)) { 3650 3652 err = ixgbe_open(adapter->netdev); 3651 3653 if (err) ··· 4577 4575 const struct ixgbe_info *ii = ixgbe_info_tbl[ent->driver_data]; 4578 4576 static int cards_found; 4579 4577 int i, err, pci_using_dac; 4580 - u16 pm_value = 0; 4581 4578 u32 part_num, eec; 4582 4579 4583 4580 err = pci_enable_device(pdev); ··· 4764 4763 4765 4764 switch (pdev->device) { 4766 4765 case IXGBE_DEV_ID_82599_KX4: 4767 - #define IXGBE_PCIE_PMCSR 0x44 4768 - adapter->wol = IXGBE_WUFC_MAG; 4769 - pci_read_config_word(pdev, IXGBE_PCIE_PMCSR, &pm_value); 4770 - pci_write_config_word(pdev, IXGBE_PCIE_PMCSR, 4771 - (pm_value | (1 << 8))); 4766 + adapter->wol = (IXGBE_WUFC_MAG | IXGBE_WUFC_EX | 4767 + IXGBE_WUFC_MC | IXGBE_WUFC_BC); 4772 4768 break; 4773 4769 default: 4774 4770 adapter->wol = 0;