Support for D-Link DIR842 (Rev C3)

I understand your point in viewing separate images as bloat, but i personally prefer having different images for each sub-sub-revision here.

D-Link is known to not be the most consistent player in the (sub-)revision game and the digit can refer to hardware changes (different components) as well as software changes (different partition layout). I think the advantage of creating images for each distinct revision, that might save a User from a brick if a C4 with different partition layout appears, outweighs the cost of 2-4 additional 4M large images.

2 Likes

I agree with your point
Dlink likes to release revisions specific to some small markets, it is hard track all of the revisions and make sure all of the C revisions uses the same hardware

i'm with @blocktrron on this one... if, in 12 months the devices still are identical, then it's alot easier to squash 3 into 1 than it is to split 1 into 3.....

in the meantime, there are three clear differentiated devices to alter.... if and when specific differences come to light....

make note of this in your git commit... and keep a running table of the differences....

this will pay dividends should future sysupgrade/model specific differences become known....

with the usb, unless space is an issue... the physical driver section i'd be happy to see on all devices ... perhaps a brief comment in the dts... about models without the physical port present.

Update: Meanwhile I grabbed my DIR-842 Rev. B1 and it turns out this one is also based on Realtek, basically the South Africa version of A1.

So only revisions C will be relevant for us.

By the way, has anyone checked the format of the latest firmware available from D-Link? It's basically a high entropy file with no signs of any header or even legible strings.
When upgrading from older revisions, you are supposed to flash an intermediate firmware (in SEAMA format) first, and then flash the latest one from there.

I hope D-Link are not trying to ban alternative firmware anytime soon, has anyone tried downgrading from the latest stock version to an older stock version or OpenWRT?
Otherwise only the recovery might be left for downgrading newer devices, as long as they don't consider starting to ship new routers with an updated version of uboot...

new Dlink firmwares are encrypted, more information here:
https://pierrekim.github.io/blog/2017-09-08-dlink-850l-mydlink-cloud-0days-vulnerabilities.html

we just need to figure out your your devices's signature

2 Likes

The PR to add support for C3 is https://github.com/openwrt/openwrt/pull/2307

I have just installed OpenWRT SNAPSHOT, r10899-1c0290c5cc on a D-Link DIR-842 (C3).
Flashing directly from the factory web UI doesn't works. I used the U-Boot safemode method described there.

First observations:

  • Wifi LED always off
  • Poor forwarding performance: 300Mbps with NAT, 400Mbps without NAT. (with factory firmware: ~1Gbps)
  • 5GHz card not recognized

Edit:
Probably related to broken 5GHz:

