OpenWrt Forum Archive

Topic: TRENDnet AC2600 (TEW-827DRU)

The content of this topic has been archived between 25 Mar 2018 and 29 Apr 2018. Unfortunately there are posts – most likely complete pages – missing.

This weekend I got my device fixed by a friend who does embedded device development for a living. He was able to reprogram the NAND flash in-place with the help of what I'm sure is very expensive equipment.

I am still going to work on the jtag stuff, but I'll get back to that some time in the future. OpenOCD is waiting on some patches to get figured out before SoCs like this can be supported.

If anyone wants to take a shot at it, all you need to do to make the JTAG port work is to stick a blob of solder over R33 to short it, and install a 10Kohm resistor in R15. Installing the R15 resistor is not easy due to the space constraints of the pads.

I will get back to working on this during the next few days.

(Last edited by jmomo on 31 Aug 2016, 04:29)

I have my first working boot with rootfs mounted. Hopefully I can finish this soon. My time is somewhat limited right now.

Some kernel boot log notes

[    0.000000] Kernel command line: console=ttyMSM0,115200n8 ubi.mtd=11 ubi.block=0,1 root=/dev/ubiblock0_1 rootfstype=squashfs
[    0.000000] Bootloader command line (ignored): console=ttyHSL1,115200n8 ubi.mtd=rootfs root=mtd:ubi_rootfs rootfstype=squashfs

If LEDE has UBI auto-detection, it's not working. With no cmdline arguments in the DTS, the system fails to find a rootfs. I manually specified the UBI block device above for the squashfs root.

[    1.428503] nand: device found, Manufacturer ID: 0x01, Chip ID: 0xaa
[    1.429728] nand: AMD/Spansion S34MS02G2
[    1.436338] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 128
[    1.440166] Scanning device for bad blocks
[    1.961829] random: nonblocking pool is initialized
[    3.217907] 15 ofpart partitions found on MTD device qcom-nandc
[    3.217940] Creating 15 MTD partitions on "qcom-nandc":
[    3.222752] 0x000000000000-0x000000040000 : "SBL1"
[    3.239991] 0x000000040000-0x000000180000 : "MIBIB"
[    3.252087] 0x000000180000-0x0000002c0000 : "SBL2"
[    3.263861] 0x0000002c0000-0x000000540000 : "SBL3"
[    3.265348] 0x000000540000-0x000000660000 : "DDRCONFIG"
[    3.269040] 0x000000660000-0x000000780000 : "SSD"
[    3.274251] 0x000000780000-0x000000a00000 : "TZ"
[    3.279018] 0x000000a00000-0x000000c80000 : "RPM"
[    3.283844] 0x0000053a0000-0x0000058a0000 : "APPSBL"
[    3.298601] 0x000001180000-0x000001200000 : "APPSBLENV"
[    3.310404] 0x000001180000-0x000001200000 : "ART"
[    3.322228] 0x0000058a0000-0x0000098a0000 : "rootfs"
[    3.323746] mtd: device 11 (rootfs) set to be root filesystem
[    3.327188] mtdsplit: no squashfs found in "rootfs"
[    3.332027] 0x000005340000-0x0000053a0000 : "BOOTCONFIG"
[    3.338091] 0x000000c80000-0x000001180000 : "APPSBL_1"
[    3.343837] 0x000001340000-0x000005340000 : "rootfs_1"

There is supposed to be a patch which automatically renames "rootfs" smem partitions to "ubi", but it's apparently not working. Also we should probably rename rootfs_1 to ubi_1 too., not that it matters here.

Reference: target/linux/ipq806x/patches-4.4/302-mtd-qcom-smem-rename-rootfs-ubi.patch


[    3.781394] ubi0: attaching mtd11
[    4.483487] ubi0: scanning is finished
[    4.499011] ubi0 warning: print_rsvd_warning: cannot reserve enough PEBs for bad PEB handling, reserved 5, need 40
[    4.500065] ubi0: attached mtd11 (name "rootfs", size 64 MiB)
[    4.508316] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    4.514116] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    4.520833] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    4.527768] ubi0: good PEBs: 512, bad PEBs: 0, corrupted PEBs: 0
[    4.534517] ubi0: user volume: 3, internal volumes: 1, max. volumes count: 128
[    4.540714] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1781561988
[    4.547825] ubi0: available PEBs: 0, total reserved PEBs: 512, PEBs reserved for bad PEB handling: 5
[    4.557244] ubi0: background thread "ubi_bgt0d" started, PID 54
[    4.566797] block ubiblock0_1: created from ubi0:1(rootfs)
[    4.572433] UBI error: block: can't add 'rootfs' volume, err=-17
[    4.577354] hctosys: unable to open rtc device (rtc0)
[    4.594800] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    4.594990] Freeing unused kernel memory: 200K (c078c000 - c07be000)

