DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix
@ 2026-06-11  8:28 Howard Wang
  2026-06-11  8:28 ` [PATCH v1 1/6] net/r8169: disable RX CRC drop for RTL8125BP and later Howard Wang
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Howard Wang @ 2026-06-11  8:28 UTC (permalink / raw)
  To: dev; +Cc: pro_nic_dpdk, Howard Wang

This patch series primarily focuses on updating hardware configurations, 
optimizing the datapath, and refining device behaviors for the net/r8169 PMD. 
Additionally, it includes one bug fix for a segmentation fault encountered 
during initialization.

Summary of the series:

  - Patch 1: Updates RX CRC drop behavior for RTL8125BP and later MAC versions
    to align with device shutdown sequences and prevent cross-driver states.
  - Patch 2: Optimizes the Tx datapath performance by removing redundant branch
    checks for malformed packets, replacing them with RTE_ASSERT.
  - Patch 3: Enhances RTL8125+ flow control by utilizing a new formula for 
    nearfull and nearempty thresholds.
  - Patch 4: Removes RTL9151 CSI (DBI) channel support, as firmware handling 
    latency makes it no longer suitable for the driver.
  - Patch 5: Updates PHY and MAC MCU configurations for RTL9151A and RTL8125BP.
  - Patch 6: Fixes a segmentation fault during RTL8168 initialization by 
    restricting RTL8125-specific RSS/VMQ configurations to the correct hardware.

Howard Wang (6):
  net/r8169: disable RX CRC drop for RTL8125BP and later
  net/r8169: optimize Tx datapath by removing redundant packet checks
  net/r8169: improve RTL8125+ flow control
  net/r8169: remove RTL9151 CSI (DBI) channel support
  net/r8169: update hardware configurations for 8125
  net/r8169: fix segmentation fault during RTL8168 initialization

 drivers/net/r8169/base/rtl8125bp_mcu.c | 15 ++--
 drivers/net/r8169/base/rtl9151a.c      |  8 +++
 drivers/net/r8169/base/rtl9151a_mcu.c  | 14 +++-
 drivers/net/r8169/r8169_compat.h       |  1 +
 drivers/net/r8169/r8169_hw.c           | 98 ++++++++++++++++++++++++--
 drivers/net/r8169/r8169_hw.h           |  2 +-
 drivers/net/r8169/r8169_rxtx.c         | 32 ++++-----
 7 files changed, 137 insertions(+), 33 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 1/6] net/r8169: disable RX CRC drop for RTL8125BP and later
  2026-06-11  8:28 [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix Howard Wang
@ 2026-06-11  8:28 ` Howard Wang
  2026-06-11  8:28 ` [PATCH v1 2/6] net/r8169: optimize Tx datapath by removing redundant packet checks Howard Wang
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Howard Wang @ 2026-06-11  8:28 UTC (permalink / raw)
  To: dev; +Cc: pro_nic_dpdk, Howard Wang

When RX drop CRC is enabled, the hardware will not DMA the RX CRC,
and the packet length in the RX descriptor will not include the CRC
length.
Other OS drivers might leave this feature enabled instead of disabling
it during their shutdown sequence. To avoid driver conflicts and
unexpected behavior upon reboot or driver reload, explicitly disable
this feature for RTL8125BP and all subsequent MAC versions.

Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>
---
 drivers/net/r8169/r8169_compat.h |  1 +
 drivers/net/r8169/r8169_hw.c     | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/drivers/net/r8169/r8169_compat.h b/drivers/net/r8169/r8169_compat.h
index 91c84c7633..28f0bfc246 100644
--- a/drivers/net/r8169/r8169_compat.h
+++ b/drivers/net/r8169/r8169_compat.h
@@ -347,6 +347,7 @@ enum RTL_register_content {
 	RxCfg_pause_slot_en = (1 << 11),
 	RxCfg_9356SEL       = (1 << 6),
 	EnableRxDescV4_0    = (1 << 1), /* Not in rcr */
+	RX_CRC_DROP_EN      = (1 << 0),
 
 	/* TX config bits */
 	TxInterFrameGapShift = 24,
diff --git a/drivers/net/r8169/r8169_hw.c b/drivers/net/r8169/r8169_hw.c
index 27d52c81c9..e5434165ba 100644
--- a/drivers/net/r8169/r8169_hw.c
+++ b/drivers/net/r8169/r8169_hw.c
@@ -911,6 +911,29 @@ rtl8125_set_rx_desc_type(struct rtl_hw *hw)
 	}
 }
 
+static void
+rtl8125_set_rx_crc_drop(struct rtl_hw *hw, bool enable)
+{
+	switch (hw->mcfg) {
+	case CFG_METHOD_54:
+	case CFG_METHOD_55:
+	case CFG_METHOD_56:
+	case CFG_METHOD_57:
+	case CFG_METHOD_58:
+	case CFG_METHOD_59:
+	case CFG_METHOD_60:
+	case CFG_METHOD_61:
+	case CFG_METHOD_70:
+	case CFG_METHOD_71:
+	case CFG_METHOD_91:
+		if (enable)
+			RTL_W8(hw, 0xD8, RTL_R8(hw, 0xD8) | RX_CRC_DROP_EN);
+		else
+			RTL_W8(hw, 0xD8, RTL_R8(hw, 0xD8) & ~RX_CRC_DROP_EN);
+		break;
+	}
+}
+
 static void
 rtl8125_hw_config(struct rtl_hw *hw)
 {
@@ -967,6 +990,8 @@ rtl8125_hw_config(struct rtl_hw *hw)
 
 	rtl8125_set_rx_desc_type(hw);
 
+	rtl8125_set_rx_crc_drop(hw, false);
+
 	if (hw->mcfg == CFG_METHOD_58 || hw->mcfg == CFG_METHOD_91) {
 		rtl_clear_mac_ocp_bit(hw, 0xE00C, BIT_12);
 		rtl_clear_mac_ocp_bit(hw, 0xC0C2, BIT_6);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 2/6] net/r8169: optimize Tx datapath by removing redundant packet checks
  2026-06-11  8:28 [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix Howard Wang
  2026-06-11  8:28 ` [PATCH v1 1/6] net/r8169: disable RX CRC drop for RTL8125BP and later Howard Wang
