aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/usb
diff options
context:
space:
mode:
authorStephane Grosjean <s.grosjean@peak-system.com>2015-01-23 05:31:24 -0500
committerMarc Kleine-Budde <mkl@pengutronix.de>2015-01-28 08:47:06 -0500
commitfaa233d902bb97ac034fa2580e6e0934ccf98cf3 (patch)
treec8160f089c22b47337720c7eeb0b5c0bae15daba /drivers/net/can/usb
parent1114be1e5ca43d465e2da95a2118672f7d4110fb (diff)
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 <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/usb')
-rw-r--r--drivers/net/can/usb/peak_usb/pcan_usb_core.c15
-rw-r--r--drivers/net/can/usb/peak_usb/pcan_usb_core.h4
2 files changed, 18 insertions, 1 deletions
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
index ae8c448fd4d0..7587337a3b42 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -164,6 +164,21 @@ void peak_usb_get_ts_tv(struct peak_time_ref *time_ref, u32 ts,
164} 164}
165 165
166/* 166/*
167 * post received skb after having set any hw timestamp
168 */
169int 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
181/*
167 * callback for bulk Rx urb 182 * callback for bulk Rx urb
168 */ 183 */
169static void peak_usb_read_bulk_callback(struct urb *urb) 184static void peak_usb_read_bulk_callback(struct urb *urb)
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.h b/drivers/net/can/usb/peak_usb/pcan_usb_core.h
index e8038b30bab5..0e76b84fb786 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.h
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.h
@@ -145,7 +145,9 @@ void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now);
145void peak_usb_set_ts_now(struct peak_time_ref *time_ref, u32 ts_now); 145void peak_usb_set_ts_now(struct peak_time_ref *time_ref, u32 ts_now);
146void peak_usb_get_ts_tv(struct peak_time_ref *time_ref, u32 ts, 146void peak_usb_get_ts_tv(struct peak_time_ref *time_ref, u32 ts,
147 struct timeval *tv); 147 struct timeval *tv);
148 148int peak_usb_netif_rx(struct sk_buff *skb,
149 struct peak_time_ref *time_ref, u32 ts_low, u32 ts_high);
149void peak_usb_async_complete(struct urb *urb); 150void peak_usb_async_complete(struct urb *urb);
150void peak_usb_restart_complete(struct peak_usb_device *dev); 151void peak_usb_restart_complete(struct peak_usb_device *dev);
152
151#endif 153#endif