[11/14] net/sfc: add MCDI callback to schedule restart
diff mbox series

Message ID 1599556475-27820-13-git-send-email-arybchenko@solarflare.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • net/sfc: factor out common driver library
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Sept. 8, 2020, 9:14 a.m. UTC
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 | 15 +++++++++++++--
 drivers/net/sfc/sfc_mcdi.h |  3 +++
 2 files changed, 16 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/sfc/sfc_mcdi.c b/drivers/net/sfc/sfc_mcdi.c
index 5077fcddd6..73dbd8194b 100644
--- a/drivers/net/sfc/sfc_mcdi.c
+++ b/drivers/net/sfc/sfc_mcdi.c
@@ -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
diff --git a/drivers/net/sfc/sfc_mcdi.h b/drivers/net/sfc/sfc_mcdi.h
index ef24a8bc67..8f9b1991be 100644
--- a/drivers/net/sfc/sfc_mcdi.h
+++ b/drivers/net/sfc/sfc_mcdi.h
@@ -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 {