net: ethtool: re-order local includes
Subsystems (8)
Maxime Chevallier
maintainerPATCH 1/1 net: ethtool: re-order local includes
Most local #include in the ethtool command handling is out of order, with either :
#include "netlink.h"
#include "common.h"
or even :
#include "netlink.h"
#include "common.h"
#include "bitset.h"
One of the reasons is because bitset.h s lacking definitions for nlattr, netlink_ext_ack, ETH_GSTRING_LEN, and types such as u32, bool, etc.
Make bitset.h standalone by including <linux/ethtool.h> for ETH_GSTRING_LEN, and <linux/netlink.h> for nlattr, netlink_ext_ack and the rest.
While at it, take a pass on ethnl sources to re-order the local includes :
- put them after the global includes
- add a newline between global and local includes
- alpha-sort the local includes
One notable exception is the cmis.h include, that needs definitions from module_fw.h. Keep them in this order for now.
--- net/ethtool/bitset.c | 3 ++- net/ethtool/bitset.h | 3 +++ net/ethtool/cabletest.c | 3 ++- net/ethtool/channels.c | 2 +- net/ethtool/coalesce.c | 3 ++- net/ethtool/common.c | 2 +- net/ethtool/debug.c | 4 ++-- net/ethtool/eee.c | 4 ++-- net/ethtool/eeprom.c | 3 ++- net/ethtool/features.c | 4 ++-- net/ethtool/fec.c | 4 ++-- net/ethtool/ioctl.c | 1 + net/ethtool/linkinfo.c | 2 +- net/ethtool/linkmodes.c | 4 ++-- net/ethtool/linkstate.c | 5 +++-- net/ethtool/module.c | 4 ++-- net/ethtool/mse.c | 2 +- net/ethtool/netlink.c | 3 ++- net/ethtool/pause.c | 2 +- net/ethtool/phc_vclocks.c | 2 +- net/ethtool/phy.c | 6 +++--- net/ethtool/plca.c | 2 +- net/ethtool/privflags.c | 4 ++-- net/ethtool/pse-pd.c | 7 ++++--- net/ethtool/rings.c | 2 +- net/ethtool/rss.c | 2 +- net/ethtool/stats.c | 4 ++-- net/ethtool/strset.c | 3 ++- net/ethtool/tsconfig.c | 6 +++--- net/ethtool/tsinfo.c | 4 ++-- net/ethtool/wol.c | 4 ++-- 31 files changed, 58 insertions(+), 46 deletions(-)
net/ethtool/bitset.c +2 -1
@@ -2,8 +2,9 @@#include <linux/ethtool_netlink.h> #include <linux/bitmap.h> -#include "netlink.h" +#include "bitset.h" +#include "netlink.h" /* Some bitmaps are internally represented as an array of unsigned long, some * as an array of u32 (some even as single u32 for now). To avoid the need of
net/ethtool/bitset.h +3 -0
@@ -3,6 +3,9 @@#ifndef _NET_ETHTOOL_BITSET_H#define _NET_ETHTOOL_BITSET_H +#include <linux/ethtool.h> +#include <linux/netlink.h> +#define ETHNL_MAX_BITSET_SIZE S16_MAXtypedef const char (*const ethnl_string_array_t )[ETH_GSTRING_LEN ];
net/ethtool/cabletest.c +2 -1
@@ -3,8 +3,9 @@#include <linux/phy.h> #include <linux/ethtool_netlink.h> #include <net/netdev_lock.h> -#include "netlink.h" +#include "common.h" +#include "netlink.h" /* 802.3 standard allows 100 meters for BaseT cables. However longer * cables might work, depending on the quality of the cables and the
net/ethtool/channels.c +1 -1
@@ -2,8 +2,8 @@#include <net/xdp_sock_drv.h> -#include "netlink.h" #include "common.h" +#include "netlink.h" struct channels_req_info {struct ethnl_req_info base;
net/ethtool/coalesce.c +2 -1
@@ -1,8 +1,9 @@// SPDX-License-Identifier: GPL-2.0-only #include <linux/dim.h> -#include "netlink.h" +#include "common.h" +#include "netlink.h" struct coalesce_req_info {struct ethnl_req_info base;
net/ethtool/common.c +1 -1
@@ -8,8 +8,8 @@#include <linux/phy_link_topology.h> #include <net/netdev_queues.h> -#include "netlink.h" #include "common.h" +#include "netlink.h" #include "../core/dev.h"
net/ethtool/debug.c +2 -2
@@ -1,8 +1,8 @@// SPDX-License-Identifier: GPL-2.0-only -#include "netlink.h" -#include "common.h" #include "bitset.h" +#include "common.h" +#include "netlink.h" struct debug_req_info {struct ethnl_req_info base;
net/ethtool/eee.c +2 -2
@@ -1,8 +1,8 @@// SPDX-License-Identifier: GPL-2.0-only -#include "netlink.h" -#include "common.h" #include "bitset.h" +#include "common.h" +#include "netlink.h" struct eee_req_info {struct ethnl_req_info base;
net/ethtool/eeprom.c +2 -1
@@ -2,8 +2,9 @@#include <linux/ethtool.h> #include <linux/sfp.h> -#include "netlink.h" +#include "common.h" +#include "netlink.h" struct eeprom_req_info {struct ethnl_req_info base;
net/ethtool/features.c +2 -2
@@ -2,9 +2,9 @@#include <net/netdev_lock.h> -#include "netlink.h" -#include "common.h" #include "bitset.h" +#include "common.h" +#include "netlink.h" struct features_req_info {struct ethnl_req_info base;
net/ethtool/fec.c +2 -2
@@ -1,8 +1,8 @@// SPDX-License-Identifier: GPL-2.0-only -#include "netlink.h" -#include "common.h" #include "bitset.h" +#include "common.h" +#include "netlink.h" struct fec_req_info {struct ethnl_req_info base;
net/ethtool/ioctl.c +1 -0
@@ -33,6 +33,7 @@#include <net/flow_offload.h> #include <net/netdev_lock.h> #include <linux/ethtool_netlink.h> +#include "common.h" /* State held across locks and calls for commands which have devlink fallback */
net/ethtool/linkinfo.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only -#include "netlink.h" #include "common.h" +#include "netlink.h" struct linkinfo_req_info {struct ethnl_req_info base;
net/ethtool/linkmodes.c +2 -2
@@ -1,8 +1,8 @@// SPDX-License-Identifier: GPL-2.0-only -#include "netlink.h" -#include "common.h" #include "bitset.h" +#include "common.h" +#include "netlink.h" /* LINKMODES_GET */
net/ethtool/linkstate.c +3 -2
@@ -1,10 +1,11 @@// SPDX-License-Identifier: GPL-2.0-only -#include "netlink.h" -#include "common.h" #include <linux/phy.h> #include <linux/phylib_stubs.h> +#include "common.h" +#include "netlink.h" +struct linkstate_req_info {struct ethnl_req_info base; };
net/ethtool/module.c +2 -2
@@ -6,10 +6,10 @@#include <net/devlink.h> #include <net/netdev_lock.h> -#include "netlink.h" -#include "common.h" #include "bitset.h" +#include "common.h" #include "module_fw.h" +#include "netlink.h" struct module_req_info {struct ethnl_req_info base;
net/ethtool/mse.c +1 -1
@@ -4,8 +4,8 @@#include <linux/phy.h> #include <linux/slab.h> -#include "netlink.h" #include "common.h" +#include "netlink.h" /* Channels A-D only; WORST and LINK are exclusive alternatives */ #define PHY_MSE_CHANNEL_COUNT 4
net/ethtool/netlink.c +2 -1
@@ -6,8 +6,9 @@#include <linux/ethtool_netlink.h> #include <linux/phy_link_topology.h> #include <linux/pm_runtime.h> -#include "netlink.h" +#include "module_fw.h" +#include "netlink.h" static struct genl_family ethtool_genl_family;
net/ethtool/pause.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only -#include "netlink.h" #include "common.h" +#include "netlink.h" struct pause_req_info {struct ethnl_req_info base;
net/ethtool/phc_vclocks.c +1 -1
@@ -2,8 +2,8 @@/* * Copyright 2021 NXP */ -#include "netlink.h" #include "common.h" +#include "netlink.h" struct phc_vclocks_req_info {struct ethnl_req_info base;
net/ethtool/phy.c +3 -3
@@ -3,14 +3,14 @@* Copyright 2023 Bootlin * */ -#include "common.h" -#include "netlink.h" -#include <linux/phy.h> #include <linux/phy_link_topology.h> #include <linux/sfp.h> #include <net/netdev_lock.h> +#include "common.h" +#include "netlink.h" +struct phy_req_info {struct ethnl_req_info base; };
net/ethtool/plca.c +1 -1
@@ -3,8 +3,8 @@#include <linux/phy.h> #include <linux/ethtool_netlink.h> -#include "netlink.h" #include "common.h" +#include "netlink.h" struct plca_req_info {struct ethnl_req_info base;
net/ethtool/privflags.c +2 -2
@@ -1,8 +1,8 @@// SPDX-License-Identifier: GPL-2.0-only -#include "netlink.h" -#include "common.h" #include "bitset.h" +#include "common.h" +#include "netlink.h" struct privflags_req_info {struct ethnl_req_info base;
net/ethtool/pse-pd.c +4 -3
@@ -6,14 +6,15 @@// Copyright (c) 2022 Pengutronix, Oleksij Rempel <[email protected]> // -#include "common.h" -#include "linux/pse-pd/pse.h" -#include "netlink.h" #include <linux/ethtool_netlink.h> #include <linux/ethtool.h> #include <linux/export.h> #include <linux/phy.h> +#include "common.h" +#include "linux/pse-pd/pse.h" +#include "netlink.h" +struct pse_req_info {struct ethnl_req_info base; };
net/ethtool/rings.c +1 -1
@@ -2,8 +2,8 @@#include <net/netdev_queues.h> -#include "netlink.h" #include "common.h" +#include "netlink.h" struct rings_req_info {struct ethnl_req_info base;
net/ethtool/rss.c +1 -1
@@ -2,8 +2,8 @@#include <net/netdev_lock.h> -#include "netlink.h" #include "common.h" +#include "netlink.h" struct rss_req_info {struct ethnl_req_info base;
net/ethtool/stats.c +2 -2
@@ -3,9 +3,9 @@#include <linux/phy.h> #include <linux/phylib_stubs.h> -#include "netlink.h" -#include "common.h" #include "bitset.h" +#include "common.h" +#include "netlink.h" struct stats_req_info {struct ethnl_req_info base;
net/ethtool/strset.c +2 -1
@@ -2,8 +2,9 @@#include <linux/ethtool.h> #include <linux/phy.h> -#include "netlink.h" +#include "common.h" +#include "netlink.h" struct strset_info {bool per_dev;
net/ethtool/tsconfig.c +3 -3
@@ -3,11 +3,11 @@#include <linux/net_tstamp.h> #include <linux/ptp_clock_kernel.h> -#include "netlink.h" -#include "common.h" #include "bitset.h" -#include "../core/dev.h" +#include "common.h" +#include "netlink.h" #include "ts.h" +#include "../core/dev.h" struct tsconfig_req_info {struct ethnl_req_info base;
net/ethtool/tsinfo.c +2 -2
@@ -6,9 +6,9 @@#include <linux/ptp_clock_kernel.h> #include <net/netdev_lock.h> -#include "netlink.h" -#include "common.h" #include "bitset.h" +#include "common.h" +#include "netlink.h" #include "ts.h" struct tsinfo_req_info {
net/ethtool/wol.c +2 -2
@@ -1,8 +1,8 @@// SPDX-License-Identifier: GPL-2.0-only -#include "netlink.h" -#include "common.h" #include "bitset.h" +#include "common.h" +#include "netlink.h" struct wol_req_info {struct ethnl_req_info base;
Signature · 1 line
2.49.0
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Thu, 19 Mar 2026 19:05:54 +0100 you wrote:
Most local #include in the ethtool command handling is out of order, with either :
#include "
netlink.h"
#include "common.h"or even :
[...]
Here is the summary with links:
- [net-next] net: ethtool: re-order local includes
https://git.kernel.org/netdev/net-next/c/82a5852595f5
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html