Some applications (fox example J1939 stack) listen on CAN bus an use TX-ECHO and RX packages. The order of this messages should be correct. Current Linux CAN implementation do not guarantee correct order of RX and TX-ECHO package. The same is with CAN bus status messages. This patches extend CAN framework and fixes this issue for flexcan driver. Other driver still can be affected. The test is available on this branch: https://github.com/olerem/can-utils/commits/canfdtest-2018.09.18 The test setup should have two peers: slave and master. The master peer will be tested, the slave is needed only to response to the traffic generated on the master peer. run on slave: canfdtest -v can0 run on master: canfdtest -v -g can0 & while(true); do chrt 50 dd if=/dev/zero of=/dev/null count=10000 status=none; done The master peer should have enough system load to increase probability of unsorted packages. Oleksij Rempel (4): can: introduce can_rx_offload_get_echo_skb and can_rx_offload_queue_sorted functions flexcan: handle tx-complete CAN frames via rx-offload infrastructure can: rename can_rx_offload_irq_queue_err_skb to can_rx_offload_queue_tail can: flexcan: use can_rx_offload_queue_sorted for flexcan_irq_bus_* drivers/net/can/flexcan.c | 18 ++++++++++-- drivers/net/can/rx-offload.c | 52 ++++++++++++++++++++++++++++++++-- include/linux/can/rx-offload.h | 7 ++++- 3 files changed, 71 insertions(+), 6 deletions(-) -- 2.19.0