There we go. That's a proper UBI attachment. Volume 0 = kernel, 1 = rootfs(squashfs), 2 = rootfs_data(ubifs).

[    6.192030] init: - preinit -
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    8.344647] UBIFS (ubi0:2): default file-system created
[    8.345758] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" started, PID 91
[    8.453599] UBIFS (ubi0:2): UBIFS: mounted UBI device 0, volume 2, name "rootfs_data"
[    8.453628] UBIFS (ubi0:2): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[    8.460413] UBIFS (ubi0:2): FS size: 57774080 bytes (55 MiB, 455 LEBs), journal size 2920448 bytes (2 MiB, 23 LEBs)
[    8.470385] UBIFS (ubi0:2): reserved for root: 2728812 bytes (2664 KiB)
[    8.480601] UBIFS (ubi0:2): media format: w4/r0 (latest is w4/r0), UUID FC1C8316-B386-4D98-B657-BC1C6F152A77, small LPT model
[    8.489914] mount_root: overlay filesystem has not been fully initialized yet
[    8.499158] mount_root: switching to jffs2 overlay
[    8.508152] urandom-seed: Seed file not found (/etc/urandom.seed)
[    8.559615] procd: - early -
[    8.559688] procd: - watchdog -
[    9.140470] procd: - ubus -
[    9.192554] procd: - init -
Please press Enter to activate this console.

There were two intermittent kernel oops/panics so far on boot.I'll worry about those later. I need to rebase.

Current issues:

I've seen a couple of kernel panic/oops. Might just be DTS issues. Will look into it later.

Block errors. These are ECC related I think. Not a serious issue for now. Other platforms have these same NAND issues. I'm not having any issue with flashing or the UBIFS. Also this flash is pretty damned fast.

802.11 radios are not yet working. I see them on the PCI bus but there is some driver issue.

Switchports: Looks like MAC addresses and switch ports are good. I need to do more testing to make sure my config is right. I think there are two internal CPU-facing ports? I guess I'll trunk them. I think the EA8500 is doing that based on some config I was just looking at.

LEDs/buttons: Switch port LEDs are working. Nothing else. I need to probe GPIOs and other stuff. I'm not sure about getting the 802.11 LEDs working. I don't think the other ipq806x devices have that figured out in the driver yet. Those LEDs are controlled via the radio chips directly (I think).

All in all pretty good.

(Last edited by jmomo on 31 Aug 2016, 09:34)

I am getting these errors on the ath10k 802.11 drivers. No idea for now.

This is just for the first radio. Same error for the second radio:

ath10k_pci 0000:01:00.0: enabling device (0140 -> 0142)
ath10k_pci 0000:01:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0
ath10k_pci 0000:01:00.0: Direct firmware load for ath10k/pre-cal-pci-0000:01:00.0.bin failed with error -2
ath10k_pci 0000:01:00.0: Falling back to user helper
firmware ath10k!pre-cal-pci-0000:01:00.0.bin: firmware_loading_store: map pages failed
ath10k_pci 0000:01:00.0: Direct firmware load for ath10k/cal-pci-0000:01:00.0.bin failed with error -2
ath10k_pci 0000:01:00.0: Falling back to user helper
firmware ath10k!cal-pci-0000:01:00.0.bin: firmware_loading_store: map pages failed
ath10k_pci 0000:01:00.0: Unknown FW IE: 30
ath10k_pci 0000:01:00.0: qca99x0 hw2.0 target 0x01000000 chip_id 0x003b01ff sub 168c:0002
ath10k_pci 0000:01:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 1
ath10k_pci 0000:01:00.0: firmware ver 10.4.3-ct-fW-007-71d92ff api 5 features peer-flow-ctrl crc32 3a3bc4d2
ath10k_pci 0000:01:00.0: unable to read from the device
ath10k_pci 0000:01:00.0: could not execute otp for board id check: -110
ath10k_pci 0000:01:00.0: failed to get board id from otp: -110
ath10k_pci 0000:01:00.0: could not probe fw (-110)

The current preferred configuration for the ethernet is to configure two VLANs on the switch, one for LAN and one for WAN with one cpu port assigned to each (without tagging).

Hi Bendavid. Yes I did add an entry in the caldata file, but it might be wrong. I need to inspect that dump of the flash and see if it's the same as other devices. Also, I just discovered a typo where my ART part definition in my DTS file was wrong, so it might already be fixed. Not sure.

I need to read up on how the ath10k driver works in regards to the binary blobs vs what needs to get read from the firmware.

Also thanks for the idea on the switch ports. I'm not sure which route I'll go with yet. I think it's the EA8500 that is doing trunking. I plan on heavy 802.11 use with large amounts of traffic between radios, so trunking might actually be better for me, but I'll benchmark both and see.

Thanks for your replies.

(Last edited by jmomo on 1 Sep 2016, 12:32)

