common/sfc_efx/base: support adding decap action to a set
authorIvan Malov <ivan.malov@oktetlabs.ru>
Fri, 12 Mar 2021 11:07:44 +0000 (14:07 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 22 Mar 2021 16:19:16 +0000 (17:19 +0100)
The action has no arguments.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
drivers/common/sfc_efx/base/efx.h
drivers/common/sfc_efx/base/efx_impl.h
drivers/common/sfc_efx/base/efx_mae.c
drivers/common/sfc_efx/version.map

index f98c616..771fe5a 100644 (file)
@@ -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(
index c76ed9b..4a51317 100644 (file)
@@ -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,
index fc112f8..e615610 100644 (file)
@@ -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);
 
index 7e88674..5e724fd 100644 (file)
@@ -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;