ionic: keep ionic dev on lif init fail
authorShannon Nelson <snelson@pensando.io>
Sat, 7 Mar 2020 01:04:01 +0000 (17:04 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Mar 2020 02:34:03 +0000 (19:34 -0700)
If the basic ionic interface works but the lif creation fails,
don't fail the probe.  This will allow us to use the driver to
help inspect the hw/fw/pci interface for debugging purposes.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
drivers/net/ethernet/pensando/ionic/ionic_lif.c

index 448d7b2..0ac6acb 100644 (file)
@@ -37,6 +37,9 @@ int ionic_bus_alloc_irq_vectors(struct ionic *ionic, unsigned int nintrs)
 
 void ionic_bus_free_irq_vectors(struct ionic *ionic)
 {
+       if (!ionic->nintrs)
+               return;
+
        pci_free_irq_vectors(ionic->pdev);
 }
 
@@ -346,6 +349,11 @@ err_out_reset:
        ionic_reset(ionic);
 err_out_teardown:
        ionic_dev_teardown(ionic);
+       /* Don't fail the probe for these errors, keep
+        * the hw interface around for inspection
+        */
+       return 0;
+
 err_out_unmap_bars:
        ionic_unmap_bars(ionic);
        pci_release_regions(pdev);
@@ -369,11 +377,14 @@ static void ionic_remove(struct pci_dev *pdev)
        if (!ionic)
                return;
 
-       ionic_devlink_unregister(ionic);
-       ionic_lifs_unregister(ionic);
-       ionic_lifs_deinit(ionic);
-       ionic_lifs_free(ionic);
-       ionic_bus_free_irq_vectors(ionic);
+       if (ionic->master_lif) {
+               ionic_devlink_unregister(ionic);
+               ionic_lifs_unregister(ionic);
+               ionic_lifs_deinit(ionic);
+               ionic_lifs_free(ionic);
+               ionic_bus_free_irq_vectors(ionic);
+       }
+
        ionic_port_reset(ionic);
        ionic_reset(ionic);
        ionic_dev_teardown(ionic);
index 191271f..1b7e18f 100644 (file)
@@ -2408,6 +2408,9 @@ void ionic_lifs_unregister(struct ionic *ionic)
         * current model, so don't bother searching the
         * ionic->lif for candidates to unregister
         */
+       if (!ionic->master_lif)
+               return;
+
        cancel_work_sync(&ionic->master_lif->deferred.work);
        cancel_work_sync(&ionic->master_lif->tx_timeout_work);
        if (ionic->master_lif->netdev->reg_state == NETREG_REGISTERED)