summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/kvaser_pciefd.c
diff options
context:
space:
mode:
authorJimmy Assarsson <extja@kvaser.com>2023-05-29 15:42:38 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2023-06-22 09:44:28 +0200
commitec681b91befa982477e24a150dd6452427fe6473 (patch)
tree3a2ffe2c603e2e32c7166d51f02fdf9f533c1933 /drivers/net/can/kvaser_pciefd.c
parentcan: kvaser_pciefd: Add function to set skb hwtstamps (diff)
downloadlinux-ec681b91befa982477e24a150dd6452427fe6473.tar.xz
linux-ec681b91befa982477e24a150dd6452427fe6473.zip
can: kvaser_pciefd: Set hardware timestamp on transmitted packets
Set hardware timestamp on transmitted packets. Fixes: 26ad340e582d ("can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices") Signed-off-by: Jimmy Assarsson <extja@kvaser.com> Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Link: https://lore.kernel.org/all/20230529134248.752036-5-extja@kvaser.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/kvaser_pciefd.c')
-rw-r--r--drivers/net/can/kvaser_pciefd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/can/kvaser_pciefd.c b/drivers/net/can/kvaser_pciefd.c
index 7646338d4d44..88bad2c2b641 100644
--- a/drivers/net/can/kvaser_pciefd.c
+++ b/drivers/net/can/kvaser_pciefd.c
@@ -1485,6 +1485,7 @@ static void kvaser_pciefd_handle_nack_packet(struct kvaser_pciefd_can *can,
if (skb) {
cf->can_id |= CAN_ERR_BUSERROR;
+ kvaser_pciefd_set_skb_timestamp(can->kv_pcie, skb, p->timestamp);
netif_rx(skb);
} else {
stats->rx_dropped++;
@@ -1516,8 +1517,15 @@ static int kvaser_pciefd_handle_ack_packet(struct kvaser_pciefd *pcie,
netdev_dbg(can->can.dev, "Packet was flushed\n");
} else {
int echo_idx = p->header[0] & KVASER_PCIEFD_PACKET_SEQ_MSK;
- int dlc = can_get_echo_skb(can->can.dev, echo_idx, NULL);
- u8 count = ioread32(can->reg_base +
+ int dlc;
+ u8 count;
+ struct sk_buff *skb;
+
+ skb = can->can.echo_skb[echo_idx];
+ if (skb)
+ kvaser_pciefd_set_skb_timestamp(pcie, skb, p->timestamp);
+ dlc = can_get_echo_skb(can->can.dev, echo_idx, NULL);
+ count = ioread32(can->reg_base +
KVASER_PCIEFD_KCAN_TX_NPACKETS_REG) & 0xff;
if (count < KVASER_PCIEFD_CAN_TX_MAX_COUNT &&