Commit 6a774228 authored by Kory Maincent's avatar Kory Maincent Committed by Jakub Kicinski
Browse files

net: ethtool: tsconfig: Fix netlink type of hwtstamp flags



Fix the netlink type for hardware timestamp flags, which are represented
as a bitset of flags. Although only one flag is supported currently, the
correct netlink bitset type should be used instead of u32 to keep
consistency with other fields. Address this by adding a new named string
set description for the hwtstamp flag structure.

The code has been introduced in the current release so the uAPI change is
still okay.

Signed-off-by: default avatarKory Maincent <kory.maincent@bootlin.com>
Fixes: 6e9e2eed ("net: ethtool: Add support for tsconfig command to get/set hwtstamp config")
Link: https://patch.msgid.link/20250205110304.375086-1-kory.maincent@bootlin.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3da81cb9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1524,7 +1524,8 @@ attribute-sets:
        nested-attributes: bitset
      -
        name: hwtstamp-flags
        type: u32
        type: nest
        nested-attributes: bitset

operations:
  enum-model: directional
+2 −0
Original line number Diff line number Diff line
@@ -682,6 +682,7 @@ enum ethtool_link_ext_substate_module {
 * @ETH_SS_STATS_ETH_CTRL: names of IEEE 802.3 MAC Control statistics
 * @ETH_SS_STATS_RMON: names of RMON statistics
 * @ETH_SS_STATS_PHY: names of PHY(dev) statistics
 * @ETH_SS_TS_FLAGS: hardware timestamping flags
 *
 * @ETH_SS_COUNT: number of defined string sets
 */
@@ -708,6 +709,7 @@ enum ethtool_stringset {
	ETH_SS_STATS_ETH_CTRL,
	ETH_SS_STATS_RMON,
	ETH_SS_STATS_PHY,
	ETH_SS_TS_FLAGS,

	/* add new constants above here */
	ETH_SS_COUNT
+5 −0
Original line number Diff line number Diff line
@@ -462,6 +462,11 @@ const char ts_rx_filter_names[][ETH_GSTRING_LEN] = {
};
static_assert(ARRAY_SIZE(ts_rx_filter_names) == __HWTSTAMP_FILTER_CNT);

const char ts_flags_names[][ETH_GSTRING_LEN] = {
	[const_ilog2(HWTSTAMP_FLAG_BONDED_PHC_INDEX)] = "bonded-phc-index",
};
static_assert(ARRAY_SIZE(ts_flags_names) == __HWTSTAMP_FLAG_CNT);

const char udp_tunnel_type_names[][ETH_GSTRING_LEN] = {
	[ETHTOOL_UDP_TUNNEL_TYPE_VXLAN]		= "vxlan",
	[ETHTOOL_UDP_TUNNEL_TYPE_GENEVE]	= "geneve",
+2 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
	ETHTOOL_LINK_MODE_ ## speed ## base ## type ## _ ## duplex ## _BIT

#define __SOF_TIMESTAMPING_CNT (const_ilog2(SOF_TIMESTAMPING_LAST) + 1)
#define __HWTSTAMP_FLAG_CNT (const_ilog2(HWTSTAMP_FLAG_LAST) + 1)

struct link_mode_info {
	int				speed;
@@ -38,6 +39,7 @@ extern const char wol_mode_names[][ETH_GSTRING_LEN];
extern const char sof_timestamping_names[][ETH_GSTRING_LEN];
extern const char ts_tx_type_names[][ETH_GSTRING_LEN];
extern const char ts_rx_filter_names[][ETH_GSTRING_LEN];
extern const char ts_flags_names[][ETH_GSTRING_LEN];
extern const char udp_tunnel_type_names[][ETH_GSTRING_LEN];

int __ethtool_get_link(struct net_device *dev);
+5 −0
Original line number Diff line number Diff line
@@ -75,6 +75,11 @@ static const struct strset_info info_template[] = {
		.count		= __HWTSTAMP_FILTER_CNT,
		.strings	= ts_rx_filter_names,
	},
	[ETH_SS_TS_FLAGS] = {
		.per_dev	= false,
		.count		= __HWTSTAMP_FLAG_CNT,
		.strings	= ts_flags_names,
	},
	[ETH_SS_UDP_TUNNEL_TYPES] = {
		.per_dev	= false,
		.count		= __ETHTOOL_UDP_TUNNEL_TYPE_CNT,
Loading