Re: [PATCH net-next] net: enetc: add ethtool::get_channels support

From: Vladimir Oltean
Date: Wed Nov 22 2023 - 06:01:39 EST


Hi Wei,

On Wed, Nov 22, 2023 at 06:25:40PM +0800, Wei Fang wrote:
> Since ETHTOOL_MSG_RSS_GET netlink message [1] has been applied to
> ethtool tree, there is a netlink error when using "ethtool -x eno0"
> command to get RSS information from fsl-enetc driver, and the user
> cannot get the information, the error logs are as follows:
>
> root@ls1028ardb:~# ./ethtool -x eno0
> netlink error: Operation not supported
>
> The rationale is that ethtool will issue a ETHTOOL_MSG_CHANNELS_GET
> netlink message to get the number of Rx ring. However, the fsl-enetc
> driver doesn't support ethtool::get_channels, so it directly returns
> -EOPNOTSUPP error.
>
> [1]: https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/ethtool.git/commit/?id=ffab99c1f3820e21d65686e030dcf2c4fd0a8bd0
>
> Signed-off-by: Wei Fang <wei.fang@xxxxxxx>
> ---

I think we have 2 problems on our hands.

1. enetc is not the only driver that doesn't report ETHTOOL_MSG_CHANNELS_GET.
So it is a general issue for Sudheer Mogilappagari's implementation
of "ethtool -x" using netlink. The ioctl-based implementation used to
look at ETHTOOL_GRXRINGS which was handled in the kernel through
ethtool_ops :: get_rxnfc.

2. I used to have a different implementation (and interpretation) of
ETHTOOL_MSG_CHANNELS_GET for enetc anyway, which associated channels
not with rings, but with interrupt vectors (making the reported
channels combined):
https://patchwork.kernel.org/project/netdevbpf/patch/20230206100837.451300-6-vladimir.oltean@xxxxxxx/

I would suggest finding a way for the user space implementation to not
assume that ETHTOOL_MSG_CHANNELS_GET is implemented by the driver.