diff mbox series

[v3,07/20] common/sfc_efx/base: add ingress m-port RxQ flag

Message ID 20210618134032.1922012-8-andrew.rybchenko@oktetlabs.ru (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers show
Series net/sfc: support flow API COUNT action | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko June 18, 2021, 1:40 p.m. UTC
From: Igor Romanov <igor.romanov@oktetlabs.ru>

Add a flag to request support for ingress m-port on an RxQ.
Implement it only for Riverhead, other families will return an error
if the flag is set.

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/ef10_rx.c  |  9 ++++++++-
 drivers/common/sfc_efx/base/efx.h      |  5 +++++
 drivers/common/sfc_efx/base/efx_rx.c   | 14 +++++++++-----
 drivers/common/sfc_efx/base/rhead_rx.c |  3 +++
 4 files changed, 25 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/common/sfc_efx/base/ef10_rx.c b/drivers/common/sfc_efx/base/ef10_rx.c
index cfa60bd324..0e140645a5 100644
--- a/drivers/common/sfc_efx/base/ef10_rx.c
+++ b/drivers/common/sfc_efx/base/ef10_rx.c
@@ -1031,6 +1031,11 @@  ef10_rx_qcreate(
 	EFSYS_ASSERT(params.es_bufs_per_desc == 0);
 #endif /* EFSYS_OPT_RX_ES_SUPER_BUFFER */
 
+	if (flags & EFX_RXQ_FLAG_INGRESS_MPORT) {
+		rc = ENOTSUP;
+		goto fail12;
+	}
+
 	/* Scatter can only be disabled if the firmware supports doing so */
 	if (flags & EFX_RXQ_FLAG_SCATTER)
 		params.disable_scatter = B_FALSE;
@@ -1044,7 +1049,7 @@  ef10_rx_qcreate(
 
 	if ((rc = efx_mcdi_init_rxq(enp, ndescs, eep, label, index,
 		    esmp, &params)) != 0)
-		goto fail12;
+		goto fail13;
 
 	erp->er_eep = eep;
 	erp->er_label = label;
@@ -1057,6 +1062,8 @@  ef10_rx_qcreate(
 
 	return (0);
 
+fail13:
+	EFSYS_PROBE(fail13);
 fail12:
 	EFSYS_PROBE(fail12);
 #if EFSYS_OPT_RX_ES_SUPER_BUFFER
diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h
index e43efbda1f..76092d794f 100644
--- a/drivers/common/sfc_efx/base/efx.h
+++ b/drivers/common/sfc_efx/base/efx.h
@@ -2925,6 +2925,7 @@  typedef enum efx_rx_prefix_field_e {
 	EFX_RX_PREFIX_FIELD_USER_MARK_VALID,
 	EFX_RX_PREFIX_FIELD_CSUM_FRAME,
 	EFX_RX_PREFIX_FIELD_INGRESS_VPORT,
+	EFX_RX_PREFIX_FIELD_INGRESS_MPORT = EFX_RX_PREFIX_FIELD_INGRESS_VPORT,
 	EFX_RX_PREFIX_NFIELDS
 } efx_rx_prefix_field_t;
 
@@ -2998,6 +2999,10 @@  typedef enum efx_rxq_type_e {
  * the driver.
  */
 #define	EFX_RXQ_FLAG_RSS_HASH		0x4
+/*
+ * Request ingress mport field in the Rx prefix of a queue.
+ */
+#define	EFX_RXQ_FLAG_INGRESS_MPORT	0x8
 
 LIBEFX_API
 extern	__checkReturn	efx_rc_t
diff --git a/drivers/common/sfc_efx/base/efx_rx.c b/drivers/common/sfc_efx/base/efx_rx.c
index 7c6fecf925..7e63363be7 100644
--- a/drivers/common/sfc_efx/base/efx_rx.c
+++ b/drivers/common/sfc_efx/base/efx_rx.c
@@ -1743,14 +1743,20 @@  siena_rx_qcreate(
 		goto fail2;
 	}
 
-	if (flags & EFX_RXQ_FLAG_SCATTER) {
 #if EFSYS_OPT_RX_SCATTER
-		jumbo = B_TRUE;
+#define SUPPORTED_RXQ_FLAGS EFX_RXQ_FLAG_SCATTER
 #else
+#define SUPPORTED_RXQ_FLAGS EFX_RXQ_FLAG_NONE
+#endif
+	/* Reject flags for unsupported queue features */
+	if ((flags & ~SUPPORTED_RXQ_FLAGS) != 0) {
 		rc = EINVAL;
 		goto fail3;
-#endif	/* EFSYS_OPT_RX_SCATTER */
 	}
+#undef SUPPORTED_RXQ_FLAGS
+
+	if (flags & EFX_RXQ_FLAG_SCATTER)
+		jumbo = B_TRUE;
 
 	/* Set up the new descriptor queue */
 	EFX_POPULATE_OWORD_7(oword,
@@ -1769,10 +1775,8 @@  siena_rx_qcreate(
 
 	return (0);
 
-#if !EFSYS_OPT_RX_SCATTER
 fail3:
 	EFSYS_PROBE(fail3);
-#endif
 fail2:
 	EFSYS_PROBE(fail2);
 fail1:
diff --git a/drivers/common/sfc_efx/base/rhead_rx.c b/drivers/common/sfc_efx/base/rhead_rx.c
index b2dacbab32..f1d46f7c70 100644
--- a/drivers/common/sfc_efx/base/rhead_rx.c
+++ b/drivers/common/sfc_efx/base/rhead_rx.c
@@ -629,6 +629,9 @@  rhead_rx_qcreate(
 		fields_mask |= 1U << EFX_RX_PREFIX_FIELD_RSS_HASH_VALID;
 	}
 
+	if (flags & EFX_RXQ_FLAG_INGRESS_MPORT)
+		fields_mask |= 1U << EFX_RX_PREFIX_FIELD_INGRESS_MPORT;
+
 	/*
 	 * LENGTH is required in EF100 host interface, as receive events
 	 * do not include the packet length.