1#ifndef _ACKVEC_H
2#define _ACKVEC_H
3
4
5
6
7
8
9
10
11
12
13
14#include <linux/compiler.h>
15#include <linux/ktime.h>
16#include <linux/list.h>
17#include <linux/types.h>
18
19
20#define DCCP_MAX_ACKVEC_OPT_LEN 253
21
22#define DCCP_MAX_ACKVEC_LEN (DCCP_MAX_ACKVEC_OPT_LEN * 2)
23
24#define DCCP_ACKVEC_STATE_RECEIVED 0
25#define DCCP_ACKVEC_STATE_ECN_MARKED (1 << 6)
26#define DCCP_ACKVEC_STATE_NOT_RECEIVED (3 << 6)
27
28#define DCCP_ACKVEC_STATE_MASK 0xC0
29#define DCCP_ACKVEC_LEN_MASK 0x3F
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52struct dccp_ackvec {
53 u64 dccpav_buf_ackno;
54 struct list_head dccpav_records;
55 ktime_t dccpav_time;
56 u16 dccpav_buf_head;
57 u16 dccpav_vec_len;
58 u8 dccpav_buf_nonce;
59 u8 dccpav_ack_nonce;
60 u8 dccpav_buf[DCCP_MAX_ACKVEC_LEN];
61};
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76struct dccp_ackvec_record {
77 struct list_head dccpavr_node;
78 u64 dccpavr_ack_seqno;
79 u64 dccpavr_ack_ackno;
80 u16 dccpavr_ack_ptr;
81 u16 dccpavr_sent_len;
82 u8 dccpavr_ack_nonce;
83};
84
85struct sock;
86struct sk_buff;
87
88#ifdef CONFIG_IP_DCCP_ACKVEC
89extern int dccp_ackvec_init(void);
90extern void dccp_ackvec_exit(void);
91
92extern struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority);
93extern void dccp_ackvec_free(struct dccp_ackvec *av);
94
95extern int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
96 const u64 ackno, const u8 state);
97
98extern void dccp_ackvec_check_rcv_ackno(struct dccp_ackvec *av,
99 struct sock *sk, const u64 ackno);
100extern int dccp_ackvec_parse(struct sock *sk, const struct sk_buff *skb,
101 u64 *ackno, const u8 opt,
102 const u8 *value, const u8 len);
103
104extern int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb);
105
106static inline int dccp_ackvec_pending(const struct dccp_ackvec *av)
107{
108 return av->dccpav_vec_len;
109}
110#else
111static inline int dccp_ackvec_init(void)
112{
113 return 0;
114}
115
116static inline void dccp_ackvec_exit(void)
117{
118}
119
120static inline struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority)
121{
122 return NULL;
123}
124
125static inline void dccp_ackvec_free(struct dccp_ackvec *av)
126{
127}
128
129static inline int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
130 const u64 ackno, const u8 state)
131{
132 return -1;
133}
134
135static inline void dccp_ackvec_check_rcv_ackno(struct dccp_ackvec *av,
136 struct sock *sk, const u64 ackno)
137{
138}
139
140static inline int dccp_ackvec_parse(struct sock *sk, const struct sk_buff *skb,
141 const u64 *ackno, const u8 opt,
142 const u8 *value, const u8 len)
143{
144 return -1;
145}
146
147static inline int dccp_insert_option_ackvec(const struct sock *sk,
148 const struct sk_buff *skb)
149{
150 return -1;
151}
152
153static inline int dccp_ackvec_pending(const struct dccp_ackvec *av)
154{
155 return 0;
156}
157#endif
158#endif
159