[dpdk-dev] [PATCH 10/38] common/sfc_efx/base: allow creating invalid mport selectors

Andrew Rybchenko andrew.rybchenko at oktetlabs.ru
Fri Aug 27 08:56:49 CEST 2021


From: Viacheslav Galaktionov <viacheslav.galaktionov at oktetlabs.ru>

There isn't always a valid mport that can be used. For these cases,
special invalid selectors can be generated. Requests that use such
selectors in any way will be rejected.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov at oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton at xilinx.com>
---
 drivers/common/sfc_efx/base/efx.h     | 11 +++++++++++
 drivers/common/sfc_efx/base/efx_mae.c | 25 +++++++++++++++++++++++++
 drivers/common/sfc_efx/version.map    |  1 +
 3 files changed, 37 insertions(+)

diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h
index 94803815ac..c0d1535017 100644
--- a/drivers/common/sfc_efx/base/efx.h
+++ b/drivers/common/sfc_efx/base/efx.h
@@ -4196,6 +4196,17 @@ typedef struct efx_mport_id_s {
 
 #define	EFX_MPORT_NULL			(0U)
 
+/*
+ * Generate an invalid MPORT selector.
+ *
+ * The resulting MPORT selector is opaque to the caller. Requests
+ * that attempt to use it will be rejected.
+ */
+LIBEFX_API
+extern	__checkReturn			efx_rc_t
+efx_mae_mport_invalid(
+	__out				efx_mport_sel_t *mportp);
+
 /*
  * Get MPORT selector of a physical port.
  *
diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c
index b38b1143d6..b7afe8fdc8 100644
--- a/drivers/common/sfc_efx/base/efx_mae.c
+++ b/drivers/common/sfc_efx/base/efx_mae.c
@@ -660,6 +660,31 @@ static const efx_mae_mv_bit_desc_t __efx_mae_action_rule_mv_bit_desc_set[] = {
 #undef EFX_MAE_MV_BIT_DESC
 };
 
+	__checkReturn			efx_rc_t
+efx_mae_mport_invalid(
+	__out				efx_mport_sel_t *mportp)
+{
+	efx_dword_t dword;
+	efx_rc_t rc;
+
+	if (mportp == NULL) {
+		rc = EINVAL;
+		goto fail1;
+	}
+
+	EFX_POPULATE_DWORD_1(dword,
+	    MAE_MPORT_SELECTOR_TYPE, MAE_MPORT_SELECTOR_TYPE_INVALID);
+
+	memset(mportp, 0, sizeof (*mportp));
+	mportp->sel = dword.ed_u32[0];
+
+	return (0);
+
+fail1:
+	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+	return (rc);
+}
+
 	__checkReturn			efx_rc_t
 efx_mae_mport_by_phy_port(
 	__in				uint32_t phy_port,
diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map
index 3dc21878c0..611757ccde 100644
--- a/drivers/common/sfc_efx/version.map
+++ b/drivers/common/sfc_efx/version.map
@@ -127,6 +127,7 @@ INTERNAL {
 	efx_mae_mport_by_pcie_function;
 	efx_mae_mport_by_phy_port;
 	efx_mae_mport_id_by_selector;
+	efx_mae_mport_invalid;
 	efx_mae_outer_rule_insert;
 	efx_mae_outer_rule_remove;
 
-- 
2.30.2



More information about the dev mailing list