So actually on the EA8500, it's only using a single cpu port, with vlan tagging, because as far as I recall there were some problems with the switch and/or PHY configuration that have not been understood or fixed yet and which prevented using both ethernet interfaces.

I'm not sure if trunking is supported by the ethernet controllers/drivers.

bendavid wrote:

So actually on the EA8500, it's only using a single cpu port, with vlan tagging, because as far as I recall there were some problems with the switch and/or PHY configuration that have not been understood or fixed yet and which prevented using both ethernet interfaces.

I'm not sure if trunking is supported by the ethernet controllers/drivers.

Okay, I'll definitely test that out. I know that my switch is working and I've accounted for all the ports. I need to test features like large frames, dot1q, and lacp trunking.

root@(none):~# cat /tmp/sysinfo/model
TRENDnet TEW-827DRU
root@(none):~# cat /tmp/sysinfo/board_name
unknown

My lib/ipq806x.sh file ipq806x_board_detect() wasn't triggering because the case pattern wasn't right. The board name wasn't being set, thus the firmware wasn't being created.

Also some of those errors were for firmware of different chips that I should not even have had in my image.

The 802.11 interfaces appear to be coming up now. I can see them in "iw dev".

(Last edited by jmomo on 2 Sep 2016, 00:24)

Let's look at MAC addresses. This seems to be a fun issue in all of these ipq806x systems.

These addresses are from a real world device.

Physical label
    LAN MAC: D8:EB:97:30:30:03
    WAN MAC: D8:EB:97:30:30:04

uboot messages
    Net:   MAC1 addr:0:3:7f:ba:db:1
    MAC2 addr:0:3:7f:ba:db:2

(IPQ) # printenv
    lan_mac=D8:EB:97:30:30:03
    wan_mac=D8:EB:97:30:30:04

HTTP recovery loader system (uboot)
    hostmac = default_mac_from_artblock: 00:03:7F:BA:DB:02 from 0xBF7FFFA0

OEM ifconfig output
    ath0      Link encap:Ethernet  HWaddr D8:EB:97:30:30:03  
    ath4      Link encap:Ethernet  HWaddr D8:EB:97:30:30:05  
    br-lan    Link encap:Ethernet  HWaddr D8:EB:97:30:30:03  
    eth0      Link encap:Ethernet  HWaddr D8:EB:97:30:30:04  
    eth1      Link encap:Ethernet  HWaddr D8:EB:97:30:30:03  

It looks like the primary MAC addresses used on the system come from the u-boot environment variables. However, there is also a second set mentioned (00:03:7f). Those belong to the qca8337 switch chip. The OEM system does not appear to use those.

The OEM system isn't using the switch MAC addresses.

I grepped through a dump of the ART partition but none of these matched anything there. If there are MAC address in the ART, I don't know what their location is and the OEM system doesn't seem to be using them.

(Last edited by jmomo on 2 Sep 2016, 04:26)

Our GPIOs are as follows:

6 0 = Enable the 1000BASE-T switch?
6 1 = Disable the 1000BASE-T switch?

7 0 = USB LED
53 0 = Power LED

9 1 = WiFi on/off button up
9 0 = WiFi on/off button down

54 1 = Reset button up
54 0 = Reset button down

67 1 = WPS button up
67 0 = WPS button down

26 1 = LED on/off button up
26 0 = LED on/off button down

Here are the scripts I used to test:



GPIO_LIST="8 9 16 22 23 24 26 33 49 54 64 65 66 67 68 2 3 4 5 10 11 14 15 17 25 48 50 55 56 57 58 63"

# LED/output test
for EACH in $GPIO_LIST ; do
 echo $EACH > /sys/class/gpio/export  2> /dev/null
 if [[ -d /sys/class/gpio/gpio$EACH ]] ; then
  echo out > /sys/class/gpio/gpio$EACH/direction 2> /dev/null
  echo "[GPIO $EACH]: Trying value 0"
  echo 0 > /sys/class/gpio/gpio$EACH/value 2> /dev/null
  sleep 2
  echo "[GPIO $EACH]: Trying value 1"
  echo 1 > /sys/class/gpio/gpio$EACH/value 2> /dev/null
  sleep 2
  echo $EACH > /sys/class/gpio/unexport 2> /dev/null
 fi
done ; unset EACH


# BUTTON/input test
for EACH in $GPIO_LIST ; do
 echo $EACH > /sys/class/gpio/export 2> /dev/null
 if [[ -d /sys/class/gpio/gpio$EACH ]] ; then
  echo in > /sys/class/gpio/gpio$EACH/direction 2> /dev/null
  # if [[ -e /sys/class/gpio/gpio$EACH}/value ]] ; then
   echo "[GPIO $EACH] value: $(cat /sys/class/gpio/gpio$EACH/value)"
  # fi
  echo $EACH > /sys/class/gpio/unexport 2> /dev/null
 fi
done > out1.txt ; unset EACH

