2 * linux/can/rx-offload.h
4 * Copyright (c) 2014 David Jander, Protonic Holland
5 * Copyright (c) 2014-2017 Pengutronix, Marc Kleine-Budde <kernel@pengutronix.de>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the version 2 of the GNU General Public License
9 * as published by the Free Software Foundation
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #ifndef _CAN_RX_OFFLOAD_H
18 #define _CAN_RX_OFFLOAD_H
20 #include <linux/netdevice.h>
21 #include <linux/can.h>
23 struct can_rx_offload
{
24 struct net_device
*dev
;
26 unsigned int (*mailbox_read
)(struct can_rx_offload
*offload
, struct can_frame
*cf
,
27 u32
*timestamp
, unsigned int mb
);
29 struct sk_buff_head skb_queue
;
30 u32 skb_queue_len_max
;
32 unsigned int mb_first
;
35 struct napi_struct napi
;
40 int can_rx_offload_add_timestamp(struct net_device
*dev
, struct can_rx_offload
*offload
);
41 int can_rx_offload_add_fifo(struct net_device
*dev
, struct can_rx_offload
*offload
, unsigned int weight
);
42 int can_rx_offload_irq_offload_timestamp(struct can_rx_offload
*offload
, u64 reg
);
43 int can_rx_offload_irq_offload_fifo(struct can_rx_offload
*offload
);
44 int can_rx_offload_irq_queue_err_skb(struct can_rx_offload
*offload
, struct sk_buff
*skb
);
45 void can_rx_offload_reset(struct can_rx_offload
*offload
);
46 void can_rx_offload_del(struct can_rx_offload
*offload
);
47 void can_rx_offload_enable(struct can_rx_offload
*offload
);
49 static inline void can_rx_offload_schedule(struct can_rx_offload
*offload
)
51 napi_schedule(&offload
->napi
);
54 static inline void can_rx_offload_disable(struct can_rx_offload
*offload
)
56 napi_disable(&offload
->napi
);
59 #endif /* !_CAN_RX_OFFLOAD_H */