root@OpenWrt:~# logread | grep err
Fri Aug 30 18:45:54 2019 kern.err kernel: [    0.518856] ag71xx 19000000.eth: invalid MAC address, using random address
Fri Aug 30 18:45:54 2019 kern.err kernel: [   12.375307] firmware ath10k!fwcfg-pci-0000:00:00.0.txt: firmware_loading_store: map pages failed
Fri Aug 30 18:45:54 2019 kern.err kernel: [   12.881070] firmware ath10k!QCA9888!hw2.0!ct-firmware-5.bin: firmware_loading_store: map pages failed
Fri Aug 30 18:45:54 2019 kern.err kernel: [   13.073967] firmware ath10k!QCA9888!hw2.0!ct-firmware-2.bin: firmware_loading_store: map pages failed
Fri Aug 30 18:45:54 2019 kern.err kernel: [   13.261293] firmware ath10k!QCA9888!hw2.0!firmware-6.bin: firmware_loading_store: map pages failed
Fri Aug 30 18:45:54 2019 kern.err kernel: [   14.458473] ath10k_pci 0000:00:00.0: failed to fetch board data for bus=pci,bmi-chip-id=0,bmi-board-id=31 from ath10k/QCA9888/hw2.0/board-2.bin
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.538052] ath10k_pci 0000:00:00.0: firmware crashed! (guid f93439d5-a6eb-44fc-933f-1ff5053aca01)
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.626751] ath10k_pci 0000:00:00.0: firmware register dump:
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.632594] ath10k_pci 0000:00:00.0: [00]: 0x0000000C 0x000015B3 0x0A01CC48 0x00975B31
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.640778] ath10k_pci 0000:00:00.0: [04]: 0x0A01CC48 0x00060B30 0x0000000E 0x57D938D8
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.648960] ath10k_pci 0000:00:00.0: [08]: 0x00000000 0x000C0B78 0x0000096C 0x00000028
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.657146] ath10k_pci 0000:00:00.0: [12]: 0x00000009 0x00000000 0x009C7804 0x009C7859
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.665338] ath10k_pci 0000:00:00.0: [16]: 0x0A01CC48 0x000CB93C 0x00000000 0x00000000
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.673514] ath10k_pci 0000:00:00.0: [20]: 0x409C75E8 0x0040586C 0x00000001 0xFFFFFFFF
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.681695] ath10k_pci 0000:00:00.0: [24]: 0x809B5A28 0x004058CC 0x00000000 0xC09C75E8
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.689872] ath10k_pci 0000:00:00.0: [28]: 0x809C790A 0x0040590C 0x0000096C 0x000C0B92
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.698056] ath10k_pci 0000:00:00.0: [32]: 0x809B5AD6 0x0040593C 0x0000096C 0x0041A7A8
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.706245] ath10k_pci 0000:00:00.0: [36]: 0x800D1DEF 0x00405A5C 0x0041A47C 0x0041A7A8
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.714416] ath10k_pci 0000:00:00.0: [40]: 0x809C7BD7 0x00405A8C 0x0041A47C 0x0041A7A8
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.722599] ath10k_pci 0000:00:00.0: [44]: 0x809B5B00 0x00405AAC 0x0041A47C 0x0041A7A8
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.730788] ath10k_pci 0000:00:00.0: [48]: 0x809C80AE 0x00405AEC 0x0041A47C 0x0041A7A8
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.738973] ath10k_pci 0000:00:00.0: [52]: 0x809B5B67 0x00405B1C 0x0041A47C 0x0000003F
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.747157] ath10k_pci 0000:00:00.0: [56]: 0x800CB947 0x00405B6C 0x0041A47C 0x0000003F
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.755344] ath10k_pci 0000:00:00.0: Copy Engine register dump:
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.761462] ath10k_pci 0000:00:00.0: [00]: 0x0004a000   5   5   3   3
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.768130] ath10k_pci 0000:00:00.0: [01]: 0x0004a400   4   4  14  15
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.774784] ath10k_pci 0000:00:00.0: [02]: 0x0004a800   1   1   0   1
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.781453] ath10k_pci 0000:00:00.0: [03]: 0x0004ac00   2   2   5   2
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.788115] ath10k_pci 0000:00:00.0: [04]: 0x0004b000   0   0  40   0
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.794774] ath10k_pci 0000:00:00.0: [05]: 0x0004b400   0   0   0   0
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.801442] ath10k_pci 0000:00:00.0: [06]: 0x0004b800   0   0   0   0
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.808104] ath10k_pci 0000:00:00.0: [07]: 0x0004bc00   1   1   1   1
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.814763] ath10k_pci 0000:00:00.0: [08]: 0x0004c000   0   0 127   0
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.821432] ath10k_pci 0000:00:00.0: [09]: 0x0004c400   0   0   0   0
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.828094] ath10k_pci 0000:00:00.0: [10]: 0x0004c800   0   0   0   0
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.834753] ath10k_pci 0000:00:00.0: [11]: 0x0004cc00   0   0   0   0
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.862887] ath10k_pci 0000:00:00.0: ath10k_pci ATH10K_DBG_BUFFER:
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.869281] ath10k: [0000]: 64110000 0700FC13 70200060 10000000 30000000 01004E00 6A110000 0100FC17
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.878626] ath10k: [0008]: 48CC010A B3150000 B3150000 5C574000 69451091
Fri Aug 30 18:45:54 2019 kern.err kernel: [   16.885549] ath10k_pci 0000:00:00.0: ATH10K_END
Fri Aug 30 18:45:54 2019 kern.err kernel: [   21.544849] ath10k_pci 0000:00:00.0: wmi unified ready event not received
Fri Aug 30 18:45:54 2019 kern.err kernel: [   21.637723] ath10k_pci 0000:00:00.0: could not init core (-145)
Fri Aug 30 18:45:54 2019 kern.err kernel: [   21.644101] ath10k_pci 0000:00:00.0: could not probe fw (-145)
Fri Aug 30 18:45:54 2019 kern.warn kernel: [   21.693932] ath9k 18100000.wmac: Direct firmware load for ath9k-eeprom-ahb-18100000.wmac.bin failed with error -2

To reinstall D-Link firmware: reuse the U-Boot safemod method, but upload C1 D-Link firmware. C3 are refused...

Yes, because mine work perfectly.I haven't tested performances but Wifi 5Ghz is working.

