Commit Graph

2342 Commits

Author SHA1 Message Date
Graeme Foot 2c1597231d Applied base-0028-ec_master_exec_slave_fsms-external-datagram-fix
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.
2023-08-29 14:38:54 +02:00
Gavin Lambert d3e853514f Applied base-0027-Prevent abandoning the mailbox state machines early
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.
2023-08-29 14:38:54 +02:00
Knud Baastrup ff2e062a08 Applied base-0026-EoE-processing-is-now-only-allowed-in-state-PREOP
EoE is disabled in INIT, BOOT, and invalid states to prevent errors.
2023-08-29 14:38:54 +02:00
Knud Baastrup 1267e45bf8 Applied base-0025-Ignore-mailbox-settings-if-corrupted-sii-file
Ignore SII specified mailbox settings if they appear to be from
a blank EEPROM.
2023-08-29 14:38:54 +02:00
Knud Baastrup ba27819221 Applied base-0024-Sdo-directory-now-only-fetched-on-request
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.
2023-08-29 14:38:54 +02:00
Knud Baastrup 1124a8b359 Applied base-0023-Skip-output-statistics-during-re-scan
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.
2023-08-28 13:41:59 +02:00
Knud Baastrup 74798d5259 Applied base-0022-Clear-slave-mailboxes-after-a-re-scan
When rescanning a slave (and thus discarding any prior pending FSMs),
explicitly clear the slave mailbox, to avoid getting confused by a
stale response.
2023-08-28 13:39:15 +02:00
Florian Pose b1945b7bdc Always define EoE handler count. 2023-07-20 13:11:10 +02:00
Florian Pose f5dc109176 Merge branch 'fix-6.4' into 'master'
Fix class_create on kernel 6.4

See merge request etherlab.org/ethercat!73
2023-07-05 08:13:02 +00:00
Nicola Fontana 262afa2f9c Fix class_create on kernel 6.4
Commit 1aaba11da9aa7d7d6b52a74d45b31cac118295a1 in kernel code removed
`module *` argument from `class_create`.
2023-07-05 07:31:52 +02:00
Florian Pose 589838526a Merge branch '8139too-5.10' into 'master'
8139too 5.10

See merge request etherlab.org/ethercat!72
2023-06-29 10:19:25 +00:00
Florian Pose b310b98936 Updated copyright, removed Id. 2023-06-29 11:37:00 +02:00
Florian Pose 6ff4168daa Added 8139too driver for kernel 5.10. 2023-06-29 11:01:31 +02:00
Florian Pose 0ac3c50a0e Improved help on ioctl() version magic mismatch. 2023-06-26 11:45:40 +02:00
Andreas Stewering-Bone 80bfddc640 Merge branch 'cherry-pick-04f202a3' into 'master'
Merge branch 'fix_vm_set_flag' into 'stable-1.5'

See merge request etherlab.org/ethercat!70
2023-06-01 06:27:36 +00:00
Andreas Stewering-Bone e35f35b25c Merge branch 'fix_vm_set_flag' into 'stable-1.5'
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
2023-06-01 06:11:19 +00:00
Florian Pose f8c9ec6e48 Merge branch 'v6.1-fixups' into 'master'
tty/module.c: fixups for linux >= v6.1

See merge request etherlab.org/ethercat!68
2023-05-25 14:26:10 +00:00
Rasmus Villemoes d39b4a59ec tty/module.c: include proper header for INIT_C_CC definition
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.
2023-05-25 14:35:04 +02:00
Rasmus Villemoes bbb16b872b tty/module.c: adapt signature of ->set_termios method to v6.1
Upstream changed ->set_termios to take a const struct ktermios in
commit a8c11c1520347 (tty: Make ->set_termios() old ktermios const).
2023-05-25 14:34:59 +02:00
Florian Pose 960895cb4d Merge branch 'toc' into 'master'
Add automatic TOC to README.md

See merge request etherlab.org/ethercat!66
2023-05-05 08:21:46 +00:00
Nicola Fontana 6d66773bc6 Add automatic TOC to README.md
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
2023-05-04 08:27:56 +02:00
Florian Pose 24a361c8f5 Allow zero-sized SDO responses 2023-05-02 10:53:33 +02:00
Florian Pose 251062a245 Merge branch 'fix/bash-completion-typo' into 'master'
bash_completion: fix confic typo

