diff options
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_main.c | 50 |
2 files changed, 45 insertions, 6 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 33cd8b67535d..beb7b4393a6c 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h | |||
@@ -136,6 +136,7 @@ enum i40e_state_t { | |||
136 | __I40E_EMP_RESET_REQUESTED, | 136 | __I40E_EMP_RESET_REQUESTED, |
137 | __I40E_FILTER_OVERFLOW_PROMISC, | 137 | __I40E_FILTER_OVERFLOW_PROMISC, |
138 | __I40E_SUSPENDED, | 138 | __I40E_SUSPENDED, |
139 | __I40E_BAD_EEPROM, | ||
139 | }; | 140 | }; |
140 | 141 | ||
141 | enum i40e_interrupt_policy { | 142 | enum i40e_interrupt_policy { |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 91fd1f1f8f45..a1ec793b93db 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | /* Local includes */ | 27 | /* Local includes */ |
28 | #include "i40e.h" | 28 | #include "i40e.h" |
29 | #include "i40e_diag.h" | ||
29 | #ifdef CONFIG_I40E_VXLAN | 30 | #ifdef CONFIG_I40E_VXLAN |
30 | #include <net/vxlan.h> | 31 | #include <net/vxlan.h> |
31 | #endif | 32 | #endif |
@@ -2877,12 +2878,14 @@ static irqreturn_t i40e_intr(int irq, void *data) | |||
2877 | val = rd32(hw, I40E_GLGEN_RSTAT); | 2878 | val = rd32(hw, I40E_GLGEN_RSTAT); |
2878 | val = (val & I40E_GLGEN_RSTAT_RESET_TYPE_MASK) | 2879 | val = (val & I40E_GLGEN_RSTAT_RESET_TYPE_MASK) |
2879 | >> I40E_GLGEN_RSTAT_RESET_TYPE_SHIFT; | 2880 | >> I40E_GLGEN_RSTAT_RESET_TYPE_SHIFT; |
2880 | if (val == I40E_RESET_CORER) | 2881 | if (val == I40E_RESET_CORER) { |
2881 | pf->corer_count++; | 2882 | pf->corer_count++; |
2882 | else if (val == I40E_RESET_GLOBR) | 2883 | } else if (val == I40E_RESET_GLOBR) { |
2883 | pf->globr_count++; | 2884 | pf->globr_count++; |
2884 | else if (val == I40E_RESET_EMPR) | 2885 | } else if (val == I40E_RESET_EMPR) { |
2885 | pf->empr_count++; | 2886 | pf->empr_count++; |
2887 | set_bit(__I40E_EMP_RESET_REQUESTED, &pf->state); | ||
2888 | } | ||
2886 | } | 2889 | } |
2887 | 2890 | ||
2888 | if (icr0 & I40E_PFINT_ICR0_HMC_ERR_MASK) { | 2891 | if (icr0 & I40E_PFINT_ICR0_HMC_ERR_MASK) { |
@@ -4257,8 +4260,9 @@ static int i40e_open(struct net_device *netdev) | |||
4257 | struct i40e_pf *pf = vsi->back; | 4260 | struct i40e_pf *pf = vsi->back; |
4258 | int err; | 4261 | int err; |
4259 | 4262 | ||
4260 | /* disallow open during test */ | 4263 | /* disallow open during test or if eeprom is broken */ |
4261 | if (test_bit(__I40E_TESTING, &pf->state)) | 4264 | if (test_bit(__I40E_TESTING, &pf->state) || |
4265 | test_bit(__I40E_BAD_EEPROM, &pf->state)) | ||
4262 | return -EBUSY; | 4266 | return -EBUSY; |
4263 | 4267 | ||
4264 | netif_carrier_off(netdev); | 4268 | netif_carrier_off(netdev); |
@@ -5078,6 +5082,31 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf) | |||
5078 | } | 5082 | } |
5079 | 5083 | ||
5080 | /** | 5084 | /** |
5085 | * i40e_verify_eeprom - make sure eeprom is good to use | ||
5086 | * @pf: board private structure | ||
5087 | **/ | ||
5088 | static void i40e_verify_eeprom(struct i40e_pf *pf) | ||
5089 | { | ||
5090 | int err; | ||
5091 | |||
5092 | err = i40e_diag_eeprom_test(&pf->hw); | ||
5093 | if (err) { | ||
5094 | /* retry in case of garbage read */ | ||
5095 | err = i40e_diag_eeprom_test(&pf->hw); | ||
5096 | if (err) { | ||
5097 | dev_info(&pf->pdev->dev, "eeprom check failed (%d), Tx/Rx traffic disabled\n", | ||
5098 | err); | ||
5099 | set_bit(__I40E_BAD_EEPROM, &pf->state); | ||
5100 | } | ||
5101 | } | ||
5102 | |||
5103 | if (!err && test_bit(__I40E_BAD_EEPROM, &pf->state)) { | ||
5104 | dev_info(&pf->pdev->dev, "eeprom check passed, Tx/Rx traffic enabled\n"); | ||
5105 | clear_bit(__I40E_BAD_EEPROM, &pf->state); | ||
5106 | } | ||
5107 | } | ||
5108 | |||
5109 | /** | ||
5081 | * i40e_reconstitute_veb - rebuild the VEB and anything connected to it | 5110 | * i40e_reconstitute_veb - rebuild the VEB and anything connected to it |
5082 | * @veb: pointer to the VEB instance | 5111 | * @veb: pointer to the VEB instance |
5083 | * | 5112 | * |
@@ -5386,6 +5415,12 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit) | |||
5386 | goto end_core_reset; | 5415 | goto end_core_reset; |
5387 | } | 5416 | } |
5388 | 5417 | ||
5418 | /* re-verify the eeprom if we just had an EMP reset */ | ||
5419 | if (test_bit(__I40E_EMP_RESET_REQUESTED, &pf->state)) { | ||
5420 | clear_bit(__I40E_EMP_RESET_REQUESTED, &pf->state); | ||
5421 | i40e_verify_eeprom(pf); | ||
5422 | } | ||
5423 | |||
5389 | ret = i40e_get_capabilities(pf); | 5424 | ret = i40e_get_capabilities(pf); |
5390 | if (ret) { | 5425 | if (ret) { |
5391 | dev_info(&pf->pdev->dev, "i40e_get_capabilities failed, %d\n", | 5426 | dev_info(&pf->pdev->dev, "i40e_get_capabilities failed, %d\n", |
@@ -8157,6 +8192,8 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8157 | goto err_pf_reset; | 8192 | goto err_pf_reset; |
8158 | } | 8193 | } |
8159 | 8194 | ||
8195 | i40e_verify_eeprom(pf); | ||
8196 | |||
8160 | i40e_clear_pxe_mode(hw); | 8197 | i40e_clear_pxe_mode(hw); |
8161 | err = i40e_get_capabilities(pf); | 8198 | err = i40e_get_capabilities(pf); |
8162 | if (err) | 8199 | if (err) |
@@ -8258,7 +8295,8 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8258 | 8295 | ||
8259 | /* prep for VF support */ | 8296 | /* prep for VF support */ |
8260 | if ((pf->flags & I40E_FLAG_SRIOV_ENABLED) && | 8297 | if ((pf->flags & I40E_FLAG_SRIOV_ENABLED) && |
8261 | (pf->flags & I40E_FLAG_MSIX_ENABLED)) { | 8298 | (pf->flags & I40E_FLAG_MSIX_ENABLED) && |
8299 | !test_bit(__I40E_BAD_EEPROM, &pf->state)) { | ||
8262 | u32 val; | 8300 | u32 val; |
8263 | 8301 | ||
8264 | /* disable link interrupts for VFs */ | 8302 | /* disable link interrupts for VFs */ |