1 Like

The Nat performance is related to the software offload not working in kernel 4.19, we need to wait for Linux to fix it.

But I have no idea about the 5G wifi problem, but you are not the only one.

It seems like the driver crashed when loading.

and share the result of

hexdump -C /dev/mtd9

?
thanks!

It seems I'm lucky today. I managed to have a working 5GHz:

  • Download /lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin from the router
  • Use ath10k-bdencoder script to extract the files with ./ath10k-bdencoder -e board-2.bin
  • Edit board-2.json file to add "bus=pci,bmi-chip-id=0,bmi-board-id=31". I randomly choose to put it in bmi-board-id=25 section.
    {
        "data": "bus=pci,bmi-chip-id=0,bmi-board-id=25.bin",
        "names": [
            "bus=pci,bmi-chip-id=0,bmi-board-id=25",
            "bus=pci,bmi-chip-id=0,bmi-board-id=31"
        ]
    },
  • Re-create a new board-2.bin with ./ath10k-bdencoder -c board-2.json
  • Upload the new board-2.bin to the router, replacing the old one.
  • Reboot the router

I'm absolutely no sure if it's the good/clean way to fix this issue, but it works for me.

3 Likes
root@OpenWrt:~# hexdump -C /dev/mtd9
00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00001000  02 02 02 03 8f 00 04 58  00 00 00 00 00 00 00 00  |.......X........|
00001010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 1f 00  |................|
00001020  33 02 00 00 00 00 04 00  48 00 7d 00 03 00 08 ff  |3.......H.}.....|
00001030  11 76 c1 3e 63 20 02 20  00 11 11 01 00 50 01 50  |.v.>c . .....P.P|
00001040  01 50 01 00 00 00 00 00  00 12 00 00 00 00 00 00  |.P..............|
00001050  ff 00 00 02 04 02 06 06  06 00 00 00 00 00 00 00  |................|
00001060  0e 0e 03 00 2c e2 00 02  0e 1c f0 f0 f0 00 f0 f0  |....,...........|
00001070  f0 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00001080  00 00 00 00 00 00 00 00  00 00 70 8e ac e2 00 b6  |..........p.....|
00001090  00 00 00 e6 00 b5 00 00  00 e4 00 b5 00 00 00 ea  |................|
000010a0  00 b3 00 00 00 ea 00 b2  00 00 00 e9 00 b2 00 00  |................|
000010b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000010c0  00 00 00 70 ac 70 89 ac  70 89 ac 70 89 ac 2a 2a  |...p.p..p..p..**|
000010d0  2a 2a 2a 2a 2a 2a 28 24  22 1e 28 24 22 1e 28 24  |******($".($".($|
000010e0  22 1e 28 28 26 24 22 1e  26 24 22 1e 26 24 22 1e  |".((&$".&$".&$".|
000010f0  28 28 26 24 22 1e 26 24  22 1e 26 24 22 1e 28 28  |((&$".&$".&$".((|
00001100  26 24 22 1e 26 24 22 1e  26 24 22 1e 26 26 24 22  |&$".&$".&$".&&$"|
00001110  20 1e 24 22 20 1e 24 22  20 1e 26 26 24 22 20 1e  | .$" .$" .&&$" .|
00001120  24 22 20 1e 24 22 20 1e  26 26 24 22 20 1e 24 22  |$" .$" .&&$" .$"|
00001130  20 1e 24 22 20 1e 11 12  15 17 41 42 45 47 31 32  | .$" .....ABEG12|
00001140  35 37 70 75 a2 b8 70 75  a2 b8 70 75 a2 b8 7a 84  |57pu..pu..pu..z.|
00001150  98 b8 70 75 ac b8 70 75  ac b8 70 75 ac b8 70 75  |..pu..pu..pu..pu|
00001160  ac b8 70 75 ac b8 70 75  ac b8 70 75 ac b8 70 75  |..pu..pu..pu..pu|
00001170  ac b8 1e 6a 1e 5e 1e 7c  1e 5e 1e 7c 1e 5e 1e 7c  |...j.^.|.^.|.^.||
00001180  1e 5e 3c 7c 3c 7c 3c 7c  3c 7c 3c 7c 3c 7c 3c 7c  |.^<|<|<|<|<|<|<||
00001190  3c 7c 1e 5e 1e 5e 1e 5e  1e 5e 1e 5e 1e 5e 1e 5e  |<|.^.^.^.^.^.^.^|
000011a0  1e 5e 10 01 00 00 22 22  02 00 00 00 00 00 00 00  |.^....""........|
000011b0  00 00 00 00 00 00 44 00  00 00 00 00 00 ff 00 00  |......D.........|
000011c0  00 00 00 00 00 00 00 00  00 00 00 00 00 0e 0e 03  |................|
000011d0  00 2d e2 00 02 0e 1c e0  e0 f0 0c e0 e0 f0 6c 00  |.-............l.|
000011e0  00 00 00 00 00 00 00 00  00 12 00 00 00 00 00 00  |................|
000011f0  00 00 00 00 00 00 00 4c  54 68 78 8c a0 b9 cd 00  |.......LThx.....|
00001200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001280  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 4c  |...............L|
00001290  54 68 78 8c a0 b9 cd 4c  58 68 8c b4 bd b9 cd 4c  |Thx....LXh.....L|
000012a0  58 68 8c b4 bd b9 cd 14  14 14 0a 14 14 14 0a 14  |Xh..............|
000012b0  14 14 0a 14 14 14 0a 14  14 14 0a 14 14 14 0a 14  |................|
000012c0  14 14 0a 14 14 14 0a 14  14 0a 0a 00 00 0a 0a 00  |................|
000012d0  00 0a 0a 00 00 14 14 0a  0a 00 00 0a 0a 00 00 0a  |................|
000012e0  0a 00 00 14 14 0a 0a 00  00 0a 0a 00 00 0a 0a 00  |................|
000012f0  00 14 14 0a 0a 00 00 0a  0a 00 00 0a 0a 00 00 14  |................|
00001300  14 0a 0a 00 00 0a 0a 00  00 0a 0a 00 00 14 14 0a  |................|
00001310  0a 00 00 0a 0a 00 00 0a  0a 00 00 14 14 0a 0a 00  |................|
00001320  00 0a 0a 00 00 0a 0a 00  00 14 14 0a 0a 00 00 0a  |................|
00001330  0a 00 00 0a 0a 00 00 14  14 0a 0a 00 00 0a 0a 00  |................|
00001340  00 0a 0a 00 00 14 14 0a  0a 00 00 0a 0a 00 00 0a  |................|
00001350  0a 00 00 14 14 0a 0a 00  00 0a 0a 00 00 0a 0a 00  |................|
00001360  00 14 14 0a 0a 00 00 0a  0a 00 00 0a 0a 00 00 14  |................|
00001370  14 0a 0a 00 00 0a 0a 00  00 0a 0a 00 00 14 14 0a  |................|
00001380  0a 00 00 0a 0a 00 00 0a  0a 00 00 14 14 0a 0a 00  |................|
00001390  00 0a 0a 00 00 0a 0a 00  00 14 14 0a 0a 00 00 0a  |................|
000013a0  0a 00 00 0a 0a 00 00 10  16 18 40 46 48 30 36 38  |..........@FH068|
000013b0  4c 54 68 78 8c a0 b9 cd  4c 54 68 78 8c a0 b9 cd  |LThx....LThx....|
*
000013f0  4c 54 68 78 8c a0 b9 cd  3c 7c 3c 7c 3c 7c 3c 7c  |LThx....<|<|<|<||
00001400  3c 7c 3c 7c 3c 7c 3c 7c  3c 7c 3c 7c 3c 7c 3c 7c  |<|<|<|<|<|<|<|<||
*
00001440  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00010000

I'm now with a working 5GHz as explained before. If you want this hexdump from a broken state, tell me.

Thanks for the reply!

Is this the full result?

there is no line after
00001440 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
?

Yes, this is the full result !

This sounds like a corrupted ART partition for me, the 5g wifi calibration data should start at 0x5000, but in your case the calibration data is filled with 0xff

can you flash back to stock firmware to make sure 5G wifi still works?

I'm back to D-Link firmware, and 5GHz is working...

hmmm this is weird....

Can you make sure the 5G wifi range and speed in D-Link firmware are normal also?

if range and speed are normal, the only conclusion I can have is D-Link changed the location of the calibration data.

Wifi range and speed seems ok. Nothing obvious at least.

I also had the issue regarding 5GHz driver and the workaround using ath10k-bencoder on board-2.bin work for me too.

Let me know if I can provide more information.

You can configure the wifi led like this:

system.@led[1]=led
system.@led[1].sysfs='dir-842-c3:green:wlan'
system.@led[1].default='0'
system.@led[1].trigger='phy1radio'
system.@led[1].name='WLAN