Adding support for VRX518 (and maybe VRX320)

There is a stable announced on the device page. Does it support the dsl modem?

Hi Daniel and @blogic!

Can we support here with donations?
Is there any hardware you could buy, that makes this reverse engineering easier for you?

Cheers, David

The problem for me is lack of HW and DSL line to test against.
adding the MSI stubs should be a 10 line patch, problem is how to debug it if it does not work and no DSL line is easily accessable.

No DSL line is obviously problematic. But at least in terms of required hardware maybe the community could help out?

I did some tests and I think that the MSI part should already work (more or less).
In fact using a regular VDSL2 line it syncs correctly but can't send or receive packets.

@blogic if you tell me where I should look at or send me an example I could try to investigate.

I recently bought an used Planet VC-231G (https://www.planet.com.tw/en/product/vc-231g) to test the vdsl line quicker. I think that we can collect some money to donate another one to you or something similar so that you can test it (@DavidDohmen what do you think?).

I rebased the @sch-m tree (https://github.com/3headeddevs/openwrt/commits/vrx518_support) on top of current master and quickly fixed some errors due to the different kernel (https://github.com/DavideFioravanti/openwrt/tree/vrx518_support_rebase_master)

This is what I get.

If I don't connect the DSL cable I have these interrupts:

100:         38          0          0          0   PCI-MSI 524289 Edge      mei_cpe
101:          0          0          0          0   PCI-MSI 524290 Edge      aca-txo
102:          0          0          0          0   PCI-MSI 524291 Edge      aca-rxo

I don't know how the modem works internally but the interrupts mei_cpe seems to be the related to the analog line (detect, sync, transmit, etc.) and it increases the counter every second without the DSL cable connected.

If I connect the DSL cable, after some seconds a new interrupts (PTM SL) appear and I get these messages:

[   87.584321] plat_tc_request: dsl id: 0, mode: 1, tc_mode: 3, tc_idx: -1
[   87.599566] plat_get_mib is not supported
[   87.600940] vrx518_tc:ptm_tc_hw_fw_init: id(Line)		= 0
[   87.602907] vrx518_tc:ptm_tc_hw_fw_init: irq			= 99
[   87.607729] vrx518_tc:ptm_tc_hw_fw_init: membase		= 0xd1480000
[   87.612544] vrx518_tc:ptm_tc_hw_fw_init: phy_membase		= 0x40800000
[   87.618411] vrx518_tc:ptm_tc_hw_fw_init: peer_num		= 0
[   87.624654] vrx518_tc:ptm_tc_hw_fw_init: tc_mode		= PTM Single Line
[   87.649426] vrx518_tc:is_ptm_sl: is_ptm_sl: SINGLE
[   87.649468] vrx518_tc:is_ptm_sl: is_ptm_sl: SINGLE
[   87.653497] vrx518_tc:is_ptm_sl: is_ptm_sl: SINGLE
[   87.657888] ppe_aca_cfg_cnt: priv->ep_id[0] bond[0]
[   87.662685] ppe_aca_cfg_cnt: 0 0 0 0
[   87.667431] ppe_aca_cfg_cnt: cfg->txin.soc_cnt_phyaddr[0]
[   87.671279] ppe_aca_cfg_cnt: cfg->txout.soc_cnt_phyaddr[0]
[   87.676548] ppe_aca_cfg_cnt: cfg->rxout.soc_cnt_phyaddr[0]
[   87.681953] ppe_aca_cfg_cnt: cfg->rxin.soc_cnt_phyaddr[0]
[   87.687404] Loading PTM FW ver: 3.5.72
[   87.713935] vrx518_tc:ptm_tc_hw_fw_init: PTM TC init successfully
[   87.713976] id: 0, txin(0x8e8f7000: 128, 0x8e7149c0), txout(0x8e8f7800: 128, 0x8e714a00), rxin(0x8e720000: 1024, 0x8e714a40), rxout(0x8e724000: 1024, 0x8e714a80)
[   87.719024] vrx518_tc:ptm_aca_init: txin: bswp: 1, hdsz:4, pd: dbase(0x2801c0), dnum(64), sz_indw(2), soc_dbase:0x8e8f7000, soc_dnum:0x80, soc cnt addr: 0x40b21480
[   87.733467] vrx518_tc:ptm_aca_init: txout: bswp: 1, hdsz:4, pd: dbase(0x230000), dnum(64), sz_indw(2), soc_dbase:0x8e8f7800, soc_dnum:0x80, soc cnt addr: 0x40b21484
[   87.747874] vrx518_tc:ptm_aca_init: rxout: bswp: 1, hdsz:4, pd: dbase(0x230200), dnum(255), sz_indw(2), soc_dbase:0x8e724000, soc_dnum:0x400, soc cnt addr: 0x40b21488
[   87.762804] vrx518_tc:ptm_aca_init: rxin: bswp: 1, hdsz:4, pd: dbase(0x2855c0), dnum(255), sz_indw(2), soc_dbase:0x8e720000, soc_dnum:0x400, soc cnt addr: 0x40b2148c
[   87.777467] vrx518_tc:ptm_aca_init: txout: (stat:0x40b6b7d0, pd: 0x40b6b7d4, cnt: 0x40b6b7cc)
[   87.792295] vrx518_tc:ptm_aca_init: rxout: (stat:0x40b6b7e8, pd: 0x40b6b7ec, cnt: 0x40b6b7e4)
[   87.800781] vrx518_tc:ptm_aca_init: rxin: (stat:0x40b6b7dc, pd: 0x40b6b7e0, cnt: 0x40b6b7d8)
[   87.809494] vrx518 0000:01:00.0: ACA fw build 0 branch 4 major 0x20 minor 0x0016
[   87.817853] vrx518 0000:01:00.0: ACA fw for vrx518 supported SoC type xrx500 
[   87.826635] vrx518 0000:01:00.0: aca init done
[   87.832238] vrx518_tc:is_ptm_sl: is_ptm_sl: SINGLE
[   87.836599] Sent TC multicast message Fail!
[   87.841343] vrx518_tc:ptm_tc_load: PTM TC is successfully loaded
[   88.091797] vrx518_tc:is_ptm_sl: is_ptm_sl: SINGLE
[   88.092095] vrx518_tc:ptm_erb_addr_get: idx: 0, data addr: 0x40a30000,  desc_addr: 0x40b60000

 99:          0          0          0          0   PCI-MSI 524288 Edge      PTM SL
100:         99          0          0          0   PCI-MSI 524289 Edge      mei_cpe
101:          0          0          0          0   PCI-MSI 524290 Edge      aca-txo
102:          0          0          0          0   PCI-MSI 524291 Edge      aca-rxo

After some more seconds it syncs correctly

[  108.805317] vrx518_tc:ptm_showtime_enter: Line[0]: show time enter!!
[  108.805735] vrx518_tc:is_ptm_sl: is_ptm_sl: SINGLE
root@OpenWrt:/# ubus call dsl metrics
{
	"api_version": "4.21.3",
	"firmware_version": "8.12.1.7.1.7",
	"chipset": "Lantiq-VRX500",
	"driver_version": "1.9.3",
	"state": "Showtime with TC-Layer sync",
	"up": true,
	"uptime": 5,
	"atu_c": {
		
	},
	"power_state": "L0 - Synchronized",
	"xtse": [
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		2
	],
	"annex": "B",
	"standard": "G.993.2",
	"profile": "35b",
	"mode": "G.993.2 (VDSL2, Profile 35b)",
	"upstream": {
		"vector": false,
		"trellis": true,
		"bitswap": false,
		"retx": true,
		"virtual_noise": false,
		"interleave_delay": 0,
		"data_rate": 17310000,
		"latn": 9.200000,
		"satn": 9.200000,
		"snr": 8.900000,
		"actps": -90.100000,
		"actatp": -21.100000,
		"attndr": 20852000
	},
	"downstream": {
		"vector": false,
		"trellis": true,
		"bitswap": false,
		"retx": true,
		"virtual_noise": false,
		"interleave_delay": 90,
		"data_rate": 75238000,
		"latn": 12.700000,
		"satn": 12.400000,
		"snr": 9.500000,
		"actps": -90.100000,
		"actatp": 14.500000,
		"attndr": 88853288
	},
	"errors": {
		"near": {
			"es": 0,
			"ses": 0,
			"loss": 0,
			"uas": 74,
			"lofs": 0,
			"fecs": 0,
			"hec": 0,
			"ibe": 0,
			"crc_p": 0,
			"crcp_p": 0,
			"cv_p": 0,
			"cvp_p": 0
		},
		"far": {
			"es": 90,
			"ses": 53,
			"loss": 0,
			"uas": 74,
			"lofs": 0,
			"fecs": 1593551,
			"hec": 0,
			"ibe": 0,
			"crc_p": 0,
			"crcp_p": 0,
			"cv_p": 0,
			"cvp_p": 0
		}
	}
}

After this event the PTM SL increases to 1 (I think should be the interrupt which fires for every sync) and the mei_cpe starts increasing rapidly:

 99:          1          0          0          0   PCI-MSI 524288 Edge      PTM SL
100:      10094          0          0          0   PCI-MSI 524289 Edge      mei_cpe
101:          0          0          0          0   PCI-MSI 524290 Edge      aca-txo
102:          0          0          0          0   PCI-MSI 524291 Edge      aca-rxo

If I set a PPPoE connection the router tries to send packets and I get these messages for every packet sent but nothing else happens (aca-txo and aca-rxo still says 0):

[  575.887682] vrx518_tc:ptm_open: ptm open
[  575.888341] plat_get_mib is not supported
[  575.892757] plat_get_mib is not supported
[  575.921202] vaddr: 0xcdbdd80e, phyaddr: 0x8dbdd80e
[  575.921255] txin idx: 0
[  575.924930] descriptor dst val:(DW0-DW3): 0x0, 0x0, 0x8d8bd8d, 0x720000f3
[  575.927278] descriptor src val: (DW0-DW3): 0x0, 0x0, 0x8dbdd808, 0xf3000072
[  575.934275] vaddr: 0xce8f7000, phyaddr: 0x8e8f7000
[  575.940969] TXIN send txin packet 1 packet
[  575.945969] vaddr: 0xcdbdd802, phyaddr: 0x8dbdd802
[  575.949912] txin idx: 1
[  575.954739] descriptor dst val:(DW0-DW3): 0x0, 0x0, 0xd8bd8d, 0x6e0000f1
[  575.957035] descriptor src val: (DW0-DW3): 0x0, 0x0, 0x8dbdd800, 0xf100006e
[  575.964034] vaddr: 0xce8f7010, phyaddr: 0x8e8f7010
[  575.970649] TXIN send txin packet 1 packet
[  576.191271] vaddr: 0xcda7ba0a, phyaddr: 0x8da7ba0a

I tried using the Planet VC-231G but when I connect the modem to this device I get "power_state": "L3 - No power" or Exception and after sometime it can't sync anymore even using the regular VDSL line.
Using the stock firmware or another router with the old VRX268 and Openwrt it can sync correctly.

2 Likes

Amazing progress!
Good to see people more knowledgable than myself are working on this!
Just checked out the Planet VC-231G. Seems like it's around 100€ and I'm sure there are enough people in here happy to donate a bit. I'd chip in 30€ as a start.
@blogic do you live in Europe or the US or somewhere else? Would you be interested in something like this? Do you have a Patreon / Github (Sponsors) Account?

@hauke wanna chip in ? MSI appears working. could you possible ask/find out how the packet pipeline is driven ?

I would donate 30€ too! :slight_smile: We are already near the goal :smiley:

the netgear d7800 gpl drop has a package in it called
ltq_vrx320_datapath_drv/
this appears to be what we are missing

Hmm... I've selected the CPU datapath, because the original lantiq/intel Makefile says:
"Select CPU path. No dependency on any other library/function except linux kernel
and works on any platform."

So I thought we don't need any further datapath drivers etc.

looks like we do and d7800 has the src in it

For the VRX320 sure, but for the VRX518? In my tests I was already able to send frames out and saw them behind the DSLAM (in PTM mode). Only the rx path was/is not working.

Small update about the Planet VC-231G.
Using a newer version of the vdsl firmware (8.13.1.10.1.7) extracted from the latest AVM 7530 firmware it syncs correctly with the Planet VC-231G.
image

@numero53 FYI: I've updated my patches to the latest openwrt master.

For my tests in the past I also used the extracted firmware from the official AVM 7530 image (aca, ppe and vdsl annex b).

Thank you, I will continue my tests using your branch. :slight_smile:

However there is a small problem when I use ubus call dsl metrics because it won't find the path /dev/dsl_cpe_api/0

I don't know if it should be fixed here with something like:
fd = open(DSL_CPE_DEVICE_NAME "/0", O_RDWR, 0644);

or adding the following patch here:

--- a/src/dsl_cpe_control.h
+++ b/src/dsl_cpe_control.h
@@ -153,7 +153,7 @@
 #define MAX_WHAT_STRING_LEN   64
 #define WHAT_STRING_CHUNK_LEN  (64*1024)
 
-#define DSL_CPE_DEVICE_NAME         "/dev/dsl_cpe_api"
+#define DSL_CPE_DEVICE_NAME         "/dev/dsl_cpe_api/"
 #define DSL_CPE_PREFIX              "DSL_CPE: "
 #define DSL_CPE_SCRIPT_PREFIX       "DSL_CPE_SCRIPT: "
 

Ah, ok I see. There was added a / in the newer versions of dsl_cpe_api and dsl_cpe_control.
I'll add a patch to handle this in the ubus part like you suggested.

Already done.

2 Likes

Thank you :slight_smile:

2 Likes

@sch-m Do you remember how did you manage to send packets?
I can't receive/send anything

I tried enabling the interrupt as you said https://github.com/3headeddevs/openwrt/commit/5b080a93079af4161f65ab9544601eda5b53c620#diff-62fa99147cdad8c2b7cc7cabb46c14c63f745e570ffa0e16301a413afbe5cd08R497
but exactly as you said, the DSL synchronization breaks off.

However commenting this line: https://gitlab.com/prpl-foundation/intel/vrx518_tc_drv/-/blob/vrx518_tc_drv-19.07/dcdp/platform/sw_plat.c#L759 the DSL sync doesn't break anymore.
The aca-rxo counter bacame 1 when I send a packet from my pc to the DSL line but after that event that interrupt won't fire anymore.

I used the pppoe-discovery tool on the ptm0 interface to send some PADI frames.