# BUTTON/input test
for EACH in $GPIO_LIST ; do
 echo $EACH > /sys/class/gpio/export 2> /dev/null
 if [[ -d /sys/class/gpio/gpio$EACH ]] ; then
  echo in > /sys/class/gpio/gpio$EACH/direction 2> /dev/null
  # if [[ -e /sys/class/gpio/gpio$EACH}/value ]] ; then
   echo "[GPIO $EACH] value: $(cat /sys/class/gpio/gpio$EACH/value)"
  # fi
  echo $EACH > /sys/class/gpio/unexport 2> /dev/null
 fi
done > out2.txt ; unset EACH

diff out1.txt out2.txt

You need to build diff into your image, obviously.

Useful info also here:
  https://wiki.openwrt.org/doc/hardware/port.gpio
  https://wiki.openwrt.org/doc/devel/add.new.device
  https://wiki.openwrt.org/doc/howto/hardware.button

I was really hoping to be able to control the USB port power, but I didn't find anything.

Also I tested the unpopulated pads for LED DS10 on the board and my multimeter saw nothing, so it must not be hooked up.

There is silkscreen for what looks like a button on the front there too, near the NSS DEBUG-2, but just looking at the tracings I can tell it's not connected. I wonder what that would have been for.

--

More update:

GPIOs are documented in OEM source file: qsdk_gpl/qca/src/linux/arch/arm/mach-msm/board-ipq806x.c

(Last edited by jmomo on 19 Sep 2016, 10:33)

The "fw_printenv" command from uboot-envtools now works.

I am currently unable to get the USB activity LED to work for both USB ports. I can make it work for either of them, but not both at the same time. The Linux kernel USB LED trigger driver only supports a 1:1 matching of port to LED.

This is a known issue and was discussed recently on the LKML:
https://lkml.org/lkml/2016/7/29/38
or
https://lwn.net/Articles/698218/

I sent an email to Rafal Milechi and he replied that it's an ongoing discussion but there is no resolution yet. I'll check back with it in the future.

For now, the USB port on the left (when looking at the ports) works with the LED, but the one on the right does not.

Also, because of the way these USB ports work, the USB2 functionality is seen as a different USB hub. So even though there are two physical ports, there are four busses.

Bus 1 is USB2 on the outer/left port.
Bus 2 is USB3 on the outer/left port.
Bus 3 is USB2 on the inner/right port.
Bus 4 is USB3 on the inner/right port.

So the USB LED will only light up when the left port has a USB3 device in it.

(Last edited by jmomo on 12 Sep 2016, 12:44)

sysupgrades verified as working properly.

MAC addresses are a huge pain for this device. The problem originates with Qualcomm and it affects all of the various OEMs who made similar devices using these SoCs and the QSDK.

I now have a couple of TEW-827DRUs to compare with each other.

The 1000BASE-T switch hardware MAC addresses are all the same for every device of this model:
eth0(wan) = 00:03:7f:ba:db:01
eth1(lan) = 00:03:7f:ba:db:02

The "LAN" and "WAN" MAC addresses shown on the device label are set by the OS in software. They are declared in the u-boot environment as "lan_mac" and "wan_mac".

I will look into the driver for this switch and see if there is some way to program or declare some better MAC addresses. This can definitely break some shit, like LLDP, bridging, and other obscure stuff.



The 802.11/wifi MAC address are also a nightmare, and I'm not completely positive WTF is going on.

One of my devices seems to be getting the appropriate, or semi-appropriate, MAC addresses. The others are just pseudo random crap.

Why one of them is getting those semi-correct addresses is beyond me. I'm not sure yet where the driver is getting that MAC. I need to look at the source because just hexdumping the ART partitions and grepping through that wasn't helpful and I didn't find them.

I strongly suspect the ath10k driver is drunk/broke in this regard.

For example, if I set one of my 802.11 MAC addresses to xx:xx:xx:yy:yy:05, I then go look in sysfs and it has been set to xx:xx:xx:yy:yy:04. Yea, really.

cat /sys/devices/platform/soc/1b500000.pci/pci0000:00/0000:00:00.0/0000:01:00.0/ieee80211/phy0/macaddress
cat /sys/devices/platform/soc/1b500000.pci/pci0000:00/0000:00:00.0/0000:01:00.0/ieee80211/phy0/device/net/wlan0/address

cat /sys/devices/platform/soc/1b700000.pci/pci0001:00/0001:00:00.0/0001:01:00.0/ieee80211/phy1/macaddress
cat /sys/devices/platform/soc/1b700000.pci/pci0001:00/0001:00:00.0/0001:01:00.0/ieee80211/phy1/device/net/wlan1/address


So here is how to kinda/sorta fix this stupid mess:

source /lib/functions/uci-defaults.sh
source /lib/ipq806x.sh
source /lib/functions/system.sh

