ltq-vdsl-app: add ubus support to get metrics
authorAndre Heider <a.heider@gmail.com>
Tue, 26 Jan 2021 08:00:48 +0000 (09:00 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Mon, 8 Feb 2021 20:43:00 +0000 (21:43 +0100)
commit5372205ca9afea8e51c1762eabcaf5a97350bbaf
treefe7cde18357fc6905d9cc95d1f9e819956163b99
parent4ba6fad7f7f9fe12633149d76fbf9d1486c06306
ltq-vdsl-app: add ubus support to get metrics

Add a 'dsl' ubus object with a 'metrics' function to replace the
expensive shell parsing done by /etc/init.d/dsl_control [dsl|luci]stat.

All metrics are gathered by using syscalls. An additional thread is started
to handle ubus events.

$ time /etc/init.d/dsl_control dslstat
real 0m 2.66s
user 0m 0.90s
sys 0m 1.76s

$ time ubus call dsl metrics
real 0m 0.02s
user 0m 0.00s
sys 0m 0.01s

Example output:
{
"api_version": "4.17.18.6",
"firmware_version": "5.8.1.5.0.7",
"chipset": "Lantiq-VRX200",
"driver_version": "1.5.17.6",
"state": "Showtime with TC-Layer sync",
"up": true,
"uptime": 3891,
"atu_c": {
"vendor_id": [
181,
0,
66,
68,
67,
77,
178,
26
],
"vendor": "Broadcom 178.26",
"system_vendor_id": [
181,
0,
66,
68,
67,
77,
0,
0
],
"system_vendor": "Broadcom",
"version": [
49,
57,
46,
48,
46,
51,
53,
46,
50,
32,
86,
69,
95,
49,
49,
95
],
"serial": [
65,
65,
49,
52,
52,
54,
70,
69,
48,
90,
87,
45,
48,
56,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
"power_state": "L0 - Synchronized",
"xtse": [
0,
0,
0,
0,
0,
0,
0,
2
],
"annex": "B",
"standard": "G.993.2",
"profile": "17a",
"mode": "G.993.2 (VDSL2, Profile 17a, with down- and upstream vectoring)",
"upstream": {
"vector": true,
"trellis": true,
"bitswap": true,
"retx": true,
"virtual_noise": false,
"interleave_delay": 0,
"data_rate": 31999000,
"latn": 8.500000,
"satn": 8.400000,
"snr": 12.700000,
"actps": -90.100000,
"actatp": 13.400000,
"attndr": 37180000
},
"downstream": {
"vector": true,
"trellis": true,
"bitswap": true,
"retx": true,
"virtual_noise": false,
"interleave_delay": 140,
"data_rate": 89998000,
"latn": 9.500000,
"satn": 9.600000,
"snr": 13.300000,
"actps": -90.100000,
"actatp": -1.600000,
"attndr": 116315372
},
"errors": {
"near": {
"es": 1,
"ses": 0,
"loss": 3,
"uas": 424,
"lofs": 0,
"fecs": 0,
"hec": 0,
"ibe": 0,
"crc_p": 0,
"crcp_p": 0,
"cv_p": 0,
"cvp_p": 0,
"rx_corrupted": 27740,
"rx_uncorrected_protected": 27010,
"rx_retransmitted": 0,
"rx_corrected": 730,
"tx_retransmitted": 16222
},
"far": {
"es": 242,
"ses": 71,
"loss": 0,
"uas": 424,
"lofs": 0,
"fecs": 22687,
"hec": 0,
"ibe": 0,
"crc_p": 0,
"crcp_p": 0,
"cv_p": 0,
"cvp_p": 0,
"rx_corrupted": 1383552,
"rx_uncorrected_protected": 1220215,
"rx_retransmitted": 0,
"rx_corrected": 163337,
"tx_retransmitted": 1574051
}
}
}

Signed-off-by: Andre Heider <a.heider@gmail.com>
Tested-by: Martin Schiller <ms@dev.tdt.de>
package/network/config/ltq-vdsl-app/Makefile
package/network/config/ltq-vdsl-app/patches/300-ubus.patch [new file with mode: 0644]
package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c [new file with mode: 0644]