From: Ivan Malov Date: Tue, 20 Oct 2020 09:12:46 +0000 (+0100) Subject: common/sfc_efx/base: add MAE limit query API X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d761ec9f335e5a1d6951100d8cbd93359494f44d;p=dpdk.git common/sfc_efx/base: add MAE limit query API Add an API for client drivers to query the engine limits. Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index f109c8e332..db66be0faf 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -4048,6 +4048,16 @@ extern void efx_mae_fini( __in efx_nic_t *enp); +typedef struct efx_mae_limits_s { + uint32_t eml_max_n_action_prios; +} efx_mae_limits_t; + +LIBEFX_API +extern __checkReturn efx_rc_t +efx_mae_get_limits( + __in efx_nic_t *enp, + __out efx_mae_limits_t *emlp); + #endif /* EFSYS_OPT_MAE */ #ifdef __cplusplus diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 8e72796acf..6e9329c203 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -783,6 +783,7 @@ typedef struct efx_proxy_ops_s { #if EFSYS_OPT_MAE typedef struct efx_mae_s { + uint32_t em_max_n_action_prios; } efx_mae_t; #endif /* EFSYS_OPT_MAE */ diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c index 0de9ccb2e0..c93342de15 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -10,6 +10,47 @@ #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) @@ -31,8 +72,16 @@ efx_mae_init( 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: @@ -54,4 +103,27 @@ efx_mae_fini( 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 */ diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map index c76dfe1e45..4b500b646a 100644 --- a/drivers/common/sfc_efx/version.map +++ b/drivers/common/sfc_efx/version.map @@ -86,6 +86,7 @@ INTERNAL { efx_mac_up; efx_mae_fini; + efx_mae_get_limits; efx_mae_init; efx_mcdi_fini;