From: Ivan Malov <ivan.malov@oktetlabs.ru>
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 <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
drivers/common/sfc_efx/base/efx.h | 14 +++++
drivers/common/sfc_efx/base/efx_impl.h | 10 ++++
drivers/common/sfc_efx/base/efx_mae.c | 57 +++++++++++++++++++
drivers/common/sfc_efx/base/meson.build | 1 +
.../sfc_efx/rte_common_sfc_efx_version.map | 3 +
5 files changed, 85 insertions(+)
create mode 100644 drivers/common/sfc_efx/base/efx_mae.c
@@ -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
@@ -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) \
new file mode 100644
@@ -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 */
@@ -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',
@@ -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;