See merge request etherlab.org/ethercat!63
2023-02-09 21:44:42 +00:00
Jeppe Odgaard d3bcb6238e bash_completion: fix confic typo
Change 'confic' to 'config' in ethercat.bash_completion.
2023-02-09 09:27:12 +01:00
Florian Pose ee10317cf6 Put md files in EXTRA_DIST. 2023-01-30 11:31:56 +01:00
Florian Pose 3bc8703f5c Added 'foreign' to AM_INIT_AUTOMAKE(), cause README was renamed to README.md. 2023-01-30 11:29:06 +01:00
Florian Pose fb59955145 Cherry-picked markdown conversions from stable-1.5. 2023-01-30 11:19:08 +01:00
Florian Pose b403327659 Removed $Id$. 2023-01-09 12:42:37 +01:00
Florian Pose d329e30969 ext target for documentation. 2023-01-09 12:40:33 +01:00
Florian Pose c813ad4042 Using CI file from stable-1.5. 2023-01-09 11:39:34 +01:00
Florian Pose 20d0c93270 Changed email and postal address. 2023-01-09 10:01:24 +01:00
Florian Pose 2e2cef6131 Merge branch 'master' of gitlab.com:etherlab.org/ethercat 2022-11-02 09:45:57 +01:00
Florian Pose 72ee17b0e5 Precised kernel versions. 2022-11-02 09:45:38 +01:00
Florian Pose 565f742ea2 Merge branch 'fix-31' into 'master'
Fix #31: typos in documentation

Closes #31

See merge request etherlab.org/ethercat!59
2022-10-26 07:18:33 +00:00
Nicola Fontana b7211615af Fix #31: typos in documentation 2022-10-26 08:01:57 +02:00
Florian Pose 575ae786ed Minor line length change. 2022-09-21 09:09:33 +02:00
Florian Pose fa96b8fcb0 Merge branch 'lock-fixes' into 'master'
Various locking fixes and improvements

See merge request etherlab.org/ethercat!58
2022-09-05 09:41:16 +00:00
Florian Pose 7cce5ec6ae Fixed downloading SDOs via stdin (-). 2022-09-05 11:22:08 +02:00
Florian Pose afbead48a7 Removed tabs; output code as int. 2022-09-05 11:19:59 +02:00
Florian Pose e893051563 Merge branch 'deif/O_CLOEXEC' into 'master'
lib: use O_CLOEXEC flag when opening EtherCAT master device

See merge request etherlab.org/ethercat!56
2022-09-05 09:18:03 +00:00
Florian Pose 1437f8d409 Merge branch 'lock-abstraction-fixups' into 'master'
fix direct uses of up()/down()

See merge request etherlab.org/ethercat!55
2022-09-05 09:17:32 +00:00
Florian Pose 6af1d9a441 Merge branch 'ip-path' into 'master'
ethercatctl: fix hard-coded path to ip utility

See merge request etherlab.org/ethercat!54
2022-09-05 09:16:46 +00:00
Florian Pose 2aacdb810a Merge branch 'deif/tty-fixups' into 'master'
tty: fixups for kernels 5.14 and 5.15

See merge request etherlab.org/ethercat!53
2022-09-05 09:16:02 +00:00
Florian Pose 19be4c8da4 Merge branch 'fix-5.18' into 'master'
Fix for linux 5.18.0

See merge request etherlab.org/ethercat!52
2022-09-05 09:15:06 +00:00
Florian Pose 869a88a6c8 Merge branch 'build-update' into 'master'
Fix obsolete warnings on bootstrap

See merge request etherlab.org/ethercat!49
2022-09-05 09:14:33 +00:00
Florian Pose 82ce570c7e Merge branch 'fix-init-doc' into 'master'
doc: fix references to init scripts

See merge request etherlab.org/ethercat!48
2022-09-05 09:13:40 +00:00
Esben Haabendal 81758004fd Improve synchronization of master->domains list
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.]
2022-09-01 15:38:01 +02:00
Esben Haabendal 19b8ddea18 Add lock protection of domain->datagram_pairs
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.
2022-09-01 15:37:58 +02:00
Esben Haabendal 2372382259 Acquire master->io_sem lock where needed
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 .
2022-09-01 15:37:54 +02:00
Esben Haabendal e243c6b7db Clarify purpose of master->io_sem
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.
2022-09-01 15:37:50 +02:00