Merge branch 'stable-1.6' into protect-datagram-fields

This commit is contained in:
Florian Pose
2026-07-15 10:50:08 +02:00
5 changed files with 48 additions and 20 deletions
+11 -1
View File
@@ -7,9 +7,14 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: fix-byte-order-marker
- id: mixed-line-ending
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.49.0
rev: v0.49.1
hooks:
- id: markdownlint
@@ -17,3 +22,8 @@ repos:
rev: v3.14.2
hooks:
- id: markdown-link-check
- repo: https://github.com/cpplint/cpplint
rev: 2.0.2
hooks:
- id: cpplint
+3
View File
@@ -165,6 +165,9 @@ Enhancement suggestions are tracked as
There is a [coding style document](CodingStyle.md) next to this guide.
Please install the [pre-commit hooks](.pre-commit-config.yaml) via `pre-commit
install`.
<!-- omit in toc -->
## Attribution
+9
View File
@@ -0,0 +1,9 @@
filter=-build/include_subdir
filter=-build/include_what_you_use
filter=-readability/braces
filter=-runtime/int
filter=-whitespace/braces
filter=-whitespace/comments
filter=-whitespace/empty_loop_body
filter=-whitespace/newline
linelength=78
+8
View File
@@ -108,3 +108,11 @@ Please see the [contributing document](CONTRIBUTING.md).
Developers shall use the coding style rules in the [coding style
file](CodingStyle.md).
There is a [cpplint configuration](CPPLINT.cfg) included as well that is
automatically checked via [pre-commit hooks](.pre-commit-config.yaml). So
please install the pre-commit hooks via
```bash
pre-commit install
```
+17 -19
View File
@@ -53,7 +53,8 @@
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) || \
(defined(CONFIG_PREEMPT_RT_FULL) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
(defined(CONFIG_PREEMPT_RT_FULL) && \
LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
# define ec_rt_lock_interruptible(lock) \
rt_mutex_lock_interruptible(lock)
#else
@@ -65,15 +66,15 @@
#define smp_store_release(p, v) \
do { \
smp_mb(); \
ACCESS_ONCE(*p) = (v); \
smp_mb(); \
ACCESS_ONCE(*p) = (v); \
} while (0)
#define smp_load_acquire(p) \
#define smp_load_acquire(p) \
({ \
typeof(*p) ___p1 = ACCESS_ONCE(*p); \
smp_mb(); \
___p1; \
typeof(*p) ___p1 = ACCESS_ONCE(*p); \
smp_mb(); \
___p1; \
})
#endif
@@ -614,8 +615,9 @@ int ec_master_thread_start(
return err;
}
if (0xffffffff != master->run_on_cpu) {
EC_MASTER_INFO(master, " binding thread to cpu %u\n",master->run_on_cpu);
kthread_bind(master->thread,master->run_on_cpu);
EC_MASTER_INFO(master, " binding thread to cpu %u\n",
master->run_on_cpu);
kthread_bind(master->thread, master->run_on_cpu);
}
/* Ignoring return value of wake_up_process */
(void) wake_up_process(master->thread);
@@ -1072,8 +1074,8 @@ void ec_master_send_datagrams(
}
// EtherCAT datagram header
EC_WRITE_U8 (cur_data, datagram->type);
EC_WRITE_U8 (cur_data + 1, datagram->index);
EC_WRITE_U8(cur_data, datagram->type);
EC_WRITE_U8(cur_data + 1, datagram->index);
memcpy(cur_data + 2, datagram->address, EC_ADDR_LEN);
EC_WRITE_U16(cur_data + 6, datagram->data_size & 0x7FF);
EC_WRITE_U16(cur_data + 8, 0x0000);
@@ -1195,8 +1197,8 @@ void ec_master_receive_datagrams(
cmd_follows = 1;
while (cmd_follows) {
// process datagram header
datagram_type = EC_READ_U8 (cur_data);
datagram_index = EC_READ_U8 (cur_data + 1);
datagram_type = EC_READ_U8(cur_data);
datagram_index = EC_READ_U8(cur_data + 1);
data_size = EC_READ_U16(cur_data + 6) & 0x07FF;
cmd_follows = EC_READ_U16(cur_data + 6) & 0x8000;
cur_data += EC_DATAGRAM_HEADER_SIZE;
@@ -1435,12 +1437,12 @@ void ec_master_nanosleep(const unsigned long nsecs)
set_current_state(TASK_INTERRUPTIBLE);
hrtimer_start(&t.timer, hrtimer_get_expires(&t.timer), mode);
if (likely(t.task))
if (likely(t.task)) {
schedule();
}
hrtimer_cancel(&t.timer);
mode = HRTIMER_MODE_ABS;
} while (t.task && !signal_pending(current));
}
@@ -1509,7 +1511,6 @@ void ec_master_exec_slave_fsms(
while (master->fsm_exec_count < EC_EXT_RING_SIZE / 2
&& count < master->slave_count) {
if (ec_fsm_slave_is_ready(&master->fsm_slave->fsm)) {
datagram = ec_master_get_external_datagram(master);
@@ -1629,7 +1630,6 @@ static int ec_master_operation_thread(void *priv_data)
* https://gitlab.com/etherlab.org/ethercat/-/work_items/168 */
seq_rt = smp_load_acquire(&master->injection_seq_rt);
if (seq_rt == master->injection_seq_fsm) { // was injected
// output statistics
ec_master_output_stats(master);
@@ -2107,7 +2107,6 @@ void ec_master_find_dc_ref_clock(
break;
}
}
}
master->dc_ref_clock = ref;
@@ -2418,7 +2417,6 @@ int ecrt_master_deactivate(ec_master_t *master)
for (slave = master->slaves;
slave < master->slaves + master->slave_count;
slave++) {
// set states for all slaves
ec_slave_request_state(slave, EC_SLAVE_STATE_PREOP);