Add patches to improve support for using 3rd-party DSA switches like MaxLinear MxL862xx with MediaTek's mtk_eth_soc being the conduit. This involves reorganizing hardware queues to avoid overlap (currently dp->index is used -- if there is more than one DSA switch this is problematic), and correctly programming flows of the non-MTK DSA users ports in the PPE offloading engine. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
80 lines
2.7 KiB
Diff
80 lines
2.7 KiB
Diff
From 5ef0b04d30efff8f171e30bfbe876c00e3b9036a Mon Sep 17 00:00:00 2001
|
|
From: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
|
|
Date: Fri, 9 May 2025 09:49:04 +0800
|
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: revise hardware configuration for
|
|
mt7987
|
|
|
|
Change hardware configuration for the MT7987.
|
|
- Enable PSE drop mechanism when the WDMA Rx ring full
|
|
- Enable PSE no-drop mechanism for packets from the WDMA Tx
|
|
|
|
Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
|
|
---
|
|
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 49 +++++++++++++--------
|
|
1 file changed, 31 insertions(+), 18 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
@@ -4570,27 +4570,40 @@ static int mtk_hw_init(struct mtk_eth *e
|
|
mtk_w32(eth, PSE_DUMMY_WORK_GDM(1) | PSE_DUMMY_WORK_GDM(2) |
|
|
PSE_DUMMY_WORK_GDM(3) | DUMMY_PAGE_THR, PSE_DUMY_REQ);
|
|
|
|
- /* PSE free buffer drop threshold */
|
|
- mtk_w32(eth, 0x00600009, PSE_IQ_REV(8));
|
|
-
|
|
- /* PSE should not drop port8, port9 and port13 packets from
|
|
- * WDMA Tx
|
|
- */
|
|
- mtk_w32(eth, 0x00002300, PSE_DROP_CFG);
|
|
-
|
|
- /* PSE should drop packets to port8, port9 and port13 on WDMA Rx
|
|
- * ring full
|
|
- */
|
|
- mtk_w32(eth, 0x00002300, PSE_PPE_DROP(0));
|
|
- mtk_w32(eth, 0x00002300, PSE_PPE_DROP(1));
|
|
- mtk_w32(eth, 0x00002300, PSE_PPE_DROP(2));
|
|
-
|
|
- /* GDM and CDM Threshold */
|
|
- mtk_w32(eth, 0x08000707, MTK_CDMW0_THRES);
|
|
- mtk_w32(eth, 0x00000077, MTK_CDMW1_THRES);
|
|
-
|
|
- /* Disable GDM1 RX CRC stripping */
|
|
- mtk_m32(eth, MTK_GDMA_STRP_CRC, 0, MTK_GDMA_FWD_CFG(0));
|
|
+ if (eth->soc->caps == MT7988_CAPS) {
|
|
+ /* PSE free buffer drop threshold */
|
|
+ mtk_w32(eth, 0x00600009, PSE_IQ_REV(8));
|
|
+
|
|
+ /* PSE should not drop port8, port9 and port13 packets
|
|
+ * from WDMA Tx
|
|
+ */
|
|
+ mtk_w32(eth, 0x00002300, PSE_DROP_CFG);
|
|
+
|
|
+ /* PSE should drop packets to port8, port9 and port13
|
|
+ * on WDMA Rx ring full
|
|
+ */
|
|
+ mtk_w32(eth, 0x00002300, PSE_PPE_DROP(0));
|
|
+ mtk_w32(eth, 0x00002300, PSE_PPE_DROP(1));
|
|
+ mtk_w32(eth, 0x00002300, PSE_PPE_DROP(2));
|
|
+
|
|
+ /* GDM and CDM Threshold */
|
|
+ mtk_w32(eth, 0x08000707, MTK_CDMW0_THRES);
|
|
+ mtk_w32(eth, 0x00000077, MTK_CDMW1_THRES);
|
|
+ } else if (eth->soc->caps == MT7987_CAPS) {
|
|
+ /* PSE should not drop port8 packets from WDMA Tx */
|
|
+ mtk_w32(eth, 0x00000100, PSE_DROP_CFG);
|
|
+
|
|
+ /* PSE should drop packets to port8 on WDMA Rx ring
|
|
+ * full
|
|
+ */
|
|
+ mtk_w32(eth, 0x00000100, PSE_PPE_DROP(0));
|
|
+ mtk_w32(eth, 0x00000100, PSE_PPE_DROP(1));
|
|
+ }
|
|
+
|
|
+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_ESW)) {
|
|
+ /* Disable GDM1 RX CRC stripping */
|
|
+ mtk_m32(eth, MTK_GDMA_STRP_CRC, 0, MTK_GDMA_FWD_CFG(0));
|
|
+ }
|
|
|
|
/* PSE GDM3 MIB counter has incorrect hw default values,
|
|
* so the driver ought to read clear the values beforehand
|