[PATCH v1 6/6] net/r8169: fix segmentation fault during RTL8168 initialization

Howard Wang howard_wang at realsil.com.cn
Thu Jun 11 10:28:33 CEST 2026


In rtl_rx_init(), the configuration of RSS control and RX queue number
(which are specific to RTL8125) was incorrectly executed for all MAC
versions. Accessing RTL8125-specific registers (e.g., RSS_CTRL_8125)
on RTL8168 hardware causes a segmentation fault.

This patch fixes the issue by moving the RTL8125-specific RSS and VMQ
configurations into the existing `if (rtl_is_8125(hw))` block, ensuring
they are only executed on the correct hardware.

Fixes: 25e19d532b4b ("net/r8169: support multi-queues for 8126 and 8127")
Cc: stable at dpdk.org

Signed-off-by: Howard Wang <howard_wang at realsil.com.cn>
---
 drivers/net/r8169/r8169_rxtx.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/r8169/r8169_rxtx.c b/drivers/net/r8169/r8169_rxtx.c
index e0154b7741..00de0471f4 100644
--- a/drivers/net/r8169/r8169_rxtx.c
+++ b/drivers/net/r8169/r8169_rxtx.c
@@ -672,7 +672,18 @@ rtl_rx_init(struct rte_eth_dev *dev)
 
 	rtl_enable_cfg9346_write(hw);
 
-	if (!rtl_is_8125(hw)) {
+	if (rtl_is_8125(hw)) {
+		/* RSS_control_0 */
+		if (hw->EnableRss) {
+			rtl_init_rss(hw, nb_rx_queues);
+			rtl8125_config_rss(hw, nb_rx_queues);
+		} else {
+			RTL_W32(hw, RSS_CTRL_8125, 0x00);
+		}
+
+		/* VMQ_control */
+		rtl8125_set_rx_q_num(hw, nb_rx_queues);
+	} else {
 		/* RX ftr mcu enable */
 		csi_tmp = rtl_eri_read(hw, 0xDC, 1, ERIAR_ExGMAC);
 		csi_tmp &= ~BIT_0;
@@ -700,17 +711,6 @@ rtl_rx_init(struct rte_eth_dev *dev)
 	else
 		rtl_clear_rdu = rtl8168_clear_rdu;
 
-	/* RSS_control_0 */
-	if (hw->EnableRss) {
-		rtl_init_rss(hw, nb_rx_queues);
-		rtl8125_config_rss(hw, nb_rx_queues);
-	} else {
-		RTL_W32(hw, RSS_CTRL_8125, 0x00);
-	}
-
-	/* VMQ_control */
-	rtl8125_set_rx_q_num(hw, nb_rx_queues);
-
 	RTL_W8(hw, ChipCmd, RTL_R8(hw, ChipCmd) | CmdRxEnb);
 
 	return 0;
-- 
2.43.0



More information about the dev mailing list