@ 2026-06-11  8:28 ` Howard Wang
  2026-06-11  8:28 ` [PATCH v1 3/6] net/r8169: improve RTL8125+ flow control Howard Wang
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Howard Wang @ 2026-06-11  8:28 UTC (permalink / raw)
  To: dev; +Cc: pro_nic_dpdk, Howard Wang

Malformed packets (e.g., pkt_len == 0 or nb_segs == 0) should never
be passed down to the PMD by the upper layers. The current handling
of such abnormal packets in the Tx datapath not only introduces
unnecessary branch overhead but can also lead to unexpected behaviors.

To adhere to DPDK's high-performance design principles, we should not
penalize the datapath to cover up upper-layer errors. Therefore, this
patch removes the runtime 'if' conditions for these anomalies. Instead,
RTE_ASSERT is introduced to help catch such issues during debugging.

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

diff --git a/drivers/net/r8169/r8169_rxtx.c b/drivers/net/r8169/r8169_rxtx.c
index a2e9139ec6..e0154b7741 100644
--- a/drivers/net/r8169/r8169_rxtx.c
+++ b/drivers/net/r8169/r8169_rxtx.c
@@ -1621,8 +1621,7 @@ rtl_xmit_pkt(struct rtl_hw *hw, struct rtl_tx_queue *txq,
 
 		len = m_seg->data_len;
 
-		if (len == 0)
-			break;
+		RTE_ASSERT(len > 0);
 
 		txd = &txq->hw_ring[tail];
 
@@ -1971,10 +1970,7 @@ rtl_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		if (txq->tx_free < tx_pkt->nb_segs)
 			break;
 
-		/* Check mbuf is valid */
-		if (tx_pkt->nb_segs == 0 || tx_pkt->pkt_len == 0 ||
-		    (tx_pkt->nb_segs > 1 && tx_pkt->next == NULL))
-			break;
+		RTE_ASSERT(tx_pkt->pkt_len > 0);
 
 		rtl_xmit_pkt(hw, txq, tx_pkt);
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 3/6] net/r8169: improve RTL8125+ flow control
  2026-06-11  8:28 [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix Howard Wang
  2026-06-11  8:28 ` [PATCH v1 1/6] net/r8169: disable RX CRC drop for RTL8125BP and later Howard Wang
  2026-06-11  8:28 ` [PATCH v1 2/6] net/r8169: optimize Tx datapath by removing redundant packet checks Howard Wang
@ 2026-06-11  8:28 ` Howard Wang
  2026-06-11  8:28 ` [PATCH v1 4/6] net/r8169: remove RTL9151 CSI (DBI) channel support Howard Wang
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Howard Wang @ 2026-06-11  8:28 UTC (permalink / raw)
  To: dev; +Cc: pro_nic_dpdk, Howard Wang

Improve it by using formula to set H/W nearfull and nearempty.

Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>
---
 drivers/net/r8169/r8169_hw.c | 67 +++++++++++++++++++++++++++++++++---
 1 file changed, 62 insertions(+), 5 deletions(-)

diff --git a/drivers/net/r8169/r8169_hw.c b/drivers/net/r8169/r8169_hw.c
index e5434165ba..53d0620422 100644
--- a/drivers/net/r8169/r8169_hw.c
+++ b/drivers/net/r8169/r8169_hw.c
@@ -1979,6 +1979,66 @@ rtl8168_switch_to_sgmii_mode(struct rtl_hw *hw)
 	rtl8168_set_mcu_ocp_bit(hw, 0xEB16, BIT_1);
 }
 
