Messages in this thread Patch in this message | | | From | Wei Fang <> | Subject | [PATCH net-next] net: enetc: add ethtool::get_channels support | Date | Wed, 22 Nov 2023 18:25:40 +0800 |
| |
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@nxp.com> --- .../net/ethernet/freescale/enetc/enetc_ethtool.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c index e993ed04ab57..5fa1000b9b83 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -740,6 +740,17 @@ static int enetc_set_rxfh(struct net_device *ndev, const u32 *indir, return err; } +static void enetc_get_channels(struct net_device *ndev, + struct ethtool_channels *ch) +{ + struct enetc_ndev_priv *priv = netdev_priv(ndev); + + ch->max_rx = priv->num_rx_rings; + ch->max_tx = priv->num_tx_rings; + ch->rx_count = priv->num_rx_rings; + ch->tx_count = priv->num_tx_rings; +} + static void enetc_get_ringparam(struct net_device *ndev, struct ethtool_ringparam *ring, struct kernel_ethtool_ringparam *kernel_ring, @@ -1196,6 +1207,7 @@ static const struct ethtool_ops enetc_pf_ethtool_ops = { .get_rxfh_indir_size = enetc_get_rxfh_indir_size, .get_rxfh = enetc_get_rxfh, .set_rxfh = enetc_set_rxfh, + .get_channels = enetc_get_channels, .get_ringparam = enetc_get_ringparam, .get_coalesce = enetc_get_coalesce, .set_coalesce = enetc_set_coalesce, @@ -1226,6 +1238,7 @@ static const struct ethtool_ops enetc_vf_ethtool_ops = { .get_rxfh_indir_size = enetc_get_rxfh_indir_size, .get_rxfh = enetc_get_rxfh, .set_rxfh = enetc_set_rxfh, + .get_channels = enetc_get_channels, .get_ringparam = enetc_get_ringparam, .get_coalesce = enetc_get_coalesce, .set_coalesce = enetc_set_coalesce, -- 2.25.1
| |