162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _NET_ESPINTCP_H
362306a36Sopenharmony_ci#define _NET_ESPINTCP_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <net/strparser.h>
662306a36Sopenharmony_ci#include <linux/skmsg.h>
762306a36Sopenharmony_ci
862306a36Sopenharmony_civoid __init espintcp_init(void);
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciint espintcp_push_skb(struct sock *sk, struct sk_buff *skb);
1162306a36Sopenharmony_ciint espintcp_queue_out(struct sock *sk, struct sk_buff *skb);
1262306a36Sopenharmony_cibool tcp_is_ulp_esp(struct sock *sk);
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cistruct espintcp_msg {
1562306a36Sopenharmony_ci	struct sk_buff *skb;
1662306a36Sopenharmony_ci	struct sk_msg skmsg;
1762306a36Sopenharmony_ci	int offset;
1862306a36Sopenharmony_ci	int len;
1962306a36Sopenharmony_ci};
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_cistruct espintcp_ctx {
2262306a36Sopenharmony_ci	struct strparser strp;
2362306a36Sopenharmony_ci	struct sk_buff_head ike_queue;
2462306a36Sopenharmony_ci	struct sk_buff_head out_queue;
2562306a36Sopenharmony_ci	struct espintcp_msg partial;
2662306a36Sopenharmony_ci	void (*saved_data_ready)(struct sock *sk);
2762306a36Sopenharmony_ci	void (*saved_write_space)(struct sock *sk);
2862306a36Sopenharmony_ci	void (*saved_destruct)(struct sock *sk);
2962306a36Sopenharmony_ci	struct work_struct work;
3062306a36Sopenharmony_ci	bool tx_running;
3162306a36Sopenharmony_ci};
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_cistatic inline struct espintcp_ctx *espintcp_getctx(const struct sock *sk)
3462306a36Sopenharmony_ci{
3562306a36Sopenharmony_ci	struct inet_connection_sock *icsk = inet_csk(sk);
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci	/* RCU is only needed for diag */
3862306a36Sopenharmony_ci	return (__force void *)icsk->icsk_ulp_data;
3962306a36Sopenharmony_ci}
4062306a36Sopenharmony_ci#endif
41