drivers: init/fini MAE on attach/detach
These actions affect MAE supplementary resources which are libefx-internal. Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Andy Moreton <amoreton@xilinx.com>
This commit is contained in:
parent
6f956d5cb1
commit
3af6451292
@ -167,7 +167,7 @@ prefetch_read_once(const volatile void *addr)
|
||||
|
||||
#define EFSYS_OPT_DESC_PROXY 0
|
||||
|
||||
#define EFSYS_OPT_MAE 0
|
||||
#define EFSYS_OPT_MAE 1
|
||||
|
||||
/* ID */
|
||||
|
||||
|
@ -21,6 +21,7 @@ sfc_mae_attach(struct sfc_adapter *sa)
|
||||
{
|
||||
const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
|
||||
struct sfc_mae *mae = &sa->mae;
|
||||
int rc;
|
||||
|
||||
sfc_log_init(sa, "entry");
|
||||
|
||||
@ -29,21 +30,37 @@ sfc_mae_attach(struct sfc_adapter *sa)
|
||||
return 0;
|
||||
}
|
||||
|
||||
sfc_log_init(sa, "init MAE");
|
||||
rc = efx_mae_init(sa->nic);
|
||||
if (rc != 0)
|
||||
goto fail_mae_init;
|
||||
|
||||
mae->status = SFC_MAE_STATUS_SUPPORTED;
|
||||
|
||||
sfc_log_init(sa, "done");
|
||||
|
||||
return 0;
|
||||
|
||||
fail_mae_init:
|
||||
sfc_log_init(sa, "failed %d", rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
sfc_mae_detach(struct sfc_adapter *sa)
|
||||
{
|
||||
struct sfc_mae *mae = &sa->mae;
|
||||
enum sfc_mae_status status_prev = mae->status;
|
||||
|
||||
sfc_log_init(sa, "entry");
|
||||
|
||||
mae->status = SFC_MAE_STATUS_UNKNOWN;
|
||||
|
||||
if (status_prev != SFC_MAE_STATUS_SUPPORTED)
|
||||
return;
|
||||
|
||||
efx_mae_fini(sa->nic);
|
||||
|
||||
sfc_log_init(sa, "done");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user