[PATCH net-next v5 05/13] net: ethtool: Allow passing a phy index for some commands

Jakub Kicinski kuba at kernel.org
Thu Jan 4 15:15:16 PST 2024


On Thu, 21 Dec 2023 19:00:38 +0100 Maxime Chevallier wrote:
> @@ -20,6 +21,7 @@ const struct nla_policy ethnl_header_policy[] = {
>  					    .len = ALTIFNAMSIZ - 1 },
>  	[ETHTOOL_A_HEADER_FLAGS]	= NLA_POLICY_MASK(NLA_U32,
>  							  ETHTOOL_FLAGS_BASIC),
> +	[ETHTOOL_A_HEADER_PHY_INDEX]		= NLA_POLICY_MIN(NLA_U32, 1),
>  };
>  
>  const struct nla_policy ethnl_header_policy_stats[] = {
> @@ -28,6 +30,7 @@ const struct nla_policy ethnl_header_policy_stats[] = {
>  					    .len = ALTIFNAMSIZ - 1 },
>  	[ETHTOOL_A_HEADER_FLAGS]	= NLA_POLICY_MASK(NLA_U32,
>  							  ETHTOOL_FLAGS_STATS),
> +	[ETHTOOL_A_HEADER_PHY_INDEX]		= NLA_POLICY_MIN(NLA_U32, 1),
>  };

You should define (copy/paste) a new header policy and use it
only for commands which actually make use of the PHY index.
That's why we have separate copies already for stats.



More information about the linux-arm-kernel mailing list