From 891408c45a63a35835e50ba792118fdc0ff32ae4 Mon Sep 17 00:00:00 2001 From: Ivan Malov Date: Tue, 20 Oct 2020 10:13:35 +0100 Subject: [PATCH] common/sfc_efx/base: indicate MAE support for encapsulation MAE provides support for encapsulation. One needs to insert a so-called outer rule, which can match outer packet fields, to require that matching packets be parsed as tunnel frames of a given type (VXLAN, Geneve, NVGRE). Then it is possible to chain this rule with an action rule in order to match on inner fields and carry out some actions on matching packets. Report to clients what encapsulation types are supported by MAE. Indicate the number of priority levels for outer rules. Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx.h | 2 ++ drivers/common/sfc_efx/base/efx_impl.h | 2 ++ drivers/common/sfc_efx/base/efx_mae.c | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index b84a43336a..dea1fe3979 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -4068,6 +4068,8 @@ efx_mae_fini( typedef struct efx_mae_limits_s { uint32_t eml_max_n_action_prios; + uint32_t eml_max_n_outer_prios; + uint32_t eml_encap_types_supported; } efx_mae_limits_t; LIBEFX_API diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index 5f662b6fe3..3d1a4fdcb9 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -798,6 +798,8 @@ typedef struct efx_mae_s { /** Action rule match field capabilities. */ efx_mae_field_cap_t *em_action_rule_field_caps; size_t em_action_rule_field_caps_size; + uint32_t em_max_n_outer_prios; + uint32_t em_encap_types_supported; } efx_mae_t; #endif /* EFSYS_OPT_MAE */ diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c index a2b541a9e2..58b323d939 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -39,9 +39,29 @@ efx_mae_get_capabilities( goto fail2; } + maep->em_max_n_outer_prios = + MCDI_OUT_DWORD(req, MAE_GET_CAPS_OUT_OUTER_PRIOS); + maep->em_max_n_action_prios = MCDI_OUT_DWORD(req, MAE_GET_CAPS_OUT_ACTION_PRIOS); + maep->em_encap_types_supported = 0; + + if (MCDI_OUT_DWORD(req, MAE_GET_CAPS_OUT_ENCAP_TYPE_VXLAN) == 1) { + maep->em_encap_types_supported |= + (1U << EFX_TUNNEL_PROTOCOL_VXLAN); + } + + if (MCDI_OUT_DWORD(req, MAE_GET_CAPS_OUT_ENCAP_TYPE_GENEVE) == 1) { + maep->em_encap_types_supported |= + (1U << EFX_TUNNEL_PROTOCOL_GENEVE); + } + + if (MCDI_OUT_DWORD(req, MAE_GET_CAPS_OUT_ENCAP_TYPE_NVGRE) == 1) { + maep->em_encap_types_supported |= + (1U << EFX_TUNNEL_PROTOCOL_NVGRE); + } + maep->em_max_nfields = MCDI_OUT_DWORD(req, MAE_GET_CAPS_OUT_MATCH_FIELD_COUNT); @@ -225,7 +245,9 @@ efx_mae_get_limits( goto fail1; } + emlp->eml_max_n_outer_prios = maep->em_max_n_outer_prios; emlp->eml_max_n_action_prios = maep->em_max_n_action_prios; + emlp->eml_encap_types_supported = maep->em_encap_types_supported; return (0); -- 2.20.1