ixgbe: Break include dependency cycle
authorDiomidis Spinellis <dds@aueb.gr>
Thu, 17 Oct 2024 08:58:53 +0000 (11:58 +0300)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 13 Nov 2024 18:30:21 +0000 (10:30 -0800)
Header ixgbe_type.h includes ixgbe_mbx.h.  Also, header
ixgbe_mbx.h included ixgbe_type.h, thus introducing a circular
dependency.

- Remove ixgbe_mbx.h inclusion from ixgbe_type.h.

- ixgbe_mbx.h requires the definition of struct ixgbe_mbx_operations
  so move its definition there. While at it, add missing argument
  identifier names.

- Add required forward structure declarations.

- Include ixgbe_mbx.h in the .c files that need it, for the
  following reasons:

  ixgbe_sriov.c uses ixgbe_check_for_msg
  ixgbe_main.c uses ixgbe_init_mbx_params_pf
  ixgbe_82599.c uses mbx_ops_generic
  ixgbe_x540.c uses mbx_ops_generic
  ixgbe_x550.c uses mbx_ops_generic

Signed-off-by: Diomidis Spinellis <dds@aueb.gr>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c

index 283a23150a4d44d15e92ec4255994b0f7cc9270a..4aaaea3b5f8ff8d2a03dd0fe61552996b8a1dadf 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/sched.h>
 
 #include "ixgbe.h"
+#include "ixgbe_mbx.h"
 #include "ixgbe_phy.h"
 
 #define IXGBE_82598_MAX_TX_QUEUES 32
index 8b8404d8c9460686f4bed17a1766e2470c6f21eb..c229a26fbbb7976a2e3e931925e63aeef462e9bf 100644 (file)
@@ -43,6 +43,7 @@
 #include "ixgbe.h"
 #include "ixgbe_common.h"
 #include "ixgbe_dcb_82599.h"
+#include "ixgbe_mbx.h"
 #include "ixgbe_phy.h"
 #include "ixgbe_sriov.h"
 #include "ixgbe_model.h"
index bd205306934b8fabe1744bee331dd6f491d9648d..bf65e82b4c611e449e2ce5e0266228f39639cf08 100644 (file)
@@ -4,7 +4,7 @@
 #ifndef _IXGBE_MBX_H_
 #define _IXGBE_MBX_H_
 
-#include "ixgbe_type.h"
+#include <linux/types.h>
 
 #define IXGBE_VFMAILBOX_SIZE        16 /* 16 32 bit words - 64 bytes */
 
@@ -96,6 +96,8 @@ enum ixgbe_pfvf_api_rev {
 #define IXGBE_VF_MBX_INIT_TIMEOUT 2000 /* number of retries on mailbox */
 #define IXGBE_VF_MBX_INIT_DELAY   500  /* microseconds between retries */
 
+struct ixgbe_hw;
+
 int ixgbe_read_mbx(struct ixgbe_hw *, u32 *, u16, u16);
 int ixgbe_write_mbx(struct ixgbe_hw *, u32 *, u16, u16);
 int ixgbe_check_for_msg(struct ixgbe_hw *, u16);
@@ -105,6 +107,18 @@ int ixgbe_check_for_rst(struct ixgbe_hw *, u16);
 void ixgbe_init_mbx_params_pf(struct ixgbe_hw *);
 #endif /* CONFIG_PCI_IOV */
 
+struct ixgbe_mbx_operations {
+       int (*init_params)(struct ixgbe_hw *hw);
+       int (*read)(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 vf_number);
+       int (*write)(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 vf_number);
+       int (*read_posted)(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id);
+       int (*write_posted)(struct ixgbe_hw *hw, u32 *msg, u16 size,
+                           u16 mbx_id);
+       int (*check_for_msg)(struct ixgbe_hw *hw, u16 vf_number);
+       int (*check_for_ack)(struct ixgbe_hw *hw, u16 vf_number);
+       int (*check_for_rst)(struct ixgbe_hw *hw, u16 vf_number);
+};
+
 extern const struct ixgbe_mbx_operations mbx_ops_generic;
 
 #endif /* _IXGBE_MBX_H_ */
index e71715f5da22874a1edcdb49e8c8ae211086516f..9631559a5aeacdf19377ec0acd512bfa9660bf78 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "ixgbe.h"
 #include "ixgbe_type.h"
+#include "ixgbe_mbx.h"
 #include "ixgbe_sriov.h"
 
 #ifdef CONFIG_PCI_IOV
index 346e3d9114a8377f260abd730463d2f093e468e5..9baccacd02a1e5a3d1c96dbf6c39be7bd50362c3 100644 (file)
@@ -3601,19 +3601,6 @@ struct ixgbe_phy_info {
        u32                             nw_mng_if_sel;
 };
 
-#include "ixgbe_mbx.h"
-
-struct ixgbe_mbx_operations {
-       int (*init_params)(struct ixgbe_hw *hw);
-       int (*read)(struct ixgbe_hw *, u32 *, u16,  u16);
-       int (*write)(struct ixgbe_hw *, u32 *, u16, u16);
-       int (*read_posted)(struct ixgbe_hw *, u32 *, u16,  u16);
-       int (*write_posted)(struct ixgbe_hw *, u32 *, u16, u16);
-       int (*check_for_msg)(struct ixgbe_hw *, u16);
-       int (*check_for_ack)(struct ixgbe_hw *, u16);
-       int (*check_for_rst)(struct ixgbe_hw *, u16);
-};
-
 struct ixgbe_mbx_stats {
        u32 msgs_tx;
        u32 msgs_rx;
@@ -3623,6 +3610,8 @@ struct ixgbe_mbx_stats {
        u32 rsts;
 };
 
+struct ixgbe_mbx_operations;
+
 struct ixgbe_mbx_info {
        const struct ixgbe_mbx_operations *ops;
        struct ixgbe_mbx_stats stats;
index f1ffa398f6df42d880dbeaa9e957495c1127fd8f..81e1df83f1369733a3a33793e89ed95ef7dc2ae9 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/sched.h>
 
 #include "ixgbe.h"
+#include "ixgbe_mbx.h"
 #include "ixgbe_phy.h"
 #include "ixgbe_x540.h"
 
index a5f6449344450cef75fb7f6299fc9d3ce5b7c7dd..d9a8cf018d3bb233e3744d0ca5e62f63906c0c71 100644 (file)
@@ -4,6 +4,7 @@
 #include "ixgbe_x540.h"
 #include "ixgbe_type.h"
 #include "ixgbe_common.h"
+#include "ixgbe_mbx.h"
 #include "ixgbe_phy.h"
 
 static int ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *, ixgbe_link_speed);