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.

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>
This commit is contained in:
Maxime Chevallier 2026-03-19 19:05:54 +01:00 committed by Jakub Kicinski
parent e783e40fb6
commit 82a5852595
31 changed files with 58 additions and 46 deletions

View File

@ -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

View File

@ -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_MAX
typedef const char (*const ethnl_string_array_t)[ETH_GSTRING_LEN];

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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"

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -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 */

View File

@ -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;
};

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
};

View File

@ -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;

View File

@ -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;

View File

@ -6,14 +6,15 @@
// 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;
};

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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;