mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vlad Banea <montrealtango@gmail.com>
To: netdev@vger.kernel.org
Cc: hkallweit1@gmail.com, javen_xu@realsil.com.cn,
	nic_swsd@realtek.com, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	linux-kernel@vger.kernel.org
Subject: [RFC net-next 3/5] r8169: make the RSS hash types and descriptor type per chip
Date: Wed, 11 Nov 2026 17:01:12 -0500	[thread overview]
Message-ID: <20261111220114.3863505-4-montrealtango@gmail.com> (raw)
In-Reply-To: <20261111220114.3863505-1-montrealtango@gmail.com>

The RSS hash types and the RX descriptor type used with RSS are those of
the RTL8127A. Make both per chip, set in rtl_setup_rx_params().

No functional change.

Signed-off-by: Vlad Banea <montrealtango@gmail.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 29 +++++++++++++----------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index a77bbedc8c02..cc253728109c 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -858,6 +858,7 @@ struct rtl8169_rss_data {
 	u8 rss_key[RTL_RSS_KEY_SIZE];
 	u8 rss_indir_tbl[RTL_MAX_INDIRECTION_TABLE_ENTRIES];
 	unsigned int hw_supp_indir_tbl_entries;
+	u32 hash_types;		/* RSS_CTRL_*_SUPP bits to hash on */
 };
 
 struct rtl8169_private {
@@ -884,6 +885,7 @@ struct rtl8169_private {
 	unsigned int irq_nvecs;
 	const struct rtl_vec_map *vec_map;	/* NULL: single vector only */
 	enum rx_desc_type init_rx_desc_type;
+	enum rx_desc_type rss_desc_type;	/* layout used with RSS on */
 	struct clk *clk;
 	int speed;
 
@@ -2906,6 +2908,15 @@ static void rtl_setup_rx_params(struct rtl8169_private *tp)
 	case RTL_GIGA_MAC_VER_80:
 		tp->hw_supp_num_rx_queues = R8169_MAX_RX_QUEUES;
 		tp->rss_data->hw_supp_indir_tbl_entries = RTL_MAX_INDIRECTION_TABLE_ENTRIES;
+		tp->rss_data->hash_types = RSS_CTRL_TCP_IPV4_SUPP |
+					   RSS_CTRL_IPV4_SUPP |
+					   RSS_CTRL_IPV6_SUPP |
+					   RSS_CTRL_IPV6_EXT_SUPP |
+					   RSS_CTRL_TCP_IPV6_SUPP |
+					   RSS_CTRL_TCP_IPV6_EXT_SUPP |
+					   RSS_CTRL_UDP_IPV4_SUPP |
+					   RSS_CTRL_UDP_IPV6_SUPP;
+		tp->rss_desc_type = RX_DESC_TYPE_RSS;
 		break;
 	default:
 		tp->hw_supp_num_rx_queues = R8169_DEFAULT_RX_QUEUES;
@@ -3066,14 +3077,7 @@ static void rtl8169_set_rss_hash_opt(struct rtl8169_private *tp)
 	rss_ctrl = FIELD_PREP(RSS_CPU_NUM_MASK, ilog2(tp->num_rx_rings));
 
 	/* Perform hash on these packet types */
-	rss_ctrl |= RSS_CTRL_TCP_IPV4_SUPP |
-		    RSS_CTRL_IPV4_SUPP |
-		    RSS_CTRL_IPV6_SUPP |
-		    RSS_CTRL_IPV6_EXT_SUPP |
-		    RSS_CTRL_TCP_IPV6_SUPP |
-		    RSS_CTRL_TCP_IPV6_EXT_SUPP |
-		    RSS_CTRL_UDP_IPV4_SUPP |
-		    RSS_CTRL_UDP_IPV6_SUPP;
+	rss_ctrl |= tp->rss_data->hash_types;
 
 	rss_ctrl |= FIELD_PREP(RSS_HASH_MASK,
 			       ilog2(tp->rss_data->hw_supp_indir_tbl_entries));
@@ -4272,11 +4276,12 @@ static void rtl_hw_start_8125_common(struct rtl8169_private *tp)
 	    tp->mac_version == RTL_GIGA_MAC_VER_80)
 		RTL_W8(tp, 0xD8, RTL_R8(tp, 0xD8) & ~0x02);
 
-	/* enable rx descriptor type v4 and set queue num for rss */
+	/* set queue num for rss and enable its rx descriptor type */
 	if (tp->num_rx_rings > 1) {
 		rtl8125_set_rx_q_num(tp);
-		RTL_W8(tp, RTL_DESC_TYPE_CTRL,
-		       RTL_R8(tp, RTL_DESC_TYPE_CTRL) | RTL_DESC_TYPE_RSS);
+		if (tp->init_rx_desc_type == RX_DESC_TYPE_RSS)
+			RTL_W8(tp, RTL_DESC_TYPE_CTRL,
+			       RTL_R8(tp, RTL_DESC_TYPE_CTRL) | RTL_DESC_TYPE_RSS);
 	}
 
 	if (tp->mac_version == RTL_GIGA_MAC_VER_80)
@@ -6142,7 +6147,7 @@ static void rtl8169_set_rx_ring_num(struct rtl8169_private *tp)
 		tp->num_rx_rings = rounddown_pow_of_two(min(rss_queue_num,
 							    tp->hw_supp_num_rx_queues));
 		if (tp->num_rx_rings >= 2)
-			tp->init_rx_desc_type = RX_DESC_TYPE_RSS;
+			tp->init_rx_desc_type = tp->rss_desc_type;
 	}
 }
 
-- 
2.53.0


  parent reply	other threads:[~2026-11-11 22:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 22:01 [RFC net-next 0/5] r8169: RSS for the RTL8125B Vlad Banea
2026-11-11 22:01 ` [RFC net-next 1/5] r8169: recheck the TX descriptor after a vector-map interrupt Vlad Banea
2026-11-11 22:01 ` [RFC net-next 2/5] r8169: describe the vector-map interrupt layout per chip Vlad Banea
2026-11-11 22:01 ` Vlad Banea [this message]
2026-11-11 22:01 ` [RFC net-next 4/5] r8169: add the type 3 RX descriptor Vlad Banea
2026-11-11 22:01 ` [RFC net-next 5/5] r8169: enable RSS on the RTL8125B Vlad Banea

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=20261111220114.3863505-4-montrealtango@gmail.com \
    --to=montrealtango@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=javen_xu@realsil.com.cn \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®