[dpdk-dev] [PATCH 06/14] net/sfc: start to make MCDI helpers interface shareable

Andrew Rybchenko arybchenko at solarflare.com
Tue Sep 8 11:14:27 CEST 2020


sfc_adapter is network driver specific structure which finally
should not be used in shared MCDI helpers interface.

Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
Reviewed-by: Andy Moreton <amoreton at xilinx.com>
---
 drivers/net/sfc/sfc_mcdi.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/sfc/sfc_mcdi.c b/drivers/net/sfc/sfc_mcdi.c
index c716caabdf..35e1f3940d 100644
--- a/drivers/net/sfc/sfc_mcdi.c
+++ b/drivers/net/sfc/sfc_mcdi.c
@@ -248,17 +248,14 @@ sfc_efx_mcdi_ev_proxy_response(void *arg, uint32_t handle, efx_rc_t result)
 }
 
 static int
-sfc_efx_mcdi_init(struct sfc_adapter *sa)
+sfc_efx_mcdi_init(struct sfc_adapter *sa, struct sfc_efx_mcdi *mcdi)
 {
-	struct sfc_efx_mcdi *mcdi;
 	size_t max_msg_size;
 	efx_mcdi_transport_t *emtp;
 	int rc;
 
 	sfc_log_init(sa, "entry");
 
-	mcdi = &sa->mcdi;
-
 	SFC_ASSERT(mcdi->state == SFC_EFX_MCDI_UNINITIALIZED);
 
 	rte_spinlock_init(&mcdi->lock);
@@ -301,14 +298,12 @@ sfc_efx_mcdi_init(struct sfc_adapter *sa)
 }
 
 static void
-sfc_efx_mcdi_fini(struct sfc_adapter *sa)
+sfc_efx_mcdi_fini(struct sfc_adapter *sa, struct sfc_efx_mcdi *mcdi)
 {
-	struct sfc_efx_mcdi *mcdi;
 	efx_mcdi_transport_t *emtp;
 
 	sfc_log_init(sa, "entry");
 
-	mcdi = &sa->mcdi;
 	emtp = &mcdi->transport;
 
 	rte_spinlock_lock(&mcdi->lock);
@@ -328,11 +323,11 @@ sfc_efx_mcdi_fini(struct sfc_adapter *sa)
 int
 sfc_mcdi_init(struct sfc_adapter *sa)
 {
-	return sfc_efx_mcdi_init(sa);
+	return sfc_efx_mcdi_init(sa, &sa->mcdi);
 }
 
 void
 sfc_mcdi_fini(struct sfc_adapter *sa)
 {
-	sfc_efx_mcdi_fini(sa);
+	sfc_efx_mcdi_fini(sa, &sa->mcdi);
 }
-- 
2.17.1



More information about the dev mailing list