#if EFSYS_OPT_MAE
+static __checkReturn efx_rc_t
+efx_mae_get_capabilities(
+ __in efx_nic_t *enp)
+{
+ efx_mcdi_req_t req;
+ EFX_MCDI_DECLARE_BUF(payload,
+ MC_CMD_MAE_GET_CAPS_IN_LEN,
+ MC_CMD_MAE_GET_CAPS_OUT_LEN);
+ struct efx_mae_s *maep = enp->en_maep;
+ efx_rc_t rc;
+
+ req.emr_cmd = MC_CMD_MAE_GET_CAPS;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_MAE_GET_CAPS_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_MAE_GET_CAPS_OUT_LEN;
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ if (req.emr_out_length_used < MC_CMD_MAE_GET_CAPS_OUT_LEN) {
+ rc = EMSGSIZE;
+ goto fail2;
+ }
+
+ maep->em_max_n_action_prios =
+ MCDI_OUT_DWORD(req, MAE_GET_CAPS_OUT_ACTION_PRIOS);
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+ return (rc);
+}
+
__checkReturn efx_rc_t
efx_mae_init(
__in efx_nic_t *enp)
enp->en_maep = maep;
+ rc = efx_mae_get_capabilities(enp);
+ if (rc != 0)
+ goto fail3;
+
return (0);
+fail3:
+ EFSYS_PROBE(fail3);
+ EFSYS_KMEM_FREE(enp->en_esip, sizeof (struct efx_mae_s), enp->en_maep);
+ enp->en_maep = NULL;
fail2:
EFSYS_PROBE(fail2);
fail1:
enp->en_maep = NULL;
}
+ __checkReturn efx_rc_t
+efx_mae_get_limits(
+ __in efx_nic_t *enp,
+ __out efx_mae_limits_t *emlp)
+{
+ const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp);
+ struct efx_mae_s *maep = enp->en_maep;
+ efx_rc_t rc;
+
+ if (encp->enc_mae_supported == B_FALSE) {
+ rc = ENOTSUP;
+ goto fail1;
+ }
+
+ emlp->eml_max_n_action_prios = maep->em_max_n_action_prios;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+ return (rc);
+}
+
#endif /* EFSYS_OPT_MAE */