[dpdk-dev] [PATCH v2 15/17] net/sfc: add MCDI callback to poll management event queue

Andrew Rybchenko arybchenko at solarflare.com
Thu Sep 17 08:34:41 CEST 2020


Management event queue polling is required in the case of
MCDI proxy authentication (client driver code).

Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
Reviewed-by: Andy Moreton <amoreton at xilinx.com>
---
 drivers/net/sfc/sfc_mcdi.c | 14 ++++++++++++--
 drivers/net/sfc/sfc_mcdi.h |  3 +++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sfc/sfc_mcdi.c b/drivers/net/sfc/sfc_mcdi.c
index 73dbd8194b..fa9160f6d3 100644
--- a/drivers/net/sfc/sfc_mcdi.c
+++ b/drivers/net/sfc/sfc_mcdi.c
@@ -70,7 +70,7 @@ sfc_efx_mcdi_proxy_event_available(struct sfc_adapter *sa)
 
 	mcdi->proxy_handle = 0;
 	mcdi->proxy_result = ETIMEDOUT;
-	sfc_ev_mgmt_qpoll(sa);
+	mcdi->ops->mgmt_evq_poll(mcdi->ops_cookie);
 	if (mcdi->proxy_result != ETIMEDOUT)
 		return B_TRUE;
 
@@ -286,7 +286,7 @@ sfc_efx_mcdi_init(struct sfc_adapter *sa, struct sfc_efx_mcdi *mcdi,
 	int rc;
 
 	if (ops->dma_alloc == NULL || ops->dma_free == NULL ||
-	    ops->sched_restart == NULL)
+	    ops->sched_restart == NULL || ops->mgmt_evq_poll == NULL)
 		return EINVAL;
 
 	SFC_ASSERT(mcdi->state == SFC_EFX_MCDI_UNINITIALIZED);
@@ -382,10 +382,20 @@ sfc_mcdi_sched_restart(void *cookie)
 	sfc_schedule_restart(sa);
 }
 
+static sfc_efx_mcdi_mgmt_evq_poll_cb sfc_mcdi_mgmt_evq_poll;
+static void
+sfc_mcdi_mgmt_evq_poll(void *cookie)
+{
+	struct sfc_adapter *sa = cookie;
+
+	sfc_ev_mgmt_qpoll(sa);
+}
+
 static const struct sfc_efx_mcdi_ops sfc_mcdi_ops = {
 	.dma_alloc	= sfc_mcdi_dma_alloc,
 	.dma_free	= sfc_mcdi_dma_free,
 	.sched_restart	= sfc_mcdi_sched_restart,
+	.mgmt_evq_poll	= sfc_mcdi_mgmt_evq_poll,
 };
 
 int
diff --git a/drivers/net/sfc/sfc_mcdi.h b/drivers/net/sfc/sfc_mcdi.h
index 8f9b1991be..e3a637aeb7 100644
--- a/drivers/net/sfc/sfc_mcdi.h
+++ b/drivers/net/sfc/sfc_mcdi.h
@@ -39,10 +39,13 @@ typedef void (sfc_efx_mcdi_dma_free_cb)(void *cookie, efsys_mem_t *esmp);
 
 typedef void (sfc_efx_mcdi_sched_restart_cb)(void *cookie);
 
+typedef void (sfc_efx_mcdi_mgmt_evq_poll_cb)(void *cookie);
+
 struct sfc_efx_mcdi_ops {
 	sfc_efx_mcdi_dma_alloc_cb	*dma_alloc;
 	sfc_efx_mcdi_dma_free_cb	*dma_free;
 	sfc_efx_mcdi_sched_restart_cb	*sched_restart;
+	sfc_efx_mcdi_mgmt_evq_poll_cb	*mgmt_evq_poll;
 };
 
 struct sfc_efx_mcdi {
-- 
2.17.1



More information about the dev mailing list