xref: /linux/include/net/espintcp.h (revision 621cde16e49b3ecf7d59a8106a20aaebfb4a59a9)
1e27cca96SSabrina Dubroca /* SPDX-License-Identifier: GPL-2.0 */
2e27cca96SSabrina Dubroca #ifndef _NET_ESPINTCP_H
3e27cca96SSabrina Dubroca #define _NET_ESPINTCP_H
4e27cca96SSabrina Dubroca 
5e27cca96SSabrina Dubroca #include <net/strparser.h>
6e27cca96SSabrina Dubroca #include <linux/skmsg.h>
7e27cca96SSabrina Dubroca 
8e27cca96SSabrina Dubroca void __init espintcp_init(void);
9e27cca96SSabrina Dubroca 
10e27cca96SSabrina Dubroca int espintcp_push_skb(struct sock *sk, struct sk_buff *skb);
11e27cca96SSabrina Dubroca int espintcp_queue_out(struct sock *sk, struct sk_buff *skb);
12e27cca96SSabrina Dubroca bool tcp_is_ulp_esp(struct sock *sk);
13e27cca96SSabrina Dubroca 
14e27cca96SSabrina Dubroca struct espintcp_msg {
15e27cca96SSabrina Dubroca 	struct sk_buff *skb;
16e27cca96SSabrina Dubroca 	struct sk_msg skmsg;
17e27cca96SSabrina Dubroca 	int offset;
18e27cca96SSabrina Dubroca 	int len;
19e27cca96SSabrina Dubroca };
20e27cca96SSabrina Dubroca 
21e27cca96SSabrina Dubroca struct espintcp_ctx {
22e27cca96SSabrina Dubroca 	struct strparser strp;
23e27cca96SSabrina Dubroca 	struct sk_buff_head ike_queue;
24e27cca96SSabrina Dubroca 	struct sk_buff_head out_queue;
25e27cca96SSabrina Dubroca 	struct espintcp_msg partial;
26e27cca96SSabrina Dubroca 	void (*saved_data_ready)(struct sock *sk);
27e27cca96SSabrina Dubroca 	void (*saved_write_space)(struct sock *sk);
289f0cadc3SSabrina Dubroca 	void (*saved_destruct)(struct sock *sk);
29e27cca96SSabrina Dubroca 	struct work_struct work;
30e27cca96SSabrina Dubroca 	bool tx_running;
31e27cca96SSabrina Dubroca };
32e27cca96SSabrina Dubroca 
espintcp_getctx(const struct sock * sk)33e27cca96SSabrina Dubroca static inline struct espintcp_ctx *espintcp_getctx(const struct sock *sk)
34e27cca96SSabrina Dubroca {
35*58169ec9SEric Dumazet 	const struct inet_connection_sock *icsk = inet_csk(sk);
36e27cca96SSabrina Dubroca 
37e27cca96SSabrina Dubroca 	/* RCU is only needed for diag */
38e27cca96SSabrina Dubroca 	return (__force void *)icsk->icsk_ulp_data;
39e27cca96SSabrina Dubroca }
40e27cca96SSabrina Dubroca #endif
41