+static u16
+rtl8125_get_fifo_nf(struct rtl_hw *hw)
+{
+	u32 magic = 0;
+	u32 mtu;
+
+	mtu = hw->mtu;
+
+	if (hw->mcfg >= CFG_METHOD_48 && hw->mcfg <= CFG_METHOD_61) {
+		if (mtu < 9500)
+			magic = 14215 + mtu;
+		else
+			return 0x5CA;
+	} else if (hw->mcfg >= CFG_METHOD_70 && hw->mcfg <= CFG_METHOD_71) {
+		if (mtu < 9500)
+			magic = 14447;
+		else
+			magic = 4947;
+
+		magic += mtu * (mtu < 9500 ? 1 : 2);
+	} else if (hw->mcfg >= CFG_METHOD_91) {
+		if (mtu < 9500)
+			magic = 17171;
+		else
+			magic = 7671;
+
+		magic += mtu * (mtu < 9500 ? 1 : 2);
+	}
+
+	return (u16)(magic >> 4);
+}
+
+static u16
+rtl8125_get_fifo_ne(struct rtl_hw *hw)
+{
+	u32 magic = 0;
+	u32 mtu;
+
+	mtu = hw->mtu;
+
+	if (hw->mcfg >= CFG_METHOD_48 && hw->mcfg <= CFG_METHOD_61) {
+		return 0x6BE;
+	} else if (hw->mcfg >= CFG_METHOD_70 && hw->mcfg <= CFG_METHOD_71) {
+		if (mtu < 9500)
+			return 0x107C;
+
+		magic = 77033;
+	} else if (hw->mcfg >= CFG_METHOD_91) {
+		if (mtu < 9500)
+			return 0x2C4A;
+
+		magic = 190910;
+	}
+
+	if (magic > mtu)
+		return (u16)((magic - mtu) >> 4);
+	else
+		return 0;
+}
+
 static void
 rtl_exit_oob(struct rtl_hw *hw)
 {
@@ -2007,12 +2067,9 @@ rtl_exit_oob(struct rtl_hw *hw)
 	rtl_wait_ll_share_fifo_ready(hw);
 
 	if (rtl_is_8125(hw)) {
-		rtl_mac_ocp_write(hw, 0xC0AA, 0x07D0);
-
-		rtl_mac_ocp_write(hw, 0xC0A6, 0x01B5);
-
+		rtl_mac_ocp_write(hw, 0xC0A6, rtl8125_get_fifo_nf(hw));
+		rtl_mac_ocp_write(hw, 0xC0AA, rtl8125_get_fifo_ne(hw));
 		rtl_mac_ocp_write(hw, 0xC01E, 0x5555);
-
 	} else {
 		data16 = rtl_mac_ocp_read(hw, 0xE8DE) | BIT_15;
 		rtl_mac_ocp_write(hw, 0xE8DE, data16);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 4/6] net/r8169: remove RTL9151 CSI (DBI) channel support
  2026-06-11  8:28 [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix Howard Wang
                   ` (2 preceding siblings ...)
  2026-06-11  8:28 ` [PATCH v1 3/6] net/r8169: improve RTL8125+ flow control Howard Wang
@ 2026-06-11  8:28 ` Howard Wang
  2026-06-11  8:28 ` [PATCH v1 5/6] net/r8169: update hardware configurations for 8125 Howard Wang
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Howard Wang @ 2026-06-11  8:28 UTC (permalink / raw)
  To: dev; +Cc: pro_nic_dpdk, Howard Wang

RTL9151 CSI (DBI) channel access is handled by FW. But FW may take
time to handle driver CSI channel access request and cause a HwIoErr.
For the reason mentioned above, remove RTL9151 CSI channel support.

Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>
---
 drivers/net/r8169/r8169_hw.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/r8169/r8169_hw.c b/drivers/net/r8169/r8169_hw.c
index 53d0620422..f15bd579fd 100644
--- a/drivers/net/r8169/r8169_hw.c
+++ b/drivers/net/r8169/r8169_hw.c
@@ -467,6 +467,9 @@ rtl_csi_other_fun_read(struct rtl_hw *hw, u8 multi_fun_sel_bit, u32 addr)
 	int i;
 	u32 value = 0xffffffff;
 
+	if (hw->mcfg == CFG_METHOD_60)
+		goto exit;
+
 	cmd = CSIAR_Read | CSIAR_ByteEn << CSIAR_ByteEn_shift |
 	      (addr & CSIAR_Addr_Mask);
 
@@ -506,6 +509,9 @@ rtl_csi_other_fun_write(struct rtl_hw *hw, u8 multi_fun_sel_bit, u32 addr,
 	u32 cmd;
 	int i;
 
+	if (hw->mcfg == CFG_METHOD_60)
+		return;
+
 	RTL_W32(hw, CSIDR, value);
 	cmd = CSIAR_Write | CSIAR_ByteEn << CSIAR_ByteEn_shift |
 	      (addr & CSIAR_Addr_Mask);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 5/6] net/r8169: update hardware configurations for 8125
  2026-06-11  8:28 [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix Howard Wang
                   ` (3 preceding siblings ...)
  2026-06-11  8:28 ` [PATCH v1 4/6] net/r8169: remove RTL9151 CSI (DBI) channel support Howard Wang
@ 2026-06-11  8:28 ` Howard Wang
  2026-06-11  8:28 ` [PATCH v1 6/6] net/r8169: fix segmentation fault during RTL8168 initialization Howard Wang
  2026-06-11 16:46 ` [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix Stephen Hemminger
  6 siblings, 0 replies; 8+ messages in thread
From: Howard Wang @ 2026-06-11  8:28 UTC (permalink / raw)
  To: dev; +Cc: pro_nic_dpdk, Howard Wang

Update hw configurations as below:
9151a's phy mcu,
9151a's phy config,
8125bp's mac mcu.

Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>
---
 drivers/net/r8169/base/rtl8125bp_mcu.c | 15 ++++++++-------
 drivers/net/r8169/base/rtl9151a.c      |  8 ++++++++
 drivers/net/r8169/base/rtl9151a_mcu.c  | 14 ++++++++++++--
 drivers/net/r8169/r8169_hw.h           |  2 +-
 4 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/drivers/net/r8169/base/rtl8125bp_mcu.c b/drivers/net/r8169/base/rtl8125bp_mcu.c
index a591988657..56b036314c 100644
--- a/drivers/net/r8169/base/rtl8125bp_mcu.c
+++ b/drivers/net/r8169/base/rtl8125bp_mcu.c
@@ -59,8 +59,8 @@ rtl_set_mac_mcu_8125bp_2(struct rtl_hw *hw)
 {
 	u16 entry_cnt;
 	static const u16 mcu_patch_code[] = {
-		0xE010, 0xE033, 0xE046, 0xE04A, 0xE04D, 0xE050, 0xE054, 0xE056, 0xE058,
-		0xE05A, 0xE05C, 0xE05E, 0xE060, 0xE062, 0xE064, 0xE066, 0xB406, 0x1000,
+		0xE010, 0xE033, 0xE046, 0xE04A, 0xE04D, 0xE050, 0xE054, 0xE058, 0xE05A,
+		0xE05C, 0xE05E, 0xE060, 0xE062, 0xE064, 0xE066, 0xE068, 0xB406, 0x1000,
 		0xF016, 0xC61F, 0x400E, 0xF012, 0x218E, 0x25BE, 0x1300, 0xF007, 0x7340,
 		0xC618, 0x400E, 0xF102, 0x48B0, 0x8320, 0xB400, 0x2402, 0x1000, 0xF003,
 		0x7342, 0x8322, 0xB000, 0xE007, 0x7322, 0x9B42, 0x7320, 0x9B40, 0x0300,
@@ -69,10 +69,10 @@ rtl_set_mac_mcu_8125bp_2(struct rtl_hw *hw)
 		0x9B20, 0x1B00, 0x9BA0, 0xC602, 0xBE00, 0x4392, 0xE6E0, 0xE6E2, 0xC01C,
 		0x4166, 0x9CF6, 0xC002, 0xB800, 0x143C, 0x49D1, 0xC602, 0xBE00, 0x3FC4,
 		0x49D1, 0xC602, 0xBE00, 0x405A, 0xC104, 0xC202, 0xBA00, 0x22E6, 0xD116,
-		0xC602, 0xBE00, 0x0000, 0xC102, 0xB900, 0x0000, 0xC002, 0xB800, 0x0000,
-		0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000,
-		0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000,
-		0xC602, 0xBE00, 0x0000, 0x6936, 0x0119, 0x030E, 0x0B18
+		0x1BC8, 0x46EB, 0xC302, 0xBB00, 0x0F14, 0xC102, 0xB900, 0x0000, 0xC002,
+		0xB800, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602,
+		0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602,
+		0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0x1171, 0x011A, 0x041D, 0x131A
 	};
 
 	entry_cnt = ARRAY_SIZE(mcu_patch_code);
@@ -92,8 +92,9 @@ rtl_set_mac_mcu_8125bp_2(struct rtl_hw *hw)
 	rtl_mac_ocp_write(hw, 0xFC2E, 0x3FC2);
 	rtl_mac_ocp_write(hw, 0xFC30, 0x4058);
 	rtl_mac_ocp_write(hw, 0xFC32, 0x22E4);
+	rtl_mac_ocp_write(hw, 0xFC34, 0x0F10);
 
-	rtl_mac_ocp_write(hw, 0xFC48, 0x003F);
+	rtl_mac_ocp_write(hw, 0xFC48, 0x007F);
 }
 
 /* ------------------------------------PHY 8125BP--------------------------------------- */
diff --git a/drivers/net/r8169/base/rtl9151a.c b/drivers/net/r8169/base/rtl9151a.c
index 4eca5fb96b..54ea424703 100644
--- a/drivers/net/r8169/base/rtl9151a.c
+++ b/drivers/net/r8169/base/rtl9151a.c
@@ -38,6 +38,14 @@ rtl_hw_phy_config_9151a_1(struct rtl_hw *hw)
 
 	rtl_mdio_direct_write_phy_ocp(hw, 0xA436, 0x80B6);
 	rtl_mdio_direct_write_phy_ocp(hw, 0xA438, 0xB6C3);
+
+	rtl_set_phy_mcu_patch_request(hw);
+
+	rtl_set_eth_phy_ocp_bit(hw, 0xA466, BIT_1);
+	rtl_mdio_direct_write_phy_ocp(hw, 0xA436, 0x837C);
+	rtl_clear_eth_phy_ocp_bit(hw, 0xA438, BIT_14);
+
+	rtl_clear_phy_mcu_patch_request(hw);
 }
 
 static void
diff --git a/drivers/net/r8169/base/rtl9151a_mcu.c b/drivers/net/r8169/base/rtl9151a_mcu.c
index 50a2cd90e6..d338daafce 100644
--- a/drivers/net/r8169/base/rtl9151a_mcu.c
+++ b/drivers/net/r8169/base/rtl9151a_mcu.c
@@ -31,8 +31,18 @@ static const u16 phy_mcu_ram_code_9151a_1_1[] = {
 	0xa436, 0xA108, 0xa438, 0xffff, 0xa436, 0xA106, 0xa438, 0xffff,
 	0xa436, 0xA104, 0xa438, 0xffff, 0xa436, 0xA102, 0xa438, 0x0cb4,
 	0xa436, 0xA100, 0xa438, 0x1398, 0xa436, 0xA110, 0xa438, 0x0003,
-	0xb820, 0x0010, 0xB82E, 0x0000, 0xa436, 0x8023, 0xa438, 0x0000,
-	0xB820, 0x0000, 0xFFFF, 0xFFFF
+	0xb820, 0x0010, 0xa436, 0x844e, 0xa438, 0xaf84, 0xa438, 0x66af,
+	0xa438, 0x847b, 0xa438, 0xaf84, 0xa438, 0x7baf, 0xa438, 0x847b,
+	0xa438, 0xaf84, 0xa438, 0x7baf, 0xa438, 0x847b, 0xa438, 0xaf84,
+	0xa438, 0x7baf, 0xa438, 0x847b, 0xa438, 0xd400, 0xa438, 0x04bf,
+	0xa438, 0x645d, 0xa438, 0x026a, 0xa438, 0x4cd4, 0xa438, 0x0004,
+	0xa438, 0xbf64, 0xa438, 0x6002, 0xa438, 0x6a4c, 0xa438, 0xaf61,
+	0xa438, 0x1600, 0xa436, 0xb818, 0xa438, 0x6110, 0xa436, 0xb81a,
+	0xa438, 0xffff, 0xa436, 0xb81c, 0xa438, 0xffff, 0xa436, 0xb81e,
+	0xa438, 0xffff, 0xa436, 0xb850, 0xa438, 0x03d1, 0xa436, 0xb852,
+	0xa438, 0xffff, 0xa436, 0xb878, 0xa438, 0xffff, 0xa436, 0xb884,
+	0xa438, 0xffff, 0xa436, 0xb832, 0xa438, 0x0001, 0xB82E, 0x0000,
+	0xa436, 0x8023, 0xa438, 0x0000, 0xB820, 0x0000, 0xFFFF, 0xFFFF
 };
 
 static void
diff --git a/drivers/net/r8169/r8169_hw.h b/drivers/net/r8169/r8169_hw.h
index 65007c2a7e..475bbbb016 100644
--- a/drivers/net/r8169/r8169_hw.h
+++ b/drivers/net/r8169/r8169_hw.h
@@ -138,7 +138,7 @@ extern const struct rtl_hw_ops rtl8125cp_ops;
 #define NIC_RAMCODE_VERSION_CFG_METHOD_56  (0x0027)
 #define NIC_RAMCODE_VERSION_CFG_METHOD_57  (0x0034)
 #define NIC_RAMCODE_VERSION_CFG_METHOD_58  (0x0024)
-#define NIC_RAMCODE_VERSION_CFG_METHOD_60  (0x0003)
+#define NIC_RAMCODE_VERSION_CFG_METHOD_60  (0x0017)
 #define NIC_RAMCODE_VERSION_CFG_METHOD_70  (0x0033)
 #define NIC_RAMCODE_VERSION_CFG_METHOD_71  (0x0060)
 #define NIC_RAMCODE_VERSION_CFG_METHOD_91  (0x0051)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 6/6] net/r8169: fix segmentation fault during RTL8168 initialization
  2026-06-11  8:28 [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix Howard Wang
                   ` (4 preceding siblings ...)
  2026-06-11  8:28 ` [PATCH v1 5/6] net/r8169: update hardware configurations for 8125 Howard Wang
@ 2026-06-11  8:28 ` Howard Wang
  2026-06-11 16:46 ` [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix Stephen Hemminger
  6 siblings, 0 replies; 8+ messages in thread
From: Howard Wang @ 2026-06-11  8:28 UTC (permalink / raw)
  To: dev; +Cc: pro_nic_dpdk, Howard Wang, stable

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@dpdk.org

Signed-off-by: Howard Wang <howard_wang@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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix
  2026-06-11  8:28 [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix Howard Wang
                   ` (5 preceding siblings ...)
  2026-06-11  8:28 ` [PATCH v1 6/6] net/r8169: fix segmentation fault during RTL8168 initialization Howard Wang
@ 2026-06-11 16:46 ` Stephen Hemminger
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Hemminger @ 2026-06-11 16:46 UTC (permalink / raw)
  To: Howard Wang; +Cc: dev, pro_nic_dpdk

On Thu, 11 Jun 2026 16:28:27 +0800
Howard Wang <howard_wang@realsil.com.cn> wrote:

> This patch series primarily focuses on updating hardware configurations, 
> optimizing the datapath, and refining device behaviors for the net/r8169 PMD. 
> Additionally, it includes one bug fix for a segmentation fault encountered 
> during initialization.
> 
> Summary of the series:
> 
>   - Patch 1: Updates RX CRC drop behavior for RTL8125BP and later MAC versions
>     to align with device shutdown sequences and prevent cross-driver states.
>   - Patch 2: Optimizes the Tx datapath performance by removing redundant branch
>     checks for malformed packets, replacing them with RTE_ASSERT.
>   - Patch 3: Enhances RTL8125+ flow control by utilizing a new formula for 
>     nearfull and nearempty thresholds.
>   - Patch 4: Removes RTL9151 CSI (DBI) channel support, as firmware handling 
>     latency makes it no longer suitable for the driver.
>   - Patch 5: Updates PHY and MAC MCU configurations for RTL9151A and RTL8125BP.
>   - Patch 6: Fixes a segmentation fault during RTL8168 initialization by 
>     restricting RTL8125-specific RSS/VMQ configurations to the correct hardware.
> 
> Howard Wang (6):
>   net/r8169: disable RX CRC drop for RTL8125BP and later
>   net/r8169: optimize Tx datapath by removing redundant packet checks
>   net/r8169: improve RTL8125+ flow control
>   net/r8169: remove RTL9151 CSI (DBI) channel support
>   net/r8169: update hardware configurations for 8125
>   net/r8169: fix segmentation fault during RTL8168 initialization
> 
>  drivers/net/r8169/base/rtl8125bp_mcu.c | 15 ++--
>  drivers/net/r8169/base/rtl9151a.c      |  8 +++
>  drivers/net/r8169/base/rtl9151a_mcu.c  | 14 +++-
>  drivers/net/r8169/r8169_compat.h       |  1 +
>  drivers/net/r8169/r8169_hw.c           | 98 ++++++++++++++++++++++++--
>  drivers/net/r8169/r8169_hw.h           |  2 +-
>  drivers/net/r8169/r8169_rxtx.c         | 32 ++++-----
>  7 files changed, 137 insertions(+), 33 deletions(-)
> 

Looks good, the CI AI review complaints are noise and will ignore those.
Applied to next-net


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-06-11 16:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11  8:28 [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix Howard Wang
2026-06-11  8:28 ` [PATCH v1 1/6] net/r8169: disable RX CRC drop for RTL8125BP and later Howard Wang
2026-06-11  8:28 ` [PATCH v1 2/6] net/r8169: optimize Tx datapath by removing redundant packet checks Howard Wang
2026-06-11  8:28 ` [PATCH v1 3/6] net/r8169: improve RTL8125+ flow control Howard Wang
2026-06-11  8:28 ` [PATCH v1 4/6] net/r8169: remove RTL9151 CSI (DBI) channel support Howard Wang
2026-06-11  8:28 ` [PATCH v1 5/6] net/r8169: update hardware configurations for 8125 Howard Wang
2026-06-11  8:28 ` [PATCH v1 6/6] net/r8169: fix segmentation fault during RTL8168 initialization Howard Wang
2026-06-11 16:46 ` [PATCH v1 0/6] net/r8169: hardware updates, optimizations, and a bug fix Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox