]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: hibmcge: adjust the burst len configuration of the MAC controller to improve...
authorJijie Shao <shaojijie@huawei.com>
Wed, 2 Jul 2025 12:57:15 +0000 (20:57 +0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 8 Jul 2025 15:54:25 +0000 (08:54 -0700)
Adjust the burst len configuration of the MAC controller
to improve TX performance.

Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250702125716.2875169-3-shaojijie@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c
drivers/net/ethernet/hisilicon/hibmcge/hbg_reg.h

index 9b65eef62b3fbafd39ad858a2c7742690e0857be..6e56025915549e6b9f9c4e80b0b977d47803ae0e 100644 (file)
@@ -168,6 +168,11 @@ static void hbg_hw_set_mac_max_frame_len(struct hbg_priv *priv,
 
 void hbg_hw_set_mtu(struct hbg_priv *priv, u16 mtu)
 {
+       /* burst_len BIT(29) set to 1 can improve the TX performance.
+        * But packet drop occurs when mtu > 2000.
+        * So, BIT(29) reset to 0 when mtu > 2000.
+        */
+       u32 burst_len_bit = (mtu > 2000) ? 0 : 1;
        u32 frame_len;
 
        frame_len = mtu + VLAN_HLEN * priv->dev_specs.vlan_layers +
@@ -175,6 +180,9 @@ void hbg_hw_set_mtu(struct hbg_priv *priv, u16 mtu)
 
        hbg_hw_set_pcu_max_frame_len(priv, frame_len);
        hbg_hw_set_mac_max_frame_len(priv, frame_len);
+
+       hbg_reg_write_field(priv, HBG_REG_BRUST_LENGTH_ADDR,
+                           HBG_REG_BRUST_LENGTH_B, burst_len_bit);
 }
 
 void hbg_hw_mac_enable(struct hbg_priv *priv, u32 enable)
index a6e7f5e62b48aa00cc634ddc7fc1b29b5bf4c2af..d40880beb2f8f8e63a2d86cafac9455aa1064229 100644 (file)
 #define HBG_REG_TX_CFF_ADDR_2_ADDR             (HBG_REG_SGMII_BASE + 0x0490)
 #define HBG_REG_TX_CFF_ADDR_3_ADDR             (HBG_REG_SGMII_BASE + 0x0494)
 #define HBG_REG_RX_CFF_ADDR_ADDR               (HBG_REG_SGMII_BASE + 0x04A0)
+#define HBG_REG_BRUST_LENGTH_ADDR              (HBG_REG_SGMII_BASE + 0x04C4)
+#define HBG_REG_BRUST_LENGTH_B                 BIT(29)
 #define HBG_REG_RX_BUF_SIZE_ADDR               (HBG_REG_SGMII_BASE + 0x04E4)
 #define HBG_REG_RX_BUF_SIZE_M                  GENMASK(15, 0)
 #define HBG_REG_BUS_CTRL_ADDR                  (HBG_REG_SGMII_BASE + 0x04E8)