]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
can: peak_canfd: pucan_handle_can_rx(): fix echo management when loopback is on
authorStephane Grosjean <s.grosjean@peak-system.com>
Tue, 13 Oct 2020 15:39:47 +0000 (17:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:22:06 +0000 (19:22 +0100)
commitad3f9f9f0a4978ec8338afd7d58583eed4905ffe
treee429e4ccddf2f142d3ca6421520d1cd6d3fa4eaf
parent37cc52739ad1839550a39aae8de1f6ae979ed494
can: peak_canfd: pucan_handle_can_rx(): fix echo management when loopback is on

[ Upstream commit 93ef65e5a6357cc7381f85fcec9283fe29970045 ]

Echo management is driven by PUCAN_MSG_LOOPED_BACK bit, while loopback
frames are identified with PUCAN_MSG_SELF_RECEIVE bit. Those bits are set
for each outgoing frame written to the IP core so that a copy of each one
will be placed into the rx path. Thus,

- when PUCAN_MSG_LOOPED_BACK is set then the rx frame is an echo of a
  previously sent frame,
- when PUCAN_MSG_LOOPED_BACK+PUCAN_MSG_SELF_RECEIVE are set, then the rx
  frame is an echo AND a loopback frame. Therefore, this frame must be
  put into the socket rx path too.

This patch fixes how CAN frames are handled when these are sent while the
can interface is configured in "loopback on" mode.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Link: https://lore.kernel.org/r/20201013153947.28012-1-s.grosjean@peak-system.com
Fixes: 8ac8321e4a79 ("can: peak: add support for PEAK PCAN-PCIe FD CAN-FD boards")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/can/peak_canfd/peak_canfd.c