From: Ivan Malov Date: Tue, 20 Oct 2020 09:12:44 +0000 (+0100) Subject: common/sfc_efx/base: add MAE init/fini APIs X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6f956d5cb1d24407e8b8fd814f544571d91b0436;p=dpdk.git common/sfc_efx/base: add MAE init/fini APIs The patch adds APIs for client drivers to initialise / finalise MAE-specific context in NIC control structure. The context itself will be used by the follow-up patches to store supportive data for library-internal consumers. 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 9947882d26..f109c8e332 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -4036,6 +4036,20 @@ efx_proxy_auth_privilege_modify( #endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ +#if EFSYS_OPT_MAE + +LIBEFX_API +extern __checkReturn efx_rc_t +efx_mae_init( + __in efx_nic_t *enp); + +LIBEFX_API +extern void +efx_mae_fini( + __in efx_nic_t *enp); + +#endif /* EFSYS_OPT_MAE */ + #ifdef __cplusplus } #endif diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 196fd4a79c..8e72796acf 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -780,6 +780,13 @@ typedef struct efx_proxy_ops_s { #endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ +#if EFSYS_OPT_MAE + +typedef struct efx_mae_s { +} efx_mae_t; + +#endif /* EFSYS_OPT_MAE */ + #define EFX_DRV_VER_MAX 20 typedef struct efx_drv_cfg_s { @@ -886,6 +893,9 @@ struct efx_nic_s { #if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER const efx_proxy_ops_t *en_epop; #endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ +#if EFSYS_OPT_MAE + efx_mae_t *en_maep; +#endif /* EFSYS_OPT_MAE */ }; #define EFX_FAMILY_IS_EF10(_enp) \ diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c new file mode 100644 index 0000000000..0de9ccb2e0 --- /dev/null +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2019 Xilinx, Inc. All rights reserved. + * All rights reserved. + */ + +#include "efx.h" +#include "efx_impl.h" + + +#if EFSYS_OPT_MAE + + __checkReturn efx_rc_t +efx_mae_init( + __in efx_nic_t *enp) +{ + const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp); + efx_mae_t *maep; + efx_rc_t rc; + + if (encp->enc_mae_supported == B_FALSE) { + rc = ENOTSUP; + goto fail1; + } + + EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (*maep), maep); + if (maep == NULL) { + rc = ENOMEM; + goto fail2; + } + + enp->en_maep = maep; + + return (0); + +fail2: + EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + + void +efx_mae_fini( + __in efx_nic_t *enp) +{ + const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp); + efx_mae_t *maep = enp->en_maep; + + if (encp->enc_mae_supported == B_FALSE) + return; + + EFSYS_KMEM_FREE(enp->en_esip, sizeof (*maep), maep); + enp->en_maep = NULL; +} + +#endif /* EFSYS_OPT_MAE */ diff --git a/drivers/common/sfc_efx/base/meson.build b/drivers/common/sfc_efx/base/meson.build index e0acbda993..2016346eb5 100644 --- a/drivers/common/sfc_efx/base/meson.build +++ b/drivers/common/sfc_efx/base/meson.build @@ -15,6 +15,7 @@ sources = [ 'efx_intr.c', 'efx_lic.c', 'efx_mac.c', + 'efx_mae.c', 'efx_mcdi.c', 'efx_mon.c', 'efx_nic.c', diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map index f656d5b644..c76dfe1e45 100644 --- a/drivers/common/sfc_efx/version.map +++ b/drivers/common/sfc_efx/version.map @@ -85,6 +85,9 @@ INTERNAL { efx_mac_stats_upload; efx_mac_up; + efx_mae_fini; + efx_mae_init; + efx_mcdi_fini; efx_mcdi_get_proxy_handle; efx_mcdi_get_timeout;