From 0dcac22b697cc9585a91793d4b632cff11391ec3 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Fri, 21 Oct 2022 15:36:30 +0800
Subject: [PATCH 154/189] net/hns3: fix header files includes

Header files should be self contained and should not be cyclically
dependent.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
 drivers/net/hns3/hns3_cmd.h    | 3 +++
 drivers/net/hns3/hns3_common.c | 2 +-
 drivers/net/hns3/hns3_dcb.h    | 4 ++++
 drivers/net/hns3/hns3_ethdev.c | 2 +-
 drivers/net/hns3/hns3_fdir.h   | 5 +++++
 drivers/net/hns3/hns3_flow.h   | 3 +++
 drivers/net/hns3/hns3_intr.c   | 2 +-
 drivers/net/hns3/hns3_mbx.h    | 4 ++++
 drivers/net/hns3/hns3_mp.h     | 2 ++
 drivers/net/hns3/hns3_regs.h   | 3 +++
 drivers/net/hns3/hns3_rss.h    | 2 ++
 drivers/net/hns3/hns3_rxtx.c   | 2 +-
 drivers/net/hns3/hns3_rxtx.h   | 9 +++++++++
 drivers/net/hns3/hns3_stats.h  | 5 +++++
 drivers/net/hns3/hns3_tm.h     | 2 ++
 15 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h
index 82c999061d..bee96c1e46 100644
--- a/drivers/net/hns3/hns3_cmd.h
+++ b/drivers/net/hns3/hns3_cmd.h
@@ -7,6 +7,9 @@
 
 #include <stdint.h>
 
+#include <rte_byteorder.h>
+#include <rte_spinlock.h>
+
 #define HNS3_CMDQ_TX_TIMEOUT		30000
 #define HNS3_CMDQ_CLEAR_WAIT_TIME	200
 #define HNS3_CMDQ_RX_INVLD_B		0
diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
index 1a1a016aa6..716cebbcec 100644
--- a/drivers/net/hns3/hns3_common.c
+++ b/drivers/net/hns3/hns3_common.c
@@ -7,10 +7,10 @@
 #include <ethdev_pci.h>
 #include <rte_pci.h>
 
-#include "hns3_common.h"
 #include "hns3_logs.h"
 #include "hns3_regs.h"
 #include "hns3_rxtx.h"
+#include "hns3_common.h"
 
 int
 hns3_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
diff --git a/drivers/net/hns3/hns3_dcb.h b/drivers/net/hns3/hns3_dcb.h
index e06ec177c8..9d9e7684c1 100644
--- a/drivers/net/hns3/hns3_dcb.h
+++ b/drivers/net/hns3/hns3_dcb.h
@@ -7,7 +7,11 @@
 
 #include <stdint.h>
 
+#include <ethdev_driver.h>
+#include <rte_ethdev.h>
+
 #include "hns3_cmd.h"
+#include "hns3_ethdev.h"
 
 #define HNS3_ETHER_MAX_RATE		100000
 
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index adc47d815d..7b0e8fc77d 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -6,7 +6,6 @@
 #include <rte_bus_pci.h>
 #include <ethdev_pci.h>
 
-#include "hns3_ethdev.h"
 #include "hns3_common.h"
 #include "hns3_dump.h"
 #include "hns3_logs.h"
@@ -16,6 +15,7 @@
 #include "hns3_dcb.h"
 #include "hns3_mp.h"
 #include "hns3_flow.h"
+#include "hns3_ethdev.h"
 
 #define HNS3_SERVICE_INTERVAL		1000000 /* us */
 #define HNS3_SERVICE_QUICK_INTERVAL	10
diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h
index 4d18759160..7be1c0a248 100644
--- a/drivers/net/hns3/hns3_fdir.h
+++ b/drivers/net/hns3/hns3_fdir.h
@@ -5,6 +5,10 @@
 #ifndef _HNS3_FDIR_H_
 #define _HNS3_FDIR_H_
 
