From 36d124c37d7fc2d19758210ab17ec2f09c080cae Mon Sep 17 00:00:00 2001 From: Ivan Malov Date: Tue, 20 Oct 2020 10:13:38 +0100 Subject: [PATCH] common/sfc_efx/base: add API to compare match specs 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 Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx.h | 6 ++++++ drivers/common/sfc_efx/base/efx_mae.c | 8 ++++++++ drivers/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 20473a3b54..b75059efe3 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -636,6 +636,14 @@ fail1: 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/version.map b/drivers/common/sfc_efx/version.map index 37056abd60..07b3b6371b 100644 --- a/drivers/common/sfc_efx/version.map +++ b/drivers/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.20.1