From aaf99d89a72a798845ff5cb4167bc32f84e52439 Mon Sep 17 00:00:00 2001 From: Javen Xu Date: Thu, 8 Oct 2026 14:57:22 +0800 Subject: [PATCH] r8169: add get_channel support for ethtool Add get_channel support for ethtool. In multi-vector mode, it reports the active RX channel count and a single TX channel. Additionly, it reports one other channel to account for the dedicated link-change interrupt vector. In single-vector mode, where RX, TX, link-change events share the same interrupt, it reports a single combined channel. Signed-off-by: Javen Xu Link: https://patch.msgid.link/20261008065722.1026-8-javen_xu@realsil.com.cn Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/realtek/r8169_main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index de0c860328ba..88354e7570f0 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -6741,6 +6741,24 @@ static void r8169_init_napi(struct rtl8169_private *tp) } } +static void rtl8169_get_channels(struct net_device *dev, + struct ethtool_channels *ch) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + if (tp->irq_nvecs > 1) { + ch->max_rx = tp->hw_supp_num_rx_queues; + ch->max_tx = 1; + ch->max_other = 1; + ch->rx_count = tp->num_rx_rings; + ch->tx_count = 1; + ch->other_count = 1; + } else { + ch->max_combined = 1; + ch->combined_count = 1; + } +} + static const struct ethtool_ops rtl8169_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES, @@ -6759,6 +6777,7 @@ static const struct ethtool_ops rtl8169_ethtool_ops = { .nway_reset = rtl8169_nway_reset, .get_eee = rtl8169_get_eee, .set_eee = rtl8169_set_eee, + .get_channels = rtl8169_get_channels, .get_link_ksettings = rtl8169_get_link_ksettings, .set_link_ksettings = rtl8169_set_link_ksettings, .get_ringparam = rtl8169_get_ringparam,