+#include <stdint.h>
+
+#include <rte_flow.h>
+
 struct hns3_fd_key_cfg {
 	uint8_t key_sel;
 	uint8_t inner_sipv6_word_en;
@@ -177,6 +181,7 @@ struct hns3_fdir_info {
 };
 
 struct hns3_adapter;
+struct hns3_hw;
 
 int hns3_init_fd_config(struct hns3_adapter *hns);
 int hns3_fdir_filter_init(struct hns3_adapter *hns);
diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h
index 854fbb7ff0..ec94510152 100644
--- a/drivers/net/hns3/hns3_flow.h
+++ b/drivers/net/hns3/hns3_flow.h
@@ -6,6 +6,9 @@
 #define _HNS3_FLOW_H_
 
 #include <rte_flow.h>
+#include <ethdev_driver.h>
+
+#include "hns3_rss.h"
 
 struct hns3_flow_counter {
 	LIST_ENTRY(hns3_flow_counter) next; /* Pointer to the next counter. */
diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c
index 4bdcd6070b..57679254ee 100644
--- a/drivers/net/hns3/hns3_intr.c
+++ b/drivers/net/hns3/hns3_intr.c
@@ -10,9 +10,9 @@
 
 #include "hns3_common.h"
 #include "hns3_logs.h"
-#include "hns3_intr.h"
 #include "hns3_regs.h"
 #include "hns3_rxtx.h"
+#include "hns3_intr.h"
 
 #define SWITCH_CONTEXT_US	10
 
diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h
index d637bd2b23..b6ccd9ff8c 100644
--- a/drivers/net/hns3/hns3_mbx.h
+++ b/drivers/net/hns3/hns3_mbx.h
@@ -5,6 +5,10 @@
 #ifndef _HNS3_MBX_H_
 #define _HNS3_MBX_H_
 
+#include <stdint.h>
+
+#include <rte_spinlock.h>
+
 enum HNS3_MBX_OPCODE {
 	HNS3_MBX_RESET = 0x01,          /* (VF -> PF) assert reset */
 	HNS3_MBX_ASSERTING_RESET,       /* (PF -> VF) PF is asserting reset */
diff --git a/drivers/net/hns3/hns3_mp.h b/drivers/net/hns3/hns3_mp.h
index a74221d086..230230bbfe 100644
--- a/drivers/net/hns3/hns3_mp.h
+++ b/drivers/net/hns3/hns3_mp.h
@@ -5,6 +5,8 @@
 #ifndef _HNS3_MP_H_
 #define _HNS3_MP_H_
 
+#include <ethdev_driver.h>
+
 /* Local data for primary or secondary process. */
 struct hns3_process_local_data {
 	bool init_done; /* Process action register completed flag. */
diff --git a/drivers/net/hns3/hns3_regs.h b/drivers/net/hns3/hns3_regs.h
index 5812eb39db..2636429844 100644
--- a/drivers/net/hns3/hns3_regs.h
+++ b/drivers/net/hns3/hns3_regs.h
@@ -5,6 +5,9 @@
 #ifndef _HNS3_REGS_H_
 #define _HNS3_REGS_H_
 
+#include <ethdev_driver.h>
+#include <rte_dev_info.h>
+
 /* bar registers for cmdq */
 #define HNS3_CMDQ_TX_ADDR_L_REG		0x27000
 #define HNS3_CMDQ_TX_ADDR_H_REG		0x27004
diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h
index a12f8b7034..ebb51b4c66 100644
--- a/drivers/net/hns3/hns3_rss.h
+++ b/drivers/net/hns3/hns3_rss.h
@@ -4,6 +4,7 @@
 
 #ifndef _HNS3_RSS_H_
 #define _HNS3_RSS_H_
+
 #include <rte_ethdev.h>
 #include <rte_flow.h>
 
@@ -91,6 +92,7 @@ static inline uint32_t roundup_pow_of_two(uint32_t x)
 extern const uint8_t hns3_hash_key[HNS3_RSS_KEY_SIZE];
 
 struct hns3_adapter;
+struct hns3_hw;
 
 int hns3_dev_rss_hash_update(struct rte_eth_dev *dev,
 			     struct rte_eth_rss_conf *rss_conf);
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index f7641b1309..8ad40a49c7 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -17,10 +17,10 @@
 #endif
 
 #include "hns3_common.h"
-#include "hns3_rxtx.h"
 #include "hns3_regs.h"
 #include "hns3_logs.h"
 #include "hns3_mp.h"
+#include "hns3_rxtx.h"
 
 #define HNS3_CFG_DESC_NUM(num)	((num) / 8 - 1)
 #define HNS3_RX_RING_PREFETCTH_MASK	3
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
index 87c7c115a1..f619d6d466 100644
--- a/drivers/net/hns3/hns3_rxtx.h
+++ b/drivers/net/hns3/hns3_rxtx.h
@@ -6,7 +6,16 @@
 #define _HNS3_RXTX_H_
 
 #include <stdint.h>
+
+#include <ethdev_driver.h>
 #include <rte_mbuf_core.h>
+#include <rte_ethdev.h>
+#include <rte_ethdev_core.h>
+#include <rte_io.h>
+#include <rte_mempool.h>
+#include <rte_memzone.h>
+
+#include "hns3_ethdev.h"
 
 #define	HNS3_MIN_RING_DESC	64
 #define	HNS3_MAX_RING_DESC	32768
diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h
index 9d84072205..9a360f8870 100644
--- a/drivers/net/hns3/hns3_stats.h
+++ b/drivers/net/hns3/hns3_stats.h
@@ -5,6 +5,9 @@
 #ifndef _HNS3_STATS_H_
 #define _HNS3_STATS_H_
 
+#include <ethdev_driver.h>
+#include <rte_ethdev.h>
+
 /* TQP stats */
 struct hns3_tqp_stats {
 	uint64_t rcb_tx_ring_pktnum_rcd; /* Total num of transmitted packets */
@@ -145,6 +148,8 @@ struct hns3_reset_stats;
 #define HNS3_IMISSED_STATS_FIELD_OFFSET(f) \
 	(offsetof(struct hns3_rx_missed_stats, f))
 
+struct hns3_hw;
+
 int hns3_stats_get(struct rte_eth_dev *eth_dev,
 		   struct rte_eth_stats *rte_stats);
 int hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
diff --git a/drivers/net/hns3/hns3_tm.h b/drivers/net/hns3/hns3_tm.h
index 83e9cc8ba9..47345eeed1 100644
--- a/drivers/net/hns3/hns3_tm.h
+++ b/drivers/net/hns3/hns3_tm.h
@@ -105,6 +105,8 @@ hns3_tm_calc_node_tc_no(struct hns3_tm_conf *conf, uint32_t node_id)
 		return 0;
 }
 
+struct hns3_hw;
+
 void hns3_tm_conf_init(struct rte_eth_dev *dev);
 void hns3_tm_conf_uninit(struct rte_eth_dev *dev);
 int hns3_tm_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg);
-- 
2.23.0

