2019-06-04 11:11:28 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2014-10-10 19:30:10 +04:00
|
|
|
/*
|
|
|
|
* linux/can/rx-offload.h
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014 David Jander, Protonic Holland
|
|
|
|
* Copyright (c) 2014-2017 Pengutronix, Marc Kleine-Budde <kernel@pengutronix.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CAN_RX_OFFLOAD_H
|
|
|
|
#define _CAN_RX_OFFLOAD_H
|
|
|
|
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/can.h>
|
|
|
|
|
|
|
|
struct can_rx_offload {
|
|
|
|
struct net_device *dev;
|
|
|
|
|
2019-07-12 11:02:38 +03:00
|
|
|
struct sk_buff *(*mailbox_read)(struct can_rx_offload *offload,
|
|
|
|
unsigned int mb, u32 *timestamp,
|
|
|
|
bool drop);
|
2014-10-10 19:30:10 +04:00
|
|
|
|
|
|
|
struct sk_buff_head skb_queue;
|
2019-10-09 07:41:08 +03:00
|
|
|
struct sk_buff_head skb_irq_queue;
|
2014-10-10 19:30:10 +04:00
|
|
|
u32 skb_queue_len_max;
|
|
|
|
|
2014-09-23 17:28:21 +04:00
|
|
|
unsigned int mb_first;
|
|
|
|
unsigned int mb_last;
|
|
|
|
|
2014-10-10 19:30:10 +04:00
|
|
|
struct napi_struct napi;
|
2014-09-23 17:28:21 +04:00
|
|
|
|
|
|
|
bool inc;
|
2014-10-10 19:30:10 +04:00
|
|
|
};
|
|
|
|
|
2019-08-27 14:53:18 +03:00
|
|
|
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);
|
2020-09-16 01:35:22 +03:00
|
|
|
int can_rx_offload_add_manual(struct net_device *dev,
|
|
|
|
struct can_rx_offload *offload,
|
|
|
|
unsigned int weight);
|
2019-08-27 14:53:18 +03:00
|
|
|
int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload,
|
|
|
|
u64 reg);
|
2014-10-10 19:30:10 +04:00
|
|
|
int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload);
|
2022-03-15 01:09:10 +03:00
|
|
|
int can_rx_offload_queue_timestamp(struct can_rx_offload *offload,
|
|
|
|
struct sk_buff *skb, u32 timestamp);
|
2018-09-18 12:40:38 +03:00
|
|
|
unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload,
|
2021-01-11 17:19:29 +03:00
|
|
|
unsigned int idx, u32 timestamp,
|
|
|
|
unsigned int *frame_len_ptr);
|
2018-09-18 12:40:40 +03:00
|
|
|
int can_rx_offload_queue_tail(struct can_rx_offload *offload,
|
|
|
|
struct sk_buff *skb);
|
2019-10-09 07:41:08 +03:00
|
|
|
void can_rx_offload_irq_finish(struct can_rx_offload *offload);
|
2021-05-10 23:51:39 +03:00
|
|
|
void can_rx_offload_threaded_irq_finish(struct can_rx_offload *offload);
|
2014-10-10 19:30:10 +04:00
|
|
|
void can_rx_offload_del(struct can_rx_offload *offload);
|
|
|
|
void can_rx_offload_enable(struct can_rx_offload *offload);
|
|
|
|
|
|
|
|
static inline void can_rx_offload_disable(struct can_rx_offload *offload)
|
|
|
|
{
|
|
|
|
napi_disable(&offload->napi);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* !_CAN_RX_OFFLOAD_H */
|