diff options
| author | David Jander <david@protonic.nl> | 2014-10-10 11:30:10 -0400 |
|---|---|---|
| committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2017-02-06 09:13:23 -0500 |
| commit | d254586c34538c0014280806c5d4795697cf21e5 (patch) | |
| tree | ecce05b11eb440dc8bfc211de75304cd977ebbf9 /include/linux | |
| parent | bd092ad1463ca0990581fa992e12a9b0ed295d25 (diff) | |
can: rx-offload: Add support for HW fifo based irq offloading
Some CAN controllers have a usable FIFO already but can still benefit
from off-loading the CAN controller FIFO. The CAN frames of the FIFO are
read and put into a skb queue during interrupt and then transmitted in a
NAPI context.
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/can/rx-offload.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/include/linux/can/rx-offload.h b/include/linux/can/rx-offload.h new file mode 100644 index 000000000000..cadfe9869600 --- /dev/null +++ b/include/linux/can/rx-offload.h | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* | ||
| 2 | * linux/can/rx-offload.h | ||
| 3 | * | ||
| 4 | * Copyright (c) 2014 David Jander, Protonic Holland | ||
| 5 | * Copyright (c) 2014-2017 Pengutronix, Marc Kleine-Budde <kernel@pengutronix.de> | ||
| 6 | * | ||
| 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 | ||
| 10 | * | ||
| 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. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef _CAN_RX_OFFLOAD_H | ||
| 18 | #define _CAN_RX_OFFLOAD_H | ||
| 19 | |||
| 20 | #include <linux/netdevice.h> | ||
| 21 | #include <linux/can.h> | ||
| 22 | |||
| 23 | struct can_rx_offload { | ||
| 24 | struct net_device *dev; | ||
| 25 | |||
| 26 | unsigned int (*mailbox_read)(struct can_rx_offload *offload, struct can_frame *cf, unsigned int mb); | ||
| 27 | |||
| 28 | struct sk_buff_head skb_queue; | ||
| 29 | u32 skb_queue_len_max; | ||
| 30 | |||
| 31 | struct napi_struct napi; | ||
| 32 | }; | ||
| 33 | |||
| 34 | int can_rx_offload_add_fifo(struct net_device *dev, struct can_rx_offload *offload, unsigned int weight); | ||
| 35 | int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload); | ||
| 36 | int can_rx_offload_irq_queue_err_skb(struct can_rx_offload *offload, struct sk_buff *skb); | ||
| 37 | void can_rx_offload_reset(struct can_rx_offload *offload); | ||
| 38 | void can_rx_offload_del(struct can_rx_offload *offload); | ||
| 39 | void can_rx_offload_enable(struct can_rx_offload *offload); | ||
| 40 | |||
| 41 | static inline void can_rx_offload_schedule(struct can_rx_offload *offload) | ||
| 42 | { | ||
| 43 | napi_schedule(&offload->napi); | ||
| 44 | } | ||
| 45 | |||
| 46 | static inline void can_rx_offload_disable(struct can_rx_offload *offload) | ||
| 47 | { | ||
| 48 | napi_disable(&offload->napi); | ||
| 49 | } | ||
| 50 | |||
| 51 | #endif /* !_CAN_RX_OFFLOAD_H */ | ||
