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

Merge branch '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2024-01-02 (ixgbe, i40e)

This series contains updates to ixgbe and i40e drivers.

Ovidiu Panait adds reporting of VF link state to ixgbe.

Jedrzej removes uses of IXGBE_ERR* codes to instead use standard error
codes.

Andrii modifies behavior of VF disable to properly shut down queues on
i40e.

Simon Horman removes, undesired, use of comma operator for i40e.

* '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
i40e: Avoid unnecessary use of comma operator
i40e: Fix VF disable behavior to block all traffic
ixgbe: Refactor returning internal error codes
ixgbe: Refactor overtemp event handling
ixgbe: report link state for VF devices
====================

Link: https://lore.kernel.org/r/20240102222429.699129-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+342 -359
+1 -1
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
··· 1911 1911 len = eeprom->len - (I40E_NVM_SECTOR_SIZE * i); 1912 1912 last = true; 1913 1913 } 1914 - offset = eeprom->offset + (I40E_NVM_SECTOR_SIZE * i), 1914 + offset = eeprom->offset + (I40E_NVM_SECTOR_SIZE * i); 1915 1915 ret_val = i40e_aq_read_nvm(hw, 0x0, offset, len, 1916 1916 (u8 *)eeprom_buff + (I40E_NVM_SECTOR_SIZE * i), 1917 1917 last, NULL);
+32
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
··· 2579 2579 int aq_ret = 0; 2580 2580 int i; 2581 2581 2582 + if (vf->is_disabled_from_host) { 2583 + aq_ret = -EPERM; 2584 + dev_info(&pf->pdev->dev, 2585 + "Admin has disabled VF %d, will not enable queues\n", 2586 + vf->vf_id); 2587 + goto error_param; 2588 + } 2589 + 2582 2590 if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 2583 2591 aq_ret = -EINVAL; 2584 2592 goto error_param; ··· 4713 4705 struct i40e_link_status *ls = &pf->hw.phy.link_info; 4714 4706 struct virtchnl_pf_event pfe; 4715 4707 struct i40e_hw *hw = &pf->hw; 4708 + struct i40e_vsi *vsi; 4709 + unsigned long q_map; 4716 4710 struct i40e_vf *vf; 4717 4711 int abs_vf_id; 4718 4712 int ret = 0; 4713 + int tmp; 4719 4714 4720 4715 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { 4721 4716 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); ··· 4741 4730 switch (link) { 4742 4731 case IFLA_VF_LINK_STATE_AUTO: 4743 4732 vf->link_forced = false; 4733 + vf->is_disabled_from_host = false; 4734 + /* reset needed to reinit VF resources */ 4735 + i40e_vc_reset_vf(vf, true); 4744 4736 i40e_set_vf_link_state(vf, &pfe, ls); 4745 4737 break; 4746 4738 case IFLA_VF_LINK_STATE_ENABLE: 4747 4739 vf->link_forced = true; 4748 4740 vf->link_up = true; 4741 + vf->is_disabled_from_host = false; 4742 + /* reset needed to reinit VF resources */ 4743 + i40e_vc_reset_vf(vf, true); 4749 4744 i40e_set_vf_link_state(vf, &pfe, ls); 4750 4745 break; 4751 4746 case IFLA_VF_LINK_STATE_DISABLE: 4752 4747 vf->link_forced = true; 4753 4748 vf->link_up = false; 4754 4749 i40e_set_vf_link_state(vf, &pfe, ls); 4750 + 4751 + vsi = pf->vsi[vf->lan_vsi_idx]; 4752 + q_map = BIT(vsi->num_queue_pairs) - 1; 4753 + 4754 + vf->is_disabled_from_host = true; 4755 + 4756 + /* Try to stop both Tx&Rx rings even if one of the calls fails 4757 + * to ensure we stop the rings even in case of errors. 4758 + * If any of them returns with an error then the first 4759 + * error that occurred will be returned. 4760 + */ 4761 + tmp = i40e_ctrl_vf_tx_rings(vsi, q_map, false); 4762 + ret = i40e_ctrl_vf_rx_rings(vsi, q_map, false); 4763 + 4764 + ret = tmp ? tmp : ret; 4755 4765 break; 4756 4766 default: 4757 4767 ret = -EINVAL;
+1
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
··· 100 100 bool link_forced; 101 101 bool link_up; /* only valid if VF link is forced */ 102 102 bool spoofchk; 103 + bool is_disabled_from_host; /* PF ctrl of VF enable/disable */ 103 104 u16 num_vlan; 104 105 105 106 /* ADq related variables */
+18 -18
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
··· 123 123 if (ret_val) 124 124 return ret_val; 125 125 if (hw->phy.sfp_type == ixgbe_sfp_type_unknown) 126 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 126 + return -EOPNOTSUPP; 127 127 128 128 /* Check to see if SFP+ module is supported */ 129 129 ret_val = ixgbe_get_sfp_init_sequence_offsets(hw, 130 130 &list_offset, 131 131 &data_offset); 132 132 if (ret_val) 133 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 133 + return -EOPNOTSUPP; 134 134 break; 135 135 default: 136 136 break; ··· 213 213 break; 214 214 215 215 default: 216 - return IXGBE_ERR_LINK_SETUP; 216 + return -EIO; 217 217 } 218 218 219 219 return 0; ··· 283 283 284 284 /* Validate the water mark configuration */ 285 285 if (!hw->fc.pause_time) 286 - return IXGBE_ERR_INVALID_LINK_SETTINGS; 286 + return -EINVAL; 287 287 288 288 /* Low water mark of zero causes XOFF floods */ 289 289 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { ··· 292 292 if (!hw->fc.low_water[i] || 293 293 hw->fc.low_water[i] >= hw->fc.high_water[i]) { 294 294 hw_dbg(hw, "Invalid water mark configuration\n"); 295 - return IXGBE_ERR_INVALID_LINK_SETTINGS; 295 + return -EINVAL; 296 296 } 297 297 } 298 298 } ··· 369 369 break; 370 370 default: 371 371 hw_dbg(hw, "Flow control param set incorrectly\n"); 372 - return IXGBE_ERR_CONFIG; 372 + return -EIO; 373 373 } 374 374 375 375 /* Set 802.3x based flow control settings. */ ··· 438 438 msleep(100); 439 439 } 440 440 if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) { 441 - status = IXGBE_ERR_AUTONEG_NOT_COMPLETE; 441 + status = -EIO; 442 442 hw_dbg(hw, "Autonegotiation did not complete.\n"); 443 443 } 444 444 } ··· 478 478 479 479 if (timeout == IXGBE_VALIDATE_LINK_READY_TIMEOUT) { 480 480 hw_dbg(hw, "Link was indicated but link is down\n"); 481 - return IXGBE_ERR_LINK_SETUP; 481 + return -EIO; 482 482 } 483 483 484 484 return 0; ··· 594 594 speed &= link_capabilities; 595 595 596 596 if (speed == IXGBE_LINK_SPEED_UNKNOWN) 597 - return IXGBE_ERR_LINK_SETUP; 597 + return -EINVAL; 598 598 599 599 /* Set KX4/KX support according to speed requested */ 600 600 else if (link_mode == IXGBE_AUTOC_LMS_KX4_AN || ··· 701 701 702 702 /* Init PHY and function pointers, perform SFP setup */ 703 703 phy_status = hw->phy.ops.init(hw); 704 - if (phy_status == IXGBE_ERR_SFP_NOT_SUPPORTED) 704 + if (phy_status == -EOPNOTSUPP) 705 705 return phy_status; 706 - if (phy_status == IXGBE_ERR_SFP_NOT_PRESENT) 706 + if (phy_status == -ENOENT) 707 707 goto mac_reset_top; 708 708 709 709 hw->phy.ops.reset(hw); ··· 727 727 udelay(1); 728 728 } 729 729 if (ctrl & IXGBE_CTRL_RST) { 730 - status = IXGBE_ERR_RESET_FAILED; 730 + status = -EIO; 731 731 hw_dbg(hw, "Reset polling failed to complete.\n"); 732 732 } 733 733 ··· 789 789 /* Make sure we are using a valid rar index range */ 790 790 if (rar >= rar_entries) { 791 791 hw_dbg(hw, "RAR index %d is out of range.\n", rar); 792 - return IXGBE_ERR_INVALID_ARGUMENT; 792 + return -EINVAL; 793 793 } 794 794 795 795 rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar)); ··· 814 814 /* Make sure we are using a valid rar index range */ 815 815 if (rar >= rar_entries) { 816 816 hw_dbg(hw, "RAR index %d is out of range.\n", rar); 817 - return IXGBE_ERR_INVALID_ARGUMENT; 817 + return -EINVAL; 818 818 } 819 819 820 820 rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar)); ··· 845 845 u32 vftabyte; 846 846 847 847 if (vlan > 4095) 848 - return IXGBE_ERR_PARAM; 848 + return -EINVAL; 849 849 850 850 /* Determine 32-bit word position in array */ 851 851 regindex = (vlan >> 5) & 0x7F; /* upper seven bits */ ··· 964 964 gssr = IXGBE_GSSR_PHY0_SM; 965 965 966 966 if (hw->mac.ops.acquire_swfw_sync(hw, gssr) != 0) 967 - return IXGBE_ERR_SWFW_SYNC; 967 + return -EBUSY; 968 968 969 969 if (hw->phy.type == ixgbe_phy_nl) { 970 970 /* ··· 993 993 994 994 if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_PASS) { 995 995 hw_dbg(hw, "EEPROM read did not pass.\n"); 996 - status = IXGBE_ERR_SFP_NOT_PRESENT; 996 + status = -ENOENT; 997 997 goto out; 998 998 } 999 999 ··· 1003 1003 1004 1004 *eeprom_data = (u8)(sfp_data >> 8); 1005 1005 } else { 1006 - status = IXGBE_ERR_PHY; 1006 + status = -EIO; 1007 1007 } 1008 1008 1009 1009 out:
+30 -31
drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
··· 117 117 ret_val = hw->mac.ops.acquire_swfw_sync(hw, 118 118 IXGBE_GSSR_MAC_CSR_SM); 119 119 if (ret_val) 120 - return IXGBE_ERR_SWFW_SYNC; 120 + return -EBUSY; 121 121 122 122 if (hw->eeprom.ops.read(hw, ++data_offset, &data_value)) 123 123 goto setup_sfp_err; ··· 144 144 145 145 if (ret_val) { 146 146 hw_dbg(hw, " sfp module setup not complete\n"); 147 - return IXGBE_ERR_SFP_SETUP_NOT_COMPLETE; 147 + return -EIO; 148 148 } 149 149 } 150 150 ··· 159 159 usleep_range(hw->eeprom.semaphore_delay * 1000, 160 160 hw->eeprom.semaphore_delay * 2000); 161 161 hw_err(hw, "eeprom read at offset %d failed\n", data_offset); 162 - return IXGBE_ERR_SFP_SETUP_NOT_COMPLETE; 162 + return -EIO; 163 163 } 164 164 165 165 /** ··· 184 184 ret_val = hw->mac.ops.acquire_swfw_sync(hw, 185 185 IXGBE_GSSR_MAC_CSR_SM); 186 186 if (ret_val) 187 - return IXGBE_ERR_SWFW_SYNC; 187 + return -EBUSY; 188 188 189 189 *locked = true; 190 190 } ··· 219 219 ret_val = hw->mac.ops.acquire_swfw_sync(hw, 220 220 IXGBE_GSSR_MAC_CSR_SM); 221 221 if (ret_val) 222 - return IXGBE_ERR_SWFW_SYNC; 222 + return -EBUSY; 223 223 224 224 locked = true; 225 225 } ··· 400 400 break; 401 401 402 402 default: 403 - return IXGBE_ERR_LINK_SETUP; 403 + return -EIO; 404 404 } 405 405 406 406 if (hw->phy.multispeed_fiber) { ··· 541 541 msleep(100); 542 542 } 543 543 if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) { 544 - status = IXGBE_ERR_AUTONEG_NOT_COMPLETE; 544 + status = -EIO; 545 545 hw_dbg(hw, "Autoneg did not complete.\n"); 546 546 } 547 547 } ··· 794 794 speed &= link_capabilities; 795 795 796 796 if (speed == IXGBE_LINK_SPEED_UNKNOWN) 797 - return IXGBE_ERR_LINK_SETUP; 797 + return -EINVAL; 798 798 799 799 /* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/ 800 800 if (hw->mac.orig_link_settings_stored) ··· 861 861 msleep(100); 862 862 } 863 863 if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) { 864 - status = 865 - IXGBE_ERR_AUTONEG_NOT_COMPLETE; 864 + status = -EIO; 866 865 hw_dbg(hw, "Autoneg did not complete.\n"); 867 866 } 868 867 } ··· 926 927 /* Identify PHY and related function pointers */ 927 928 status = hw->phy.ops.init(hw); 928 929 929 - if (status == IXGBE_ERR_SFP_NOT_SUPPORTED) 930 + if (status == -EOPNOTSUPP) 930 931 return status; 931 932 932 933 /* Setup SFP module if there is one present. */ ··· 935 936 hw->phy.sfp_setup_needed = false; 936 937 } 937 938 938 - if (status == IXGBE_ERR_SFP_NOT_SUPPORTED) 939 + if (status == -EOPNOTSUPP) 939 940 return status; 940 941 941 942 /* Reset PHY */ ··· 973 974 } 974 975 975 976 if (ctrl & IXGBE_CTRL_RST_MASK) { 976 - status = IXGBE_ERR_RESET_FAILED; 977 + status = -EIO; 977 978 hw_dbg(hw, "Reset polling failed to complete.\n"); 978 979 } 979 980 ··· 1092 1093 udelay(10); 1093 1094 } 1094 1095 1095 - return IXGBE_ERR_FDIR_CMD_INCOMPLETE; 1096 + return -EIO; 1096 1097 } 1097 1098 1098 1099 /** ··· 1154 1155 } 1155 1156 if (i >= IXGBE_FDIR_INIT_DONE_POLL) { 1156 1157 hw_dbg(hw, "Flow Director Signature poll time exceeded!\n"); 1157 - return IXGBE_ERR_FDIR_REINIT_FAILED; 1158 + return -EIO; 1158 1159 } 1159 1160 1160 1161 /* Clear FDIR statistics registers (read to clear) */ ··· 1386 1387 break; 1387 1388 default: 1388 1389 hw_dbg(hw, " Error on flow type input\n"); 1389 - return IXGBE_ERR_CONFIG; 1390 + return -EIO; 1390 1391 } 1391 1392 1392 1393 /* configure FDIRCMD register */ ··· 1545 1546 break; 1546 1547 default: 1547 1548 hw_dbg(hw, " Error on vm pool mask\n"); 1548 - return IXGBE_ERR_CONFIG; 1549 + return -EIO; 1549 1550 } 1550 1551 1551 1552 switch (input_mask->formatted.flow_type & IXGBE_ATR_L4TYPE_MASK) { ··· 1554 1555 if (input_mask->formatted.dst_port || 1555 1556 input_mask->formatted.src_port) { 1556 1557 hw_dbg(hw, " Error on src/dst port mask\n"); 1557 - return IXGBE_ERR_CONFIG; 1558 + return -EIO; 1558 1559 } 1559 1560 break; 1560 1561 case IXGBE_ATR_L4TYPE_MASK: 1561 1562 break; 1562 1563 default: 1563 1564 hw_dbg(hw, " Error on flow type mask\n"); 1564 - return IXGBE_ERR_CONFIG; 1565 + return -EIO; 1565 1566 } 1566 1567 1567 1568 switch (ntohs(input_mask->formatted.vlan_id) & 0xEFFF) { ··· 1582 1583 break; 1583 1584 default: 1584 1585 hw_dbg(hw, " Error on VLAN mask\n"); 1585 - return IXGBE_ERR_CONFIG; 1586 + return -EIO; 1586 1587 } 1587 1588 1588 1589 switch ((__force u16)input_mask->formatted.flex_bytes & 0xFFFF) { ··· 1594 1595 break; 1595 1596 default: 1596 1597 hw_dbg(hw, " Error on flexible byte mask\n"); 1597 - return IXGBE_ERR_CONFIG; 1598 + return -EIO; 1598 1599 } 1599 1600 1600 1601 /* Now mask VM pool and destination IPv6 - bits 5 and 2 */ ··· 1823 1824 1824 1825 /* Return error if SFP module has been detected but is not supported */ 1825 1826 if (hw->phy.type == ixgbe_phy_sfp_unsupported) 1826 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 1827 + return -EOPNOTSUPP; 1827 1828 1828 1829 return status; 1829 1830 } ··· 1862 1863 * Verifies that installed the firmware version is 0.6 or higher 1863 1864 * for SFI devices. All 82599 SFI devices should have version 0.6 or higher. 1864 1865 * 1865 - * Returns IXGBE_ERR_EEPROM_VERSION if the FW is not present or 1866 - * if the FW version is not supported. 1866 + * Return: -EACCES if the FW is not present or if the FW version is 1867 + * not supported. 1867 1868 **/ 1868 1869 static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw) 1869 1870 { 1870 - s32 status = IXGBE_ERR_EEPROM_VERSION; 1871 1871 u16 fw_offset, fw_ptp_cfg_offset; 1872 + s32 status = -EACCES; 1872 1873 u16 offset; 1873 1874 u16 fw_version = 0; 1874 1875 ··· 1882 1883 goto fw_version_err; 1883 1884 1884 1885 if (fw_offset == 0 || fw_offset == 0xFFFF) 1885 - return IXGBE_ERR_EEPROM_VERSION; 1886 + return -EACCES; 1886 1887 1887 1888 /* get the offset to the Pass Through Patch Configuration block */ 1888 1889 offset = fw_offset + IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR; ··· 1890 1891 goto fw_version_err; 1891 1892 1892 1893 if (fw_ptp_cfg_offset == 0 || fw_ptp_cfg_offset == 0xFFFF) 1893 - return IXGBE_ERR_EEPROM_VERSION; 1894 + return -EACCES; 1894 1895 1895 1896 /* get the firmware version */ 1896 1897 offset = fw_ptp_cfg_offset + IXGBE_FW_PATCH_VERSION_4; ··· 1904 1905 1905 1906 fw_version_err: 1906 1907 hw_err(hw, "eeprom read at offset %d failed\n", offset); 1907 - return IXGBE_ERR_EEPROM_VERSION; 1908 + return -EACCES; 1908 1909 } 1909 1910 1910 1911 /** ··· 2037 2038 2038 2039 if (!(anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK)) { 2039 2040 hw_dbg(hw, "auto negotiation not completed\n"); 2040 - ret_val = IXGBE_ERR_RESET_FAILED; 2041 + ret_val = -EIO; 2041 2042 goto reset_pipeline_out; 2042 2043 } 2043 2044 ··· 2086 2087 2087 2088 if (!timeout) { 2088 2089 hw_dbg(hw, "Driver can't access resource, acquiring I2C bus timeout.\n"); 2089 - status = IXGBE_ERR_I2C; 2090 + status = -EIO; 2090 2091 goto release_i2c_access; 2091 2092 } 2092 2093 } ··· 2140 2141 2141 2142 if (!timeout) { 2142 2143 hw_dbg(hw, "Driver can't access resource, acquiring I2C bus timeout.\n"); 2143 - status = IXGBE_ERR_I2C; 2144 + status = -EIO; 2144 2145 goto release_i2c_access; 2145 2146 } 2146 2147 }
+67 -78
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
··· 124 124 */ 125 125 if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { 126 126 hw_dbg(hw, "ixgbe_fc_rx_pause not valid in strict IEEE mode\n"); 127 - return IXGBE_ERR_INVALID_LINK_SETTINGS; 127 + return -EINVAL; 128 128 } 129 129 130 130 /* ··· 215 215 break; 216 216 default: 217 217 hw_dbg(hw, "Flow control param set incorrectly\n"); 218 - return IXGBE_ERR_CONFIG; 218 + return -EIO; 219 219 } 220 220 221 221 if (hw->mac.type != ixgbe_mac_X540) { ··· 500 500 501 501 if (pba_num == NULL) { 502 502 hw_dbg(hw, "PBA string buffer was null\n"); 503 - return IXGBE_ERR_INVALID_ARGUMENT; 503 + return -EINVAL; 504 504 } 505 505 506 506 ret_val = hw->eeprom.ops.read(hw, IXGBE_PBANUM0_PTR, &data); ··· 526 526 /* we will need 11 characters to store the PBA */ 527 527 if (pba_num_size < 11) { 528 528 hw_dbg(hw, "PBA string buffer too small\n"); 529 - return IXGBE_ERR_NO_SPACE; 529 + return -ENOSPC; 530 530 } 531 531 532 532 /* extract hex string from data and pba_ptr */ ··· 563 563 564 564 if (length == 0xFFFF || length == 0) { 565 565 hw_dbg(hw, "NVM PBA number section invalid length\n"); 566 - return IXGBE_ERR_PBA_SECTION; 566 + return -EIO; 567 567 } 568 568 569 569 /* check if pba_num buffer is big enough */ 570 570 if (pba_num_size < (((u32)length * 2) - 1)) { 571 571 hw_dbg(hw, "PBA string buffer too small\n"); 572 - return IXGBE_ERR_NO_SPACE; 572 + return -ENOSPC; 573 573 } 574 574 575 575 /* trim pba length from start of string */ ··· 805 805 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); 806 806 807 807 if (index > 3) 808 - return IXGBE_ERR_PARAM; 808 + return -EINVAL; 809 809 810 810 /* To turn on the LED, set mode to ON. */ 811 811 led_reg &= ~IXGBE_LED_MODE_MASK(index); ··· 826 826 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); 827 827 828 828 if (index > 3) 829 - return IXGBE_ERR_PARAM; 829 + return -EINVAL; 830 830 831 831 /* To turn off the LED, set mode to OFF. */ 832 832 led_reg &= ~IXGBE_LED_MODE_MASK(index); ··· 903 903 904 904 hw->eeprom.ops.init_params(hw); 905 905 906 - if (words == 0) 907 - return IXGBE_ERR_INVALID_ARGUMENT; 908 - 909 - if (offset + words > hw->eeprom.word_size) 910 - return IXGBE_ERR_EEPROM; 906 + if (words == 0 || (offset + words > hw->eeprom.word_size)) 907 + return -EINVAL; 911 908 912 909 /* 913 910 * The EEPROM page size cannot be queried from the chip. We do lazy ··· 958 961 959 962 if (ixgbe_ready_eeprom(hw) != 0) { 960 963 ixgbe_release_eeprom(hw); 961 - return IXGBE_ERR_EEPROM; 964 + return -EIO; 962 965 } 963 966 964 967 for (i = 0; i < words; i++) { ··· 1024 1027 hw->eeprom.ops.init_params(hw); 1025 1028 1026 1029 if (offset >= hw->eeprom.word_size) 1027 - return IXGBE_ERR_EEPROM; 1030 + return -EINVAL; 1028 1031 1029 1032 return ixgbe_write_eeprom_buffer_bit_bang(hw, offset, 1, &data); 1030 1033 } ··· 1046 1049 1047 1050 hw->eeprom.ops.init_params(hw); 1048 1051 1049 - if (words == 0) 1050 - return IXGBE_ERR_INVALID_ARGUMENT; 1051 - 1052 - if (offset + words > hw->eeprom.word_size) 1053 - return IXGBE_ERR_EEPROM; 1052 + if (words == 0 || (offset + words > hw->eeprom.word_size)) 1053 + return -EINVAL; 1054 1054 1055 1055 /* 1056 1056 * We cannot hold synchronization semaphores for too long ··· 1092 1098 1093 1099 if (ixgbe_ready_eeprom(hw) != 0) { 1094 1100 ixgbe_release_eeprom(hw); 1095 - return IXGBE_ERR_EEPROM; 1101 + return -EIO; 1096 1102 } 1097 1103 1098 1104 for (i = 0; i < words; i++) { ··· 1135 1141 hw->eeprom.ops.init_params(hw); 1136 1142 1137 1143 if (offset >= hw->eeprom.word_size) 1138 - return IXGBE_ERR_EEPROM; 1144 + return -EINVAL; 1139 1145 1140 1146 return ixgbe_read_eeprom_buffer_bit_bang(hw, offset, 1, data); 1141 1147 } ··· 1158 1164 1159 1165 hw->eeprom.ops.init_params(hw); 1160 1166 1161 - if (words == 0) 1162 - return IXGBE_ERR_INVALID_ARGUMENT; 1163 - 1164 - if (offset >= hw->eeprom.word_size) 1165 - return IXGBE_ERR_EEPROM; 1167 + if (words == 0 || offset >= hw->eeprom.word_size) 1168 + return -EINVAL; 1166 1169 1167 1170 for (i = 0; i < words; i++) { 1168 1171 eerd = ((offset + i) << IXGBE_EEPROM_RW_ADDR_SHIFT) | ··· 1252 1261 1253 1262 hw->eeprom.ops.init_params(hw); 1254 1263 1255 - if (words == 0) 1256 - return IXGBE_ERR_INVALID_ARGUMENT; 1257 - 1258 - if (offset >= hw->eeprom.word_size) 1259 - return IXGBE_ERR_EEPROM; 1264 + if (words == 0 || offset >= hw->eeprom.word_size) 1265 + return -EINVAL; 1260 1266 1261 1267 for (i = 0; i < words; i++) { 1262 1268 eewr = ((offset + i) << IXGBE_EEPROM_RW_ADDR_SHIFT) | ··· 1315 1327 } 1316 1328 udelay(5); 1317 1329 } 1318 - return IXGBE_ERR_EEPROM; 1330 + return -EIO; 1319 1331 } 1320 1332 1321 1333 /** ··· 1331 1343 u32 i; 1332 1344 1333 1345 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) != 0) 1334 - return IXGBE_ERR_SWFW_SYNC; 1346 + return -EBUSY; 1335 1347 1336 1348 eec = IXGBE_READ_REG(hw, IXGBE_EEC(hw)); 1337 1349 ··· 1353 1365 hw_dbg(hw, "Could not acquire EEPROM grant\n"); 1354 1366 1355 1367 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); 1356 - return IXGBE_ERR_EEPROM; 1368 + return -EIO; 1357 1369 } 1358 1370 1359 1371 /* Setup EEPROM for Read/Write */ ··· 1406 1418 swsm = IXGBE_READ_REG(hw, IXGBE_SWSM(hw)); 1407 1419 if (swsm & IXGBE_SWSM_SMBI) { 1408 1420 hw_dbg(hw, "Software semaphore SMBI between device drivers not granted.\n"); 1409 - return IXGBE_ERR_EEPROM; 1421 + return -EIO; 1410 1422 } 1411 1423 } 1412 1424 ··· 1434 1446 if (i >= timeout) { 1435 1447 hw_dbg(hw, "SWESMBI Software EEPROM semaphore not granted.\n"); 1436 1448 ixgbe_release_eeprom_semaphore(hw); 1437 - return IXGBE_ERR_EEPROM; 1449 + return -EIO; 1438 1450 } 1439 1451 1440 1452 return 0; ··· 1490 1502 */ 1491 1503 if (i >= IXGBE_EEPROM_MAX_RETRY_SPI) { 1492 1504 hw_dbg(hw, "SPI EEPROM Status error\n"); 1493 - return IXGBE_ERR_EEPROM; 1505 + return -EIO; 1494 1506 } 1495 1507 1496 1508 return 0; ··· 1702 1714 for (i = IXGBE_PCIE_ANALOG_PTR; i < IXGBE_FW_PTR; i++) { 1703 1715 if (hw->eeprom.ops.read(hw, i, &pointer)) { 1704 1716 hw_dbg(hw, "EEPROM read failed\n"); 1705 - return IXGBE_ERR_EEPROM; 1717 + return -EIO; 1706 1718 } 1707 1719 1708 1720 /* If the pointer seems invalid */ ··· 1711 1723 1712 1724 if (hw->eeprom.ops.read(hw, pointer, &length)) { 1713 1725 hw_dbg(hw, "EEPROM read failed\n"); 1714 - return IXGBE_ERR_EEPROM; 1726 + return -EIO; 1715 1727 } 1716 1728 1717 1729 if (length == 0xFFFF || length == 0) ··· 1720 1732 for (j = pointer + 1; j <= pointer + length; j++) { 1721 1733 if (hw->eeprom.ops.read(hw, j, &word)) { 1722 1734 hw_dbg(hw, "EEPROM read failed\n"); 1723 - return IXGBE_ERR_EEPROM; 1735 + return -EIO; 1724 1736 } 1725 1737 checksum += word; 1726 1738 } ··· 1773 1785 * calculated checksum 1774 1786 */ 1775 1787 if (read_checksum != checksum) 1776 - status = IXGBE_ERR_EEPROM_CHECKSUM; 1788 + status = -EIO; 1777 1789 1778 1790 /* If the user cares, return the calculated checksum */ 1779 1791 if (checksum_val) ··· 1832 1844 /* Make sure we are using a valid rar index range */ 1833 1845 if (index >= rar_entries) { 1834 1846 hw_dbg(hw, "RAR index %d is out of range.\n", index); 1835 - return IXGBE_ERR_INVALID_ARGUMENT; 1847 + return -EINVAL; 1836 1848 } 1837 1849 1838 1850 /* setup VMDq pool selection before this RAR gets enabled */ ··· 1884 1896 /* Make sure we are using a valid rar index range */ 1885 1897 if (index >= rar_entries) { 1886 1898 hw_dbg(hw, "RAR index %d is out of range.\n", index); 1887 - return IXGBE_ERR_INVALID_ARGUMENT; 1899 + return -EINVAL; 1888 1900 } 1889 1901 1890 1902 /* ··· 2133 2145 2134 2146 /* Validate the water mark configuration. */ 2135 2147 if (!hw->fc.pause_time) 2136 - return IXGBE_ERR_INVALID_LINK_SETTINGS; 2148 + return -EINVAL; 2137 2149 2138 2150 /* Low water mark of zero causes XOFF floods */ 2139 2151 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { ··· 2142 2154 if (!hw->fc.low_water[i] || 2143 2155 hw->fc.low_water[i] >= hw->fc.high_water[i]) { 2144 2156 hw_dbg(hw, "Invalid water mark configuration\n"); 2145 - return IXGBE_ERR_INVALID_LINK_SETTINGS; 2157 + return -EINVAL; 2146 2158 } 2147 2159 } 2148 2160 } ··· 2199 2211 break; 2200 2212 default: 2201 2213 hw_dbg(hw, "Flow control param set incorrectly\n"); 2202 - return IXGBE_ERR_CONFIG; 2214 + return -EIO; 2203 2215 } 2204 2216 2205 2217 /* Set 802.3x based flow control settings. */ ··· 2256 2268 u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm) 2257 2269 { 2258 2270 if ((!(adv_reg)) || (!(lp_reg))) 2259 - return IXGBE_ERR_FC_NOT_NEGOTIATED; 2271 + return -EINVAL; 2260 2272 2261 2273 if ((adv_reg & adv_sym) && (lp_reg & lp_sym)) { 2262 2274 /* ··· 2308 2320 linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); 2309 2321 if ((!!(linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) || 2310 2322 (!!(linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) 2311 - return IXGBE_ERR_FC_NOT_NEGOTIATED; 2323 + return -EIO; 2312 2324 2313 2325 pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); 2314 2326 pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP); ··· 2340 2352 */ 2341 2353 links = IXGBE_READ_REG(hw, IXGBE_LINKS); 2342 2354 if ((links & IXGBE_LINKS_KX_AN_COMP) == 0) 2343 - return IXGBE_ERR_FC_NOT_NEGOTIATED; 2355 + return -EIO; 2344 2356 2345 2357 if (hw->mac.type == ixgbe_mac_82599EB) { 2346 2358 links2 = IXGBE_READ_REG(hw, IXGBE_LINKS2); 2347 2359 if ((links2 & IXGBE_LINKS2_AN_SUPPORTED) == 0) 2348 - return IXGBE_ERR_FC_NOT_NEGOTIATED; 2360 + return -EIO; 2349 2361 } 2350 2362 /* 2351 2363 * Read the 10g AN autoc and LP ability registers and resolve ··· 2394 2406 **/ 2395 2407 void ixgbe_fc_autoneg(struct ixgbe_hw *hw) 2396 2408 { 2397 - s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; 2398 2409 ixgbe_link_speed speed; 2410 + s32 ret_val = -EIO; 2399 2411 bool link_up; 2400 2412 2401 2413 /* ··· 2497 2509 * @hw: pointer to hardware structure 2498 2510 * 2499 2511 * Disables PCI-Express primary access and verifies there are no pending 2500 - * requests. IXGBE_ERR_PRIMARY_REQUESTS_PENDING is returned if primary disable 2512 + * requests. -EALREADY is returned if primary disable 2501 2513 * bit hasn't caused the primary requests to be disabled, else 0 2502 2514 * is returned signifying primary requests disabled. 2503 2515 **/ ··· 2562 2574 } 2563 2575 2564 2576 hw_dbg(hw, "PCIe transaction pending bit also did not clear.\n"); 2565 - return IXGBE_ERR_PRIMARY_REQUESTS_PENDING; 2577 + return -EALREADY; 2566 2578 } 2567 2579 2568 2580 /** ··· 2587 2599 * SW_FW_SYNC bits (not just NVM) 2588 2600 */ 2589 2601 if (ixgbe_get_eeprom_semaphore(hw)) 2590 - return IXGBE_ERR_SWFW_SYNC; 2602 + return -EBUSY; 2591 2603 2592 2604 gssr = IXGBE_READ_REG(hw, IXGBE_GSSR); 2593 2605 if (!(gssr & (fwmask | swmask))) { ··· 2607 2619 ixgbe_release_swfw_sync(hw, gssr & (fwmask | swmask)); 2608 2620 2609 2621 usleep_range(5000, 10000); 2610 - return IXGBE_ERR_SWFW_SYNC; 2622 + return -EBUSY; 2611 2623 } 2612 2624 2613 2625 /** ··· 2744 2756 s32 ret_val; 2745 2757 2746 2758 if (index > 3) 2747 - return IXGBE_ERR_PARAM; 2759 + return -EINVAL; 2748 2760 2749 2761 /* 2750 2762 * Link must be up to auto-blink the LEDs; ··· 2790 2802 s32 ret_val; 2791 2803 2792 2804 if (index > 3) 2793 - return IXGBE_ERR_PARAM; 2805 + return -EINVAL; 2794 2806 2795 2807 ret_val = hw->mac.ops.prot_autoc_read(hw, &locked, &autoc_reg); 2796 2808 if (ret_val) ··· 2950 2962 /* Make sure we are using a valid rar index range */ 2951 2963 if (rar >= rar_entries) { 2952 2964 hw_dbg(hw, "RAR index %d is out of range.\n", rar); 2953 - return IXGBE_ERR_INVALID_ARGUMENT; 2965 + return -EINVAL; 2954 2966 } 2955 2967 2956 2968 mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); ··· 3001 3013 /* Make sure we are using a valid rar index range */ 3002 3014 if (rar >= rar_entries) { 3003 3015 hw_dbg(hw, "RAR index %d is out of range.\n", rar); 3004 - return IXGBE_ERR_INVALID_ARGUMENT; 3016 + return -EINVAL; 3005 3017 } 3006 3018 3007 3019 if (vmdq < 32) { ··· 3078 3090 * will simply bypass the VLVF if there are no entries present in the 3079 3091 * VLVF that contain our VLAN 3080 3092 */ 3081 - first_empty_slot = vlvf_bypass ? IXGBE_ERR_NO_SPACE : 0; 3093 + first_empty_slot = vlvf_bypass ? -ENOSPC : 0; 3082 3094 3083 3095 /* add VLAN enable bit for comparison */ 3084 3096 vlan |= IXGBE_VLVF_VIEN; ··· 3102 3114 if (!first_empty_slot) 3103 3115 hw_dbg(hw, "No space in VLVF.\n"); 3104 3116 3105 - return first_empty_slot ? : IXGBE_ERR_NO_SPACE; 3117 + return first_empty_slot ? : -ENOSPC; 3106 3118 } 3107 3119 3108 3120 /** ··· 3122 3134 s32 vlvf_index; 3123 3135 3124 3136 if ((vlan > 4095) || (vind > 63)) 3125 - return IXGBE_ERR_PARAM; 3137 + return -EINVAL; 3126 3138 3127 3139 /* 3128 3140 * this is a 2 part operation - first the VFTA, then the ··· 3598 3610 * 3599 3611 * Communicates with the manageability block. On success return 0 3600 3612 * else returns semaphore error when encountering an error acquiring 3601 - * semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails. 3613 + * semaphore, -EINVAL when incorrect parameters passed or -EIO when 3614 + * command fails. 3602 3615 * 3603 3616 * This function assumes that the IXGBE_GSSR_SW_MNG_SM semaphore is held 3604 3617 * by the caller. ··· 3612 3623 3613 3624 if (!length || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) { 3614 3625 hw_dbg(hw, "Buffer length failure buffersize-%d.\n", length); 3615 - return IXGBE_ERR_HOST_INTERFACE_COMMAND; 3626 + return -EINVAL; 3616 3627 } 3617 3628 3618 3629 /* Set bit 9 of FWSTS clearing FW reset indication */ ··· 3623 3634 hicr = IXGBE_READ_REG(hw, IXGBE_HICR); 3624 3635 if (!(hicr & IXGBE_HICR_EN)) { 3625 3636 hw_dbg(hw, "IXGBE_HOST_EN bit disabled.\n"); 3626 - return IXGBE_ERR_HOST_INTERFACE_COMMAND; 3637 + return -EIO; 3627 3638 } 3628 3639 3629 3640 /* Calculate length in DWORDs. We must be DWORD aligned */ 3630 3641 if (length % sizeof(u32)) { 3631 3642 hw_dbg(hw, "Buffer length failure, not aligned to dword"); 3632 - return IXGBE_ERR_INVALID_ARGUMENT; 3643 + return -EINVAL; 3633 3644 } 3634 3645 3635 3646 dword_len = length >> 2; ··· 3654 3665 /* Check command successful completion. */ 3655 3666 if ((timeout && i == timeout) || 3656 3667 !(IXGBE_READ_REG(hw, IXGBE_HICR) & IXGBE_HICR_SV)) 3657 - return IXGBE_ERR_HOST_INTERFACE_COMMAND; 3668 + return -EIO; 3658 3669 3659 3670 return 0; 3660 3671 } ··· 3674 3685 * in these cases. 3675 3686 * 3676 3687 * Communicates with the manageability block. On success return 0 3677 - * else return IXGBE_ERR_HOST_INTERFACE_COMMAND. 3688 + * else return -EIO or -EINVAL. 3678 3689 **/ 3679 3690 s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, void *buffer, 3680 3691 u32 length, u32 timeout, ··· 3689 3700 3690 3701 if (!length || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) { 3691 3702 hw_dbg(hw, "Buffer length failure buffersize-%d.\n", length); 3692 - return IXGBE_ERR_HOST_INTERFACE_COMMAND; 3703 + return -EINVAL; 3693 3704 } 3694 3705 /* Take management host interface semaphore */ 3695 3706 status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM); ··· 3719 3730 3720 3731 if (length < round_up(buf_len, 4) + hdr_size) { 3721 3732 hw_dbg(hw, "Buffer not large enough for reply message.\n"); 3722 - status = IXGBE_ERR_HOST_INTERFACE_COMMAND; 3733 + status = -EIO; 3723 3734 goto rel_out; 3724 3735 } 3725 3736 ··· 3750 3761 * 3751 3762 * Sends driver version number to firmware through the manageability 3752 3763 * block. On success return 0 3753 - * else returns IXGBE_ERR_SWFW_SYNC when encountering an error acquiring 3754 - * semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails. 3764 + * else returns -EBUSY when encountering an error acquiring 3765 + * semaphore or -EIO when command fails. 3755 3766 **/ 3756 3767 s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min, 3757 3768 u8 build, u8 sub, __always_unused u16 len, ··· 3787 3798 FW_CEM_RESP_STATUS_SUCCESS) 3788 3799 ret_val = 0; 3789 3800 else 3790 - ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND; 3801 + ret_val = -EIO; 3791 3802 3792 3803 break; 3793 3804 } ··· 3885 3896 return status; 3886 3897 3887 3898 if ((*ets_offset == 0x0000) || (*ets_offset == 0xFFFF)) 3888 - return IXGBE_NOT_IMPLEMENTED; 3899 + return -EOPNOTSUPP; 3889 3900 3890 3901 status = hw->eeprom.ops.read(hw, *ets_offset, ets_cfg); 3891 3902 if (status) 3892 3903 return status; 3893 3904 3894 3905 if ((*ets_cfg & IXGBE_ETS_TYPE_MASK) != IXGBE_ETS_TYPE_EMC_SHIFTED) 3895 - return IXGBE_NOT_IMPLEMENTED; 3906 + return -EOPNOTSUPP; 3896 3907 3897 3908 return 0; 3898 3909 } ··· 3915 3926 3916 3927 /* Only support thermal sensors attached to physical port 0 */ 3917 3928 if ((IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)) 3918 - return IXGBE_NOT_IMPLEMENTED; 3929 + return -EOPNOTSUPP; 3919 3930 3920 3931 status = ixgbe_get_ets_data(hw, &ets_cfg, &ets_offset); 3921 3932 if (status) ··· 3975 3986 3976 3987 /* Only support thermal sensors attached to physical port 0 */ 3977 3988 if ((IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)) 3978 - return IXGBE_NOT_IMPLEMENTED; 3989 + return -EOPNOTSUPP; 3979 3990 3980 3991 status = ixgbe_get_ets_data(hw, &ets_cfg, &ets_offset); 3981 3992 if (status)
+1 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
··· 3372 3372 { 3373 3373 struct ixgbe_adapter *adapter = netdev_priv(dev); 3374 3374 struct ixgbe_hw *hw = &adapter->hw; 3375 - s32 status = IXGBE_ERR_PHY_ADDR_INVALID; 3375 + s32 status = -EFAULT; 3376 3376 u8 databyte = 0xFF; 3377 3377 int i = 0; 3378 3378
+19 -23
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 2756 2756 { 2757 2757 struct ixgbe_hw *hw = &adapter->hw; 2758 2758 u32 eicr = adapter->interrupt_event; 2759 - s32 rc; 2760 2759 2761 2760 if (test_bit(__IXGBE_DOWN, &adapter->state)) 2762 2761 return; ··· 2789 2790 } 2790 2791 2791 2792 /* Check if this is not due to overtemp */ 2792 - if (hw->phy.ops.check_overtemp(hw) != IXGBE_ERR_OVERTEMP) 2793 + if (!hw->phy.ops.check_overtemp(hw)) 2793 2794 return; 2794 2795 2795 2796 break; 2796 2797 case IXGBE_DEV_ID_X550EM_A_1G_T: 2797 2798 case IXGBE_DEV_ID_X550EM_A_1G_T_L: 2798 - rc = hw->phy.ops.check_overtemp(hw); 2799 - if (rc != IXGBE_ERR_OVERTEMP) 2799 + if (!hw->phy.ops.check_overtemp(hw)) 2800 2800 return; 2801 2801 break; 2802 2802 default: ··· 5510 5512 { 5511 5513 u32 speed; 5512 5514 bool autoneg, link_up = false; 5513 - int ret = IXGBE_ERR_LINK_SETUP; 5515 + int ret = -EIO; 5514 5516 5515 5517 if (hw->mac.ops.check_link) 5516 5518 ret = hw->mac.ops.check_link(hw, &speed, &link_up, false); ··· 5981 5983 err = hw->mac.ops.init_hw(hw); 5982 5984 switch (err) { 5983 5985 case 0: 5984 - case IXGBE_ERR_SFP_NOT_PRESENT: 5985 - case IXGBE_ERR_SFP_NOT_SUPPORTED: 5986 + case -ENOENT: 5987 + case -EOPNOTSUPP: 5986 5988 break; 5987 - case IXGBE_ERR_PRIMARY_REQUESTS_PENDING: 5989 + case -EALREADY: 5988 5990 e_dev_err("primary disable timed out\n"); 5989 5991 break; 5990 - case IXGBE_ERR_EEPROM_VERSION: 5992 + case -EACCES: 5991 5993 /* We are running on a pre-production device, log a warning */ 5992 5994 e_dev_warn("This device is a pre-production adapter/LOM. " 5993 5995 "Please be aware there may be issues associated with " ··· 7827 7829 adapter->sfp_poll_time = jiffies + IXGBE_SFP_POLL_JIFFIES - 1; 7828 7830 7829 7831 err = hw->phy.ops.identify_sfp(hw); 7830 - if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) 7832 + if (err == -EOPNOTSUPP) 7831 7833 goto sfp_out; 7832 7834 7833 - if (err == IXGBE_ERR_SFP_NOT_PRESENT) { 7835 + if (err == -ENOENT) { 7834 7836 /* If no cable is present, then we need to reset 7835 7837 * the next time we find a good cable. */ 7836 7838 adapter->flags2 |= IXGBE_FLAG2_SFP_NEEDS_RESET; ··· 7856 7858 else 7857 7859 err = hw->mac.ops.setup_sfp(hw); 7858 7860 7859 - if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) 7861 + if (err == -EOPNOTSUPP) 7860 7862 goto sfp_out; 7861 7863 7862 7864 adapter->flags |= IXGBE_FLAG_NEED_LINK_CONFIG; ··· 7865 7867 sfp_out: 7866 7868 clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); 7867 7869 7868 - if ((err == IXGBE_ERR_SFP_NOT_SUPPORTED) && 7869 - (adapter->netdev->reg_state == NETREG_REGISTERED)) { 7870 + if (err == -EOPNOTSUPP && 7871 + adapter->netdev->reg_state == NETREG_REGISTERED) { 7870 7872 e_dev_err("failed to initialize because an unsupported " 7871 7873 "SFP+ module type was detected.\n"); 7872 7874 e_dev_err("Reload the driver after installing a " ··· 7936 7938 static void ixgbe_phy_interrupt_subtask(struct ixgbe_adapter *adapter) 7937 7939 { 7938 7940 struct ixgbe_hw *hw = &adapter->hw; 7939 - u32 status; 7941 + bool overtemp; 7940 7942 7941 7943 if (!(adapter->flags2 & IXGBE_FLAG2_PHY_INTERRUPT)) 7942 7944 return; ··· 7946 7948 if (!hw->phy.ops.handle_lasi) 7947 7949 return; 7948 7950 7949 - status = hw->phy.ops.handle_lasi(&adapter->hw); 7950 - if (status != IXGBE_ERR_OVERTEMP) 7951 - return; 7952 - 7953 - e_crit(drv, "%s\n", ixgbe_overheat_msg); 7951 + hw->phy.ops.handle_lasi(&adapter->hw, &overtemp); 7952 + if (overtemp) 7953 + e_crit(drv, "%s\n", ixgbe_overheat_msg); 7954 7954 } 7955 7955 7956 7956 static void ixgbe_reset_subtask(struct ixgbe_adapter *adapter) ··· 10918 10922 err = hw->mac.ops.reset_hw(hw); 10919 10923 hw->phy.reset_if_overtemp = false; 10920 10924 ixgbe_set_eee_capable(adapter); 10921 - if (err == IXGBE_ERR_SFP_NOT_PRESENT) { 10925 + if (err == -ENOENT) { 10922 10926 err = 0; 10923 - } else if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { 10927 + } else if (err == -EOPNOTSUPP) { 10924 10928 e_dev_err("failed to load because an unsupported SFP+ or QSFP module type was detected.\n"); 10925 10929 e_dev_err("Reload the driver after installing a supported module.\n"); 10926 10930 goto err_sw_init; ··· 11139 11143 11140 11144 /* reset the hardware with the new settings */ 11141 11145 err = hw->mac.ops.start_hw(hw); 11142 - if (err == IXGBE_ERR_EEPROM_VERSION) { 11146 + if (err == -EACCES) { 11143 11147 /* We are running on a pre-production device, log a warning */ 11144 11148 e_dev_warn("This device is a pre-production adapter/LOM. " 11145 11149 "Please be aware there may be issues associated "
+17 -17
drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c
··· 24 24 size = mbx->size; 25 25 26 26 if (!mbx->ops) 27 - return IXGBE_ERR_MBX; 27 + return -EIO; 28 28 29 29 return mbx->ops->read(hw, msg, size, mbx_id); 30 30 } ··· 43 43 struct ixgbe_mbx_info *mbx = &hw->mbx; 44 44 45 45 if (size > mbx->size) 46 - return IXGBE_ERR_MBX; 46 + return -EINVAL; 47 47 48 48 if (!mbx->ops) 49 - return IXGBE_ERR_MBX; 49 + return -EIO; 50 50 51 51 return mbx->ops->write(hw, msg, size, mbx_id); 52 52 } ··· 63 63 struct ixgbe_mbx_info *mbx = &hw->mbx; 64 64 65 65 if (!mbx->ops) 66 - return IXGBE_ERR_MBX; 66 + return -EIO; 67 67 68 68 return mbx->ops->check_for_msg(hw, mbx_id); 69 69 } ··· 80 80 struct ixgbe_mbx_info *mbx = &hw->mbx; 81 81 82 82 if (!mbx->ops) 83 - return IXGBE_ERR_MBX; 83 + return -EIO; 84 84 85 85 return mbx->ops->check_for_ack(hw, mbx_id); 86 86 } ··· 97 97 struct ixgbe_mbx_info *mbx = &hw->mbx; 98 98 99 99 if (!mbx->ops) 100 - return IXGBE_ERR_MBX; 100 + return -EIO; 101 101 102 102 return mbx->ops->check_for_rst(hw, mbx_id); 103 103 } ··· 115 115 int countdown = mbx->timeout; 116 116 117 117 if (!countdown || !mbx->ops) 118 - return IXGBE_ERR_MBX; 118 + return -EIO; 119 119 120 120 while (mbx->ops->check_for_msg(hw, mbx_id)) { 121 121 countdown--; 122 122 if (!countdown) 123 - return IXGBE_ERR_MBX; 123 + return -EIO; 124 124 udelay(mbx->usec_delay); 125 125 } 126 126 ··· 140 140 int countdown = mbx->timeout; 141 141 142 142 if (!countdown || !mbx->ops) 143 - return IXGBE_ERR_MBX; 143 + return -EIO; 144 144 145 145 while (mbx->ops->check_for_ack(hw, mbx_id)) { 146 146 countdown--; 147 147 if (!countdown) 148 - return IXGBE_ERR_MBX; 148 + return -EIO; 149 149 udelay(mbx->usec_delay); 150 150 } 151 151 ··· 169 169 s32 ret_val; 170 170 171 171 if (!mbx->ops) 172 - return IXGBE_ERR_MBX; 172 + return -EIO; 173 173 174 174 ret_val = ixgbe_poll_for_msg(hw, mbx_id); 175 175 if (ret_val) ··· 197 197 198 198 /* exit if either we can't write or there isn't a defined timeout */ 199 199 if (!mbx->ops || !mbx->timeout) 200 - return IXGBE_ERR_MBX; 200 + return -EIO; 201 201 202 202 /* send msg */ 203 203 ret_val = mbx->ops->write(hw, msg, size, mbx_id); ··· 217 217 return 0; 218 218 } 219 219 220 - return IXGBE_ERR_MBX; 220 + return -EIO; 221 221 } 222 222 223 223 /** ··· 238 238 return 0; 239 239 } 240 240 241 - return IXGBE_ERR_MBX; 241 + return -EIO; 242 242 } 243 243 244 244 /** ··· 259 259 return 0; 260 260 } 261 261 262 - return IXGBE_ERR_MBX; 262 + return -EIO; 263 263 } 264 264 265 265 /** ··· 295 295 return 0; 296 296 } 297 297 298 - return IXGBE_ERR_MBX; 298 + return -EIO; 299 299 } 300 300 301 301 /** ··· 317 317 if (p2v_mailbox & IXGBE_PFMAILBOX_PFU) 318 318 return 0; 319 319 320 - return IXGBE_ERR_MBX; 320 + return -EIO; 321 321 } 322 322 323 323 /**
-1
drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
··· 7 7 #include "ixgbe_type.h" 8 8 9 9 #define IXGBE_VFMAILBOX_SIZE 16 /* 16 32 bit words - 64 bytes */ 10 - #define IXGBE_ERR_MBX -100 11 10 12 11 #define IXGBE_VFMAILBOX 0x002FC 13 12 #define IXGBE_VFMBMEM 0x00200
+53 -52
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
··· 102 102 csum = ~csum; 103 103 do { 104 104 if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) 105 - return IXGBE_ERR_SWFW_SYNC; 105 + return -EBUSY; 106 106 ixgbe_i2c_start(hw); 107 107 /* Device Address and write indication */ 108 108 if (ixgbe_out_i2c_byte_ack(hw, addr)) ··· 150 150 hw_dbg(hw, "I2C byte read combined error.\n"); 151 151 } while (retry < max_retry); 152 152 153 - return IXGBE_ERR_I2C; 153 + return -EIO; 154 154 } 155 155 156 156 /** ··· 179 179 csum = ~csum; 180 180 do { 181 181 if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) 182 - return IXGBE_ERR_SWFW_SYNC; 182 + return -EBUSY; 183 183 ixgbe_i2c_start(hw); 184 184 /* Device Address and write indication */ 185 185 if (ixgbe_out_i2c_byte_ack(hw, addr)) ··· 215 215 hw_dbg(hw, "I2C byte write combined error.\n"); 216 216 } while (retry < max_retry); 217 217 218 - return IXGBE_ERR_I2C; 218 + return -EIO; 219 219 } 220 220 221 221 /** ··· 262 262 **/ 263 263 s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw) 264 264 { 265 + u32 status = -EFAULT; 265 266 u32 phy_addr; 266 - u32 status = IXGBE_ERR_PHY_ADDR_INVALID; 267 267 268 268 if (!hw->phy.phy_semaphore_mask) { 269 269 if (hw->bus.lan_id) ··· 281 281 if (ixgbe_probe_phy(hw, phy_addr)) 282 282 return 0; 283 283 else 284 - return IXGBE_ERR_PHY_ADDR_INVALID; 284 + return -EFAULT; 285 285 } 286 286 287 287 for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) { ··· 407 407 return status; 408 408 409 409 /* Don't reset PHY if it's shut down due to overtemp. */ 410 - if (!hw->phy.reset_if_overtemp && 411 - (IXGBE_ERR_OVERTEMP == hw->phy.ops.check_overtemp(hw))) 410 + if (!hw->phy.reset_if_overtemp && hw->phy.ops.check_overtemp(hw)) 412 411 return 0; 413 412 414 413 /* Blocked by MNG FW so bail */ ··· 455 456 456 457 if (ctrl & MDIO_CTRL1_RESET) { 457 458 hw_dbg(hw, "PHY reset polling failed to complete.\n"); 458 - return IXGBE_ERR_RESET_FAILED; 459 + return -EIO; 459 460 } 460 461 461 462 return 0; ··· 498 499 499 500 if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) { 500 501 hw_dbg(hw, "PHY address command did not complete.\n"); 501 - return IXGBE_ERR_PHY; 502 + return -EIO; 502 503 } 503 504 504 505 /* Address cycle complete, setup and write the read ··· 525 526 526 527 if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) { 527 528 hw_dbg(hw, "PHY read command didn't complete\n"); 528 - return IXGBE_ERR_PHY; 529 + return -EIO; 529 530 } 530 531 531 532 /* Read operation is complete. Get the data ··· 557 558 phy_data); 558 559 hw->mac.ops.release_swfw_sync(hw, gssr); 559 560 } else { 560 - return IXGBE_ERR_SWFW_SYNC; 561 + return -EBUSY; 561 562 } 562 563 563 564 return status; ··· 602 603 603 604 if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) { 604 605 hw_dbg(hw, "PHY address cmd didn't complete\n"); 605 - return IXGBE_ERR_PHY; 606 + return -EIO; 606 607 } 607 608 608 609 /* ··· 630 631 631 632 if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) { 632 633 hw_dbg(hw, "PHY write cmd didn't complete\n"); 633 - return IXGBE_ERR_PHY; 634 + return -EIO; 634 635 } 635 636 636 637 return 0; ··· 655 656 phy_data); 656 657 hw->mac.ops.release_swfw_sync(hw, gssr); 657 658 } else { 658 - return IXGBE_ERR_SWFW_SYNC; 659 + return -EBUSY; 659 660 } 660 661 661 662 return status; ··· 1428 1429 1429 1430 if ((phy_data & MDIO_CTRL1_RESET) != 0) { 1430 1431 hw_dbg(hw, "PHY reset did not complete.\n"); 1431 - return IXGBE_ERR_PHY; 1432 + return -EIO; 1432 1433 } 1433 1434 1434 1435 /* Get init offsets */ ··· 1484 1485 hw_dbg(hw, "SOL\n"); 1485 1486 } else { 1486 1487 hw_dbg(hw, "Bad control value\n"); 1487 - return IXGBE_ERR_PHY; 1488 + return -EIO; 1488 1489 } 1489 1490 break; 1490 1491 default: 1491 1492 hw_dbg(hw, "Bad control type\n"); 1492 - return IXGBE_ERR_PHY; 1493 + return -EIO; 1493 1494 } 1494 1495 } 1495 1496 ··· 1497 1498 1498 1499 err_eeprom: 1499 1500 hw_err(hw, "eeprom read at offset %d failed\n", data_offset); 1500 - return IXGBE_ERR_PHY; 1501 + return -EIO; 1501 1502 } 1502 1503 1503 1504 /** ··· 1515 1516 return ixgbe_identify_qsfp_module_generic(hw); 1516 1517 default: 1517 1518 hw->phy.sfp_type = ixgbe_sfp_type_not_present; 1518 - return IXGBE_ERR_SFP_NOT_PRESENT; 1519 + return -ENOENT; 1519 1520 } 1520 1521 1521 - return IXGBE_ERR_SFP_NOT_PRESENT; 1522 + return -ENOENT; 1522 1523 } 1523 1524 1524 1525 /** ··· 1543 1544 1544 1545 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber) { 1545 1546 hw->phy.sfp_type = ixgbe_sfp_type_not_present; 1546 - return IXGBE_ERR_SFP_NOT_PRESENT; 1547 + return -ENOENT; 1547 1548 } 1548 1549 1549 1550 /* LAN ID is needed for sfp_type determination */ ··· 1558 1559 1559 1560 if (identifier != IXGBE_SFF_IDENTIFIER_SFP) { 1560 1561 hw->phy.type = ixgbe_phy_sfp_unsupported; 1561 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 1562 + return -EOPNOTSUPP; 1562 1563 } 1563 1564 status = hw->phy.ops.read_i2c_eeprom(hw, 1564 1565 IXGBE_SFF_1GBE_COMP_CODES, ··· 1749 1750 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || 1750 1751 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) { 1751 1752 hw->phy.type = ixgbe_phy_sfp_unsupported; 1752 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 1753 + return -EOPNOTSUPP; 1753 1754 } 1754 1755 1755 1756 /* Anything else 82598-based is supported */ ··· 1773 1774 } 1774 1775 hw_dbg(hw, "SFP+ module not supported\n"); 1775 1776 hw->phy.type = ixgbe_phy_sfp_unsupported; 1776 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 1777 + return -EOPNOTSUPP; 1777 1778 } 1778 1779 return 0; 1779 1780 ··· 1783 1784 hw->phy.id = 0; 1784 1785 hw->phy.type = ixgbe_phy_unknown; 1785 1786 } 1786 - return IXGBE_ERR_SFP_NOT_PRESENT; 1787 + return -ENOENT; 1787 1788 } 1788 1789 1789 1790 /** ··· 1810 1811 1811 1812 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber_qsfp) { 1812 1813 hw->phy.sfp_type = ixgbe_sfp_type_not_present; 1813 - return IXGBE_ERR_SFP_NOT_PRESENT; 1814 + return -ENOENT; 1814 1815 } 1815 1816 1816 1817 /* LAN ID is needed for sfp_type determination */ ··· 1824 1825 1825 1826 if (identifier != IXGBE_SFF_IDENTIFIER_QSFP_PLUS) { 1826 1827 hw->phy.type = ixgbe_phy_sfp_unsupported; 1827 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 1828 + return -EOPNOTSUPP; 1828 1829 } 1829 1830 1830 1831 hw->phy.id = identifier; ··· 1892 1893 } else { 1893 1894 /* unsupported module type */ 1894 1895 hw->phy.type = ixgbe_phy_sfp_unsupported; 1895 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 1896 + return -EOPNOTSUPP; 1896 1897 } 1897 1898 } 1898 1899 ··· 1952 1953 } 1953 1954 hw_dbg(hw, "QSFP module not supported\n"); 1954 1955 hw->phy.type = ixgbe_phy_sfp_unsupported; 1955 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 1956 + return -EOPNOTSUPP; 1956 1957 } 1957 1958 return 0; 1958 1959 } ··· 1963 1964 hw->phy.id = 0; 1964 1965 hw->phy.type = ixgbe_phy_unknown; 1965 1966 1966 - return IXGBE_ERR_SFP_NOT_PRESENT; 1967 + return -ENOENT; 1967 1968 } 1968 1969 1969 1970 /** ··· 1983 1984 u16 sfp_type = hw->phy.sfp_type; 1984 1985 1985 1986 if (hw->phy.sfp_type == ixgbe_sfp_type_unknown) 1986 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 1987 + return -EOPNOTSUPP; 1987 1988 1988 1989 if (hw->phy.sfp_type == ixgbe_sfp_type_not_present) 1989 - return IXGBE_ERR_SFP_NOT_PRESENT; 1990 + return -ENOENT; 1990 1991 1991 1992 if ((hw->device_id == IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM) && 1992 1993 (hw->phy.sfp_type == ixgbe_sfp_type_da_cu)) 1993 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 1994 + return -EOPNOTSUPP; 1994 1995 1995 1996 /* 1996 1997 * Limiting active cables and 1G Phys must be initialized as ··· 2011 2012 if (hw->eeprom.ops.read(hw, IXGBE_PHY_INIT_OFFSET_NL, list_offset)) { 2012 2013 hw_err(hw, "eeprom read at %d failed\n", 2013 2014 IXGBE_PHY_INIT_OFFSET_NL); 2014 - return IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT; 2015 + return -EIO; 2015 2016 } 2016 2017 2017 2018 if ((!*list_offset) || (*list_offset == 0xFFFF)) 2018 - return IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT; 2019 + return -EIO; 2019 2020 2020 2021 /* Shift offset to first ID word */ 2021 2022 (*list_offset)++; ··· 2034 2035 goto err_phy; 2035 2036 if ((!*data_offset) || (*data_offset == 0xFFFF)) { 2036 2037 hw_dbg(hw, "SFP+ module not supported\n"); 2037 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 2038 + return -EOPNOTSUPP; 2038 2039 } else { 2039 2040 break; 2040 2041 } ··· 2047 2048 2048 2049 if (sfp_id == IXGBE_PHY_INIT_END_NL) { 2049 2050 hw_dbg(hw, "No matching SFP+ module found\n"); 2050 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 2051 + return -EOPNOTSUPP; 2051 2052 } 2052 2053 2053 2054 return 0; 2054 2055 2055 2056 err_phy: 2056 2057 hw_err(hw, "eeprom read at offset %d failed\n", *list_offset); 2057 - return IXGBE_ERR_PHY; 2058 + return -EIO; 2058 2059 } 2059 2060 2060 2061 /** ··· 2149 2150 2150 2151 do { 2151 2152 if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) 2152 - return IXGBE_ERR_SWFW_SYNC; 2153 + return -EBUSY; 2153 2154 2154 2155 ixgbe_i2c_start(hw); 2155 2156 ··· 2265 2266 u32 swfw_mask = hw->phy.phy_semaphore_mask; 2266 2267 2267 2268 if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) 2268 - return IXGBE_ERR_SWFW_SYNC; 2269 + return -EBUSY; 2269 2270 2270 2271 do { 2271 2272 ixgbe_i2c_start(hw); ··· 2507 2508 2508 2509 if (ack == 1) { 2509 2510 hw_dbg(hw, "I2C ack was not received.\n"); 2510 - status = IXGBE_ERR_I2C; 2511 + status = -EIO; 2511 2512 } 2512 2513 2513 2514 ixgbe_lower_i2c_clk(hw, &i2cctl); ··· 2579 2580 udelay(IXGBE_I2C_T_LOW); 2580 2581 } else { 2581 2582 hw_dbg(hw, "I2C data was not set to %X\n", data); 2582 - return IXGBE_ERR_I2C; 2583 + return -EIO; 2583 2584 } 2584 2585 2585 2586 return 0; ··· 2675 2676 *i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL(hw)); 2676 2677 if (data != ixgbe_get_i2c_data(hw, i2cctl)) { 2677 2678 hw_dbg(hw, "Error - I2C data was not set to %X.\n", data); 2678 - return IXGBE_ERR_I2C; 2679 + return -EIO; 2679 2680 } 2680 2681 2681 2682 return 0; ··· 2745 2746 * @hw: pointer to hardware structure 2746 2747 * 2747 2748 * Checks if the LASI temp alarm status was triggered due to overtemp 2749 + * 2750 + * Return true when an overtemp event detected, otherwise false. 2748 2751 **/ 2749 - s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw) 2752 + bool ixgbe_tn_check_overtemp(struct ixgbe_hw *hw) 2750 2753 { 2751 2754 u16 phy_data = 0; 2755 + u32 status; 2752 2756 2753 2757 if (hw->device_id != IXGBE_DEV_ID_82599_T3_LOM) 2754 - return 0; 2758 + return false; 2755 2759 2756 2760 /* Check that the LASI temp alarm status was triggered */ 2757 - hw->phy.ops.read_reg(hw, IXGBE_TN_LASI_STATUS_REG, 2758 - MDIO_MMD_PMAPMD, &phy_data); 2761 + status = hw->phy.ops.read_reg(hw, IXGBE_TN_LASI_STATUS_REG, 2762 + MDIO_MMD_PMAPMD, &phy_data); 2763 + if (status) 2764 + return false; 2759 2765 2760 - if (!(phy_data & IXGBE_TN_LASI_STATUS_TEMP_ALARM)) 2761 - return 0; 2762 - 2763 - return IXGBE_ERR_OVERTEMP; 2766 + return !!(phy_data & IXGBE_TN_LASI_STATUS_TEMP_ALARM); 2764 2767 } 2765 2768 2766 2769 /** ixgbe_set_copper_phy_power - Control power for copper phy
+1 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h
··· 155 155 s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, 156 156 u16 *list_offset, 157 157 u16 *data_offset); 158 - s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw); 158 + bool ixgbe_tn_check_overtemp(struct ixgbe_hw *hw); 159 159 s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, 160 160 u8 dev_addr, u8 *data); 161 161 s32 ixgbe_read_i2c_byte_generic_unlocked(struct ixgbe_hw *hw, u8 byte_offset,
+2 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
··· 1325 1325 break; 1326 1326 default: 1327 1327 e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]); 1328 - retval = IXGBE_ERR_MBX; 1328 + retval = -EIO; 1329 1329 break; 1330 1330 } 1331 1331 ··· 1847 1847 ivi->spoofchk = adapter->vfinfo[vf].spoofchk_enabled; 1848 1848 ivi->rss_query_en = adapter->vfinfo[vf].rss_query_enabled; 1849 1849 ivi->trusted = adapter->vfinfo[vf].trusted; 1850 + ivi->linkstate = adapter->vfinfo[vf].link_state; 1850 1851 return 0; 1851 1852 }
+2 -41
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
··· 3509 3509 s32 (*read_i2c_sff8472)(struct ixgbe_hw *, u8 , u8 *); 3510 3510 s32 (*read_i2c_eeprom)(struct ixgbe_hw *, u8 , u8 *); 3511 3511 s32 (*write_i2c_eeprom)(struct ixgbe_hw *, u8, u8); 3512 - s32 (*check_overtemp)(struct ixgbe_hw *); 3512 + bool (*check_overtemp)(struct ixgbe_hw *); 3513 3513 s32 (*set_phy_power)(struct ixgbe_hw *, bool on); 3514 3514 s32 (*enter_lplu)(struct ixgbe_hw *); 3515 - s32 (*handle_lasi)(struct ixgbe_hw *hw); 3515 + s32 (*handle_lasi)(struct ixgbe_hw *hw, bool *); 3516 3516 s32 (*read_i2c_byte_unlocked)(struct ixgbe_hw *, u8 offset, u8 addr, 3517 3517 u8 *value); 3518 3518 s32 (*write_i2c_byte_unlocked)(struct ixgbe_hw *, u8 offset, u8 addr, ··· 3664 3664 const struct ixgbe_link_operations *link_ops; 3665 3665 const u32 *mvals; 3666 3666 }; 3667 - 3668 - 3669 - /* Error Codes */ 3670 - #define IXGBE_ERR_EEPROM -1 3671 - #define IXGBE_ERR_EEPROM_CHECKSUM -2 3672 - #define IXGBE_ERR_PHY -3 3673 - #define IXGBE_ERR_CONFIG -4 3674 - #define IXGBE_ERR_PARAM -5 3675 - #define IXGBE_ERR_MAC_TYPE -6 3676 - #define IXGBE_ERR_UNKNOWN_PHY -7 3677 - #define IXGBE_ERR_LINK_SETUP -8 3678 - #define IXGBE_ERR_ADAPTER_STOPPED -9 3679 - #define IXGBE_ERR_INVALID_MAC_ADDR -10 3680 - #define IXGBE_ERR_DEVICE_NOT_SUPPORTED -11 3681 - #define IXGBE_ERR_PRIMARY_REQUESTS_PENDING -12 3682 - #define IXGBE_ERR_INVALID_LINK_SETTINGS -13 3683 - #define IXGBE_ERR_AUTONEG_NOT_COMPLETE -14 3684 - #define IXGBE_ERR_RESET_FAILED -15 3685 - #define IXGBE_ERR_SWFW_SYNC -16 3686 - #define IXGBE_ERR_PHY_ADDR_INVALID -17 3687 - #define IXGBE_ERR_I2C -18 3688 - #define IXGBE_ERR_SFP_NOT_SUPPORTED -19 3689 - #define IXGBE_ERR_SFP_NOT_PRESENT -20 3690 - #define IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT -21 3691 - #define IXGBE_ERR_NO_SAN_ADDR_PTR -22 3692 - #define IXGBE_ERR_FDIR_REINIT_FAILED -23 3693 - #define IXGBE_ERR_EEPROM_VERSION -24 3694 - #define IXGBE_ERR_NO_SPACE -25 3695 - #define IXGBE_ERR_OVERTEMP -26 3696 - #define IXGBE_ERR_FC_NOT_NEGOTIATED -27 3697 - #define IXGBE_ERR_FC_NOT_SUPPORTED -28 3698 - #define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30 3699 - #define IXGBE_ERR_PBA_SECTION -31 3700 - #define IXGBE_ERR_INVALID_ARGUMENT -32 3701 - #define IXGBE_ERR_HOST_INTERFACE_COMMAND -33 3702 - #define IXGBE_ERR_FDIR_CMD_INCOMPLETE -38 3703 - #define IXGBE_ERR_FW_RESP_INVALID -39 3704 - #define IXGBE_ERR_TOKEN_RETRY -40 3705 - #define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF 3706 3667 3707 3668 #define IXGBE_FUSES0_GROUP(_i) (0x11158 + ((_i) * 4)) 3708 3669 #define IXGBE_FUSES0_300MHZ BIT(5)
+22 -22
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c
··· 84 84 status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); 85 85 if (status) { 86 86 hw_dbg(hw, "semaphore failed with %d", status); 87 - return IXGBE_ERR_SWFW_SYNC; 87 + return -EBUSY; 88 88 } 89 89 90 90 ctrl = IXGBE_CTRL_RST; ··· 103 103 } 104 104 105 105 if (ctrl & IXGBE_CTRL_RST_MASK) { 106 - status = IXGBE_ERR_RESET_FAILED; 106 + status = -EIO; 107 107 hw_dbg(hw, "Reset polling failed to complete.\n"); 108 108 } 109 109 msleep(100); ··· 220 220 s32 status; 221 221 222 222 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM)) 223 - return IXGBE_ERR_SWFW_SYNC; 223 + return -EBUSY; 224 224 225 225 status = ixgbe_read_eerd_generic(hw, offset, data); 226 226 ··· 243 243 s32 status; 244 244 245 245 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM)) 246 - return IXGBE_ERR_SWFW_SYNC; 246 + return -EBUSY; 247 247 248 248 status = ixgbe_read_eerd_buffer_generic(hw, offset, words, data); 249 249 ··· 264 264 s32 status; 265 265 266 266 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM)) 267 - return IXGBE_ERR_SWFW_SYNC; 267 + return -EBUSY; 268 268 269 269 status = ixgbe_write_eewr_generic(hw, offset, data); 270 270 ··· 287 287 s32 status; 288 288 289 289 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM)) 290 - return IXGBE_ERR_SWFW_SYNC; 290 + return -EBUSY; 291 291 292 292 status = ixgbe_write_eewr_buffer_generic(hw, offset, words, data); 293 293 ··· 324 324 for (i = 0; i < checksum_last_word; i++) { 325 325 if (ixgbe_read_eerd_generic(hw, i, &word)) { 326 326 hw_dbg(hw, "EEPROM read failed\n"); 327 - return IXGBE_ERR_EEPROM; 327 + return -EIO; 328 328 } 329 329 checksum += word; 330 330 } ··· 349 349 350 350 if (ixgbe_read_eerd_generic(hw, pointer, &length)) { 351 351 hw_dbg(hw, "EEPROM read failed\n"); 352 - return IXGBE_ERR_EEPROM; 352 + return -EIO; 353 353 } 354 354 355 355 /* Skip pointer section if length is invalid. */ ··· 360 360 for (j = pointer + 1; j <= pointer + length; j++) { 361 361 if (ixgbe_read_eerd_generic(hw, j, &word)) { 362 362 hw_dbg(hw, "EEPROM read failed\n"); 363 - return IXGBE_ERR_EEPROM; 363 + return -EIO; 364 364 } 365 365 checksum += word; 366 366 } ··· 397 397 } 398 398 399 399 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM)) 400 - return IXGBE_ERR_SWFW_SYNC; 400 + return -EBUSY; 401 401 402 402 status = hw->eeprom.ops.calc_checksum(hw); 403 403 if (status < 0) ··· 418 418 */ 419 419 if (read_checksum != checksum) { 420 420 hw_dbg(hw, "Invalid EEPROM checksum"); 421 - status = IXGBE_ERR_EEPROM_CHECKSUM; 421 + status = -EIO; 422 422 } 423 423 424 424 /* If the user cares, return the calculated checksum */ ··· 455 455 } 456 456 457 457 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM)) 458 - return IXGBE_ERR_SWFW_SYNC; 458 + return -EBUSY; 459 459 460 460 status = hw->eeprom.ops.calc_checksum(hw); 461 461 if (status < 0) ··· 490 490 s32 status; 491 491 492 492 status = ixgbe_poll_flash_update_done_X540(hw); 493 - if (status == IXGBE_ERR_EEPROM) { 493 + if (status == -EIO) { 494 494 hw_dbg(hw, "Flash update time out\n"); 495 495 return status; 496 496 } ··· 540 540 return 0; 541 541 udelay(5); 542 542 } 543 - return IXGBE_ERR_EEPROM; 543 + return -EIO; 544 544 } 545 545 546 546 /** ··· 575 575 * SW_FW_SYNC bits (not just NVM) 576 576 */ 577 577 if (ixgbe_get_swfw_sync_semaphore(hw)) 578 - return IXGBE_ERR_SWFW_SYNC; 578 + return -EBUSY; 579 579 580 580 swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC(hw)); 581 581 if (!(swfw_sync & (fwmask | swmask | hwmask))) { ··· 599 599 * bits in the SW_FW_SYNC register. 600 600 */ 601 601 if (ixgbe_get_swfw_sync_semaphore(hw)) 602 - return IXGBE_ERR_SWFW_SYNC; 602 + return -EBUSY; 603 603 swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC(hw)); 604 604 if (swfw_sync & (fwmask | hwmask)) { 605 605 swfw_sync |= swmask; ··· 622 622 rmask |= IXGBE_GSSR_I2C_MASK; 623 623 ixgbe_release_swfw_sync_X540(hw, rmask); 624 624 ixgbe_release_swfw_sync_semaphore(hw); 625 - return IXGBE_ERR_SWFW_SYNC; 625 + return -EBUSY; 626 626 } 627 627 ixgbe_release_swfw_sync_semaphore(hw); 628 628 629 - return IXGBE_ERR_SWFW_SYNC; 629 + return -EBUSY; 630 630 } 631 631 632 632 /** ··· 680 680 if (i == timeout) { 681 681 hw_dbg(hw, 682 682 "Software semaphore SMBI between device drivers not granted.\n"); 683 - return IXGBE_ERR_EEPROM; 683 + return -EIO; 684 684 } 685 685 686 686 /* Now get the semaphore between SW/FW through the REGSMP bit */ ··· 697 697 */ 698 698 hw_dbg(hw, "REGSMP Software NVM semaphore not granted\n"); 699 699 ixgbe_release_swfw_sync_semaphore(hw); 700 - return IXGBE_ERR_EEPROM; 700 + return -EIO; 701 701 } 702 702 703 703 /** ··· 768 768 bool link_up; 769 769 770 770 if (index > 3) 771 - return IXGBE_ERR_PARAM; 771 + return -EINVAL; 772 772 773 773 /* Link should be up in order for the blink bit in the LED control 774 774 * register to work. Force link and speed in the MAC if link is down. ··· 804 804 u32 ledctl_reg; 805 805 806 806 if (index > 3) 807 - return IXGBE_ERR_PARAM; 807 + return -EINVAL; 808 808 809 809 /* Restore the LED to its default value. */ 810 810 ledctl_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
+76 -72
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
··· 206 206 } 207 207 if (retry == IXGBE_CS4227_RETRIES) { 208 208 hw_err(hw, "CS4227 reset did not complete\n"); 209 - return IXGBE_ERR_PHY; 209 + return -EIO; 210 210 } 211 211 212 212 status = ixgbe_read_cs4227(hw, IXGBE_CS4227_EEPROM_STATUS, &value); 213 213 if (status || !(value & IXGBE_CS4227_EEPROM_LOAD_OK)) { 214 214 hw_err(hw, "CS4227 EEPROM did not load successfully\n"); 215 - return IXGBE_ERR_PHY; 215 + return -EIO; 216 216 } 217 217 218 218 return 0; ··· 350 350 static s32 ixgbe_read_phy_reg_x550em(struct ixgbe_hw *hw, u32 reg_addr, 351 351 u32 device_type, u16 *phy_data) 352 352 { 353 - return IXGBE_NOT_IMPLEMENTED; 353 + return -EOPNOTSUPP; 354 354 } 355 355 356 356 static s32 ixgbe_write_phy_reg_x550em(struct ixgbe_hw *hw, u32 reg_addr, 357 357 u32 device_type, u16 phy_data) 358 358 { 359 - return IXGBE_NOT_IMPLEMENTED; 359 + return -EOPNOTSUPP; 360 360 } 361 361 362 362 /** ··· 463 463 --retries; 464 464 } while (retries > 0); 465 465 466 - return IXGBE_ERR_HOST_INTERFACE_COMMAND; 466 + return -EIO; 467 467 } 468 468 469 469 static const struct { ··· 511 511 hw->phy.id |= phy_id_lo & IXGBE_PHY_REVISION_MASK; 512 512 hw->phy.revision = phy_id_lo & ~IXGBE_PHY_REVISION_MASK; 513 513 if (!hw->phy.id || hw->phy.id == IXGBE_PHY_REVISION_MASK) 514 - return IXGBE_ERR_PHY_ADDR_INVALID; 514 + return -EFAULT; 515 515 516 516 hw->phy.autoneg_advertised = hw->phy.speeds_supported; 517 517 hw->phy.eee_speeds_supported = IXGBE_LINK_SPEED_100_FULL | ··· 568 568 569 569 if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { 570 570 hw_err(hw, "rx_pause not valid in strict IEEE mode\n"); 571 - return IXGBE_ERR_INVALID_LINK_SETTINGS; 571 + return -EINVAL; 572 572 } 573 573 574 574 switch (hw->fc.requested_mode) { ··· 600 600 rc = ixgbe_fw_phy_activity(hw, FW_PHY_ACT_SETUP_LINK, &setup); 601 601 if (rc) 602 602 return rc; 603 + 603 604 if (setup[0] == FW_PHY_ACT_SETUP_LINK_RSP_DOWN) 604 - return IXGBE_ERR_OVERTEMP; 605 + return -EIO; 606 + 605 607 return 0; 606 608 } 607 609 ··· 677 675 *ctrl = command; 678 676 if (i == IXGBE_MDIO_COMMAND_TIMEOUT) { 679 677 hw_dbg(hw, "IOSF wait timed out\n"); 680 - return IXGBE_ERR_PHY; 678 + return -EIO; 681 679 } 682 680 683 681 return 0; ··· 716 714 if ((command & IXGBE_SB_IOSF_CTRL_RESP_STAT_MASK) != 0) { 717 715 error = FIELD_GET(IXGBE_SB_IOSF_CTRL_CMPL_ERR_MASK, command); 718 716 hw_dbg(hw, "Failed to read, error %x\n", error); 719 - return IXGBE_ERR_PHY; 717 + return -EIO; 720 718 } 721 719 722 720 if (!ret) ··· 751 749 if (token_cmd.hdr.cmd_or_resp.ret_status == FW_PHY_TOKEN_OK) 752 750 return 0; 753 751 if (token_cmd.hdr.cmd_or_resp.ret_status != FW_PHY_TOKEN_RETRY) 754 - return IXGBE_ERR_FW_RESP_INVALID; 752 + return -EIO; 755 753 756 - return IXGBE_ERR_TOKEN_RETRY; 754 + return -EAGAIN; 757 755 } 758 756 759 757 /** ··· 779 777 return status; 780 778 if (token_cmd.hdr.cmd_or_resp.ret_status == FW_PHY_TOKEN_OK) 781 779 return 0; 782 - return IXGBE_ERR_FW_RESP_INVALID; 780 + return -EIO; 783 781 } 784 782 785 783 /** ··· 943 941 local_buffer = buf; 944 942 } else { 945 943 if (buffer_size < ptr) 946 - return IXGBE_ERR_PARAM; 944 + return -EINVAL; 947 945 local_buffer = &buffer[ptr]; 948 946 } 949 947 ··· 961 959 } 962 960 963 961 if (buffer && ((u32)start + (u32)length > buffer_size)) 964 - return IXGBE_ERR_PARAM; 962 + return -EINVAL; 965 963 966 964 for (i = start; length; i++, length--) { 967 965 if (i == bufsz && !buffer) { ··· 1013 1011 local_buffer = eeprom_ptrs; 1014 1012 } else { 1015 1013 if (buffer_size < IXGBE_EEPROM_LAST_WORD) 1016 - return IXGBE_ERR_PARAM; 1014 + return -EINVAL; 1017 1015 local_buffer = buffer; 1018 1016 } 1019 1017 ··· 1149 1147 * calculated checksum 1150 1148 */ 1151 1149 if (read_checksum != checksum) { 1152 - status = IXGBE_ERR_EEPROM_CHECKSUM; 1150 + status = -EIO; 1153 1151 hw_dbg(hw, "Invalid EEPROM checksum"); 1154 1152 } 1155 1153 ··· 1204 1202 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); 1205 1203 } else { 1206 1204 hw_dbg(hw, "write ee hostif failed to get semaphore"); 1207 - status = IXGBE_ERR_SWFW_SYNC; 1205 + status = -EBUSY; 1208 1206 } 1209 1207 1210 1208 return status; ··· 1415 1413 if ((command & IXGBE_SB_IOSF_CTRL_RESP_STAT_MASK) != 0) { 1416 1414 error = FIELD_GET(IXGBE_SB_IOSF_CTRL_CMPL_ERR_MASK, command); 1417 1415 hw_dbg(hw, "Failed to write, error %x\n", error); 1418 - return IXGBE_ERR_PHY; 1416 + return -EIO; 1419 1417 } 1420 1418 1421 1419 out: ··· 1558 1556 1559 1557 /* iXFI is only supported with X552 */ 1560 1558 if (mac->type != ixgbe_mac_X550EM_x) 1561 - return IXGBE_ERR_LINK_SETUP; 1559 + return -EIO; 1562 1560 1563 1561 /* Disable AN and force speed to 10G Serial. */ 1564 1562 status = ixgbe_read_iosf_sb_reg_x550(hw, ··· 1580 1578 break; 1581 1579 default: 1582 1580 /* Other link speeds are not supported by internal KR PHY. */ 1583 - return IXGBE_ERR_LINK_SETUP; 1581 + return -EINVAL; 1584 1582 } 1585 1583 1586 1584 status = ixgbe_write_iosf_sb_reg_x550(hw, ··· 1611 1609 { 1612 1610 switch (hw->phy.sfp_type) { 1613 1611 case ixgbe_sfp_type_not_present: 1614 - return IXGBE_ERR_SFP_NOT_PRESENT; 1612 + return -ENOENT; 1615 1613 case ixgbe_sfp_type_da_cu_core0: 1616 1614 case ixgbe_sfp_type_da_cu_core1: 1617 1615 *linear = true; ··· 1630 1628 case ixgbe_sfp_type_1g_cu_core0: 1631 1629 case ixgbe_sfp_type_1g_cu_core1: 1632 1630 default: 1633 - return IXGBE_ERR_SFP_NOT_SUPPORTED; 1631 + return -EOPNOTSUPP; 1634 1632 } 1635 1633 1636 1634 return 0; ··· 1660 1658 * there is no reason to configure CS4227 and SFP not present error is 1661 1659 * not accepted in the setup MAC link flow. 1662 1660 */ 1663 - if (status == IXGBE_ERR_SFP_NOT_PRESENT) 1661 + if (status == -ENOENT) 1664 1662 return 0; 1665 1663 1666 1664 if (status) ··· 1718 1716 break; 1719 1717 default: 1720 1718 /* Other link speeds are not supported by internal PHY. */ 1721 - return IXGBE_ERR_LINK_SETUP; 1719 + return -EINVAL; 1722 1720 } 1723 1721 1724 1722 (void)mac->ops.write_iosf_sb_reg(hw, ··· 1803 1801 /* If no SFP module present, then return success. Return success since 1804 1802 * SFP not present error is not excepted in the setup MAC link flow. 1805 1803 */ 1806 - if (ret_val == IXGBE_ERR_SFP_NOT_PRESENT) 1804 + if (ret_val == -ENOENT) 1807 1805 return 0; 1808 1806 1809 1807 if (ret_val) ··· 1853 1851 /* If no SFP module present, then return success. Return success since 1854 1852 * SFP not present error is not excepted in the setup MAC link flow. 1855 1853 */ 1856 - if (ret_val == IXGBE_ERR_SFP_NOT_PRESENT) 1854 + if (ret_val == -ENOENT) 1857 1855 return 0; 1858 1856 1859 1857 if (ret_val) ··· 1863 1861 ixgbe_setup_kr_speed_x550em(hw, speed); 1864 1862 1865 1863 if (hw->phy.mdio.prtad == MDIO_PRTAD_NONE) 1866 - return IXGBE_ERR_PHY_ADDR_INVALID; 1864 + return -EFAULT; 1867 1865 1868 1866 /* Get external PHY SKU id */ 1869 1867 ret_val = hw->phy.ops.read_reg(hw, IXGBE_CS4227_EFUSE_PDF_SKU, ··· 1962 1960 u16 i, autoneg_status; 1963 1961 1964 1962 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper) 1965 - return IXGBE_ERR_CONFIG; 1963 + return -EIO; 1966 1964 1967 1965 status = ixgbe_check_mac_link_generic(hw, speed, link_up, 1968 1966 link_up_wait_to_complete); ··· 2145 2143 */ 2146 2144 static void ixgbe_fc_autoneg_sgmii_x550em_a(struct ixgbe_hw *hw) 2147 2145 { 2148 - s32 status = IXGBE_ERR_FC_NOT_NEGOTIATED; 2149 2146 u32 info[FW_PHY_ACT_DATA_COUNT] = { 0 }; 2150 2147 ixgbe_link_speed speed; 2148 + s32 status = -EIO; 2151 2149 bool link_up; 2152 2150 2153 2151 /* AN should have completed when the cable was plugged in. ··· 2165 2163 /* Check if auto-negotiation has completed */ 2166 2164 status = ixgbe_fw_phy_activity(hw, FW_PHY_ACT_GET_LINK_INFO, &info); 2167 2165 if (status || !(info[0] & FW_PHY_ACT_GET_LINK_INFO_AN_COMPLETE)) { 2168 - status = IXGBE_ERR_FC_NOT_NEGOTIATED; 2166 + status = -EIO; 2169 2167 goto out; 2170 2168 } 2171 2169 ··· 2369 2367 * @hw: pointer to hardware structure 2370 2368 * @lsc: pointer to boolean flag which indicates whether external Base T 2371 2369 * PHY interrupt is lsc 2370 + * @is_overtemp: indicate whether an overtemp event encountered 2372 2371 * 2373 2372 * Determime if external Base T PHY interrupt cause is high temperature 2374 2373 * failure alarm or link status change. 2375 - * 2376 - * Return IXGBE_ERR_OVERTEMP if interrupt is high temperature 2377 - * failure alarm, else return PHY access status. 2378 2374 **/ 2379 - static s32 ixgbe_get_lasi_ext_t_x550em(struct ixgbe_hw *hw, bool *lsc) 2375 + static s32 ixgbe_get_lasi_ext_t_x550em(struct ixgbe_hw *hw, bool *lsc, 2376 + bool *is_overtemp) 2380 2377 { 2381 2378 u32 status; 2382 2379 u16 reg; 2383 2380 2381 + *is_overtemp = false; 2384 2382 *lsc = false; 2385 2383 2386 2384 /* Vendor alarm triggered */ ··· 2412 2410 if (reg & IXGBE_MDIO_GLOBAL_ALM_1_HI_TMP_FAIL) { 2413 2411 /* power down the PHY in case the PHY FW didn't already */ 2414 2412 ixgbe_set_copper_phy_power(hw, false); 2415 - return IXGBE_ERR_OVERTEMP; 2413 + *is_overtemp = true; 2414 + return -EIO; 2416 2415 } 2417 2416 if (reg & IXGBE_MDIO_GLOBAL_ALM_1_DEV_FAULT) { 2418 2417 /* device fault alarm triggered */ ··· 2427 2424 if (reg == IXGBE_MDIO_GLOBAL_FAULT_MSG_HI_TMP) { 2428 2425 /* power down the PHY in case the PHY FW didn't */ 2429 2426 ixgbe_set_copper_phy_power(hw, false); 2430 - return IXGBE_ERR_OVERTEMP; 2427 + *is_overtemp = true; 2428 + return -EIO; 2431 2429 } 2432 2430 } 2433 2431 ··· 2464 2460 **/ 2465 2461 static s32 ixgbe_enable_lasi_ext_t_x550em(struct ixgbe_hw *hw) 2466 2462 { 2463 + bool lsc, overtemp; 2467 2464 u32 status; 2468 2465 u16 reg; 2469 - bool lsc; 2470 2466 2471 2467 /* Clear interrupt flags */ 2472 - status = ixgbe_get_lasi_ext_t_x550em(hw, &lsc); 2468 + status = ixgbe_get_lasi_ext_t_x550em(hw, &lsc, &overtemp); 2473 2469 2474 2470 /* Enable link status change alarm */ 2475 2471 ··· 2548 2544 /** 2549 2545 * ixgbe_handle_lasi_ext_t_x550em - Handle external Base T PHY interrupt 2550 2546 * @hw: pointer to hardware structure 2547 + * @is_overtemp: indicate whether an overtemp event encountered 2551 2548 * 2552 2549 * Handle external Base T PHY interrupt. If high temperature 2553 2550 * failure alarm then return error, else if link status change 2554 2551 * then setup internal/external PHY link 2555 - * 2556 - * Return IXGBE_ERR_OVERTEMP if interrupt is high temperature 2557 - * failure alarm, else return PHY access status. 2558 2552 **/ 2559 - static s32 ixgbe_handle_lasi_ext_t_x550em(struct ixgbe_hw *hw) 2553 + static s32 ixgbe_handle_lasi_ext_t_x550em(struct ixgbe_hw *hw, 2554 + bool *is_overtemp) 2560 2555 { 2561 2556 struct ixgbe_phy_info *phy = &hw->phy; 2562 2557 bool lsc; 2563 2558 u32 status; 2564 2559 2565 - status = ixgbe_get_lasi_ext_t_x550em(hw, &lsc); 2560 + status = ixgbe_get_lasi_ext_t_x550em(hw, &lsc, is_overtemp); 2566 2561 if (status) 2567 2562 return status; 2568 2563 ··· 2693 2690 u16 speed; 2694 2691 2695 2692 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper) 2696 - return IXGBE_ERR_CONFIG; 2693 + return -EIO; 2697 2694 2698 2695 if (!(hw->mac.type == ixgbe_mac_X550EM_x && 2699 2696 !(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE))) { ··· 2736 2733 break; 2737 2734 default: 2738 2735 /* Internal PHY does not support anything else */ 2739 - return IXGBE_ERR_INVALID_LINK_SETTINGS; 2736 + return -EINVAL; 2740 2737 } 2741 2738 2742 2739 return ixgbe_setup_ixfi_x550em(hw, &force_speed); ··· 2768 2765 u16 phy_data; 2769 2766 2770 2767 if (led_idx >= IXGBE_X557_MAX_LED_INDEX) 2771 - return IXGBE_ERR_PARAM; 2768 + return -EINVAL; 2772 2769 2773 2770 /* To turn on the LED, set mode to ON. */ 2774 2771 hw->phy.ops.read_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx, ··· 2790 2787 u16 phy_data; 2791 2788 2792 2789 if (led_idx >= IXGBE_X557_MAX_LED_INDEX) 2793 - return IXGBE_ERR_PARAM; 2790 + return -EINVAL; 2794 2791 2795 2792 /* To turn on the LED, set mode to ON. */ 2796 2793 hw->phy.ops.read_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx, ··· 2814 2811 * 2815 2812 * Sends driver version number to firmware through the manageability 2816 2813 * block. On success return 0 2817 - * else returns IXGBE_ERR_SWFW_SYNC when encountering an error acquiring 2818 - * semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails. 2814 + * else returns -EBUSY when encountering an error acquiring 2815 + * semaphore, -EIO when command fails or -ENIVAL when incorrect 2816 + * params passed. 2819 2817 **/ 2820 2818 static s32 ixgbe_set_fw_drv_ver_x550(struct ixgbe_hw *hw, u8 maj, u8 min, 2821 2819 u8 build, u8 sub, u16 len, ··· 2827 2823 int i; 2828 2824 2829 2825 if (!len || !driver_ver || (len > sizeof(fw_cmd.driver_string))) 2830 - return IXGBE_ERR_INVALID_ARGUMENT; 2826 + return -EINVAL; 2831 2827 2832 2828 fw_cmd.hdr.cmd = FW_CEM_CMD_DRIVER_INFO; 2833 2829 fw_cmd.hdr.buf_len = FW_CEM_CMD_DRIVER_INFO_LEN + len; ··· 2852 2848 2853 2849 if (fw_cmd.hdr.cmd_or_resp.ret_status != 2854 2850 FW_CEM_RESP_STATUS_SUCCESS) 2855 - return IXGBE_ERR_HOST_INTERFACE_COMMAND; 2851 + return -EIO; 2856 2852 return 0; 2857 2853 } 2858 2854 ··· 2909 2905 /* Validate the requested mode */ 2910 2906 if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { 2911 2907 hw_err(hw, "ixgbe_fc_rx_pause not valid in strict IEEE mode\n"); 2912 - return IXGBE_ERR_INVALID_LINK_SETTINGS; 2908 + return -EINVAL; 2913 2909 } 2914 2910 2915 2911 /* 10gig parts do not have a word in the EEPROM to determine the ··· 2944 2940 break; 2945 2941 default: 2946 2942 hw_err(hw, "Flow control param set incorrectly\n"); 2947 - return IXGBE_ERR_CONFIG; 2943 + return -EIO; 2948 2944 } 2949 2945 2950 2946 switch (hw->device_id) { ··· 2988 2984 static void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw) 2989 2985 { 2990 2986 u32 link_s1, lp_an_page_low, an_cntl_1; 2991 - s32 status = IXGBE_ERR_FC_NOT_NEGOTIATED; 2992 2987 ixgbe_link_speed speed; 2988 + s32 status = -EIO; 2993 2989 bool link_up; 2994 2990 2995 2991 /* AN should have completed when the cable was plugged in. ··· 3015 3011 3016 3012 if (status || (link_s1 & IXGBE_KRM_LINK_S1_MAC_AN_COMPLETE) == 0) { 3017 3013 hw_dbg(hw, "Auto-Negotiation did not complete\n"); 3018 - status = IXGBE_ERR_FC_NOT_NEGOTIATED; 3014 + status = -EIO; 3019 3015 goto out; 3020 3016 } 3021 3017 ··· 3189 3185 /** 3190 3186 * ixgbe_check_overtemp_fw - Check firmware-controlled PHYs for overtemp 3191 3187 * @hw: pointer to hardware structure 3188 + * 3189 + * Return true when an overtemp event detected, otherwise false. 3192 3190 */ 3193 - static s32 ixgbe_check_overtemp_fw(struct ixgbe_hw *hw) 3191 + static bool ixgbe_check_overtemp_fw(struct ixgbe_hw *hw) 3194 3192 { 3195 3193 u32 store[FW_PHY_ACT_DATA_COUNT] = { 0 }; 3196 3194 s32 rc; 3197 3195 3198 3196 rc = ixgbe_fw_phy_activity(hw, FW_PHY_ACT_GET_LINK_INFO, &store); 3199 3197 if (rc) 3200 - return rc; 3198 + return false; 3201 3199 3202 3200 if (store[0] & FW_PHY_ACT_GET_LINK_INFO_TEMP) { 3203 3201 ixgbe_shutdown_fw_phy(hw); 3204 - return IXGBE_ERR_OVERTEMP; 3202 + return true; 3205 3203 } 3206 - return 0; 3204 + return false; 3207 3205 } 3208 3206 3209 3207 /** ··· 3254 3248 3255 3249 /* Identify the PHY or SFP module */ 3256 3250 ret_val = phy->ops.identify(hw); 3257 - if (ret_val == IXGBE_ERR_SFP_NOT_SUPPORTED || 3258 - ret_val == IXGBE_ERR_PHY_ADDR_INVALID) 3251 + if (ret_val == -EOPNOTSUPP || ret_val == -EFAULT) 3259 3252 return ret_val; 3260 3253 3261 3254 /* Setup function pointers based on detected hardware */ ··· 3462 3457 3463 3458 /* PHY ops must be identified and initialized prior to reset */ 3464 3459 status = hw->phy.ops.init(hw); 3465 - if (status == IXGBE_ERR_SFP_NOT_SUPPORTED || 3466 - status == IXGBE_ERR_PHY_ADDR_INVALID) 3460 + if (status == -EOPNOTSUPP || status == -EFAULT) 3467 3461 return status; 3468 3462 3469 3463 /* start the external PHY */ ··· 3478 3474 hw->phy.sfp_setup_needed = false; 3479 3475 } 3480 3476 3481 - if (status == IXGBE_ERR_SFP_NOT_SUPPORTED) 3477 + if (status == -EOPNOTSUPP) 3482 3478 return status; 3483 3479 3484 3480 /* Reset PHY */ ··· 3502 3498 status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); 3503 3499 if (status) { 3504 3500 hw_dbg(hw, "semaphore failed with %d", status); 3505 - return IXGBE_ERR_SWFW_SYNC; 3501 + return -EBUSY; 3506 3502 } 3507 3503 3508 3504 ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL); ··· 3520 3516 } 3521 3517 3522 3518 if (ctrl & IXGBE_CTRL_RST_MASK) { 3523 - status = IXGBE_ERR_RESET_FAILED; 3519 + status = -EIO; 3524 3520 hw_dbg(hw, "Reset polling failed to complete.\n"); 3525 3521 } 3526 3522 ··· 3616 3612 /* Validate the requested mode */ 3617 3613 if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { 3618 3614 hw_err(hw, "ixgbe_fc_rx_pause not valid in strict IEEE mode\n"); 3619 - return IXGBE_ERR_INVALID_LINK_SETTINGS; 3615 + return -EINVAL; 3620 3616 } 3621 3617 3622 3618 if (hw->fc.requested_mode == ixgbe_fc_default) ··· 3673 3669 break; 3674 3670 default: 3675 3671 hw_err(hw, "Flow control param set incorrectly\n"); 3676 - return IXGBE_ERR_CONFIG; 3672 + return -EIO; 3677 3673 } 3678 3674 3679 3675 status = hw->mac.ops.write_iosf_sb_reg(hw, ··· 3769 3765 return 0; 3770 3766 if (hmask) 3771 3767 ixgbe_release_swfw_sync_X540(hw, hmask); 3772 - if (status != IXGBE_ERR_TOKEN_RETRY) 3768 + if (status != -EAGAIN) 3773 3769 return status; 3774 3770 msleep(FW_PHY_TOKEN_DELAY); 3775 3771 } ··· 3813 3809 s32 status; 3814 3810 3815 3811 if (hw->mac.ops.acquire_swfw_sync(hw, mask)) 3816 - return IXGBE_ERR_SWFW_SYNC; 3812 + return -EBUSY; 3817 3813 3818 3814 status = hw->phy.ops.read_reg_mdi(hw, reg_addr, device_type, phy_data); 3819 3815 ··· 3839 3835 s32 status; 3840 3836 3841 3837 if (hw->mac.ops.acquire_swfw_sync(hw, mask)) 3842 - return IXGBE_ERR_SWFW_SYNC; 3838 + return -EBUSY; 3843 3839 3844 3840 status = ixgbe_write_phy_reg_mdi(hw, reg_addr, device_type, phy_data); 3845 3841 hw->mac.ops.release_swfw_sync(hw, mask);