Simple tool to query lantiq modem statistics and diagnostics, useful for modem-routers running OpenWrt's dsl_cmd

Dear all,

due to stability issues on my own link I have cobbled together a quick and dirty project to extract and display statistics and diagnostic data from my Lantiq-VRX200 modem (BT homeHub 5A, currently running OpenWrt 19.07.0). Since I would have preferred not having to do this and since, even in its rudimentary and coarse state, it might be useful to others (if only as documentation about the how to do this conceptually and how not-to-do this implementation-wise) I just put up a project on github:
The values this currently offers is twofold, a) it collects and stores the DSL data and b) it plots out a few select variables, notable the SNR, bitloading, H(log) and QuietLineNoise (QLN) over the frequency bins, all plots helpful in diagnosing issues like RF noise/interference. But besides data collection and plotting it does not do any analysis.
Final caveat, the code itself will only run under octave/matlab and expects that one already configured passwordless ssh access between the host running the code and the modem. I tested this under linux and macos, but am not sure whether it will work under windows at all.

Feel free to test and report back any issues you encounter. I will not promise any quick changes or implementation of feature requests, but I will look at any issues discovered (as far as my limited time allows). ATM this has only been tested with my own VDSL2 link (ITU G99.3.5 AnnexB, VDSL2 Vectoring).

EDIT: I now figured out how to get access to ITU G998.4 G.INP/ReTx Retransmission counters (in the example shown as a retrofit for 19.07.1, but it should be simple to do the same for other versions or to build a full firmware with the required modification):

Quick and dirty instructions how to build ReTX aware components to retrofit an existing modem build to be able to query ReTx counters

First clone a new openwrt repository (or use your old one, but in that case )

  1. Install a working build system (see
  2. git clone
  3. cd ./openwrt
  4. []( prepare the desired version):
./scripts/feeds update -a
git fetch --tags
git tag -l
git checkout v19.07.1
  1. Edit the relevant Makefiles (openwrt/package/kernel/lantiq/ltq-vdsl/Makefile , and openwrt/package/network/config/ltq-vdsl-app/Makefile) by adding:
        --enable-dsl-pm-retx-counters \

to the makefile section containing the other CONFIGURE_ARGS.
6. Opyionally copy the config.buildinfo file from the selected reference version to openwrt/.config : for the lantiq target and version 19.07.1
7. Run make menuconfig and edit as desired (in my case I dropped all other target devices than the lantiq_xrx200_DEVICE_bt_homehub-v5a)
8. Build the whole thing: make -sc or just the selexted relevant packages:

make package/kernel/lantiq/ltq-vdsl/{clean,compile,install} V=s
make package/network/config/ltq-vdsl-app/{clean,compile,install} V=s
  1. Get the build packages and extract the relevant files (IIRC drv_dsl_cpe_api.ko, and vdsl_cpe_control ) and move them over to the lantiq device and reboot
  2. On the lantiq device test with:
. /lib/functions/ ; dsl_cmd rtsg 0
. /lib/functions/ ; dsl_cmd rtsg 1

root@BTHH5A:~# . /lib/functions/ ; dsl_cmd rtsg 0
nReturn=0 nDirection=0 nRxCorruptedTotal=629 nRxUncorrectedProtected=0 nRxRetransmitted=0 nRxCorrected=629 nTxRetransmitted=744
root@ BTHH5A:~# . /lib/functions/ ; dsl_cmd rtsg 1
nReturn=0 nDirection=1 nRxCorruptedTotal=7115618 nRxUncorrectedProtected=6171968 nRxRetransmitted=0 nRxCorrected=943650 nTxRetransmitted=9229569

This might also be applicable to ADSL and the matching lantiq ADSL packages, but since I can not test that I refrained from even trying.


@mpa thanks for the clean up, :wink:

Now that you mentioned it, I actually wrote a bash script a while back to query dsl lucistat and feed the output to collectd so it can be pulled and graphed later with any front-end. But I didn't have the time to test it more.

That sounds like an excellent project. I have not yet gotten around to implement displaying stats over time at all but for stability tracking that seems quite helpful, especially if it can be easily displayed on the router itself. If you are looking for testers I happily volunteer :wink:

My current rabbit hole is trying to get G.INP/retransmit counters out of dsl_cmd, as my ISP uses these to automatically adjust my profile based on errors including uncorrected retransmits and I want to understand what is going on. And that takes longer than I expected....

P.S.: Turns out getting the ReTX statistics was not really that involved, now the challenge is to get the necessary changes (only to two to 4 makefiles) into OpenWrt proper...

sounds good, I will put it on github with explanation to everything to get it going and you can give it a try I will post the link when I have time.

1 Like

Have a look at prometheus and grafana. The former collects data, the latter visualizes it in your browser. OpenWRT already has a lua based prometheus exporter with a lantiq dsl collector (package prometheus-node-exporter-lua-ltq-dsl).

It could look like this:

I didn't visualize everything, but the data is there.