[PATCH 1/3] ramips: ethernet: ralink: mt7620 jumbo frame support

Luiz Angelo Daros de Luca luizluca at gmail.com
Thu Jan 6 21:37:21 PST 2022


mt7620 can forward jumbo frames. The fe_change_mtu() was already
compatible except for the GDM_FWD_CFG address.

An MTU greater than 1500 is required to use DSA tags with a stacked
switch chip.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca at gmail.com>
---
 .../files/drivers/net/ethernet/ralink/mtk_eth_soc.c | 13 ++++++++++---
 .../files/drivers/net/ethernet/ralink/soc_mt7620.c  |  3 ++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c
index 8b57a3cc9a..be2ee6ba7f 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c
@@ -1458,6 +1458,13 @@ static int fe_change_mtu(struct net_device *dev, int new_mtu)
 	struct fe_priv *priv = netdev_priv(dev);
 	int frag_size, old_mtu;
 	u32 fwd_cfg;
+	u32 fwd_reg;
+
+#ifdef CONFIG_SOC_MT7620
+	fwd_reg = MT7620A_GDMA1_FWD_CFG;
+#else
+	fwd_reg = FE_GDMA1_FWD_CFG;
+#endif
 
 	old_mtu = dev->mtu;
 	dev->mtu = new_mtu;
@@ -1482,7 +1489,7 @@ static int fe_change_mtu(struct net_device *dev, int new_mtu)
 
 	fe_stop(dev);
 	if (!IS_ENABLED(CONFIG_SOC_MT7621)) {
-		fwd_cfg = fe_r32(FE_GDMA1_FWD_CFG);
+		fwd_cfg = fe_r32(fwd_reg);
 		if (new_mtu <= ETH_DATA_LEN) {
 			fwd_cfg &= ~FE_GDM1_JMB_EN;
 		} else {
@@ -1491,7 +1498,7 @@ static int fe_change_mtu(struct net_device *dev, int new_mtu)
 			fwd_cfg |= (DIV_ROUND_UP(frag_size, 1024) <<
 			FE_GDM1_JMB_LEN_SHIFT) | FE_GDM1_JMB_EN;
 		}
-		fe_w32(fwd_cfg, FE_GDMA1_FWD_CFG);
+		fe_w32(fwd_cfg, fwd_reg);
 	}
 
 	return fe_open(dev);
@@ -1610,7 +1617,7 @@ static int fe_probe(struct platform_device *pdev)
 
 
 	if (IS_ENABLED(CONFIG_SOC_MT7620))
-		netdev->max_mtu = 1508;
+		netdev->max_mtu = 2048;
 	if (IS_ENABLED(CONFIG_SOC_MT7621))
 		netdev->max_mtu = 2048;
 
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c
index 42685eebc3..8c43e6d78f 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c
@@ -345,7 +345,8 @@ static void mt7620_init_data(struct fe_soc_data *data,
 	struct fe_priv *priv = netdev_priv(netdev);
 
 	priv->flags = FE_FLAG_PADDING_64B | FE_FLAG_RX_2B_OFFSET |
-		FE_FLAG_RX_SG_DMA | FE_FLAG_HAS_SWITCH;
+		FE_FLAG_RX_SG_DMA | FE_FLAG_HAS_SWITCH |
+		FE_FLAG_JUMBO_FRAME;
 
 	netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 		NETIF_F_HW_VLAN_CTAG_TX;
-- 
2.34.0




More information about the openwrt-devel mailing list