Skip to contentSkip to conversation

net/ftgmac100: Rewrite the driver

PATCH Superseded 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      | 2186 ++++++++++++++-----------
 drivers/net/ethernet/faraday/ftgmac100.h      |  183 ++-
 5 files changed, 1422 insertions(+), 960 deletions(-)
arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts +0 -1
index 140b591..d05bb09 100644
@@ -104,7 +104,6 @@
 	status = "okay";
 
 	use-ncsi;
-	no-hw-checksum;
 };
 
 
arch/arm/boot/dts/aspeed-g4.dtsi +2 -4
index b8ee6d2..101fd5a 100644
@@ -36,18 +36,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 bc5e00e..46487f8 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 +1240 -946

2,619 lines not on this page · raw message

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

211 lines not on this page · raw message