From: Ivan Malov Date: Tue, 20 Oct 2020 09:12:54 +0000 (+0100) Subject: common/sfc_efx/base: add action set spec init/fini APIs X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=799889bada11fbaefc8e372d315ec0e2dc370750;p=dpdk.git common/sfc_efx/base: add action set spec init/fini APIs The engine is only able to carry out chosen actions on matching packets in a strict order. No MCDI exists to identify supported actions and the order. Still, the definition of the latter is available from the FW documentation. The general idea is to define an action specification structure and supply a client driver with APIs for adding actions individually, order-dependent. A client driver is supposed to invoke an API on every action passed by the application, and if an out-of-order action follows, the API will reject it. Add an action set specification stub and supply initialise / finalise APIs. 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 c91f7948a0..cd0b22d43a 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -4098,6 +4098,26 @@ efx_mae_match_spec_is_valid( __in efx_nic_t *enp, __in const efx_mae_match_spec_t *spec); +typedef struct efx_mae_actions_s efx_mae_actions_t; + +LIBEFX_API +extern __checkReturn efx_rc_t +efx_mae_action_set_spec_init( + __in efx_nic_t *enp, + __out efx_mae_actions_t **specp); + +LIBEFX_API +extern void +efx_mae_action_set_spec_fini( + __in efx_nic_t *enp, + __in efx_mae_actions_t *spec); + +LIBEFX_API +extern __checkReturn boolean_t +efx_mae_action_set_specs_equal( + __in const efx_mae_actions_t *left, + __in const efx_mae_actions_t *right); + /* * Conduct a comparison to check whether two match specifications * of equal rule type (action / outer) and priority would map to diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 2b872bb62e..44e6467bc0 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -1699,6 +1699,9 @@ struct efx_mae_match_spec_s { } emms_mask_value_pairs; }; +struct efx_mae_actions_s { +}; + #endif /* EFSYS_OPT_MAE */ #ifdef __cplusplus diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c index a126cba37f..81c586dfe8 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -434,6 +434,45 @@ efx_mae_match_spec_is_valid( return (is_valid); } + __checkReturn efx_rc_t +efx_mae_action_set_spec_init( + __in efx_nic_t *enp, + __out efx_mae_actions_t **specp) +{ + efx_mae_actions_t *spec; + efx_rc_t rc; + + EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (*spec), spec); + if (spec == NULL) { + rc = ENOMEM; + goto fail1; + } + + *specp = spec; + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + + void +efx_mae_action_set_spec_fini( + __in efx_nic_t *enp, + __in efx_mae_actions_t *spec) +{ + EFSYS_KMEM_FREE(enp->en_esip, sizeof (*spec), spec); +} + + __checkReturn boolean_t +efx_mae_action_set_specs_equal( + __in const efx_mae_actions_t *left, + __in const efx_mae_actions_t *right) +{ + return ((memcmp(left, right, sizeof (*left)) == 0) ? B_TRUE : B_FALSE); +} + __checkReturn efx_rc_t efx_mae_match_specs_class_cmp( __in efx_nic_t *enp, diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map index aeb6f4d134..8a4d2b2fff 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_action_set_spec_fini; + efx_mae_action_set_spec_init; + efx_mae_action_set_specs_equal; efx_mae_fini; efx_mae_get_limits; efx_mae_init;