OpenWrt 21.02 dsl_control?

From the old /lib/functions/lantiq_dsl.sh

latency_delay() {                                                                                                                   
        local csg                                                                                                                   
                                                                                                                                    
        local idu                                                                                                                   
        local idu_s;                                                                                                                
        local sidu                                                                                                                  
                                                                                                                                    
        local idd                                                                                                                   
        local idd_s;                                                                                                                
        local sidd                                                                                                                  
                                                                                                                                    
        csg=$(dsl_cmd g997csg 0 1)                                                                                                  
        idd=$(dsl_val "$csg" ActualInterleaveDelay)                                                                                 
                                                                                                                                    
        csg=$(dsl_cmd g997csg 0 0)                                                                                                  
        idu=$(dsl_val "$csg" ActualInterleaveDelay)                                                                                 
                                                                                                                                    
        [ -z "$idd" ] && idd=0                                                                                                      
        [ -z "$idu" ] && idu=0                                                                                                      
                                                                                                                                    
        if [ "$idd" -gt 100 ]; then                                                                                                 
                idd_s="Interleave"                                                                                                  
        else                                                                                                                        
                idd_s="Fast"                                                                                                        
        fi                                                                                                                          
                                                                                                                                    
        if [ "$idu" -gt 100 ]; then                                                                                                 
                idu_s="Interleave"                                                                                                  
        else                                                                                                                        
                idu_s="Fast"                                                                                                        
        fi                                                                                                                          
                                                                                                                                    
        sidu=$(scale_latency $idu)                                                                                                  
        sidd=$(scale_latency $idd)                                                                                                  
                                                                                                                                    
        if [ "$action" = "lucistat" ]; then                                                                                         
                echo "dsl.latency_down=\"$(scale_latency_us $idd)\""                                                                
                echo "dsl.latency_up=\"$(scale_latency_us $idu)\""                                                                  
                echo "dsl.latency_num_down=\"$sidd\""                                                                               
                echo "dsl.latency_num_up=\"$sidu\""                                                                                 
                echo "dsl.latency_s_down=\"$idd_s\""                                                                                
                echo "dsl.latency_s_up=\"$idu_s\""                                                                                  
        else                                                                                                                        
                echo "Latency [Interleave Delay]:               ${sidd} [${idd_s}]   ${sidu} [${idu_s}]"                            
        fi                                                                                                                          
}                     

The file also contains:

# Basic functions to send CLI commands to the vdsl_cpe_control daemon                                                               
#                                                                                                                                   
dsl_cmd() {                                                                                                                         
        killall -q -0 ${XDSL_CTRL} && (                                                                                             
                lock /var/lock/dsl_pipe                                                                                             
                echo "$@" > /tmp/pipe/dsl_cpe0_cmd                                                                                  
                cat /tmp/pipe/dsl_cpe0_ack                                                                                          
                lock -u /var/lock/dsl_pipe                                                                                          
        )                                                                                                                           
}                                                                                                                                   
dsl_val() {                                                                                                                         
        echo $(expr "$1" : '.*'$2'=\([-\.[:alnum:]]*\).*')                                                                          
}                                                                                                                                   
dsl_string() {                                                                                                                      
        echo $(expr "$1" : '.*'$2'=(\([A-Z0-9,]*\))')                                                                               
}                                                    

So maybe you just copy/adopt these shell functions into your own code used to generate the reports?

Not hands-on with a device, but parsing the code this information should now be contained in "upstream" and "downstream", as numeric "interleave_delay". The old code simply parsed a value >100 into the string "Interleave" and <= 100 into "Fast".

1 Like

At the start of this thread you said that the way to retrieve lantiq dsl modem information is through "ubus call dsl metrics" which is what I am doing.
The script snippets you posted above do not take this information from the json structure returned.
Please could you let me know where do I find latency information in the json structure? I would not want to mix the information source in my report script, if I had to then why not just restore and make the previous dsl_control available as part of 21.02 distribution as I suggested initially?

Not sure you are talking to me here, but...
Since you are seem to be the party interested in those latency numbers, either make a patch to add this information explicitly to https://github.com/openwrt/openwrt/commit/5372205ca9afea8e51c1762eabcaf5a97350bbaf#diff-58dc73dce2a153f8e49be6f9535883c431425163b338c899e5f391f4fcf46d85, or follow @takimata's hint from above and take the information that has been used in the past as input into the fast/non-fast classification.
Or if the rest of your processing is done in shell anyway, just adopt the old functions... as you seem not to be concerned about their run-time or load impact.

As i really wanted to have dsl statistics in OpenWRT 21.02 as well, i wrote some small code.
You find it at openwrt-dsl-statistics.

The latest OpenWrt 21.02.0-rc2 release notes/Device support mentioned

Device support

    Lantiq DSL multiple backports for DSL statistics

Any insights?

The commit log for 21.02 lists three relevant commits:

lantiq: enable G.INP retransmission counters
lantiq: use ActualNetDataRate for speed reporting
ltq-vdsl-app: extent dsl metrics with state_num and power_state_num

3 Likes