common/sfc_efx/base: add API to compare match specs
authorIvan Malov <ivan.malov@oktetlabs.ru>
Tue, 20 Oct 2020 09:13:38 +0000 (10:13 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 3 Nov 2020 22:24:25 +0000 (23:24 +0100)
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@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
drivers/common/sfc_efx/base/efx.h
drivers/common/sfc_efx/base/efx_mae.c
drivers/common/sfc_efx/version.map

index 901d653..c6472ea 100644 (file)
@@ -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.
index 20473a3..b75059e 100644 (file)
@@ -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))))
index 37056ab..07b3b63 100644 (file)
@@ -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;