Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * linux/can/rx-offload.h
0004  *
0005  * Copyright (c) 2014 David Jander, Protonic Holland
0006  * Copyright (c) 2014-2017 Pengutronix, Marc Kleine-Budde <kernel@pengutronix.de>
0007  */
0008 
0009 #ifndef _CAN_RX_OFFLOAD_H
0010 #define _CAN_RX_OFFLOAD_H
0011 
0012 #include <linux/netdevice.h>
0013 #include <linux/can.h>
0014 
0015 struct can_rx_offload {
0016     struct net_device *dev;
0017 
0018     struct sk_buff *(*mailbox_read)(struct can_rx_offload *offload,
0019                     unsigned int mb, u32 *timestamp,
0020                     bool drop);
0021 
0022     struct sk_buff_head skb_queue;
0023     struct sk_buff_head skb_irq_queue;
0024     u32 skb_queue_len_max;
0025 
0026     unsigned int mb_first;
0027     unsigned int mb_last;
0028 
0029     struct napi_struct napi;
0030 
0031     bool inc;
0032 };
0033 
0034 int can_rx_offload_add_timestamp(struct net_device *dev,
0035                  struct can_rx_offload *offload);
0036 int can_rx_offload_add_fifo(struct net_device *dev,
0037                 struct can_rx_offload *offload,
0038                 unsigned int weight);
0039 int can_rx_offload_add_manual(struct net_device *dev,
0040                   struct can_rx_offload *offload,
0041                   unsigned int weight);
0042 int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload,
0043                      u64 reg);
0044 int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload);
0045 int can_rx_offload_queue_timestamp(struct can_rx_offload *offload,
0046                    struct sk_buff *skb, u32 timestamp);
0047 unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload,
0048                      unsigned int idx, u32 timestamp,
0049                      unsigned int *frame_len_ptr);
0050 int can_rx_offload_queue_tail(struct can_rx_offload *offload,
0051                   struct sk_buff *skb);
0052 void can_rx_offload_irq_finish(struct can_rx_offload *offload);
0053 void can_rx_offload_threaded_irq_finish(struct can_rx_offload *offload);
0054 void can_rx_offload_del(struct can_rx_offload *offload);
0055 void can_rx_offload_enable(struct can_rx_offload *offload);
0056 
0057 static inline void can_rx_offload_disable(struct can_rx_offload *offload)
0058 {
0059     napi_disable(&offload->napi);
0060 }
0061 
0062 #endif /* !_CAN_RX_OFFLOAD_H */