diff options
author | Shannon Nelson <shannon.nelson@intel.com> | 2014-11-13 03:23:13 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2014-12-09 15:57:01 -0500 |
commit | c150a502716476b3d3e0035e0e1f86b016980f01 (patch) | |
tree | 650452baacad5592c07cdb0ea6a6febeccbf8159 /drivers/net/ethernet/intel | |
parent | 4443ec94d246e65fcee8ebf63f4d3abea0ff86df (diff) |
i40e: better error messages for NVM update issues
Add more detail to the NVM update error messages so folks
have a better chance at diagnosing issues without having to
resort to heroic measures to reproduce an issue.
Change-ID: I270d1a9c903baceaef0bebcc55d29108ac08b0bd
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 25242f505161..951e8767fc50 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c | |||
@@ -822,7 +822,7 @@ static int i40e_get_eeprom(struct net_device *netdev, | |||
822 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 822 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
823 | struct i40e_hw *hw = &np->vsi->back->hw; | 823 | struct i40e_hw *hw = &np->vsi->back->hw; |
824 | struct i40e_pf *pf = np->vsi->back; | 824 | struct i40e_pf *pf = np->vsi->back; |
825 | int ret_val = 0, len; | 825 | int ret_val = 0, len, offset; |
826 | u8 *eeprom_buff; | 826 | u8 *eeprom_buff; |
827 | u16 i, sectors; | 827 | u16 i, sectors; |
828 | bool last; | 828 | bool last; |
@@ -835,19 +835,21 @@ static int i40e_get_eeprom(struct net_device *netdev, | |||
835 | /* check for NVMUpdate access method */ | 835 | /* check for NVMUpdate access method */ |
836 | magic = hw->vendor_id | (hw->device_id << 16); | 836 | magic = hw->vendor_id | (hw->device_id << 16); |
837 | if (eeprom->magic && eeprom->magic != magic) { | 837 | if (eeprom->magic && eeprom->magic != magic) { |
838 | struct i40e_nvm_access *cmd; | ||
838 | int errno; | 839 | int errno; |
839 | 840 | ||
840 | /* make sure it is the right magic for NVMUpdate */ | 841 | /* make sure it is the right magic for NVMUpdate */ |
841 | if ((eeprom->magic >> 16) != hw->device_id) | 842 | if ((eeprom->magic >> 16) != hw->device_id) |
842 | return -EINVAL; | 843 | return -EINVAL; |
843 | 844 | ||
844 | ret_val = i40e_nvmupd_command(hw, | 845 | cmd = (struct i40e_nvm_access *)eeprom; |
845 | (struct i40e_nvm_access *)eeprom, | 846 | ret_val = i40e_nvmupd_command(hw, cmd, bytes, &errno); |
846 | bytes, &errno); | ||
847 | if (ret_val) | 847 | if (ret_val) |
848 | dev_info(&pf->pdev->dev, | 848 | dev_info(&pf->pdev->dev, |
849 | "NVMUpdate read failed err=%d status=0x%x\n", | 849 | "NVMUpdate read failed err=%d status=0x%x errno=%d module=%d offset=0x%x size=%d\n", |
850 | ret_val, hw->aq.asq_last_status); | 850 | ret_val, hw->aq.asq_last_status, errno, |
851 | (u8)(cmd->config & I40E_NVM_MOD_PNT_MASK), | ||
852 | cmd->offset, cmd->data_size); | ||
851 | 853 | ||
852 | return errno; | 854 | return errno; |
853 | } | 855 | } |
@@ -876,20 +878,29 @@ static int i40e_get_eeprom(struct net_device *netdev, | |||
876 | len = eeprom->len - (I40E_NVM_SECTOR_SIZE * i); | 878 | len = eeprom->len - (I40E_NVM_SECTOR_SIZE * i); |
877 | last = true; | 879 | last = true; |
878 | } | 880 | } |
879 | ret_val = i40e_aq_read_nvm(hw, 0x0, | 881 | offset = eeprom->offset + (I40E_NVM_SECTOR_SIZE * i), |
880 | eeprom->offset + (I40E_NVM_SECTOR_SIZE * i), | 882 | ret_val = i40e_aq_read_nvm(hw, 0x0, offset, len, |
881 | len, | ||
882 | (u8 *)eeprom_buff + (I40E_NVM_SECTOR_SIZE * i), | 883 | (u8 *)eeprom_buff + (I40E_NVM_SECTOR_SIZE * i), |
883 | last, NULL); | 884 | last, NULL); |
884 | if (ret_val) { | 885 | if (ret_val && hw->aq.asq_last_status == I40E_AQ_RC_EPERM) { |
885 | dev_info(&pf->pdev->dev, | 886 | dev_info(&pf->pdev->dev, |
886 | "read NVM failed err=%d status=0x%x\n", | 887 | "read NVM failed, invalid offset 0x%x\n", |
887 | ret_val, hw->aq.asq_last_status); | 888 | offset); |
888 | goto release_nvm; | 889 | break; |
890 | } else if (ret_val && | ||
891 | hw->aq.asq_last_status == I40E_AQ_RC_EACCES) { | ||
892 | dev_info(&pf->pdev->dev, | ||
893 | "read NVM failed, access, offset 0x%x\n", | ||
894 | offset); | ||
895 | break; | ||
896 | } else if (ret_val) { | ||
897 | dev_info(&pf->pdev->dev, | ||
898 | "read NVM failed offset %d err=%d status=0x%x\n", | ||
899 | offset, ret_val, hw->aq.asq_last_status); | ||
900 | break; | ||
889 | } | 901 | } |
890 | } | 902 | } |
891 | 903 | ||
892 | release_nvm: | ||
893 | i40e_release_nvm(hw); | 904 | i40e_release_nvm(hw); |
894 | memcpy(bytes, (u8 *)eeprom_buff, eeprom->len); | 905 | memcpy(bytes, (u8 *)eeprom_buff, eeprom->len); |
895 | free_buff: | 906 | free_buff: |
@@ -917,6 +928,7 @@ static int i40e_set_eeprom(struct net_device *netdev, | |||
917 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 928 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
918 | struct i40e_hw *hw = &np->vsi->back->hw; | 929 | struct i40e_hw *hw = &np->vsi->back->hw; |
919 | struct i40e_pf *pf = np->vsi->back; | 930 | struct i40e_pf *pf = np->vsi->back; |
931 | struct i40e_nvm_access *cmd; | ||
920 | int ret_val = 0; | 932 | int ret_val = 0; |
921 | int errno; | 933 | int errno; |
922 | u32 magic; | 934 | u32 magic; |
@@ -934,12 +946,14 @@ static int i40e_set_eeprom(struct net_device *netdev, | |||
934 | test_bit(__I40E_RESET_INTR_RECEIVED, &pf->state)) | 946 | test_bit(__I40E_RESET_INTR_RECEIVED, &pf->state)) |
935 | return -EBUSY; | 947 | return -EBUSY; |
936 | 948 | ||
937 | ret_val = i40e_nvmupd_command(hw, (struct i40e_nvm_access *)eeprom, | 949 | cmd = (struct i40e_nvm_access *)eeprom; |
938 | bytes, &errno); | 950 | ret_val = i40e_nvmupd_command(hw, cmd, bytes, &errno); |
939 | if (ret_val) | 951 | if (ret_val && hw->aq.asq_last_status != I40E_AQ_RC_EBUSY) |
940 | dev_info(&pf->pdev->dev, | 952 | dev_info(&pf->pdev->dev, |
941 | "NVMUpdate write failed err=%d status=0x%x\n", | 953 | "NVMUpdate write failed err=%d status=0x%x errno=%d module=%d offset=0x%x size=%d\n", |
942 | ret_val, hw->aq.asq_last_status); | 954 | ret_val, hw->aq.asq_last_status, errno, |
955 | (u8)(cmd->config & I40E_NVM_MOD_PNT_MASK), | ||
956 | cmd->offset, cmd->data_size); | ||
943 | 957 | ||
944 | return errno; | 958 | return errno; |
945 | } | 959 | } |