[dpdk-dev] [PATCH v2 58/62] common/sfc_efx/base: add an API to compare match specs

Andrew Rybchenko arybchenko at solarflare.com
Tue Oct 20 11:13:38 CEST 2020


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

Match specification format and its size are not exposed to clients.
Provide an API to compare two match specifications.

A client would typically use this API to compare a match specification
of an outer rule being validated with match specifications of already
active outer rules (to make sure that rule class is supported).

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                     | 6 ++++++
 drivers/common/sfc_efx/base/efx_mae.c                 | 8 ++++++++
 drivers/common/sfc_efx/rte_common_sfc_efx_version.map | 1 +
 3 files changed, 15 insertions(+)

diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h
index 901d653262..c6472eaf76 100644
--- a/drivers/common/sfc_efx/base/efx.h
+++ b/drivers/common/sfc_efx/base/efx.h
@@ -4204,6 +4204,12 @@ efx_mae_match_spec_mport_set(
 	__in				const efx_mport_sel_t *valuep,
 	__in_opt			const efx_mport_sel_t *maskp);
 
+LIBEFX_API
+extern	__checkReturn			boolean_t
+efx_mae_match_specs_equal(
+	__in				const efx_mae_match_spec_t *left,
+	__in				const efx_mae_match_spec_t *right);
+
 /*
  * Make sure that match fields known by EFX have proper masks set
  * in the match specification as per requirements of SF-122526-TC.
diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c
index dfb8b2e743..935cec5e18 100644
--- a/drivers/common/sfc_efx/base/efx_mae.c
+++ b/drivers/common/sfc_efx/base/efx_mae.c
@@ -636,6 +636,14 @@ efx_mae_match_spec_mport_set(
 	return (rc);
 }
 
+	__checkReturn			boolean_t
+efx_mae_match_specs_equal(
+	__in				const efx_mae_match_spec_t *left,
+	__in				const efx_mae_match_spec_t *right)
+{
+	return ((memcmp(left, right, sizeof (*left)) == 0) ? B_TRUE : B_FALSE);
+}
+
 #define	EFX_MASK_BIT_IS_SET(_mask, _mask_page_nbits, _bit)		\
 	    ((_mask)[(_bit) / (_mask_page_nbits)] &			\
 		    (1ULL << ((_bit) & ((_mask_page_nbits) - 1))))
diff --git a/drivers/common/sfc_efx/rte_common_sfc_efx_version.map b/drivers/common/sfc_efx/rte_common_sfc_efx_version.map
index 37056abd60..07b3b6371b 100644
--- a/drivers/common/sfc_efx/rte_common_sfc_efx_version.map
+++ b/drivers/common/sfc_efx/rte_common_sfc_efx_version.map
@@ -107,6 +107,7 @@ INTERNAL {
 	efx_mae_match_spec_is_valid;
 	efx_mae_match_spec_mport_set;
 	efx_mae_match_specs_class_cmp;
+	efx_mae_match_specs_equal;
 	efx_mae_mport_by_pcie_function;
 	efx_mae_mport_by_phy_port;
 
-- 
2.17.1



More information about the dev mailing list