Skip to content

Commit faa233d

Browse files
Stephane Grosjeanmarckleinebudde
authored andcommitted
can: peak_usb: add peak_usb_netif_rx() new function
Add a common function that pushes the skb in the network queue with adding timestamps information, converted from time values read from the PEAK USB adapters. Signed-off-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 1114be1 commit faa233d

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

drivers/net/can/usb/peak_usb/pcan_usb_core.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,21 @@ void peak_usb_get_ts_tv(struct peak_time_ref *time_ref, u32 ts,
163163
}
164164
}
165165

166+
/*
167+
* post received skb after having set any hw timestamp
168+
*/
169+
int peak_usb_netif_rx(struct sk_buff *skb,
170+
struct peak_time_ref *time_ref, u32 ts_low, u32 ts_high)
171+
{
172+
struct skb_shared_hwtstamps *hwts = skb_hwtstamps(skb);
173+
struct timeval tv;
174+
175+
peak_usb_get_ts_tv(time_ref, ts_low, &tv);
176+
hwts->hwtstamp = timeval_to_ktime(tv);
177+
178+
return netif_rx(skb);
179+
}
180+
166181
/*
167182
* callback for bulk Rx urb
168183
*/

drivers/net/can/usb/peak_usb/pcan_usb_core.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now);
145145
void peak_usb_set_ts_now(struct peak_time_ref *time_ref, u32 ts_now);
146146
void peak_usb_get_ts_tv(struct peak_time_ref *time_ref, u32 ts,
147147
struct timeval *tv);
148-
148+
int peak_usb_netif_rx(struct sk_buff *skb,
149+
struct peak_time_ref *time_ref, u32 ts_low, u32 ts_high);
149150
void peak_usb_async_complete(struct urb *urb);
150151
void peak_usb_restart_complete(struct peak_usb_device *dev);
152+
151153
#endif

0 commit comments

Comments
 (0)