[etherlab-dev] EtherCAT Master - Overall RX stats not initialized

Rob Stocks rjs at computerway.biz
Mon Aug 11 23:27:31 CEST 2014


In the function ec_master_clear_device_stats in master/master.c, the
fields tx_frame_rates and tx_byte_rates are initialized to zero but not
their rx counterparts. This causes the 'Common' section of the 'ethercat
master' command to report incorrect RX stats.

I fixed this by adding two lines to the for loop in this function as
follows:

master->device_stats.rx_frame_rates[i] = 0;
master->device_stats.rx_byte_rates[i] = 0;


So that the function now looks like this:

void ec_master_clear_device_stats(
        ec_master_t *master /**< EtherCAT master */
        )
{
    unsigned int i;

    // zero frame statistics
    master->device_stats.tx_count = 0;
    master->device_stats.last_tx_count = 0;
    master->device_stats.rx_count = 0;
    master->device_stats.last_rx_count = 0;
    master->device_stats.tx_bytes = 0;
    master->device_stats.last_tx_bytes = 0;
    master->device_stats.rx_bytes = 0;
    master->device_stats.last_rx_bytes = 0;
    master->device_stats.last_loss = 0;

    for (i = 0; i < EC_RATE_COUNT; i++) {
        master->device_stats.tx_frame_rates[i] = 0;
        master->device_stats.tx_byte_rates[i] = 0;
        master->device_stats.rx_frame_rates[i] = 0;
        master->device_stats.rx_byte_rates[i] = 0;
        master->device_stats.loss_rates[i] = 0;
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-dev/attachments/20140811/1d59cc03/attachment.html>


More information about the etherlab-dev mailing list