net/sfc: add MCDI callback to schedule restart
authorAndrew Rybchenko <arybchenko@solarflare.com>
Thu, 17 Sep 2020 06:34:40 +0000 (07:34 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 30 Sep 2020 17:19:08 +0000 (19:19 +0200)
MC reboot handling is driver specific.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
drivers/net/sfc/sfc_mcdi.c
drivers/net/sfc/sfc_mcdi.h

index 5077fcd..73dbd81 100644 (file)
@@ -195,7 +195,7 @@ sfc_efx_mcdi_exception(void *arg, efx_mcdi_exception_t eme)
            (eme == EFX_MCDI_EXCEPTION_MC_REBOOT) ? "REBOOT" :
            (eme == EFX_MCDI_EXCEPTION_MC_BADASSERT) ? "BADASSERT" : "UNKNOWN");
 
-       sfc_schedule_restart(sa);
+       mcdi->ops->sched_restart(mcdi->ops_cookie);
 }
 
 #define SFC_MCDI_LOG_BUF_SIZE  128
@@ -285,7 +285,8 @@ sfc_efx_mcdi_init(struct sfc_adapter *sa, struct sfc_efx_mcdi *mcdi,
        efx_mcdi_transport_t *emtp;
        int rc;
 
-       if (ops->dma_alloc == NULL || ops->dma_free == NULL)
+       if (ops->dma_alloc == NULL || ops->dma_free == NULL ||
+           ops->sched_restart == NULL)
                return EINVAL;
 
        SFC_ASSERT(mcdi->state == SFC_EFX_MCDI_UNINITIALIZED);
@@ -372,9 +373,19 @@ sfc_mcdi_dma_free(void *cookie, efsys_mem_t *esmp)
        sfc_dma_free(sa, esmp);
 }
 
+static sfc_efx_mcdi_sched_restart_cb sfc_mcdi_sched_restart;
+static void
+sfc_mcdi_sched_restart(void *cookie)
+{
+       struct sfc_adapter *sa = cookie;
+
+       sfc_schedule_restart(sa);
+}
+
 static const struct sfc_efx_mcdi_ops sfc_mcdi_ops = {
        .dma_alloc      = sfc_mcdi_dma_alloc,
        .dma_free       = sfc_mcdi_dma_free,
+       .sched_restart  = sfc_mcdi_sched_restart,
 };
 
 int
index ef24a8b..8f9b199 100644 (file)
@@ -37,9 +37,12 @@ typedef int (sfc_efx_mcdi_dma_alloc_cb)(void *cookie, const char *name,
 
 typedef void (sfc_efx_mcdi_dma_free_cb)(void *cookie, efsys_mem_t *esmp);
 
+typedef void (sfc_efx_mcdi_sched_restart_cb)(void *cookie);
+
 struct sfc_efx_mcdi_ops {
        sfc_efx_mcdi_dma_alloc_cb       *dma_alloc;
        sfc_efx_mcdi_dma_free_cb        *dma_free;
+       sfc_efx_mcdi_sched_restart_cb   *sched_restart;
 };
 
 struct sfc_efx_mcdi {