uci set network.lan.macaddr=$(mtd_get_mac_ascii APPSBLENV lan_mac)
uci set network.wan.macaddr=$(mtd_get_mac_ascii APPSBLENV wan_mac)
uci commit network

uci set wireless.@wifi-iface[0].macaddr=$(macaddr_add $(mtd_get_mac_ascii APPSBLENV lan_mac) +8)
uci set wireless.@wifi-iface[1].macaddr=$(macaddr_add $(mtd_get_mac_ascii APPSBLENV lan_mac) +9)
uci commit wireless

For the 802.11 interfaces, I went with +8 and +9 from the LAN MAC because the switch has seven ports available to us. It's arbitrary anyway.



So what is the appropriate way to fix this in the image?

I guess I am going to create a new entry in target/linux/ipq806x/generic/base-files/etc/uci-defaults

We will look for existing MAC addresses in the configuration and not already existing, set some defaults.

Not, pretty, but it works.

OpenSSL speed tests results

root@lede1:/etc/config# openssl speed md5 sha1 sha256 sha512 des des-ede3 aes-128-cbc aes-192-cbc aes-256-cbc rsa2048 dsa2048 | tee /tmp/sslspe
ed
Doing md5 for 3s on 16 size blocks: 1107655 md5's in 2.96s
Doing md5 for 3s on 64 size blocks: 1003509 md5's in 2.99s
Doing md5 for 3s on 256 size blocks: 712132 md5's in 2.98s
Doing md5 for 3s on 1024 size blocks: 330237 md5's in 3.00s
Doing md5 for 3s on 8192 size blocks: 55218 md5's in 3.00s
Doing sha1 for 3s on 16 size blocks: 865866 sha1's in 3.00s
Doing sha1 for 3s on 64 size blocks: 627727 sha1's in 3.00s
Doing sha1 for 3s on 256 size blocks: 333704 sha1's in 3.00s
Doing sha1 for 3s on 1024 size blocks: 116566 sha1's in 3.00s
Doing sha1 for 3s on 8192 size blocks: 16441 sha1's in 3.00s
Doing sha256 for 3s on 16 size blocks: 1169064 sha256's in 3.00s
Doing sha256 for 3s on 64 size blocks: 733435 sha256's in 3.00s
Doing sha256 for 3s on 256 size blocks: 346109 sha256's in 3.00s
Doing sha256 for 3s on 1024 size blocks: 110550 sha256's in 3.00s
Doing sha256 for 3s on 8192 size blocks: 15085 sha256's in 3.00s
Doing sha512 for 3s on 16 size blocks: 314927 sha512's in 3.00s
Doing sha512 for 3s on 64 size blocks: 315727 sha512's in 3.00s
Doing sha512 for 3s on 256 size blocks: 116115 sha512's in 3.00s
Doing sha512 for 3s on 1024 size blocks: 40000 sha512's in 3.00s
Doing sha512 for 3s on 8192 size blocks: 5623 sha512's in 3.00s
Doing des cbc for 3s on 16 size blocks: 3545325 des cbc's in 3.00s
Doing des cbc for 3s on 64 size blocks: 912128 des cbc's in 3.00s
Doing des cbc for 3s on 256 size blocks: 230429 des cbc's in 3.00s
Doing des cbc for 3s on 1024 size blocks: 57739 des cbc's in 3.00s
Doing des cbc for 3s on 8192 size blocks: 7182 des cbc's in 3.00s
Doing des ede3 for 3s on 16 size blocks: 1290350 des ede3's in 3.00s
Doing des ede3 for 3s on 64 size blocks: 326719 des ede3's in 3.00s
Doing des ede3 for 3s on 256 size blocks: 81931 des ede3's in 3.00s
Doing des ede3 for 3s on 1024 size blocks: 20497 des ede3's in 3.00s
Doing des ede3 for 3s on 8192 size blocks: 2557 des ede3's in 3.00s
Doing aes-128 cbc for 3s on 16 size blocks: 5505154 aes-128 cbc's in 3.00s
Doing aes-128 cbc for 3s on 64 size blocks: 1541196 aes-128 cbc's in 3.00s
Doing aes-128 cbc for 3s on 256 size blocks: 401076 aes-128 cbc's in 3.00s
Doing aes-128 cbc for 3s on 1024 size blocks: 101134 aes-128 cbc's in 3.00s
Doing aes-128 cbc for 3s on 8192 size blocks: 12651 aes-128 cbc's in 3.00s
Doing aes-192 cbc for 3s on 16 size blocks: 4841335 aes-192 cbc's in 3.00s
Doing aes-192 cbc for 3s on 64 size blocks: 1379048 aes-192 cbc's in 3.00s
Doing aes-192 cbc for 3s on 256 size blocks: 357027 aes-192 cbc's in 3.00s
Doing aes-192 cbc for 3s on 1024 size blocks: 89881 aes-192 cbc's in 3.00s
Doing aes-192 cbc for 3s on 8192 size blocks: 11233 aes-192 cbc's in 3.00s
Doing aes-256 cbc for 3s on 16 size blocks: 4442265 aes-256 cbc's in 3.00s
Doing aes-256 cbc for 3s on 64 size blocks: 1223365 aes-256 cbc's in 3.00s
Doing aes-256 cbc for 3s on 256 size blocks: 315528 aes-256 cbc's in 3.00s
Doing aes-256 cbc for 3s on 1024 size blocks: 79343 aes-256 cbc's in 3.00s
Doing aes-256 cbc for 3s on 8192 size blocks: 9909 aes-256 cbc's in 3.00s
Doing 2048 bit private rsa's for 10s: 241 2048 bit private RSA's in 10.03s
Doing 2048 bit public rsa's for 10s: 8825 2048 bit public RSA's in 9.98s
Doing 2048 bit sign dsa's for 10s: 881 2048 bit DSA signs in 10.01s
Doing 2048 bit verify dsa's for 10s: 729 2048 bit DSA verify in 10.00s
OpenSSL 1.0.2h  3 May 2016
built on: reproducible build, date unspecified
options:bn(64,32) rc4(ptr,char) des(idx,cisc,2,long) aes(partial) blowfish(ptr) 
compiler: arm-openwrt-linux-muslgnueabi-gcc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -I/home/shara/proj/lede/try9/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl-1.1.15_eabi/usr/include -I/home/shara/proj/lede/try9/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl-1.1.15_eabi/include -I/home/shara/proj/lede/try9/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/usr/include -I/home/shara/proj/lede/try9/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/include/fortify -I/home/shara/proj/lede/try9/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/include -znow -zrelro -DOPENSSL_SMALL_FOOTPRINT -DOPENSSL_NO_ERR -DTERMIOS -Os -pipe -mcpu=cortex-a15 -mfpu=neon-vfpv4 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -iremap /home/shara/proj/lede/try9/build_dir/target-arm_cortex-a15+neon-vfpv4_musl-1.1.15_eabi/openssl-1.0.2h:openssl-1.0.2h -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -I/home/shara/proj/lede/try9/package/libs/openssl/include -ffunction-sections -fdata-sections -fomit-frame-pointer -Wall
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
md5               5987.32k    21479.79k    61176.44k   112720.90k   150781.95k
sha1              4617.95k    13391.51k    28476.07k    39787.86k    44894.89k
des cbc          18908.40k    19458.73k    19663.27k    19708.25k    19611.65k
des ede3          6881.87k     6970.01k     6991.45k     6996.31k     6982.31k
aes-128 cbc      29360.82k    32878.85k    34225.15k    34520.41k    34545.66k
aes-192 cbc      25820.45k    29419.69k    30466.30k    30679.38k    30673.58k
aes-256 cbc      23692.08k    26098.45k    26925.06k    27082.41k    27058.18k
sha256            6235.01k    15646.61k    29534.63k    37734.40k    41192.11k
sha512            1679.61k     6735.51k     9908.48k    13653.33k    15354.54k
                  sign    verify    sign/s verify/s
