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 <javen_xu@realsil.com.cn>
Link: https://patch.msgid.link/20261008065722.1026-8-javen_xu@realsil.com.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Javen Xu 2026-10-08 14:57:22 +08:00 committed by Jakub Kicinski
parent dcad1105f1
commit aaf99d89a7

View File

@ -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,