common/sfc_efx/base: add match spec init/fini APIs
An MAE rule is a function of match criteria and a priority. The said match criteria have to be provided using "mask-value pairs" packing format which on its own should not be exposed to client drivers. The latter have to use a functional interface of sorts in order to generate a match specification. Define an EFX match specification and implement initialise / finalise APIs. The "mask-value pairs" buffer itself is not used in this particular patch, so the corresponding struct member will be added in the follow-up patch. Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Andy Moreton <amoreton@xilinx.com>
This commit is contained in:
parent
01628fc5f6
commit
b75eb50d04
@ -4058,6 +4058,28 @@ efx_mae_get_limits(
|
||||
__in efx_nic_t *enp,
|
||||
__out efx_mae_limits_t *emlp);
|
||||
|
||||
typedef enum efx_mae_rule_type_e {
|
||||
EFX_MAE_RULE_ACTION = 0,
|
||||
|
||||
EFX_MAE_RULE_NTYPES
|
||||
} efx_mae_rule_type_t;
|
||||
|
||||
typedef struct efx_mae_match_spec_s efx_mae_match_spec_t;
|
||||
|
||||
LIBEFX_API
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_mae_match_spec_init(
|
||||
__in efx_nic_t *enp,
|
||||
__in efx_mae_rule_type_t type,
|
||||
__in uint32_t prio,
|
||||
__out efx_mae_match_spec_t **specp);
|
||||
|
||||
LIBEFX_API
|
||||
extern void
|
||||
efx_mae_match_spec_fini(
|
||||
__in efx_nic_t *enp,
|
||||
__in efx_mae_match_spec_t *spec);
|
||||
|
||||
#endif /* EFSYS_OPT_MAE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1675,6 +1675,15 @@ efx_pci_xilinx_cap_tbl_find(
|
||||
|
||||
#endif /* EFSYS_OPT_PCI */
|
||||
|
||||
#if EFSYS_OPT_MAE
|
||||
|
||||
struct efx_mae_match_spec_s {
|
||||
efx_mae_rule_type_t emms_type;
|
||||
uint32_t emms_prio;
|
||||
};
|
||||
|
||||
#endif /* EFSYS_OPT_MAE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -126,4 +126,50 @@ fail1:
|
||||
return (rc);
|
||||
}
|
||||
|
||||
__checkReturn efx_rc_t
|
||||
efx_mae_match_spec_init(
|
||||
__in efx_nic_t *enp,
|
||||
__in efx_mae_rule_type_t type,
|
||||
__in uint32_t prio,
|
||||
__out efx_mae_match_spec_t **specp)
|
||||
{
|
||||
efx_mae_match_spec_t *spec;
|
||||
efx_rc_t rc;
|
||||
|
||||
switch (type) {
|
||||
case EFX_MAE_RULE_ACTION:
|
||||
break;
|
||||
default:
|
||||
rc = ENOTSUP;
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (*spec), spec);
|
||||
if (spec == NULL) {
|
||||
rc = ENOMEM;
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
spec->emms_type = type;
|
||||
spec->emms_prio = prio;
|
||||
|
||||
*specp = spec;
|
||||
|
||||
return (0);
|
||||
|
||||
fail2:
|
||||
EFSYS_PROBE(fail2);
|
||||
fail1:
|
||||
EFSYS_PROBE1(fail1, efx_rc_t, rc);
|
||||
return (rc);
|
||||
}
|
||||
|
||||
void
|
||||
efx_mae_match_spec_fini(
|
||||
__in efx_nic_t *enp,
|
||||
__in efx_mae_match_spec_t *spec)
|
||||
{
|
||||
EFSYS_KMEM_FREE(enp->en_esip, sizeof (*spec), spec);
|
||||
}
|
||||
|
||||
#endif /* EFSYS_OPT_MAE */
|
||||
|
@ -88,6 +88,8 @@ INTERNAL {
|
||||
efx_mae_fini;
|
||||
efx_mae_get_limits;
|
||||
efx_mae_init;
|
||||
efx_mae_match_spec_fini;
|
||||
efx_mae_match_spec_init;
|
||||
|
||||
efx_mcdi_fini;
|
||||
efx_mcdi_get_proxy_handle;
|
||||
|
Loading…
x
Reference in New Issue
Block a user