[etherlab-users] Unmatched/Skipped Datagrams

Gary Grobe ggrobe at houstonmechatronics.com
Fri Dec 13 23:19:28 CET 2019


My configuration is:
- Linux 4.19.82-rt30 #1 SMP PREEMPT RT x86_64 GNU/Linux
- IgH EtherCAT master 1.5.2 6258f7d85afb+
- Intel(R) Celeron(R) CPU  J1900  @ 1.99GHz
- ec_generic based on the following NIC:

03:00.0 Ethernet controller [0200]: Intel Corporation I211 Gigabit 
Network Connection [8086:1539] (rev 03)
         Subsystem: Intel Corporation I211 Gigabit Network Connection 
[8086:0000]
         Kernel driver in use: igb

The app is a user-space client. The following is the cyclic task cut 
down to a minimum, and yet still shows the issue.

{
     // ...

     struct sched_param param = { };

     param.sched_priority = sched_get_priority_max(SCHED_FIFO);

     if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) {
         std::cout << "Warning: Failed to lock memory: " << 
strerror(errno) <<
             std::endl;
     }

     stack_prefault();

     clock_gettime(CLOCK_MONOTONIC, &wakeup_time);
     wakeup_time.tv_sec += 1;
     wakeup_time.tv_nsec = 0;

     while (running) {
         ret = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &wakeup_time,
             NULL);

         if (ret) {
             std::cerr << "clock_nanosleep(): " << strerror(ret) << 
std::endl;

             break;
         }

         task_cycle();

         wakeup_time.tv_nsec += PERIOD_NS;

         while (wakeup_time.tv_nsec >= NSEC_PER_SEC) {
             wakeup_time.tv_nsec -= NSEC_PER_SEC;
             wakeup_time.tv_sec++;
         }
     }
}

inline void TestChain::task_cycle()
{
     ecrt_master_receive(master);
     ecrt_domain_process(domain);

     ecrt_master_application_time(master, TIMESPEC2NS(wakeup_time));
     ecrt_master_sync_reference_clock(master);
     ecrt_master_sync_slave_clocks(master);

     if (counter) {
         counter--;
     }
     else {
         counter = FREQUENCY;
     }

     ecrt_domain_queue(domain);
     ecrt_master_send(master);
}

The following messages from dmesg were taken at 1kHz. Doesn't matter if 
it's doing 10Hz or 1kHz, the UNMATCHED and SKIPPED numbers are quite 
large. I've only seen 1Hz work w/o issue.

[ 4132.457210] EtherCAT 0: Domain 0: 268 working counter changes - now 1/2.
[ 4133.373743] EtherCAT WARNING 0: 657 datagrams UNMATCHED!
[ 4133.461587] EtherCAT WARNING: Datagram 000000002f1447da 
(domain0-0-main) was SKIPPED 736 times.
[ 4133.461593] EtherCAT 0: Domain 0: 395 working counter changes - now 0/2.
[ 4134.374131] EtherCAT WARNING 0: 643 datagrams UNMATCHED!
[ 4134.465961] EtherCAT WARNING: Datagram 000000002f1447da 
(domain0-0-main) was SKIPPED 776 times.
[ 4134.465968] EtherCAT 0: Domain 0: 232 working counter changes - now 0/2.
[ 4135.374332] EtherCAT WARNING 0: 850 datagrams UNMATCHED!
[ 4135.470468] EtherCAT WARNING: Datagram 000000002f1447da 
(domain0-0-main) was SKIPPED 722 times.
[ 4135.470476] EtherCAT 0: Domain 0: 331 working counter changes - now 1/2.
[ 4136.374860] EtherCAT WARNING 0: 649 datagrams UNMATCHED!
[ 4136.475180] EtherCAT WARNING: Datagram 000000002f1447da 
(domain0-0-main) was SKIPPED 858 times.
[ 4136.475187] EtherCAT 0: Domain 0: 282 working counter changes - now 1/2.
[ 4137.375178] EtherCAT WARNING 0: 757 datagrams UNMATCHED!
[ 4138.319869] EtherCAT WARNING: Datagram 000000002f1447da 
(domain0-0-main) was SKIPPED 745 times.
[ 4138.319877] EtherCAT 0: Domain 0: 208 working counter changes - now 1/2.
[ 4138.375593] EtherCAT WARNING 0: 972 datagrams UNMATCHED!
[ 4139.324269] EtherCAT WARNING: Datagram 000000002f1447da 
(domain0-0-main) was SKIPPED 911 times.



-- 
_The contents of this email message and any attachments are intended solely 
for the addressee(s).  This message (including any attachments) may contain 
confidential, proprietary, privileged and/or private information. The 
information is intended to be for the use of the individual or entity 
designated above. If you are not the intended recipient of this message, 
please notify the sender immediately, and delete the message and any 
attachments.  _Any disclosure, reproduction, distribution or other use of 
this message or any attachments by an individual or entity other than the 
intended recipient is prohibited. __


More information about the etherlab-users mailing list