From: Ivan Malov Date: Fri, 12 Mar 2021 11:07:44 +0000 (+0300) Subject: common/sfc_efx/base: support adding decap action to a set X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0f6b017bd8c6cb6823f8bf346f348094bf2732cc;p=dpdk.git common/sfc_efx/base: support adding decap action to a set The action has no arguments. Signed-off-by: Ivan Malov Reviewed-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 f98c616278..771fe5a170 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -4240,6 +4240,11 @@ efx_mae_action_set_spec_fini( __in efx_nic_t *enp, __in efx_mae_actions_t *spec); +LIBEFX_API +extern __checkReturn efx_rc_t +efx_mae_action_set_populate_decap( + __in efx_mae_actions_t *spec); + LIBEFX_API extern __checkReturn efx_rc_t efx_mae_action_set_populate_vlan_pop( diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index c76ed9bbe6..4a513171a1 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -1727,6 +1727,7 @@ struct efx_mae_match_spec_s { typedef enum efx_mae_action_e { /* These actions are strictly ordered. */ + EFX_MAE_ACTION_DECAP, EFX_MAE_ACTION_VLAN_POP, EFX_MAE_ACTION_VLAN_PUSH, EFX_MAE_ACTION_ENCAP, diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c index fc112f8323..e6156102d6 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -1012,6 +1012,37 @@ efx_mae_action_set_spec_fini( EFSYS_KMEM_FREE(enp->en_esip, sizeof (*spec), spec); } +static __checkReturn efx_rc_t +efx_mae_action_set_add_decap( + __in efx_mae_actions_t *spec, + __in size_t arg_size, + __in_bcount(arg_size) const uint8_t *arg) +{ + efx_rc_t rc; + + _NOTE(ARGUNUSED(spec)) + + if (arg_size != 0) { + rc = EINVAL; + goto fail1; + } + + if (arg != NULL) { + rc = EINVAL; + goto fail2; + } + + /* This action does not have any arguments, so do nothing here. */ + + return (0); + +fail2: + EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + static __checkReturn efx_rc_t efx_mae_action_set_add_vlan_pop( __in efx_mae_actions_t *spec, @@ -1226,6 +1257,9 @@ typedef struct efx_mae_action_desc_s { } efx_mae_action_desc_t; static const efx_mae_action_desc_t efx_mae_actions[EFX_MAE_NACTIONS] = { + [EFX_MAE_ACTION_DECAP] = { + .emad_add = efx_mae_action_set_add_decap + }, [EFX_MAE_ACTION_VLAN_POP] = { .emad_add = efx_mae_action_set_add_vlan_pop }, @@ -1247,6 +1281,7 @@ static const efx_mae_action_desc_t efx_mae_actions[EFX_MAE_NACTIONS] = { }; static const uint32_t efx_mae_action_ordered_map = + (1U << EFX_MAE_ACTION_DECAP) | (1U << EFX_MAE_ACTION_VLAN_POP) | (1U << EFX_MAE_ACTION_VLAN_PUSH) | (1U << EFX_MAE_ACTION_ENCAP) | @@ -1342,6 +1377,14 @@ fail1: return (rc); } + __checkReturn efx_rc_t +efx_mae_action_set_populate_decap( + __in efx_mae_actions_t *spec) +{ + return (efx_mae_action_set_spec_populate(spec, + EFX_MAE_ACTION_DECAP, 0, NULL)); +} + __checkReturn efx_rc_t efx_mae_action_set_populate_vlan_pop( __in efx_mae_actions_t *spec) @@ -2008,6 +2051,11 @@ efx_mae_action_set_alloc( MCDI_IN_SET_DWORD(req, MAE_ACTION_SET_ALLOC_IN_COUNTER_ID, EFX_MAE_RSRC_ID_INVALID); + if ((spec->ema_actions & (1U << EFX_MAE_ACTION_DECAP)) != 0) { + MCDI_IN_SET_DWORD_FIELD(req, MAE_ACTION_SET_ALLOC_IN_FLAGS, + MAE_ACTION_SET_ALLOC_IN_DECAP, 1); + } + MCDI_IN_SET_DWORD_FIELD(req, MAE_ACTION_SET_ALLOC_IN_FLAGS, MAE_ACTION_SET_ALLOC_IN_VLAN_POP, spec->ema_n_vlan_tags_to_pop); diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map index 7e88674ead..5e724fd102 100644 --- a/drivers/common/sfc_efx/version.map +++ b/drivers/common/sfc_efx/version.map @@ -90,6 +90,7 @@ INTERNAL { efx_mae_action_set_alloc; efx_mae_action_set_fill_in_eh_id; efx_mae_action_set_free; + efx_mae_action_set_populate_decap; efx_mae_action_set_populate_deliver; efx_mae_action_set_populate_drop; efx_mae_action_set_populate_encap;