[dpdk-dev] [PATCH 55/62] common/sfc_efx/base: indicate MAE support for encapsulation

Andrew Rybchenko arybchenko at solarflare.com
Tue Oct 20 10:48:22 CEST 2020


From: Ivan Malov <ivan.malov at oktetlabs.ru>

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 <ivan.malov at oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
Reviewed-by: Andy Moreton <amoreton at xilinx.com>
---
 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 db68cc7b24..900a8c9c6a 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 7958504963..4e51c7b69b 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.17.1



More information about the dev mailing list