diff mbox series

[13/38] common/sfc_efx/base: add API to get mport selector by ID

Message ID 20210827065717.1838258-14-andrew.rybchenko@oktetlabs.ru (mailing list archive)
State Superseded
Delegated to: Ferruh Yigit
Headers show
Series net/sfc: support port representors | expand

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Andrew Rybchenko Aug. 27, 2021, 6:56 a.m. UTC
From: Igor Romanov <igor.romanov@oktetlabs.ru>

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     | 13 +++++++++++++
 drivers/common/sfc_efx/base/efx_mae.c | 17 +++++++++++++++++
 drivers/common/sfc_efx/version.map    |  1 +
 3 files changed, 31 insertions(+)
diff mbox series

Patch

diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h
index 7f04b42bae..a59c2e47ef 100644
--- a/drivers/common/sfc_efx/base/efx.h
+++ b/drivers/common/sfc_efx/base/efx.h
@@ -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
diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c
index b7afe8fdc8..f5d981f973 100644
--- a/drivers/common/sfc_efx/base/efx_mae.c
+++ b/drivers/common/sfc_efx/base/efx_mae.c
@@ -827,6 +827,23 @@  efx_mae_mport_id_by_selector(
 	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,
diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map
index 611757ccde..8c5d813c19 100644
--- a/drivers/common/sfc_efx/version.map
+++ b/drivers/common/sfc_efx/version.map
@@ -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;