rsa 2048 bits 0.041618s 0.001131s     24.0    884.3
                  sign    verify    sign/s verify/s
dsa 2048 bits 0.011362s 0.013717s     88.0     72.9
root@lede1:/etc/config# echo "|" `awk 'match($0,/r[0-9]+/) {print substr($0,RSTART,RLENGTH)}' /etc/banner` `awk -v FS=": " -v ORS="" '/(Process
or|BogoMIPS|Hardware|machine|cpu model|system type)/ { print "| " $2 " " } END { print "" }' /proc/cpuinfo` `awk -v ORS="" '$1 ~ /OpenSSL/ {pri
nt "| " $2 " |"} $1 ~ /(md5|sha)/ {print "  " $5 " |"} $1 ~ /(des|aes)/ {b = b "  " $6 " |"} $1 ~ /(rsa|dsa)/ {print b "  " $6 " | " $7 " ";b="
"} END { print "|" }' /tmp/sslspeed | sed 's/\.\(..\)k/\10/g'`
| r1476 | ARMv7 Processor rev 0 (v7l) | 21.87 | ARMv7 Processor rev 0 (v7l) | 45.57 | Qualcomm (Flattened Device Tree) | 1.0.2h | 112720900 | 39787860 | 37734400 | 13653330 | 19708250 | 6996310 | 34520410 | 30679380 | 27082410 | 24.0 | 884.3 88.0 | 72.9 |
root@lede1:/etc/config# echo 

root@lede1:/etc/config# 

root@lede1:/etc/config# cat /etc/openwrt_*
DISTRIB_ID='LEDE'
DISTRIB_RELEASE='HEAD'
DISTRIB_REVISION='r1476+4'
DISTRIB_CODENAME='reboot'
DISTRIB_TARGET='ipq806x/generic'
DISTRIB_DESCRIPTION='LEDE Reboot r1476+4'
DISTRIB_TAINTS='no-all busybox'
r1476+4
root@lede1:/etc/config# 
root@lede1:/etc/config# date
Sun Sep  4 11:17:20 UTC 2016
root@lede1:/etc/config# uname -a
Linux lede1 4.4.19 #0 SMP PREEMPT Wed Aug 31 04:29:51 2016 armv7l GNU/Linux
root@lede1:/etc/config# 

@jmomo on Your router manual change mac in working? Check this PR https://github.com/lede-project/source/pull/131  and use this:
echo  $mymacaddr > /sys/class/ieee80211/phy0/macaddress

if mac is changed then use hotplug script.

Heinz wrote:

@jmomo on Your router manual change mac in working? Check this PR https://github.com/lede-project/source/pull/131  and use this:
echo  $mymacaddr > /sys/class/ieee80211/phy0/macaddress

if mac is changed then use hotplug script.

Heinz, thanks for that link.

Working with sysfs was the first thing I tried a couple of days ago, but I discovered that my changes were not taking when looking at the output of ifconfig, iw dev, and catting the sysfs objects. I wasn't surprised by that because my experience is that many network adapters need their MAC addresses set when the driver loads.

However, this patch, as mentioned in your link above, apparently takes care of it:

package/kernel/mac80211/patches/120-cfg80211_allow_perm_addr_change.patch

Here is what happens when I first tried to change the MACs. You will see the old garbage addresses as the "wlan address" below, and the "macaddress" is the desired/set address:

sysfs phy0 macaddress = d8:eb:97:30:30:05
sysfs phy0 wlan0 address = 00:34:56:78:95:95

sysfs phy1 macaddress = d8:eb:97:30:30:06
sysfs phy1 wlan1 address = 00:03:7f:12:27:27

It turns out this is just because I have the interfaces disabled. As soon as I enable them, they fix up:

uci set wireless.radio0.disabled='0'
uci set wireless.radio1.disabled='0'
uci commit wireless

And now

sysfs phy0 macaddress = d8:eb:97:30:30:05
sysfs phy0 wlan0 address = d8:eb:97:30:30:05

sysfs phy1 macaddress = d8:eb:97:30:30:06
sysfs phy1 wlan1 address = d8:eb:97:30:30:06

Okay I guess it does work.

So now I put this in my target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac file:

        tew827dru)
                echo $(macaddr_add $(mtd_get_mac_ascii APPSBLENV wan_mac) $(($PHYNBR + 1)) ) > /sys${DEVPATH}/macaddress
                ;;


