qrtr.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __QRTR_H_
  3. #define __QRTR_H_
  4. #include <linux/types.h>
  5. struct sk_buff;
  6. /* endpoint node id auto assignment */
  7. #define QRTR_EP_NID_AUTO (-1)
  8. #define QRTR_EP_NET_ID_AUTO (1)
  9. #define QRTR_DEL_PROC_MAGIC 0xe111
  10. /**
  11. * struct qrtr_endpoint - endpoint handle
  12. * @xmit: Callback for outgoing packets
  13. *
  14. * The socket buffer passed to the xmit function becomes owned by the endpoint
  15. * driver. As such, when the driver is done with the buffer, it should
  16. * call kfree_skb() on failure, or consume_skb() on success.
  17. */
  18. struct qrtr_endpoint {
  19. int (*xmit)(struct qrtr_endpoint *ep, struct sk_buff *skb);
  20. /* private: not for endpoint use */
  21. struct qrtr_node *node;
  22. };
  23. /**
  24. * struct qrtr_array - array with size
  25. * @arr: elements in the array
  26. * @size: number of elements
  27. *
  28. * An array with its size provided.
  29. */
  30. struct qrtr_array {
  31. u32 *arr;
  32. size_t size;
  33. };
  34. int qrtr_endpoint_register(struct qrtr_endpoint *ep, unsigned int net_id,
  35. bool rt, struct qrtr_array *no_wake);
  36. void qrtr_endpoint_unregister(struct qrtr_endpoint *ep);
  37. int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len);
  38. int qrtr_ns_init(void);
  39. void qrtr_ns_remove(void);
  40. int qrtr_peek_pkt_size(const void *data);
  41. int qrtr_get_service_id(unsigned int node_id, unsigned int port_id);
  42. void qrtr_print_wakeup_reason(const void *data);
  43. #endif