Skip to content

Commit 4c33336

Browse files
can: m_can: m_can_{read_fifo,echo_tx_event}(): shift timestamp to full 32 bits
In commit 1be37d3 ("can: m_can: fix periph RX path: use rx-offload to ensure skbs are sent from softirq context") the RX path for peripheral devices was switched to RX-offload. Received CAN frames are pushed to RX-offload together with a timestamp. RX-offload is designed to handle overflows of the timestamp correctly, if 32 bit timestamps are provided. The timestamps of m_can core are only 16 bits wide. So this patch shifts them to full 32 bit before passing them to RX-offload. Link: https://lore.kernel.org/all/[email protected] Fixes: 1be37d3 ("can: m_can: fix periph RX path: use rx-offload to ensure skbs are sent from softirq context") Cc: <[email protected]> # 5.13 Cc: Torin Cooper-Bennun <[email protected]> Reviewed-by: Chandrasekar Ramakrishnan <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 5b12933 commit 4c33336

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/can/m_can/m_can.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ static int m_can_read_fifo(struct net_device *dev, u32 rxfs)
529529
/* acknowledge rx fifo 0 */
530530
m_can_write(cdev, M_CAN_RXF0A, fgi);
531531

532-
timestamp = FIELD_GET(RX_BUF_RXTS_MASK, fifo_header.dlc);
532+
timestamp = FIELD_GET(RX_BUF_RXTS_MASK, fifo_header.dlc) << 16;
533533

534534
m_can_receive_skb(cdev, skb, timestamp);
535535

@@ -1030,7 +1030,7 @@ static int m_can_echo_tx_event(struct net_device *dev)
10301030
}
10311031

10321032
msg_mark = FIELD_GET(TX_EVENT_MM_MASK, txe);
1033-
timestamp = FIELD_GET(TX_EVENT_TXTS_MASK, txe);
1033+
timestamp = FIELD_GET(TX_EVENT_TXTS_MASK, txe) << 16;
10341034

10351035
/* ack txe element */
10361036
m_can_write(cdev, M_CAN_TXEFA, FIELD_PREP(TXEFA_EFAI_MASK,

0 commit comments

Comments
 (0)