I used the following func to produce some of the output above:

showmacs() {
  echo ""
  . /lib/functions/uci-defaults.sh
  . /lib/ipq806x.sh
  . /lib/functions/system.sh
  echo "uboot lan_mac = $(mtd_get_mac_ascii APPSBLENV lan_mac)"
  echo "uboot wan_mac = $(mtd_get_mac_ascii APPSBLENV wan_mac)"
  echo ""
  echo "sysfs phy0 macaddress = $(cat /sys/devices/platform/soc/1b500000.pci/pci0000:00/0000:00:00.0/0000:01:00.0/ieee80211/phy0/macaddress)"
  echo "sysfs phy0 wlan0 address = $(cat /sys/devices/platform/soc/1b500000.pci/pci0000:00/0000:00:00.0/0000:01:00.0/ieee80211/phy0/device/net/wlan0/address)"
  echo ""
  echo "sysfs phy1 macaddress = $(cat /sys/devices/platform/soc/1b700000.pci/pci0001:00/0001:00:00.0/0001:01:00.0/ieee80211/phy1/macaddress)"
  echo "sysfs phy1 wlan1 address = $(cat /sys/devices/platform/soc/1b700000.pci/pci0001:00/0001:00:00.0/0001:01:00.0/ieee80211/phy1/device/net/wlan1/address)"
  echo ""
  ifconfig -a | egrep HWaddr
  echo ""
}


Now I need to see if I can correctly set the 1000BASE-T MAC addresses in a similar manner. I don't know if the stmmac driver allows that though. So far, sysfs objects are not letting me change them.

Thanks again.

(Last edited by jmomo on 5 Sep 2016, 03:33)

I wondered if any devices out there just set the ethernet MAC address with ifconfig. It turns out they do.

egrep -iHr "hw ether" * 2> /dev/null | vi -

It looks like /lib/preinit is the place to do it.

--

Okay, this works.

Created a new preinit script:

target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac

#!/bin/sh
#
# Copyright (c) 2014 The Linux Foundation. All rights reserved.
#

