[DCCP] ackvec: Remove unused dccpav_ack_ptr field from dccp_ackvec
[linux-2.6] / net / dccp / ackvec.h
1 #ifndef _ACKVEC_H
2 #define _ACKVEC_H
3 /*
4  *  net/dccp/ackvec.h
5  *
6  *  An implementation of the DCCP protocol
7  *  Copyright (c) 2005 Arnaldo Carvalho de Melo <acme@mandriva.com>
8  *
9  *      This program is free software; you can redistribute it and/or modify it
10  *      under the terms of the GNU General Public License version 2 as
11  *      published by the Free Software Foundation.
12  */
13
14 #include <linux/compiler.h>
15 #include <linux/list.h>
16 #include <linux/time.h>
17 #include <linux/types.h>
18
19 /* Read about the ECN nonce to see why it is 253 */
20 #define DCCP_MAX_ACKVEC_LEN 253
21
22 #define DCCP_ACKVEC_STATE_RECEIVED      0
23 #define DCCP_ACKVEC_STATE_ECN_MARKED    (1 << 6)
24 #define DCCP_ACKVEC_STATE_NOT_RECEIVED  (3 << 6)
25
26 #define DCCP_ACKVEC_STATE_MASK          0xC0 /* 11000000 */
27 #define DCCP_ACKVEC_LEN_MASK            0x3F /* 00111111 */
28
29 /** struct dccp_ackvec - ack vector
30  *
31  * This data structure is the one defined in RFC 4340, Appendix A.
32  *
33  * @dccpav_buf_head - circular buffer head
34  * @dccpav_buf_tail - circular buffer tail
35  * @dccpav_buf_ackno - ack # of the most recent packet acknowledgeable in the
36  *                     buffer (i.e. %dccpav_buf_head)
37  * @dccpav_buf_nonce - the one-bit sum of the ECN Nonces on all packets acked
38  *                     by the buffer with State 0
39  *
40  * Additionally, the HC-Receiver must keep some information about the
41  * Ack Vectors it has recently sent. For each packet sent carrying an
42  * Ack Vector, it remembers four variables:
43  *
44  * @dccpav_records - list of dccp_ackvec_record
45  * @dccpav_ack_nonce - the one-bit sum of the ECN Nonces for all State 0.
46  *
47  * @dccpav_time         - the time in usecs
48  * @dccpav_buf - circular buffer of acknowledgeable packets
49  */
50 struct dccp_ackvec {
51         u64             dccpav_buf_ackno;
52         struct list_head dccpav_records;
53         struct timeval  dccpav_time;
54         u8              dccpav_buf_head;
55         u8              dccpav_vec_len;
56         u8              dccpav_buf_nonce;
57         u8              dccpav_ack_nonce;
58         u8              dccpav_buf[DCCP_MAX_ACKVEC_LEN];
59 };
60
61 /** struct dccp_ackvec_record - ack vector record
62  *
63  * ACK vector record as defined in Appendix A of spec.
64  *
65  * The list is sorted by dccpavr_ack_seqno
66  *
67  * @dccpavr_node - node in dccpav_records
68  * @dccpavr_ack_seqno - sequence number of the packet this record was sent on
69  * @dccpavr_ack_ackno - sequence number being acknowledged
70  * @dccpavr_ack_ptr - pointer into dccpav_buf where this record starts
71  * @dccpavr_ack_nonce - dccpav_ack_nonce at the time this record was sent
72  * @dccpavr_sent_len - lenght of the record in dccpav_buf
73  */
74 struct dccp_ackvec_record {
75         struct list_head dccpavr_node;
76         u64              dccpavr_ack_seqno;
77         u64              dccpavr_ack_ackno;
78         u8               dccpavr_ack_ptr;
79         u8               dccpavr_ack_nonce;
80         u8               dccpavr_sent_len;
81 };
82
83 struct sock;
84 struct sk_buff;
85
86 #ifdef CONFIG_IP_DCCP_ACKVEC
87 extern int dccp_ackvec_init(void);
88 extern void dccp_ackvec_exit(void);
89
90 extern struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority);
91 extern void dccp_ackvec_free(struct dccp_ackvec *av);
92
93 extern int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
94                            const u64 ackno, const u8 state);
95
96 extern void dccp_ackvec_check_rcv_ackno(struct dccp_ackvec *av,
97                                         struct sock *sk, const u64 ackno);
98 extern int dccp_ackvec_parse(struct sock *sk, const struct sk_buff *skb,
99                              const u8 opt, const u8 *value, const u8 len);
100
101 extern int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb);
102
103 static inline int dccp_ackvec_pending(const struct dccp_ackvec *av)
104 {
105         return av->dccpav_vec_len;
106 }
107 #else /* CONFIG_IP_DCCP_ACKVEC */
108 static inline int dccp_ackvec_init(void)
109 {
110         return 0;
111 }
112
113 static inline void dccp_ackvec_exit(void)
114 {
115 }
116
117 static inline struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority)
118 {
119         return NULL;
120 }
121
122 static inline void dccp_ackvec_free(struct dccp_ackvec *av)
123 {
124 }
125
126 static inline int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
127                                   const u64 ackno, const u8 state)
128 {
129         return -1;
130 }
131
132 static inline void dccp_ackvec_check_rcv_ackno(struct dccp_ackvec *av,
133                                                struct sock *sk, const u64 ackno)
134 {
135 }
136
137 static inline int dccp_ackvec_parse(struct sock *sk, const struct sk_buff *skb,
138                                     const u8 opt, const u8 *value, const u8 len)
139 {
140         return -1;
141 }
142
143 static inline int dccp_insert_option_ackvec(const struct sock *sk,
144                                             const struct sk_buff *skb)
145 {
146         return -1;
147 }
148
149 static inline int dccp_ackvec_pending(const struct dccp_ackvec *av)
150 {
151         return 0;
152 }
153 #endif /* CONFIG_IP_DCCP_ACKVEC */
154 #endif /* _ACKVEC_H */