Slaves can fail to correctly read their SII information, leading to
zero or corrupted SII information. This leads to slaves that remain
in PREOP or SAFEOP.
This is caused by the cached external (slave) datagrams being cycled
through too quickly due to being marked as consumed when they are not.
Datagrams can then be lost or incorrectly shared between multiple slaves
as the ring returns a datagram that is still in use by a read SII call.
This may also occur if multiple services are contending for a slaves
mailbox.
I have not added checks into ec_master_get_external_datagram() to
check that a returned datagram is not currently in use.
Fixup for f943348d - caused deadlock.
Fixes the exit condition of the mailbox FSMs -- previously they returned
whether they were sending a datagram or not, and the parent assumed that
this meant they were done if they didn't want to send a datagram. Since
earlier patches can cause idle cycles now, this could cause unexpected
early exit, so they now return whether they're complete or not
explicitly.
Sdo directory now only fetched on request.
The time-consuming SDO directory fetch during slave scan can now be
skipped by setting the EC_SKIP_SDO_DICT in globals.h. The directory
will now instead be fethed the first time an ethercat sdos command
is executed with the ethercat tool.
Skip output statistics during re-scan.
No reason to write output statistics in syslog when issuing a slave
scanning where UNMATCHED datagrams are expected behavior.
When rescanning a slave (and thus discarding any prior pending FSMs),
explicitly clear the slave mailbox, to avoid getting confused by a
stale response.
Fix setting flag in vm_area_struct for Kernel 6.3
See merge request etherlab.org/ethercat!67
(cherry picked from commit 04f202a39c)
27db882d Fix setting flag in vm_area_struct for Kernel 6.3
In upstream commit c9874d3ffeaf (termios: start unifying non-UAPI
parts of asm/termios.h), the INIT_C_CC definition was moved to a new
header, termios_internal.h. So we must include that header to get that
macro, but conditionally, since the header does not exist in older
kernels.
Manually maintaining the table of contents relies on how HTML fragments
are generated, it is prone to errors (infact it is already out of sync)
and just plain boring.
Unfortunately there is no common agreement on all markdown flavours on
how the table of contents must be implemented. Here the `[[_TOC_]]` tag
has been used because it is supported by both GitLab and GitHub:
https://gitlab.com/gitlab-org/gitlab/-/issues/21901
Introduce a new lock for synchronization of the master->domains list, and use
that instead of the big master_sem lock, improving real-time performance of
fx. ecrt_domain_process() when EoE thread is being shut down (or other
use-cases where master_sem is held for extended periods).
The following locking order is used:
* master->master_sem
* master->domains_lock
* master->io_sem
* domain->datagram_pairs_lock
Meaning that it is allowed to take domains_lock while holding master_sem, and
it is allowed to hold domains_lock while locking io_sem and
datagram_pairs_lock.
[RV: For now, the lockdep_assert_held() annotations are commented out,
since they don't compile with CONFIG_PROVE_LOCKING and (the default)
--disable-rtmutex.]
While domain->datagram_pairs was previously partly protected by the
master->master_sem lock (it was not done consistently though), the fix
to protection of master->datagram_queue made it even worse.
This change adds protection of domain->datagram_pairs using a new lock
dedicated to this. The domain->datagram_pairs_lock is acquired in the actual
functions accessing the domain->datagram_pairs, and this currently means that
it is acquired both in situations where master->master_sem is held and in
situations where master->io_sem is held.
With this, we should have in place so that master->io_sem is always held when
accessing master->datagram_queue.
Note, the use of master->master_sem in ec_ioctl_send() and
ec_ioctl_receive() were wrong (introduced in commit cef602586c). The
only thing needing to be synchronized there is the access to
master->datagram_queue, which is protected by master->io_sem.
This corresponds roughly to the fixes for stable-1.5 that are seen in
https://gitlab.com/etherlab.org/ethercat/-/merge_requests/36 .
In order to ensure proper use of locking, the purpose of each mutex/semaphore
must be clear and documented.
This is my best guess. The master->io_sem has a simple purpose, synchronizing
access to the master->datagram_queue list structure.