[v2,06/17] net/sfc: add dedicated header file with MCDI interface
diff mbox series

Message ID 1600324483-23153-7-git-send-email-arybchenko@solarflare.com
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series
  • net/sfc: factor out common driver library
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Sept. 17, 2020, 6:34 a.m. UTC
MCDI helpers will be shared by net and vDPA drivers.
Prepare to move it to common/sfc_efx.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/net/sfc/sfc.h      | 23 +---------------
 drivers/net/sfc/sfc_mcdi.c |  1 +
 drivers/net/sfc/sfc_mcdi.h | 54 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 22 deletions(-)
 create mode 100644 drivers/net/sfc/sfc_mcdi.h

Patch
diff mbox series

diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index cdff9be3ec..a530b12a8e 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -23,6 +23,7 @@ 
 
 #include "sfc_debug.h"
 #include "sfc_filter.h"
+#include "sfc_mcdi.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -86,25 +87,6 @@  enum sfc_dev_filter_mode {
 	SFC_DEV_FILTER_NMODES
 };
 
-enum sfc_mcdi_state {
-	SFC_MCDI_UNINITIALIZED = 0,
-	SFC_MCDI_INITIALIZED,
-	SFC_MCDI_BUSY,
-	SFC_MCDI_COMPLETED,
-
-	SFC_MCDI_NSTATES
-};
-
-struct sfc_mcdi {
-	rte_spinlock_t			lock;
-	efsys_mem_t			mem;
-	enum sfc_mcdi_state		state;
-	efx_mcdi_transport_t		transport;
-	uint32_t			logtype;
-	uint32_t			proxy_handle;
-	efx_rc_t			proxy_result;
-};
-
 struct sfc_intr {
 	efx_intr_type_t			type;
 	rte_intr_callback_fn		handler;
@@ -384,9 +366,6 @@  void sfc_stop(struct sfc_adapter *sa);
 
 void sfc_schedule_restart(struct sfc_adapter *sa);
 
-int sfc_mcdi_init(struct sfc_adapter *sa);
-void sfc_mcdi_fini(struct sfc_adapter *sa);
-
 int sfc_configure(struct sfc_adapter *sa);
 void sfc_close(struct sfc_adapter *sa);
 
diff --git a/drivers/net/sfc/sfc_mcdi.c b/drivers/net/sfc/sfc_mcdi.c
index ec62ba95ff..9a51b3e030 100644
--- a/drivers/net/sfc/sfc_mcdi.c
+++ b/drivers/net/sfc/sfc_mcdi.c
@@ -13,6 +13,7 @@ 
 #include "efx_mcdi.h"
 #include "efx_regs_mcdi.h"
 
+#include "sfc_mcdi.h"
 #include "sfc.h"
 #include "sfc_debug.h"
 #include "sfc_log.h"
diff --git a/drivers/net/sfc/sfc_mcdi.h b/drivers/net/sfc/sfc_mcdi.h
new file mode 100644
index 0000000000..789a16d8bb
--- /dev/null
+++ b/drivers/net/sfc/sfc_mcdi.h
@@ -0,0 +1,54 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright(c) 2019-2020 Xilinx, Inc.
+ * Copyright(c) 2016-2019 Solarflare Communications Inc.
+ *
+ * This software was jointly developed between OKTET Labs (under contract
+ * for Solarflare) and Solarflare Communications, Inc.
+ */
+
+#ifndef _SFC_MCDI_H
+#define _SFC_MCDI_H
+
+#include <stdint.h>
+
+#include <rte_spinlock.h>
+
+#include "efsys.h"
+#include "efx.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum sfc_mcdi_state {
+	SFC_MCDI_UNINITIALIZED = 0,
+	SFC_MCDI_INITIALIZED,
+	SFC_MCDI_BUSY,
+	SFC_MCDI_COMPLETED,
+
+	SFC_MCDI_NSTATES
+};
+
+struct sfc_mcdi {
+	rte_spinlock_t			lock;
+	efsys_mem_t			mem;
+	enum sfc_mcdi_state		state;
+	efx_mcdi_transport_t		transport;
+	uint32_t			logtype;
+	uint32_t			proxy_handle;
+	efx_rc_t			proxy_result;
+};
+
+
+struct sfc_adapter;
+
+int sfc_mcdi_init(struct sfc_adapter *sa);
+void sfc_mcdi_fini(struct sfc_adapter *sa);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _SFC_MCDI_H */