Skip to content

Commit

Permalink
ionic: fill out pci error handlers
Browse files Browse the repository at this point in the history
Set up the pci_error_handlers error_detected and resume to be useful in
handling AER events.  If the error detected is pci_channel_io_frozen we
set up to do an FLR at the end of the AER handling - this tends to clear
things up well enough that traffic can continue.  Else, let the AER/PCI
machinery do what is needed for the less serious errors seen.

Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Shannon Nelson authored and David S. Miller committed Dec 13, 2023
1 parent ce66172 commit c3a910e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,35 @@ static void ionic_reset_done(struct pci_dev *pdev)
__func__, err ? "failed" : "done");
}

static pci_ers_result_t ionic_pci_error_detected(struct pci_dev *pdev,
pci_channel_state_t error)
{
if (error == pci_channel_io_frozen) {
ionic_reset_prepare(pdev);
return PCI_ERS_RESULT_NEED_RESET;
}

return PCI_ERS_RESULT_NONE;
}

static void ionic_pci_error_resume(struct pci_dev *pdev)
{
struct ionic *ionic = pci_get_drvdata(pdev);
struct ionic_lif *lif = ionic->lif;

if (lif && test_bit(IONIC_LIF_F_FW_RESET, lif->state))
pci_reset_function_locked(pdev);
}

static const struct pci_error_handlers ionic_err_handler = {
/* FLR handling */
.reset_prepare = ionic_reset_prepare,
.reset_done = ionic_reset_done,

/* PCI bus error detected on this device */
.error_detected = ionic_pci_error_detected,
.resume = ionic_pci_error_resume,

};

static struct pci_driver ionic_driver = {
Expand Down

0 comments on commit c3a910e

Please sign in to comment.