set_ether_mac() {
        . /lib/functions/uci-defaults.sh
        . /lib/ipq806x.sh
        . /lib/functions/system.sh

        board=$(ipq806x_board_name)

        case "$board" in
        tew827dru)
                # Set the correct ethernet MAC addresses per OEM intent.
                ifconfig eth0 hw ether $(mtd_get_mac_ascii APPSBLENV wan_mac) 2>/dev/null
                ifconfig eth1 hw ether $(mtd_get_mac_ascii APPSBLENV lan_mac) 2>/dev/null
                ;;
        esac

}

boot_hook_add preinit_main set_ether_mac

That works like I expect. The vlan sub-interfaces (eth0.2) are inheriting the correct MAC address now.

(Last edited by jmomo on 5 Sep 2016, 06:46)

My MAC addresses are now all what I expect them to be. This is good.

root@lede2:~# showmacs

uboot lan_mac = d8:eb:97:30:30:03
uboot wan_mac = d8:eb:97:30:30:04

sysfs phy0 macaddress = d8:eb:97:30:30:05
sysfs phy0 wlan0 address = d8:eb:97:30:30:05

sysfs phy1 macaddress = d8:eb:97:30:30:06
sysfs phy1 wlan1 address = d8:eb:97:30:30:06

bond0     Link encap:Ethernet  HWaddr DE:7A:86:0C:FC:65  
br-lan    Link encap:Ethernet  HWaddr D8:EB:97:30:30:03  
eth0      Link encap:Ethernet  HWaddr D8:EB:97:30:30:04  
eth0.2    Link encap:Ethernet  HWaddr D8:EB:97:30:30:04  
eth1      Link encap:Ethernet  HWaddr D8:EB:97:30:30:03  
eth1.1    Link encap:Ethernet  HWaddr D8:EB:97:30:30:03  
ifb0      Link encap:Ethernet  HWaddr 7E:26:A7:81:EB:DA  
ifb1      Link encap:Ethernet  HWaddr 0E:7F:35:30:DB:BF  
wlan0     Link encap:Ethernet  HWaddr D8:EB:97:30:30:05  
wlan1     Link encap:Ethernet  HWaddr D8:EB:97:30:30:06  

As far as I can tell, the "LED on/off" button does nothing on the OEM system. I've pressed it, held it, and yelled at it, but it does nothing.

There is a button script for it at /etc/hotplug.d/button/50-led-on-off, which then calls led_ctrl.sh, which has lots of interesting stuff in it, but nothing helpful. The control systems for the ethernet switch LEDs and the 802.11 LEDs are using proprietary tools.

If I can ever figure these other LEDs out, I'll add a button script for them, but otherwise I'll just leave it alone and end-users can figure out a use for the LED on/off and WPS buttons.

--

EDIT: Our Ethernet LEDs (WAN + LAN1-4) are controlled via the qca8337-al3c chip. There are no GPIOs presented to us to use.

However, the swconfig tool can control these LEDs in other switches. It's just that it does not currently support controlling the LEDs in our switch.

root@lede:/# swconfig dev switch0 help
switch0: gpio-0(Atheros AR8337), ports: 7 (cpu @ 0), vlans: 128
     --switch
        Attribute 1 (int): enable_vlan (Enable VLAN mode)
        Attribute 2 (none): reset_mibs (Reset all MIB counters)
        Attribute 3 (int): enable_mirror_rx (Enable mirroring of RX packets)
        Attribute 4 (int): enable_mirror_tx (Enable mirroring of TX packets)
        Attribute 5 (int): mirror_monitor_port (Mirror monitor port)
        Attribute 6 (int): mirror_source_port (Mirror source port)
        Attribute 7 (int): arl_age_time (ARL age time (secs))
        Attribute 8 (string): arl_table (Get ARL table)
        Attribute 9 (none): flush_arl_table (Flush ARL table)
        Attribute 10 (int): igmp_snooping (Enable IGMP Snooping)
        Attribute 11 (int): igmp_v3 (Enable IGMPv3 support)
        Attribute 12 (none): apply (Activate changes in the hardware)
        Attribute 13 (none): reset (Reset the switch)
     --vlan
        Attribute 1 (int): vid (VLAN ID (0-4094))
        Attribute 2 (ports): ports (VLAN port mapping)
     --port
        Attribute 1 (none): reset_mib (Reset single port MIB counters)
        Attribute 2 (string): mib (Get port's MIB counters)
        Attribute 3 (int): enable_eee (Enable EEE PHY sleep mode)
        Attribute 4 (none): flush_arl_table (Flush port's ARL table entries)
        Attribute 5 (int): igmp_snooping (Enable port's IGMP Snooping)
        Attribute 6 (int): pvid (Primary VLAN ID)
        Attribute 7 (unknown): link (Get port link information)

Related links:
https://wiki.openwrt.org/doc/techref/swconfig
http://blog.cerowrt.org/post/need_no_st … kenlights/
https://forum.openwrt.org/viewtopic.php?id=48317

(Last edited by jmomo on 15 Sep 2016, 01:56)