summaryrefslogtreecommitdiff
path: root/include/linux/can
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2014-09-23 17:28:21 +0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2017-02-06 17:13:24 +0300
commit3abbac0b5dd3e3b3dfb30a4885cdde5c20e1cb83 (patch)
tree8517ce1aabaa92c0d810797a66fb97f3177e6085 /include/linux/can
parentd254586c34538c0014280806c5d4795697cf21e5 (diff)
downloadlinux-3abbac0b5dd3e3b3dfb30a4885cdde5c20e1cb83.tar.xz
can: rx-offload: Add support for timestamp based irq offloading
Some CAN controllers don't implement a FIFO in hardware, but fill their mailboxes in a particular order (from lowest to highest or highest to lowest). This makes problems to read the frames in the correct order from the hardware, as new frames might be filled into just read (low) mailboxes. This gets worse, when following new frames are received into not read (higher) mailboxes. On the bright side some these CAN controllers put a timestamp on each received CAN frame. This patch adds support to offload CAN frames in interrupt context, order them by timestamp and then transmitted in a NAPI context. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'include/linux/can')
-rw-r--r--include/linux/can/rx-offload.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/can/rx-offload.h b/include/linux/can/rx-offload.h
index cadfe9869600..cb31683bbe15 100644
--- a/include/linux/can/rx-offload.h
+++ b/include/linux/can/rx-offload.h
@@ -23,15 +23,23 @@
struct can_rx_offload {
struct net_device *dev;
- unsigned int (*mailbox_read)(struct can_rx_offload *offload, struct can_frame *cf, unsigned int mb);
+ unsigned int (*mailbox_read)(struct can_rx_offload *offload, struct can_frame *cf,
+ u32 *timestamp, unsigned int mb);
struct sk_buff_head skb_queue;
u32 skb_queue_len_max;
+ unsigned int mb_first;
+ unsigned int mb_last;
+
struct napi_struct napi;
+
+ bool inc;
};
+int can_rx_offload_add_timestamp(struct net_device *dev, struct can_rx_offload *offload);
int can_rx_offload_add_fifo(struct net_device *dev, struct can_rx_offload *offload, unsigned int weight);
+int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, u64 reg);
int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload);
int can_rx_offload_irq_queue_err_skb(struct can_rx_offload *offload, struct sk_buff *skb);
void can_rx_offload_reset(struct can_rx_offload *offload);