From fc96cecfd425f666576712eb2a57d6c0f9ea5296 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Thu, 17 Sep 2020 07:34:40 +0100 Subject: [PATCH] net/sfc: add MCDI callback to schedule restart MC reboot handling is driver specific. Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/net/sfc/sfc_mcdi.c | 15 +++++++++++++-- drivers/net/sfc/sfc_mcdi.h | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) 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 { -- 2.20.1