diff mbox series

[03/20] common/sfc_efx/base: separate target EvQ and IRQ config

Message ID 20210527152510.1551026-4-andrew.rybchenko@oktetlabs.ru (mailing list archive)
State Superseded, archived
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 May 27, 2021, 3:24 p.m. UTC
Target EvQ and IRQ number are specified in the same location
in MCDI request. The value is treated as IRQ number if the
event queue is interrupting (corresponding flag is set) and
as target event queue otherwise.

However it is better to separate it on helper API level to
make it more clear.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/ef10_ev.c  | 12 +++++++-----
 drivers/common/sfc_efx/base/efx_impl.h |  1 +
 drivers/common/sfc_efx/base/efx_mcdi.c |  7 ++++++-
 drivers/common/sfc_efx/base/rhead_ev.c | 12 +++++++-----
 4 files changed, 21 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/common/sfc_efx/base/ef10_ev.c b/drivers/common/sfc_efx/base/ef10_ev.c
index ea59beecc4..c0cbc427b9 100644
--- a/drivers/common/sfc_efx/base/ef10_ev.c
+++ b/drivers/common/sfc_efx/base/ef10_ev.c
@@ -121,7 +121,8 @@  ef10_ev_qcreate(
 	__in		efx_evq_t *eep)
 {
 	efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
-	uint32_t irq;
+	uint32_t irq = 0;
+	uint32_t target_evq = 0;
 	efx_rc_t rc;
 	boolean_t low_latency;
 
@@ -159,11 +160,12 @@  ef10_ev_qcreate(
 	    EFX_EVQ_FLAGS_NOTIFY_INTERRUPT) {
 		irq = index;
 	} else if (index == EFX_EF10_ALWAYS_INTERRUPTING_EVQ_INDEX) {
-		irq = index;
+		/* Use the first interrupt for always interrupting EvQ */
+		irq = 0;
 		flags = (flags & ~EFX_EVQ_FLAGS_NOTIFY_MASK) |
 		    EFX_EVQ_FLAGS_NOTIFY_INTERRUPT;
 	} else {
-		irq = EFX_EF10_ALWAYS_INTERRUPTING_EVQ_INDEX;
+		target_evq = EFX_EF10_ALWAYS_INTERRUPTING_EVQ_INDEX;
 	}
 
 	/*
@@ -187,8 +189,8 @@  ef10_ev_qcreate(
 	 * decision and low_latency hint is ignored.
 	 */
 	low_latency = encp->enc_datapath_cap_evb ? 0 : 1;
-	rc = efx_mcdi_init_evq(enp, index, esmp, ndescs, irq, us, flags,
-	    low_latency);
+	rc = efx_mcdi_init_evq(enp, index, esmp, ndescs, irq, target_evq, us,
+	    flags, low_latency);
 	if (rc != 0)
 		goto fail2;
 
diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h
index 8b63cfb37d..4fff9e1842 100644
--- a/drivers/common/sfc_efx/base/efx_impl.h
+++ b/drivers/common/sfc_efx/base/efx_impl.h
@@ -1535,6 +1535,7 @@  efx_mcdi_init_evq(
 	__in		efsys_mem_t *esmp,
 	__in		size_t nevs,
 	__in		uint32_t irq,
+	__in		uint32_t target_evq,
 	__in		uint32_t us,
 	__in		uint32_t flags,
 	__in		boolean_t low_latency);
diff --git a/drivers/common/sfc_efx/base/efx_mcdi.c b/drivers/common/sfc_efx/base/efx_mcdi.c
index f226ffd923..b68fc0503d 100644
--- a/drivers/common/sfc_efx/base/efx_mcdi.c
+++ b/drivers/common/sfc_efx/base/efx_mcdi.c
@@ -2568,6 +2568,7 @@  efx_mcdi_init_evq(
 	__in		efsys_mem_t *esmp,
 	__in		size_t nevs,
 	__in		uint32_t irq,
+	__in		uint32_t target_evq,
 	__in		uint32_t us,
 	__in		uint32_t flags,
 	__in		boolean_t low_latency)
@@ -2602,11 +2603,15 @@  efx_mcdi_init_evq(
 
 	MCDI_IN_SET_DWORD(req, INIT_EVQ_V2_IN_SIZE, nevs);
 	MCDI_IN_SET_DWORD(req, INIT_EVQ_V2_IN_INSTANCE, instance);
-	MCDI_IN_SET_DWORD(req, INIT_EVQ_V2_IN_IRQ_NUM, irq);
 
 	interrupting = ((flags & EFX_EVQ_FLAGS_NOTIFY_MASK) ==
 	    EFX_EVQ_FLAGS_NOTIFY_INTERRUPT);
 
+	if (interrupting)
+		MCDI_IN_SET_DWORD(req, INIT_EVQ_V2_IN_IRQ_NUM, irq);
+	else
+		MCDI_IN_SET_DWORD(req, INIT_EVQ_V2_IN_TARGET_EVQ, target_evq);
+
 	if (encp->enc_init_evq_v2_supported) {
 		/*
 		 * On Medford the low latency license is required to enable RX
diff --git a/drivers/common/sfc_efx/base/rhead_ev.c b/drivers/common/sfc_efx/base/rhead_ev.c
index 2099581fd7..533cd9e34a 100644
--- a/drivers/common/sfc_efx/base/rhead_ev.c
+++ b/drivers/common/sfc_efx/base/rhead_ev.c
@@ -106,7 +106,8 @@  rhead_ev_qcreate(
 {
 	const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp);
 	size_t desc_size;
-	uint32_t irq;
+	uint32_t irq = 0;
+	uint32_t target_evq = 0;
 	efx_rc_t rc;
 
 	_NOTE(ARGUNUSED(id))	/* buftbl id managed by MC */
@@ -142,19 +143,20 @@  rhead_ev_qcreate(
 	    EFX_EVQ_FLAGS_NOTIFY_INTERRUPT) {
 		irq = index;
 	} else if (index == EFX_RHEAD_ALWAYS_INTERRUPTING_EVQ_INDEX) {
-		irq = index;
+		/* Use the first interrupt for always interrupting EvQ */
+		irq = 0;
 		flags = (flags & ~EFX_EVQ_FLAGS_NOTIFY_MASK) |
 		    EFX_EVQ_FLAGS_NOTIFY_INTERRUPT;
 	} else {
-		irq = EFX_RHEAD_ALWAYS_INTERRUPTING_EVQ_INDEX;
+		target_evq = EFX_RHEAD_ALWAYS_INTERRUPTING_EVQ_INDEX;
 	}
 
 	/*
 	 * Interrupts may be raised for events immediately after the queue is
 	 * created. See bug58606.
 	 */
-	rc = efx_mcdi_init_evq(enp, index, esmp, ndescs, irq, us, flags,
-	    B_FALSE);
+	rc = efx_mcdi_init_evq(enp, index, esmp, ndescs, irq, target_evq, us,
+	    flags, B_FALSE);
 	if (rc != 0)
 		goto fail2;