Skip to contentSkip to conversation

net/ftgmac100: Rewrite the driver

PATCH New Benjamin Herrenschmidt 1 participant 1 message Mar 28, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 net/ftgmac100: Rewrite the driver

This is an almost-complete rewrite of this driver.

The patch overall multiplies the performance of the driver on an AST2500 eval board with a gigabit link.

I get above 360Mbit/s with this vs. about 80Mbit/s with the current driver. I've done some tests on NC-SI machines as well, I get close to peak (above 90Mbit/s).

It does that by, among other things, rewriting the receive and transmit code, to both simplify the fast path as much as possible, avoid flushing of the caches (the aspeed chips have really slow little ARM cores), implementing support for fragmented sends, fixing HW checksum generation (AST2500 only), etc...

In addition, I've added netpoll support, tx timeout recovery, better handling of link speed changes, multicast filter and promisc support, various ethtool config additions etc...

Finally, the code has been cleaned up and reorganized, and various corner cases fixed, such as recovery in some error situations.

--

v2. - Fix recovery on abnormal interrupts
- Quieten messages on rx packet errors, statistics are sufficient

v3. - Completely remove the messages on rx packet errors. We would
get ratelimit warnings without anything displayed with is weird, the statistics should be sufficient. If needed we can add device specific stats with ethtool to grab the breakdown of the length errors but so far I don't see a need for it.
- Print the discovered PHY type
- Add a way to expose the phy interface type via the DT as we don't have a clean mechanism to get read it from the SCU.

v4. - Expose to the phydev that we support Pause frames
- Add a comment mentioning how we handle RGMII clock delays via u-boot.

While I tried initially to do an incremental series of patch this quickly became unrealistic as I rewrote more of the driver. This is better reviewed as a new replacement driver for the same chip instead. Since the Aspeed SoC is the only in-tree user and we are maintaining this for OpenBMC, the risk is limited, I didn't feel the need of submitting this as a separate driver and deprecate the old one.

---
 arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts |    1 -
 arch/arm/boot/dts/aspeed-g4.dtsi              |    6 +-
 arch/arm/boot/dts/aspeed-g5.dtsi              |    6 +-
 drivers/net/ethernet/faraday/ftgmac100.c      | 2176 ++++++++++++++-----------
 drivers/net/ethernet/faraday/ftgmac100.h      |  183 ++-
 5 files changed, 1418 insertions(+), 954 deletions(-)
arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts +0 -1
index 6c52f1c..24e2c0f 100644
@@ -102,7 +102,6 @@
 	status = "okay";
 
 	use-ncsi;
-	no-hw-checksum;
 };
 
 
arch/arm/boot/dts/aspeed-g4.dtsi +2 -4
index 28408a2..80c0867 100644
@@ -42,18 +42,16 @@
 		};
 
 		mac0: ethernet@1e660000 {
-			compatible = "faraday,ftgmac100";
+			compatible = "aspeed,ast2400-mac", "faraday,ftgmac100";
 			reg = <0x1e660000 0x180>;
 			interrupts = <2>;
-			no-hw-checksum;
 			status = "disabled";
 		};
 
 		mac1: ethernet@1e680000 {
-			compatible = "faraday,ftgmac100";
+			compatible = "aspeed,ast2400-mac", "faraday,ftgmac100";
 			reg = <0x1e680000 0x180>;
 			interrupts = <3>;
-			no-hw-checksum;
 			status = "disabled";
 		};
 
arch/arm/boot/dts/aspeed-g5.dtsi +2 -4
index 7c09a26..925cdf7 100644
@@ -141,18 +141,16 @@
 		};
 
 		mac0: ethernet@1e660000 {
-			compatible = "faraday,ftgmac100";
+			compatible = "aspeed,ast2500-mac", "faraday,ftgmac100";
 			reg = <0x1e660000 0x180>;
 			interrupts = <2>;
-			no-hw-checksum;
 			status = "disabled";
 		};
 
 		mac1: ethernet@1e680000 {
-			compatible = "faraday,ftgmac100";
+			compatible = "aspeed,ast2500-mac", "faraday,ftgmac100";
 			reg = <0x1e680000 0x180>;
 			interrupts = <3>;
-			no-hw-checksum;
 			status = "disabled";
 		};
 
drivers/net/ethernet/faraday/ftgmac100.c +1236 -940

2,613 lines not on this page · raw message

drivers/net/ethernet/faraday/ftgmac100.h +178 -5

211 lines not on this page · raw message