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