Skip to content

Commit d920dd2

Browse files
Jimmy Assarssonmarckleinebudde
authored andcommitted
can: kvaser_usb: hydra: Set hardware timestamp on transmitted packets
Set hardware timestamp on transmitted packets. Signed-off-by: Jimmy Assarsson <[email protected]> Reviewed-by: Vincent Mailhol <[email protected]> Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 0512cc6 commit d920dd2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* - Transition from CAN_STATE_ERROR_WARNING to CAN_STATE_ERROR_ACTIVE is only
1111
* reported after a call to do_get_berr_counter(), since firmware does not
1212
* distinguish between ERROR_WARNING and ERROR_ACTIVE.
13-
* - Hardware timestamps are not set for CAN Tx frames.
1413
*/
1514

1615
#include <linux/completion.h>
@@ -1187,6 +1186,7 @@ static void kvaser_usb_hydra_tx_acknowledge(const struct kvaser_usb *dev,
11871186
bool one_shot_fail = false;
11881187
bool is_err_frame = false;
11891188
u16 transid = kvaser_usb_hydra_get_cmd_transid(cmd);
1189+
struct sk_buff *skb;
11901190

11911191
priv = kvaser_usb_hydra_net_priv_from_cmd(dev, cmd);
11921192
if (!priv)
@@ -1213,6 +1213,9 @@ static void kvaser_usb_hydra_tx_acknowledge(const struct kvaser_usb *dev,
12131213

12141214
spin_lock_irqsave(&priv->tx_contexts_lock, irq_flags);
12151215

1216+
skb = priv->can.echo_skb[context->echo_index];
1217+
if (skb)
1218+
skb_hwtstamps(skb)->hwtstamp = kvaser_usb_hydra_ktime_from_cmd(dev->cfg, cmd);
12161219
len = can_get_echo_skb(priv->netdev, context->echo_index, NULL);
12171220
context->echo_index = dev->max_tx_urbs;
12181221
--priv->active_tx_contexts;

0 commit comments

Comments
 (0)