18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _NET_ESPINTCP_H
38c2ecf20Sopenharmony_ci#define _NET_ESPINTCP_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <net/strparser.h>
68c2ecf20Sopenharmony_ci#include <linux/skmsg.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_civoid __init espintcp_init(void);
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciint espintcp_push_skb(struct sock *sk, struct sk_buff *skb);
118c2ecf20Sopenharmony_ciint espintcp_queue_out(struct sock *sk, struct sk_buff *skb);
128c2ecf20Sopenharmony_cibool tcp_is_ulp_esp(struct sock *sk);
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cistruct espintcp_msg {
158c2ecf20Sopenharmony_ci	struct sk_buff *skb;
168c2ecf20Sopenharmony_ci	struct sk_msg skmsg;
178c2ecf20Sopenharmony_ci	int offset;
188c2ecf20Sopenharmony_ci	int len;
198c2ecf20Sopenharmony_ci};
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistruct espintcp_ctx {
228c2ecf20Sopenharmony_ci	struct strparser strp;
238c2ecf20Sopenharmony_ci	struct sk_buff_head ike_queue;
248c2ecf20Sopenharmony_ci	struct sk_buff_head out_queue;
258c2ecf20Sopenharmony_ci	struct espintcp_msg partial;
268c2ecf20Sopenharmony_ci	void (*saved_data_ready)(struct sock *sk);
278c2ecf20Sopenharmony_ci	void (*saved_write_space)(struct sock *sk);
288c2ecf20Sopenharmony_ci	void (*saved_destruct)(struct sock *sk);
298c2ecf20Sopenharmony_ci	struct work_struct work;
308c2ecf20Sopenharmony_ci	bool tx_running;
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistatic inline struct espintcp_ctx *espintcp_getctx(const struct sock *sk)
348c2ecf20Sopenharmony_ci{
358c2ecf20Sopenharmony_ci	struct inet_connection_sock *icsk = inet_csk(sk);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	/* RCU is only needed for diag */
388c2ecf20Sopenharmony_ci	return (__force void *)icsk->icsk_ulp_data;
398c2ecf20Sopenharmony_ci}
408c2ecf20Sopenharmony_ci#endif
41