Patch "can: peak_canfd: pucan_handle_can_rx(): fix echo management when loopback is on" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    can: peak_canfd: pucan_handle_can_rx(): fix echo management when loopback is on

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     can-peak_canfd-pucan_handle_can_rx-fix-echo-manageme.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 42385733e016a884c740e7822becee60a070ed87
Author: Stephane Grosjean <s.grosjean@xxxxxxxxxxxxxxx>
Date:   Tue Oct 13 17:39:47 2020 +0200

    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@xxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20201013153947.28012-1-s.grosjean@xxxxxxxxxxxxxxx
    Fixes: 8ac8321e4a79 ("can: peak: add support for PEAK PCAN-PCIe FD CAN-FD boards")
    Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c
index 6b0c6a99fc8d6..91b156b2123a3 100644
--- a/drivers/net/can/peak_canfd/peak_canfd.c
+++ b/drivers/net/can/peak_canfd/peak_canfd.c
@@ -248,8 +248,7 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv,
 		cf_len = get_can_dlc(pucan_msg_get_dlc(msg));
 
 	/* if this frame is an echo, */
-	if ((rx_msg_flags & PUCAN_MSG_LOOPED_BACK) &&
-	    !(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) {
+	if (rx_msg_flags & PUCAN_MSG_LOOPED_BACK) {
 		unsigned long flags;
 
 		spin_lock_irqsave(&priv->echo_lock, flags);
@@ -263,7 +262,13 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv,
 		netif_wake_queue(priv->ndev);
 
 		spin_unlock_irqrestore(&priv->echo_lock, flags);
-		return 0;
+
+		/* if this frame is only an echo, stop here. Otherwise,
+		 * continue to push this application self-received frame into
+		 * its own rx queue.
+		 */
+		if (!(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE))
+			return 0;
 	}
 
 	/* otherwise, it should be pushed into rx fifo */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux