[10/19] net/hns3: fix header file self contained

Message ID 20220930072220.20753-11-liudongdong3@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Andrew Rybchenko
Headers
Series some bugfixes and clean code for hns3 - part2 |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Dongdong Liu Sept. 30, 2022, 7:22 a.m. UTC
From: Chengwen Feng <fengchengwen@huawei.com>

Header files should be self contained and should not be cyclically
dependent. This patch fixed it.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu <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(-)
  

Patch

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 e732f68238..14291193cb 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 a1348f93a7..60e933998a 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -6,7 +6,6 @@ 
 #include <bus_pci_driver.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 d81f04a3f3..1a14f1eceb 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 0172a2e288..97f704426c 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 1589c67c59..6cae5f8634 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 0a342ed9a2..f1163ce8a9 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 455f8b9419..f2d73043b7 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);