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.
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20260319180555.1531386-1-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
#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
#ifndef _NET_ETHTOOL_BITSET_H
#define _NET_ETHTOOL_BITSET_H
+#include <linux/ethtool.h>
+#include <linux/netlink.h>
+
#define ETHNL_MAX_BITSET_SIZE S16_MAX
typedef const char (*const ethnl_string_array_t)[ETH_GSTRING_LEN];
#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
#include <net/xdp_sock_drv.h>
-#include "netlink.h"
#include "common.h"
+#include "netlink.h"
struct channels_req_info {
struct ethnl_req_info base;
// 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;
#include <linux/phy_link_topology.h>
#include <net/netdev_queues.h>
-#include "netlink.h"
#include "common.h"
+#include "netlink.h"
#include "../core/dev.h"
// 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;
// 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;
#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;
#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;
// 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;
#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 */
// 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;
// SPDX-License-Identifier: GPL-2.0-only
-#include "netlink.h"
-#include "common.h"
#include "bitset.h"
+#include "common.h"
+#include "netlink.h"
/* LINKMODES_GET */
// 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;
};
#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;
#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
#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;
// 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;
/*
* Copyright 2021 NXP
*/
-#include "netlink.h"
#include "common.h"
+#include "netlink.h"
struct phc_vclocks_req_info {
struct ethnl_req_info base;
* 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;
};
#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;
// 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;
// Copyright (c) 2022 Pengutronix, Oleksij Rempel <kernel@pengutronix.de>
//
-#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;
};
#include <net/netdev_queues.h>
-#include "netlink.h"
#include "common.h"
+#include "netlink.h"
struct rings_req_info {
struct ethnl_req_info base;
#include <net/netdev_lock.h>
-#include "netlink.h"
#include "common.h"
+#include "netlink.h"
struct rss_req_info {
struct ethnl_req_info base;
#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;
#include <linux/ethtool.h>
#include <linux/phy.h>
-#include "netlink.h"
+
#include "common.h"
+#include "netlink.h"
struct strset_info {
bool per_dev;
#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;
#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 {
// 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;