1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright(c) 2019 Xilinx, Inc. All rights reserved.
13 static __checkReturn efx_rc_t
14 efx_mae_get_capabilities(
18 EFX_MCDI_DECLARE_BUF(payload,
19 MC_CMD_MAE_GET_CAPS_IN_LEN,
20 MC_CMD_MAE_GET_CAPS_OUT_LEN);
21 struct efx_mae_s *maep = enp->en_maep;
24 req.emr_cmd = MC_CMD_MAE_GET_CAPS;
25 req.emr_in_buf = payload;
26 req.emr_in_length = MC_CMD_MAE_GET_CAPS_IN_LEN;
27 req.emr_out_buf = payload;
28 req.emr_out_length = MC_CMD_MAE_GET_CAPS_OUT_LEN;
30 efx_mcdi_execute(enp, &req);
32 if (req.emr_rc != 0) {
37 if (req.emr_out_length_used < MC_CMD_MAE_GET_CAPS_OUT_LEN) {
42 maep->em_max_n_action_prios =
43 MCDI_OUT_DWORD(req, MAE_GET_CAPS_OUT_ACTION_PRIOS);
50 EFSYS_PROBE1(fail1, efx_rc_t, rc);
54 __checkReturn efx_rc_t
58 const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp);
62 if (encp->enc_mae_supported == B_FALSE) {
67 EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (*maep), maep);
75 rc = efx_mae_get_capabilities(enp);
83 EFSYS_KMEM_FREE(enp->en_esip, sizeof (struct efx_mae_s), enp->en_maep);
88 EFSYS_PROBE1(fail1, efx_rc_t, rc);
96 const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp);
97 efx_mae_t *maep = enp->en_maep;
99 if (encp->enc_mae_supported == B_FALSE)
102 EFSYS_KMEM_FREE(enp->en_esip, sizeof (*maep), maep);
106 __checkReturn efx_rc_t
109 __out efx_mae_limits_t *emlp)
111 const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp);
112 struct efx_mae_s *maep = enp->en_maep;
115 if (encp->enc_mae_supported == B_FALSE) {
120 emlp->eml_max_n_action_prios = maep->em_max_n_action_prios;
125 EFSYS_PROBE1(fail1, efx_rc_t, rc);
129 __checkReturn efx_rc_t
130 efx_mae_match_spec_init(
132 __in efx_mae_rule_type_t type,
134 __out efx_mae_match_spec_t **specp)
136 efx_mae_match_spec_t *spec;
140 case EFX_MAE_RULE_ACTION:
147 EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (*spec), spec);
153 spec->emms_type = type;
154 spec->emms_prio = prio;
163 EFSYS_PROBE1(fail1, efx_rc_t, rc);
168 efx_mae_match_spec_fini(
170 __in efx_mae_match_spec_t *spec)
172 EFSYS_KMEM_FREE(enp->en_esip, sizeof (*spec), spec);
175 #endif /* EFSYS_OPT_MAE */