mediatek: rewrite flow offload code
The code is now much cleaner and works better than the old code. Preparation for submitting it upstream (though with a different API) Also add back MT7621 support and fix flow table coherence issues on MT7622 Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
		@@ -111,7 +111,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
 | 
			
		||||
 	struct mvpp2_port *port = netdev_priv(dev);
 | 
			
		||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 | 
			
		||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 | 
			
		||||
@@ -446,9 +446,10 @@ static void mtk_mac_link_down(struct phy
 | 
			
		||||
@@ -448,9 +448,10 @@ static void mtk_mac_link_down(struct phy
 | 
			
		||||
 	mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
@@ -199,7 +199,10 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
 | 
			
		||||
+ * @duplex: link duplex
 | 
			
		||||
+ * @tx_pause: link transmit pause enablement status
 | 
			
		||||
+ * @rx_pause: link receive pause enablement status
 | 
			
		||||
+ *
 | 
			
		||||
  *
 | 
			
		||||
- * If @mode is not an in-band negotiation mode (as defined by
 | 
			
		||||
- * phylink_autoneg_inband()), allow the link to come up. If @phy
 | 
			
		||||
- * is non-%NULL, configure Energy Efficient Ethernet by calling
 | 
			
		||||
+ * Configure the MAC for an established link.
 | 
			
		||||
+ *
 | 
			
		||||
+ * @speed, @duplex, @tx_pause and @rx_pause indicate the finalised link
 | 
			
		||||
@@ -211,10 +214,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
 | 
			
		||||
+ * Note that when 802.3z in-band negotiation is in use, it is possible
 | 
			
		||||
+ * that the user wishes to override the pause settings, and this should
 | 
			
		||||
+ * be allowed when considering the implementation of this method.
 | 
			
		||||
  *
 | 
			
		||||
- * If @mode is not an in-band negotiation mode (as defined by
 | 
			
		||||
- * phylink_autoneg_inband()), allow the link to come up. If @phy
 | 
			
		||||
- * is non-%NULL, configure Energy Efficient Ethernet by calling
 | 
			
		||||
+ *
 | 
			
		||||
+ * If in-band negotiation mode is disabled, allow the link to come up. If
 | 
			
		||||
+ * @phy is non-%NULL, configure Energy Efficient Ethernet by calling
 | 
			
		||||
  * phy_init_eee() and perform appropriate MAC configuration for EEE.
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -37,12 +37,13 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
 #include <linux/mfd/syscon.h>
 | 
			
		||||
 #include <linux/regmap.h>
 | 
			
		||||
 #include <linux/clk.h>
 | 
			
		||||
@@ -2486,6 +2487,12 @@ static int mtk_hw_init(struct mtk_eth *e
 | 
			
		||||
@@ -2482,6 +2483,13 @@ static int mtk_hw_init(struct mtk_eth *e
 | 
			
		||||
 	if (ret)
 | 
			
		||||
 		goto err_disable_pm;
 | 
			
		||||
 
 | 
			
		||||
+	if (of_dma_is_coherent(eth->dev->of_node)) {
 | 
			
		||||
+		u32 mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA;
 | 
			
		||||
+		u32 mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA |
 | 
			
		||||
+			   ETHSYS_DMA_AG_MAP_PPE;
 | 
			
		||||
+
 | 
			
		||||
+		regmap_update_bits(eth->ethsys, ETHSYS_DMA_AG_MAP, mask, mask);
 | 
			
		||||
+	}
 | 
			
		||||
@@ -50,7 +51,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
 	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
 | 
			
		||||
 		ret = device_reset(eth->dev);
 | 
			
		||||
 		if (ret) {
 | 
			
		||||
@@ -3088,6 +3095,16 @@ static int mtk_probe(struct platform_dev
 | 
			
		||||
@@ -3080,6 +3088,16 @@ static int mtk_probe(struct platform_dev
 | 
			
		||||
 		}
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +70,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
 					  GFP_KERNEL);
 | 
			
		||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 | 
			
		||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 | 
			
		||||
@@ -426,6 +426,11 @@
 | 
			
		||||
@@ -435,6 +435,12 @@
 | 
			
		||||
 #define RSTCTRL_FE		BIT(6)
 | 
			
		||||
 #define RSTCTRL_PPE		BIT(31)
 | 
			
		||||
 
 | 
			
		||||
@@ -77,6 +78,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
+#define ETHSYS_DMA_AG_MAP	0x408
 | 
			
		||||
+#define ETHSYS_DMA_AG_MAP_PDMA	BIT(0)
 | 
			
		||||
+#define ETHSYS_DMA_AG_MAP_QDMA	BIT(1)
 | 
			
		||||
+#define ETHSYS_DMA_AG_MAP_PPE	BIT(2)
 | 
			
		||||
+
 | 
			
		||||
 /* SGMII subsystem config registers */
 | 
			
		||||
 /* Register to auto-negotiation restart */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user