From: Javen <javen_xu@realsil.com.cn>
To: Subbaraya Sundeep <sbhatta@marvell.com>
Cc: "hkallweit1@gmail.com" <hkallweit1@gmail.com>,
"nic_swsd@realtek.com" <nic_swsd@realtek.com>,
"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"horms@kernel.org" <horms@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [RFC Patch net-next v1 9/9] r8169: add support for ethtool
Date: Tue, 28 Apr 2026 06:37:54 +0000 [thread overview]
Message-ID: <5f10215481794848892ba759a61e4bb6@realsil.com.cn> (raw)
In-Reply-To: <20260426180546.GA791856@kernel-ep2>
>Hi,
>On 2026-04-20 at 07:49:57, javen (javen_xu@realsil.com.cn) wrote:
>> From: Javen Xu <javen_xu@realsil.com.cn>
>>
>> This patch add support for changing rx queues by ethtool. We can set
>> rx 1, 2, 4, 8 by ethtool -L eth1 rx num.
>>
>> Signed-off-by: Javen Xu <javen_xu@realsil.com.cn>
>> ---
>> drivers/net/ethernet/realtek/r8169_main.c | 68
>> +++++++++++++++++++++++
>> 1 file changed, 68 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/realtek/r8169_main.c
>> b/drivers/net/ethernet/realtek/r8169_main.c
>> index 6b574fc336d6..57087abe7d88 100644
>> --- a/drivers/net/ethernet/realtek/r8169_main.c
>> +++ b/drivers/net/ethernet/realtek/r8169_main.c
>> @@ -6518,6 +6518,72 @@ 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);
>> +
>> + ch->max_rx = tp->HwSuppNumRxQueues ? tp->HwSuppNumRxQueues :
>1;
>> + ch->max_tx = tp->HwSuppNumTxQueues ? tp->HwSuppNumTxQueues :
>1;
>> + ch->max_other = 0;
>> + ch->max_combined = 0;
>> +
>> + ch->rx_count = tp->num_rx_rings;
>> + ch->tx_count = tp->num_tx_rings;
>> + ch->other_count = 0;
>> + ch->combined_count = 0;
>> +}
>> +
>> +static int rtl8169_set_channels(struct net_device *dev,
>> + struct ethtool_channels *ch) {
>> + struct rtl8169_private *tp = netdev_priv(dev);
>> + bool if_running = netif_running(dev);
>> + int i;
>> +
>> + if (!tp->rss_support && (ch->rx_count > 1 || ch->tx_count > 1)) {
>> + netdev_warn(dev, "This chip does not support multiple
>channels/RSS.\n");
>> + return -EOPNOTSUPP;
>> + }
>> +
>> + if (ch->rx_count == 0 || ch->tx_count == 0)
>> + return -EINVAL;
>> + if (ch->rx_count > tp->HwSuppNumRxQueues ||
>> + ch->tx_count > tp->HwSuppNumTxQueues)
>> + return -EINVAL;
>> + if (ch->other_count || ch->combined_count)
>> + return -EINVAL;
>> +
>> + if (ch->rx_count == tp->num_rx_rings &&
>> + ch->tx_count == tp->num_tx_rings)
>> + return 0;
>> +
>Revisit the above checks, they are not needed since ethtool code does all
>these.
>> + if (if_running)
>> + rtl8169_close(dev);
>> +
>> + tp->num_rx_rings = ch->rx_count;
>> + tp->num_tx_rings = ch->tx_count;
>> +
>> + tp->rss_enable = (tp->num_rx_rings > 1 && tp->rss_support);
>Please help me understand your HW..Is there a condition where there are
>multi Rx queues but HW do not support RSS? I dont know how traffic is
>distributed across queues in that case (maybe - pinning flows to individual
>queues via ntuple or TC ?)
>
>Thanks,
>Sundeep
>
Hi, Sundeep
Thanks for your review.
This condition is not exist. I have removed it in the following link:
https://lore.kernel.org/netdev/f7dfe0357c04466895080f2b9aae1b56@realsil.com.cn/
BRs,
Javen
>> +
>> + for (i = 0; i < tp->HwSuppIndirTblEntries; i++) {
>> + if (tp->rss_enable)
>> + tp->rss_indir_tbl[i] = ethtool_rxfh_indir_default(i, tp-
>>num_rx_rings);
>> + else
>> + tp->rss_indir_tbl[i] = 0;
>> + }
>> +
>> + if (tp->rss_enable)
>> + tp->InitRxDescType = RX_DESC_RING_TYPE_RSS;
>> + else
>> + tp->InitRxDescType = RX_DESC_RING_TYPE_DEAFULT;
>> +
>> + if (if_running)
>> + return rtl_open(dev);
>> +
>> + return 0;
>> +}
>> +
>> static const struct ethtool_ops rtl8169_ethtool_ops = {
>> .supported_coalesce_params = ETHTOOL_COALESCE_USECS |
>> ETHTOOL_COALESCE_MAX_FRAMES, @@
>> -6536,6 +6602,8 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
>> .nway_reset = phy_ethtool_nway_reset,
>> .get_eee = rtl8169_get_eee,
>> .set_eee = rtl8169_set_eee,
>> + .get_channels = rtl8169_get_channels,
>> + .set_channels = rtl8169_set_channels,
>> .get_link_ksettings = phy_ethtool_get_link_ksettings,
>> .set_link_ksettings = rtl8169_set_link_ksettings,
>> .get_ringparam = rtl8169_get_ringparam,
>> --
>> 2.43.0
>>
next prev parent reply other threads:[~2026-04-28 6:38 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 2:19 [RFC Patch net-next v1 0/9] r8169: add RSS support for RTL8127 javen
2026-04-20 2:19 ` [RFC Patch net-next v1 1/9] r8169: add some register definitions javen
2026-04-25 22:32 ` Heiner Kallweit
2026-04-27 6:41 ` Javen
2026-04-27 14:22 ` Andrew Lunn
2026-04-26 18:08 ` Subbaraya Sundeep
2026-04-26 20:12 ` Heiner Kallweit
2026-04-27 2:30 ` Andrew Lunn
2026-04-27 6:42 ` Javen
2026-04-27 14:34 ` Andrew Lunn
2026-04-20 2:19 ` [RFC Patch net-next v1 2/9] r8169: add napi and irq support javen
2026-04-26 18:35 ` Subbaraya Sundeep
2026-04-20 2:19 ` [RFC Patch net-next v1 3/9] r8169: add support for multi tx queues javen
2026-04-26 19:48 ` Heiner Kallweit
2026-04-20 2:19 ` [RFC Patch net-next v1 4/9] r8169: add support for multi rx queues javen
2026-04-25 22:23 ` Heiner Kallweit
2026-04-20 2:19 ` [RFC Patch net-next v1 5/9] r8169: add support for msix javen
2026-04-25 22:14 ` Heiner Kallweit
2026-04-27 6:40 ` Javen
2026-04-20 2:19 ` [RFC Patch net-next v1 6/9] r8169: enable msix for RTL8127 javen
2026-04-20 2:19 ` [RFC Patch net-next v1 7/9] r8169: add support and enable rss javen
2026-04-20 2:19 ` [RFC Patch net-next v1 8/9] r8169: move struct ethtool_ops javen
2026-04-20 14:33 ` Andrew Lunn
2026-04-20 2:19 ` [RFC Patch net-next v1 9/9] r8169: add support for ethtool javen
2026-04-20 13:10 ` Andrew Lunn
2026-04-22 7:47 ` Javen
2026-04-26 18:05 ` Subbaraya Sundeep
2026-04-28 6:37 ` Javen [this message]
2026-04-20 11:06 ` [RFC Patch net-next v1 0/9] r8169: add RSS support for RTL8127 FUKAUMI Naoki
2026-04-25 22:49 ` Heiner Kallweit
2026-04-27 6:55 ` Javen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5f10215481794848892ba759a61e4bb6@realsil.com.cn \
--to=javen_xu@realsil.com.cn \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.com \
--cc=pabeni@redhat.com \
--cc=sbhatta@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox