[v3,25/60] common/sfc_efx/base: handle MCDI events on Riverhead
diff mbox series

Message ID 1600949555-28043-26-git-send-email-arybchenko@solarflare.com
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series
  • common/sfc_efx: support Riverhead NIC family
Related show

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Andrew Rybchenko Sept. 24, 2020, 12:12 p.m. UTC
EF100 MCDI event layout is same as on EF10 except added QDMA phase
bit which is unused on EF10.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/ef10_ev.c   | 17 +++++++------
 drivers/common/sfc_efx/base/ef10_impl.h |  8 ++++++
 drivers/common/sfc_efx/base/rhead_ev.c  | 33 ++++++++++++++++++++++++-
 3 files changed, 49 insertions(+), 9 deletions(-)

Patch
diff mbox series

diff --git a/drivers/common/sfc_efx/base/ef10_ev.c b/drivers/common/sfc_efx/base/ef10_ev.c
index e2b5c62d5d..aec1c468a4 100644
--- a/drivers/common/sfc_efx/base/ef10_ev.c
+++ b/drivers/common/sfc_efx/base/ef10_ev.c
@@ -47,13 +47,6 @@  ef10_ev_drv_gen(
 	__in		const efx_ev_callbacks_t *eecp,
 	__in_opt	void *arg);
 
-static	__checkReturn	boolean_t
-ef10_ev_mcdi(
-	__in		efx_evq_t *eep,
-	__in		efx_qword_t *eqp,
-	__in		const efx_ev_callbacks_t *eecp,
-	__in_opt	void *arg);
-
 
 static	__checkReturn	efx_rc_t
 efx_mcdi_set_evq_tmr(
@@ -857,7 +850,11 @@  ef10_ev_drv_gen(
 	return (should_abort);
 }
 
-static	__checkReturn	boolean_t
+#endif	/* EFX_OPTS_EF10() */
+
+#if EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10()
+
+	__checkReturn	boolean_t
 ef10_ev_mcdi(
 	__in		efx_evq_t *eep,
 	__in		efx_qword_t *eqp,
@@ -1064,6 +1061,10 @@  ef10_ev_mcdi(
 	return (should_abort);
 }
 
+#endif	/* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */
+
+#if EFX_OPTS_EF10()
+
 		void
 ef10_ev_rxlabel_init(
 	__in		efx_evq_t *eep,
diff --git a/drivers/common/sfc_efx/base/ef10_impl.h b/drivers/common/sfc_efx/base/ef10_impl.h
index e933d88135..e77fb4ddea 100644
--- a/drivers/common/sfc_efx/base/ef10_impl.h
+++ b/drivers/common/sfc_efx/base/ef10_impl.h
@@ -158,6 +158,14 @@  ef10_ev_rxlabel_fini(
 	__in		efx_evq_t *eep,
 	__in		unsigned int label);
 
+LIBEFX_INTERNAL
+extern	__checkReturn	boolean_t
+ef10_ev_mcdi(
+	__in		efx_evq_t *eep,
+	__in		efx_qword_t *eqp,
+	__in		const efx_ev_callbacks_t *eecp,
+	__in_opt	void *arg);
+
 /* INTR */
 
 LIBEFX_INTERNAL
diff --git a/drivers/common/sfc_efx/base/rhead_ev.c b/drivers/common/sfc_efx/base/rhead_ev.c
index 36e355f209..6113cc9cf3 100644
--- a/drivers/common/sfc_efx/base/rhead_ev.c
+++ b/drivers/common/sfc_efx/base/rhead_ev.c
@@ -17,6 +17,14 @@ 
 #define	EFX_RHEAD_ALWAYS_INTERRUPTING_EVQ_INDEX	(0)
 
 
+static	__checkReturn	boolean_t
+rhead_ev_mcdi(
+	__in		efx_evq_t *eep,
+	__in		efx_qword_t *eqp,
+	__in		const efx_ev_callbacks_t *eecp,
+	__in_opt	void *arg);
+
+
 	__checkReturn	efx_rc_t
 rhead_ev_init(
 	__in		efx_nic_t *enp)
@@ -54,7 +62,7 @@  rhead_ev_qcreate(
 	eep->ee_tx	= NULL; /* FIXME */
 	eep->ee_driver	= NULL; /* FIXME */
 	eep->ee_drv_gen	= NULL; /* FIXME */
-	eep->ee_mcdi	= NULL; /* FIXME */
+	eep->ee_mcdi	= rhead_ev_mcdi;
 
 	/* Set up the event queue */
 	/* INIT_EVQ expects function-relative vector number */
@@ -193,6 +201,10 @@  rhead_ev_qpoll(
 
 			code = EFX_QWORD_FIELD(ev[index], ESF_GZ_E_TYPE);
 			switch (code) {
+			case ESE_GZ_EF100_EV_MCDI:
+				should_abort = eep->ee_mcdi(eep,
+				    &(ev[index]), eecp, arg);
+				break;
 			default:
 				EFSYS_PROBE3(bad_event,
 				    unsigned int, eep->ee_index,
@@ -262,4 +274,23 @@  rhead_ev_qstats_update(
 }
 #endif /* EFSYS_OPT_QSTATS */
 
+static	__checkReturn	boolean_t
+rhead_ev_mcdi(
+	__in		efx_evq_t *eep,
+	__in		efx_qword_t *eqp,
+	__in		const efx_ev_callbacks_t *eecp,
+	__in_opt	void *arg)
+{
+	boolean_t ret;
+
+	/*
+	 * Event format was changed post Riverhead R1 and now
+	 * MCDI event layout on EF100 is exactly the same as on EF10
+	 * except added QDMA phase bit which is unused on EF10.
+	 */
+	ret = ef10_ev_mcdi(eep, eqp, eecp, arg);
+
+	return (ret);
+}
+
 #endif	/* EFSYS_OPT_RIVERHEAD */