common/sfc_efx/base: add API to get mport selector by ID
authorIgor Romanov <igor.romanov@oktetlabs.ru>
Mon, 11 Oct 2021 14:48:32 +0000 (17:48 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 12 Oct 2021 16:44:11 +0000 (18:44 +0200)
The conversion is required when mport ID is received via
mport allocation and mport selector is required for filter
creation.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
drivers/common/sfc_efx/base/efx.h
drivers/common/sfc_efx/base/efx_mae.c
drivers/common/sfc_efx/version.map

index 7f04b42..a59c2e4 100644 (file)
@@ -4237,6 +4237,19 @@ efx_mae_mport_by_pcie_function(
        __in                            uint32_t vf,
        __out                           efx_mport_sel_t *mportp);
 
+/*
+ * Get MPORT selector by an MPORT ID
+ *
+ * The resulting MPORT selector is opaque to the caller and can be
+ * passed as an argument to efx_mae_match_spec_mport_set()
+ * and efx_mae_action_set_populate_deliver().
+ */
+LIBEFX_API
+extern __checkReturn                   efx_rc_t
+efx_mae_mport_by_id(
+       __in                            const efx_mport_id_t *mport_idp,
+       __out                           efx_mport_sel_t *mportp);
+
 /* Get MPORT ID by an MPORT selector */
 LIBEFX_API
 extern __checkReturn                   efx_rc_t
index b7afe8f..f5d981f 100644 (file)
@@ -827,6 +827,23 @@ fail1:
        return (rc);
 }
 
+       __checkReturn                   efx_rc_t
+efx_mae_mport_by_id(
+       __in                            const efx_mport_id_t *mport_idp,
+       __out                           efx_mport_sel_t *mportp)
+{
+       efx_dword_t dword;
+
+       EFX_POPULATE_DWORD_2(dword,
+           MAE_MPORT_SELECTOR_TYPE, MAE_MPORT_SELECTOR_TYPE_MPORT_ID,
+           MAE_MPORT_SELECTOR_MPORT_ID, mport_idp->id);
+
+       memset(mportp, 0, sizeof (*mportp));
+       mportp->sel = __LE_TO_CPU_32(dword.ed_u32[0]);
+
+       return (0);
+}
+
        __checkReturn                   efx_rc_t
 efx_mae_match_spec_field_set(
        __in                            efx_mae_match_spec_t *spec,
index 611757c..8c5d813 100644 (file)
@@ -126,6 +126,7 @@ INTERNAL {
        efx_mae_match_specs_equal;
        efx_mae_mport_by_pcie_function;
        efx_mae_mport_by_phy_port;
+       efx_mae_mport_by_id;
        efx_mae_mport_id_by_selector;
        efx_mae_mport_invalid;
        efx_mae_outer_rule_insert;