This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: [Linux] HSR/PRP statistic as per MIB differs when fetched in two different ways

Part Number: AM5728

Hello,

I am trying to get statistics for HSR/PRP on Linux.

When I use recommended way as described in SDK documentation (4.2.4.13.3. LRE Statistics (firmware offload)):

ethtool -S <ifc_name>

I get different values for some stats than when using the method you listed in for example 4.2.4.13.5. PRP Testing:

cat /proc/prp0/lre-stats

One of the values that differs is lreTxC, while lreRxA and lreRxB are the same in both methods.

Why is there a difference and which method should be used? Or is there some other method to get statistic via C/C++ code?

Best regards.

 

 

  • Hi Darko,

    Can you share an example of the numbers you see?  Interested to know if the numbers are drastically different.

    In the meantime, I'll take a look at the driver and will let you know if there is an explanation. 

    Regards,
    Mike

  • Hi Mike,

    Sure, I will list it below. I also noticed that ethtool gives more stats of which some are not described in MIB.

    ethtool:

         lreTxA: 41300
         lreTxB: 41297
         lreTxC: 108759
         lreErrWrongLanA: 41091
         lreErrWrongLanB: 41090
         lreErrWrongLanC: 0
         lreRxA: 41297
         lreRxB: 41301
         lreRxC: 0
         lreErrorsA: 0
         lreErrorsB: 0
         lreErrorsC: 0
         lreNodes: 9
         lreProxyNodes: 0
         lreUniqueRxA: 0
         lreUniqueRxB: 0
         lreUniqueRxC: 0
         lreDuplicateRxA: 0
         lreDuplicateRxB: 0
         lreDuplicateRxC: 0
         lreMultiRxA: 0
         lreMultiRxB: 0
         lreMultiRxC: 0
         lreOwnRxA: 41297
         lreOwnRxB: 41300
         lreDuplicateDiscard: 2
         lreTransRecept: 1
         lreNtLookupErrA: 55536
         lreNtLookupErrB: 55539
         lreNodeTableFull: 0
         lreMulticastDropped: 9
         lreVlanDropped: 0
         lrePaceTimerExpired: 0
         lreTotalRxA: 55536
         lreTotalRxB: 55539
         lreOverflowPru0: 0
         lreOverflowPru1: 0
         lreDDCountPru0: 0
         lreDDCountPru1: 0
         lreCntSupPru0: 41091
         lreCntSupPru1: 41091
    

    cat /proc/...

    lreTxA: 41383
         lreTxB: 41380
         lreTxC: 21326
         lreErrWrongLanA: 41174
         lreErrWrongLanB: 41173
         lreErrWrongLanC: 0
         lreRxA: 41380
         lreRxB: 41384
         lreRxC: 43930821
         lreErrorsA: 0
         lreErrorsB: 0
         lreErrorsC: 0
         lreNodes: 9
         lreProxyNodes: 0
         lreUniqueRxA: 0
         lreUniqueRxB: 0
         lreUniqueRxC: 0
         lreDuplicateRxA: 0
         lreDuplicateRxB: 0
         lreDuplicateRxC: 0
         lreMultiRxA: 0
         lreMultiRxB: 0
         lreMultiRxC: 0
         lreOwnRxA: 41380
         lreOwnRxB: 41383
    

    Slight difference between stats like lreTxA and lreTxB in examples is because system is running, but these are in general same values. lreTxC or lreRxC differ significantly.

    If I understood correctly, lreTxC and lreRxC should be the values that driver forwarded or received to application layer respectively.

    Best regards,

    Darko

  • Hi Darko,

    Thank you for your patience - wanted to let you know this is still open on my side and will have an update on Wednesday.

    Regards,
    Mike

  • Darko,

    Ran out of time today - I will be working on this tomorrow.

    Regards,
    Mike

  • Hi Darko,

    Seeing the same result as you.  I didn't dig dig into the Linux kernel code to understand how /proc/prp0/lre-stats gets populated.  The ethtool stats are coming directly from the driver.  I am checking with another engineer here that can help.

    Regards,
    Mike

  • Hi Darko,

    Got confirmation you would want to use the stats in /proc/..

    That is what is used by SNMP agent to dump LRE stats. If you want to have a user space function, they can dump this and retrieve the value.

    Please refer hsr_prp_lre_stats_show() in net/hsr-prp/hsr_prp_proc.c for the code.

    As per spec TxC count is LRE to application stats a.k.a C interface.  Driver increment the count of good frame forwarded to stack using INC_CNT_TX_C() macro in deliver_master() of hsr_prp_forward.c

    Same is retrieved in hsr_prp_lre_stats_show() and send to user space. RxC count is Application to LRE stats counted using INC_CNT_RX_C()
    in hsr_prp_dev_xmit() of hsr_prp_device.c.

    hsr_prp_lre_stats_show() retrieve the above values from net/hsr-prp upper device and A/B stats from lower device which in turn is received from prueth driver using lredev_get_stats() ops and the same retrieved from firmware memory.

    Hope this clarifies. ethtool at prueth level is not to be used for LRE stats as it is incomplete w.r.t TxC/RxC stats.

    Regards,
    Mike

  • Hello Mike

    Thanks for your confirmation.

    I'll check the referred method.

    Best regards,

    Darko