Ethernet Slow Download
#52
OK, let me give you a short walk-through at what I did:

TEST AT YOUR OWN RISK!

Make sure you have up-to-date kernel and u-boot first!

The tx- / rx- delay settings live in the devicetree file which describes your hardware (board) to the Linux kernel and configures besides many other things which drivers are used and how...

Set up a way to test your Ethernet performance against a fast machine (not a NAS or some other embedded device), I use a Windows box here on the same switch (Netgear GS716Tv3) with fully shielded CAT6 S/FTP patch cables of 3m length (please use proper cables....).

Using iperf3 on Windows as a server:


Code:
c:\iperf-3.1.3-win64>iperf3.exe -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

Using iperf3 on the Pine64 as client: (switch out 192.168.1.107 for your test server's IP address...)

Code:
debian@pine64:/boot/pine64$ iperf3 -c 192.168.1.107 -p 5201
Connecting to host 192.168.1.107, port 5201
[  4] local 192.168.1.116 port 57451 connected to 192.168.1.107 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  52.5 MBytes   441 Mbits/sec    0    243 KBytes
[  4]   1.00-2.01   sec  78.9 MBytes   652 Mbits/sec    0    273 KBytes
[  4]   2.01-3.00   sec  82.4 MBytes   701 Mbits/sec    0    273 KBytes
[  4]   3.00-4.01   sec   105 MBytes   873 Mbits/sec    0    273 KBytes
[  4]   4.01-5.01   sec   106 MBytes   892 Mbits/sec    0    273 KBytes
[  4]   5.01-6.01   sec   106 MBytes   886 Mbits/sec    0    273 KBytes
[  4]   6.01-7.02   sec   107 MBytes   889 Mbits/sec    0    273 KBytes
[  4]   7.02-8.00   sec   105 MBytes   889 Mbits/sec    0    273 KBytes
[  4]   8.00-9.00   sec   106 MBytes   888 Mbits/sec    0    273 KBytes
[  4]   9.00-10.01  sec   107 MBytes   888 Mbits/sec    0    273 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.01  sec   955 MBytes   800 Mbits/sec    0    sender
[  4]   0.00-10.01  sec   955 MBytes   800 Mbits/sec         receiver

As you can see, results are pretty good, we are getting about 800Mbit/s here, this is sending data towards the Windows box, so we want to adjust tx-delay if we get bad results (as opposed to the values shown above)...

The devicetree files are located in /boot/pine64/ , we are looking for sun50i-a64-pine64-plus.dtb which is the binary, compiled devicetree blob. To edit the setting we first have to decompile the binary to a text file (dts) using the devicetree compiler dtc:

Code:
debian@pine64:/boot/pine64$ sudo dtc -I dtb -O dts -o sun50i-a64-pine64-plus.dts sun50i-a64-pine64-plus.dtb

Now you should have a text file called sun50i-a64-pine64-plus.dts ... it should look something like https://github.com/longsleep/build-pine6...pine64.dts

Edit this file with your favourite text editor, search for tx-delay in the Ethernet section:

Code:
eth@01c30000 {
                       compatible = "allwinner,sunxi-gmac";
                       reg = <0x0 0x1c30000 0x0 0x40000 0x0 0x1c00000 0x0 0x30>;
                       pinctrl-names = "default";
                       interrupts = <0x0 0x52 0x4>;
                       interrupt-names = "gmacirq";
                       clocks = <0x8f>;
                       clock-names = "gmac";
                       phy-mode = "rgmii";
                       tx-delay = <0x3>;
                       rx-delay = <0x0>;
                       gmac_power1 = "axp81x_dc1sw:0";
                       status = "okay";
                       device_type = "gmac0";
                       pinctrl-0 = <0x9e>;
                       gmac_power2;
                       gmac_power3;
               };

According to the driver source in /drivers/net/ethernet/allwinner/sunxi-gma.c

Code:
static unsigned long tx_delay = 0;
module_param(tx_delay, ulong, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(tx_delay, "Adjust transmit clock delay, value: 0~7");

static unsigned long rx_delay = 0;
module_param(rx_delay, ulong, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(rx_delay, "Adjust receive clock delay, value: 0~31");

tx-delay ranges from 0 to 7, rx-delay ranges from 0 to 31.... we are adjusting tx-delay for now since we are interested in tweaking the sending of packets at the moment, so pick a value and save the file....

Now it's time to generate a binary file out of the dts again, maybe make a backup of your original dtb at this point, so if something goes wrong, you can copy it back... if you screw up the dtb, your image will most likely not boot or malfunction in some other way...

Code:
debian@pine64:/boot/pine64$ sudo dtc -I dts -O dtb -o sun50i-a64-pine64-plus.dtb sun50i-a64-pine64-plus.dts

Now reboot, and repeat the network test with iperf3, rinse repeat.... if you want to check if your devicetree changes are in effect after you reboot, you can look into the sysfs files of the driver:

Code:
debian@pine64:/boot/pine64$ cat /sys/module/sunxi_gmac/parameters/tx_delay

Happy hacking....


PS: It is by no means sure that tuning the delays will fix all the GbE issues people seem to have, I had two working boards that can get around 800Mbit/s in both directions with the default values (tx-delay 3, rx-delay 0).... BUT I can degrade my performance substantially when I move away from those values, up to a point where the GbE stops working, so testing this on a board that doesnt work with the default will be interesting...
Come have a chat in the Pine IRC channel >>
  Reply


Messages In This Thread
Ethernet Slow Download - by Ascotg - 04-09-2016, 01:15 PM
RE: Ethernet Slow Download - by Roverius - 04-09-2016, 04:27 PM
RE: Ethernet Slow Download - by rahlquist - 04-10-2016, 12:17 AM
RE: Ethernet Slow Download - by teke - 04-25-2016, 04:21 AM
RE: Ethernet Slow Download - by utdrmac - 04-27-2016, 01:47 PM
RE: Ethernet Slow Download - by utdrmac - 04-27-2016, 03:10 PM
RE: Ethernet Slow Download - by piahoo - 04-28-2016, 01:04 PM
RE: Ethernet Slow Download - by utdrmac - 04-27-2016, 06:06 PM
RE: Ethernet Slow Download - by teke - 04-28-2016, 05:09 AM
RE: Ethernet Slow Download - by malevolent - 05-08-2016, 01:14 PM
RE: Ethernet Slow Download - by tkaiser - 05-09-2016, 04:33 AM
RE: Ethernet Slow Download - by utdrmac - 05-09-2016, 05:50 AM
RE: Ethernet Slow Download - by tkaiser - 05-09-2016, 06:06 AM
RE: Ethernet Slow Download - by pinecone - 05-12-2016, 12:23 PM
RE: Ethernet Slow Download - by luggi - 05-14-2016, 11:29 AM
RE: Ethernet Slow Download - by rahlquist - 05-14-2016, 08:36 PM
RE: Ethernet Slow Download - by dR@G - 05-15-2016, 07:05 AM
RE: Ethernet Slow Download - by luggi - 05-18-2016, 01:13 PM
RE: Ethernet Slow Download - by trinitytest - 05-21-2016, 06:22 PM
RE: Ethernet Slow Download - by williamsoro - 05-26-2016, 06:27 PM
RE: Ethernet Slow Download - by cpacheco - 06-10-2016, 03:15 PM
RE: Ethernet Slow Download - by amc2012 - 06-10-2016, 09:56 PM
RE: Ethernet Slow Download - by psmacmur - 06-12-2016, 09:19 AM
RE: Ethernet Slow Download - by cdslashetc - 06-29-2016, 01:09 PM
RE: Ethernet Slow Download - by Er0l - 07-01-2016, 04:17 PM
RE: Ethernet Slow Download - by AVL2016 - 07-10-2016, 12:11 AM
RE: Ethernet Slow Download - by Er0l - 07-10-2016, 01:27 AM
RE: Ethernet Slow Download - by AVL2016 - 07-10-2016, 08:47 AM
RE: Ethernet Slow Download - by cdslashetc - 07-10-2016, 10:40 AM
RE: Ethernet Slow Download - by amc2012 - 07-11-2016, 02:16 PM
RE: Ethernet Slow Download - by coleshores - 07-11-2016, 02:34 PM
RE: Ethernet Slow Download - by amc2012 - 07-11-2016, 02:56 PM
RE: Ethernet Slow Download - by utdrmac - 07-11-2016, 03:14 PM
RE: Ethernet Slow Download - by Summons - 07-11-2016, 06:00 PM
RE: Ethernet Slow Download - by coleshores - 07-11-2016, 06:03 PM
RE: Ethernet Slow Download - by utdrmac - 07-17-2016, 05:17 PM
RE: Ethernet Slow Download - by cdslashetc - 07-11-2016, 06:25 PM
RE: Ethernet Slow Download - by xalius - 07-11-2016, 06:34 PM
RE: Ethernet Slow Download - by amc2012 - 07-11-2016, 07:18 PM
RE: Ethernet Slow Download - by cdslashetc - 07-11-2016, 07:56 PM
RE: Ethernet Slow Download - by amc2012 - 07-11-2016, 08:30 PM
RE: Ethernet Slow Download - by xalius - 07-17-2016, 05:11 PM
RE: Ethernet Slow Download - by waldo - 07-17-2016, 05:34 PM
RE: Ethernet Slow Download - by Summons - 07-18-2016, 07:51 AM
RE: Ethernet Slow Download - by xalius - 07-18-2016, 08:01 AM
RE: Ethernet Slow Download - by waldo - 07-18-2016, 08:09 AM
RE: Ethernet Slow Download - by cdslashetc - 07-18-2016, 09:08 AM
RE: Ethernet Slow Download - by amc2012 - 07-18-2016, 09:15 AM
RE: Ethernet Slow Download - by Summons - 07-18-2016, 10:58 AM
RE: Ethernet Slow Download - by xalius - 07-18-2016, 12:26 PM
RE: Ethernet Slow Download - by androsch - 07-18-2016, 01:45 PM
RE: Ethernet Slow Download - by amc2012 - 07-18-2016, 01:47 PM
RE: Ethernet Slow Download - by androsch - 07-18-2016, 01:55 PM
RE: Ethernet Slow Download - by amc2012 - 07-18-2016, 02:03 PM
RE: Ethernet Slow Download - by nSkaarup - 08-06-2016, 09:27 AM
RE: Ethernet Slow Download - by longsleep - 07-18-2016, 02:05 PM
RE: Ethernet Slow Download - by amc2012 - 07-18-2016, 03:06 PM
RE: Ethernet Slow Download - by Summons - 07-19-2016, 06:46 AM
RE: Ethernet Slow Download - by cdslashetc - 07-20-2016, 01:47 PM
RE: Ethernet Slow Download - by cdslashetc - 07-21-2016, 03:59 AM
RE: Ethernet Slow Download - by cdslashetc - 07-22-2016, 05:44 PM
RE: Ethernet Slow Download - by cdslashetc - 07-22-2016, 06:44 PM
RE: Ethernet Slow Download - by cdslashetc - 07-23-2016, 11:42 AM
RE: Ethernet Slow Download - by waldo - 07-24-2016, 01:27 PM
RE: Ethernet Slow Download - by cdslashetc - 07-24-2016, 02:26 PM
RE: Ethernet Slow Download - by waldo - 08-01-2016, 08:03 PM
RE: Ethernet Slow Download - by dkryder - 07-24-2016, 02:02 PM
RE: Ethernet Slow Download - by cdslashetc - 08-06-2016, 11:55 AM
RE: Ethernet Slow Download - by amc2012 - 08-06-2016, 12:13 PM
RE: Ethernet Slow Download - by MarkHaysHarris777 - 08-06-2016, 01:10 PM
RE: Ethernet Slow Download - by amc2012 - 08-06-2016, 04:40 PM
RE: Ethernet Slow Download - by MarkHaysHarris777 - 08-06-2016, 05:25 PM
RE: Ethernet Slow Download - by amc2012 - 08-06-2016, 05:46 PM
RE: Ethernet Slow Download - by MarkHaysHarris777 - 08-06-2016, 07:20 PM
RE: Ethernet Slow Download - by amc2012 - 08-06-2016, 07:52 PM
RE: Ethernet Slow Download - by cdslashetc - 08-06-2016, 08:05 PM
RE: Ethernet Slow Download - by waldo - 08-06-2016, 08:23 PM
RE: Ethernet Slow Download - by amc2012 - 08-06-2016, 08:30 PM
RE: Ethernet Slow Download - by waldo - 08-06-2016, 08:38 PM
RE: Ethernet Slow Download - by cdslashetc - 09-04-2016, 08:55 AM
RE: Ethernet Slow Download - by androsch - 09-04-2016, 09:48 AM
RE: Ethernet Slow Download - by tllim - 09-07-2016, 05:00 PM
RE: Ethernet Slow Download - by androsch - 09-08-2016, 11:34 AM
RE: Ethernet Slow Download - by MarkHaysHarris777 - 09-08-2016, 11:58 AM
RE: Ethernet Slow Download - by androsch - 09-08-2016, 12:21 PM
RE: Ethernet Slow Download - by waldo - 09-08-2016, 01:05 PM
RE: Ethernet Slow Download - by cdslashetc - 09-08-2016, 01:07 PM
RE: Ethernet Slow Download - by MarkHaysHarris777 - 09-08-2016, 01:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Ethernet port down afert 1 day jeda 0 863 11-12-2022, 06:48 AM
Last Post: jeda
  Ethernet --> Causing boot loop podtofs 3 5,817 05-16-2017, 03:41 AM
Last Post: m17
  GbE Ethernet Port Issue Data Gathering Statistics Intel MarkHaysHarris777 19 27,218 01-17-2017, 01:17 AM
Last Post: DrunkTank
  What will it take to get the Ethernet port working? clarkss12 10 18,366 10-17-2016, 03:42 PM
Last Post: waldo
  Pine64+ 1GB Ethernet Port spec ecotack 13 17,789 08-20-2016, 09:28 PM
Last Post: pfeerick
  If you have had difficulty with the GbE ethernet please take the poll MarkHaysHarris777 0 2,589 08-17-2016, 05:44 PM
Last Post: MarkHaysHarris777
  Ethernet works on Arch Linux. Nothing elese pfunk237 4 6,777 07-23-2016, 03:07 PM
Last Post: SuperArmySoldiers

Forum Jump:


Users browsing this thread: 6 Guest(s)