ixgbe: Break include dependency cycle
Subsystems (2)
PATCH 1/1 ixgbe: Break include dependency cycle
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
--- drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h | 16 +++++++++++++++- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 15 ++------------- drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 1 + 7 files changed, 22 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +1 -0
@@ -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
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1 -0
@@ -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"
drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h +15 -1
@@ -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_ */
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +1 -0
@@ -18,6 +18,7 @@#include "ixgbe.h" #include "ixgbe_type.h" +#include "ixgbe_mbx.h" #include "ixgbe_sriov.h" #ifdef CONFIG_PCI_IOV
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +2 -13
@@ -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;
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +1 -0
@@ -6,6 +6,7 @@#include <linux/sched.h> #include "ixgbe.h" +#include "ixgbe_mbx.h" #include "ixgbe_phy.h" #include "ixgbe_x540.h"
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +1 -0
@@ -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 );
Signature · 1 line
2.39.5
Quoted 15 lines · Diomidis Spinellis
Header
ixgbe_type.hincludesixgbe_mbx.h. Also, headerixgbe_mbx.hincludedixgbe_type.h, thus introducing a circular dependency.- Remove
ixgbe_mbx.hinclusion fromixgbe_type.h.-
ixgbe_mbx.hrequires the definition of structixgbe_mbx_operationsso move its definition there. While at it, add missing argument identifier names.- Add required forward structure declarations.
- Include
ixgbe_mbx.hin the .c files that need it, for the following reasons:
Quoted 8 lines
ixgbe_sriov.cusesixgbe_check_for_msg
ixgbe_main.cusesixgbe_init_mbx_params_pf
ixgbe_82599.cusesmbx_ops_generic
ixgbe_x540.cusesmbx_ops_generic
ixgbe_x550.cusesmbx_ops_genericSigned-off-by Diomidis Spinellis <[email protected]>---
The changes make sense. Which tree was this aimed at? I'd guess as a cleanup without direct impact that its aimed at next?
Thanks,
Jake
Quoted 6 lines · Jacob Keller
Quoted 4 lines · Diomidis Spinellis
Header
ixgbe_type.hincludesixgbe_mbx.h. Also, headerixgbe_mbx.hincludedixgbe_type.h, thus introducing a circular dependency.
[...]
Quoted 8 lines
Quoted 3 lines
Signed-off-by Diomidis Spinellis <[email protected]>---
The changes make sense. Which tree was this aimed at? I'd guess as a cleanup without direct impact that its aimed at next?
Reviewed-by Jacob Keller <[email protected]>
Yes, "next" is fine, thank you.
Diomidis - https://www.spinellis.gr
From: Intel-wired-lan <[email protected]> on behalf of Diomidis Spinellis <[email protected]> Sent: Thursday, October 17, 2024 10:58 AM
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]> Cc: [email protected] <[email protected]>; Diomidis Spinellis <[email protected]> Subject: [Intel-wired-lan] [PATCH] ixgbe: Break include dependency cycle
Header ixgbe_type.h includes ixgbe_mbx.h. Also, headerixgbe_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
---
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h | 16 +++++++++++++++- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 1 +
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 15 ++------------- drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 1 + 7 files changed, 22 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +0 -0
@@ -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
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 -0
@@ -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"
drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h +0 -0
@@ -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_ */
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +0 -0
@@ -18,6 +18,7 @@
#include "ixgbe.h"
#include "ixgbe_type.h"
+#include "ixgbe_mbx.h"
#include "ixgbe_sriov.h"
#ifdef CONFIG_PCI_IOV
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +0 -0
@@ -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;
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +0 -0
@@ -6,6 +6,7 @@
#include <linux/sched.h>
#include "ixgbe.h"
+#include "ixgbe_mbx.h"
#include "ixgbe_phy.h"
#include "ixgbe_x540.h"
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +0 -0
@@ -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); --
2.39.5