net/sfc: add MCDI callback to schedule restart

MC reboot handling is driver specific.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
This commit is contained in:
Andrew Rybchenko 2020-09-17 07:34:40 +01:00 committed by Ferruh Yigit
parent 710ac30e4d
commit fc96cecfd4
2 changed files with 16 additions and 2 deletions

View 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

View 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 {