xref: /kernel/linux/linux-5.10/net/qrtr/qrtr.h (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __QRTR_H_
38c2ecf20Sopenharmony_ci#define __QRTR_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/types.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cistruct sk_buff;
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/* endpoint node id auto assignment */
108c2ecf20Sopenharmony_ci#define QRTR_EP_NID_AUTO (-1)
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/**
138c2ecf20Sopenharmony_ci * struct qrtr_endpoint - endpoint handle
148c2ecf20Sopenharmony_ci * @xmit: Callback for outgoing packets
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci * The socket buffer passed to the xmit function becomes owned by the endpoint
178c2ecf20Sopenharmony_ci * driver.  As such, when the driver is done with the buffer, it should
188c2ecf20Sopenharmony_ci * call kfree_skb() on failure, or consume_skb() on success.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_cistruct qrtr_endpoint {
218c2ecf20Sopenharmony_ci	int (*xmit)(struct qrtr_endpoint *ep, struct sk_buff *skb);
228c2ecf20Sopenharmony_ci	/* private: not for endpoint use */
238c2ecf20Sopenharmony_ci	struct qrtr_node *node;
248c2ecf20Sopenharmony_ci};
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciint qrtr_endpoint_register(struct qrtr_endpoint *ep, unsigned int nid);
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_civoid qrtr_endpoint_unregister(struct qrtr_endpoint *ep);
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciint qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len);
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_civoid qrtr_ns_init(void);
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_civoid qrtr_ns_remove(void);
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#endif
37