rx-offload.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * linux/can/rx-offload.h
  4. *
  5. * Copyright (c) 2014 David Jander, Protonic Holland
  6. * Copyright (c) 2014-2017 Pengutronix, Marc Kleine-Budde <[email protected]>
  7. */
  8. #ifndef _CAN_RX_OFFLOAD_H
  9. #define _CAN_RX_OFFLOAD_H
  10. #include <linux/netdevice.h>
  11. #include <linux/can.h>
  12. struct can_rx_offload {
  13. struct net_device *dev;
  14. struct sk_buff *(*mailbox_read)(struct can_rx_offload *offload,
  15. unsigned int mb, u32 *timestamp,
  16. bool drop);
  17. struct sk_buff_head skb_queue;
  18. struct sk_buff_head skb_irq_queue;
  19. u32 skb_queue_len_max;
  20. unsigned int mb_first;
  21. unsigned int mb_last;
  22. struct napi_struct napi;
  23. bool inc;
  24. };
  25. int can_rx_offload_add_timestamp(struct net_device *dev,
  26. struct can_rx_offload *offload);
  27. int can_rx_offload_add_fifo(struct net_device *dev,
  28. struct can_rx_offload *offload,
  29. unsigned int weight);
  30. int can_rx_offload_add_manual(struct net_device *dev,
  31. struct can_rx_offload *offload,
  32. unsigned int weight);
  33. int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload,
  34. u64 reg);
  35. int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload);
  36. int can_rx_offload_queue_timestamp(struct can_rx_offload *offload,
  37. struct sk_buff *skb, u32 timestamp);
  38. unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload,
  39. unsigned int idx, u32 timestamp,
  40. unsigned int *frame_len_ptr);
  41. int can_rx_offload_queue_tail(struct can_rx_offload *offload,
  42. struct sk_buff *skb);
  43. void can_rx_offload_irq_finish(struct can_rx_offload *offload);
  44. void can_rx_offload_threaded_irq_finish(struct can_rx_offload *offload);
  45. void can_rx_offload_del(struct can_rx_offload *offload);
  46. void can_rx_offload_enable(struct can_rx_offload *offload);
  47. static inline void can_rx_offload_disable(struct can_rx_offload *offload)
  48. {
  49. napi_disable(&offload->napi);
  50. }
  51. #endif /* !_CAN_RX_OFFLOAD_H */