diff options
-rw-r--r-- | net/dccp/ackvec.c | 163 | ||||
-rw-r--r-- | net/dccp/ackvec.h | 62 |
2 files changed, 108 insertions, 117 deletions
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c index 83378f379f72..6de4bd195d28 100644 --- a/net/dccp/ackvec.c +++ b/net/dccp/ackvec.c | |||
@@ -30,7 +30,7 @@ static struct dccp_ackvec_record *dccp_ackvec_record_new(void) | |||
30 | kmem_cache_alloc(dccp_ackvec_record_slab, GFP_ATOMIC); | 30 | kmem_cache_alloc(dccp_ackvec_record_slab, GFP_ATOMIC); |
31 | 31 | ||
32 | if (avr != NULL) | 32 | if (avr != NULL) |
33 | INIT_LIST_HEAD(&avr->dccpavr_node); | 33 | INIT_LIST_HEAD(&avr->avr_node); |
34 | 34 | ||
35 | return avr; | 35 | return avr; |
36 | } | 36 | } |
@@ -40,7 +40,7 @@ static void dccp_ackvec_record_delete(struct dccp_ackvec_record *avr) | |||
40 | if (unlikely(avr == NULL)) | 40 | if (unlikely(avr == NULL)) |
41 | return; | 41 | return; |
42 | /* Check if deleting a linked record */ | 42 | /* Check if deleting a linked record */ |
43 | WARN_ON(!list_empty(&avr->dccpavr_node)); | 43 | WARN_ON(!list_empty(&avr->avr_node)); |
44 | kmem_cache_free(dccp_ackvec_record_slab, avr); | 44 | kmem_cache_free(dccp_ackvec_record_slab, avr); |
45 | } | 45 | } |
46 | 46 | ||
@@ -52,16 +52,15 @@ static void dccp_ackvec_insert_avr(struct dccp_ackvec *av, | |||
52 | * just add the AVR at the head of the list. | 52 | * just add the AVR at the head of the list. |
53 | * -sorbo. | 53 | * -sorbo. |
54 | */ | 54 | */ |
55 | if (!list_empty(&av->dccpav_records)) { | 55 | if (!list_empty(&av->av_records)) { |
56 | const struct dccp_ackvec_record *head = | 56 | const struct dccp_ackvec_record *head = |
57 | list_entry(av->dccpav_records.next, | 57 | list_entry(av->av_records.next, |
58 | struct dccp_ackvec_record, | 58 | struct dccp_ackvec_record, |
59 | dccpavr_node); | 59 | avr_node); |
60 | BUG_ON(before48(avr->dccpavr_ack_seqno, | 60 | BUG_ON(before48(avr->avr_ack_seqno, head->avr_ack_seqno)); |
61 | head->dccpavr_ack_seqno)); | ||
62 | } | 61 | } |
63 | 62 | ||
64 | list_add(&avr->dccpavr_node, &av->dccpav_records); | 63 | list_add(&avr->avr_node, &av->av_records); |
65 | } | 64 | } |
66 | 65 | ||
67 | int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) | 66 | int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) |
@@ -69,9 +68,8 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) | |||
69 | struct dccp_sock *dp = dccp_sk(sk); | 68 | struct dccp_sock *dp = dccp_sk(sk); |
70 | struct dccp_ackvec *av = dp->dccps_hc_rx_ackvec; | 69 | struct dccp_ackvec *av = dp->dccps_hc_rx_ackvec; |
71 | /* Figure out how many options do we need to represent the ackvec */ | 70 | /* Figure out how many options do we need to represent the ackvec */ |
72 | const u16 nr_opts = DIV_ROUND_UP(av->dccpav_vec_len, | 71 | const u16 nr_opts = DIV_ROUND_UP(av->av_vec_len, DCCP_MAX_ACKVEC_OPT_LEN); |
73 | DCCP_MAX_ACKVEC_OPT_LEN); | 72 | u16 len = av->av_vec_len + 2 * nr_opts, i; |
74 | u16 len = av->dccpav_vec_len + 2 * nr_opts, i; | ||
75 | u32 elapsed_time; | 73 | u32 elapsed_time; |
76 | const unsigned char *tail, *from; | 74 | const unsigned char *tail, *from; |
77 | unsigned char *to; | 75 | unsigned char *to; |
@@ -81,7 +79,7 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) | |||
81 | if (DCCP_SKB_CB(skb)->dccpd_opt_len + len > DCCP_MAX_OPT_LEN) | 79 | if (DCCP_SKB_CB(skb)->dccpd_opt_len + len > DCCP_MAX_OPT_LEN) |
82 | return -1; | 80 | return -1; |
83 | 81 | ||
84 | delta = ktime_us_delta(ktime_get_real(), av->dccpav_time); | 82 | delta = ktime_us_delta(ktime_get_real(), av->av_time); |
85 | elapsed_time = delta / 10; | 83 | elapsed_time = delta / 10; |
86 | 84 | ||
87 | if (elapsed_time != 0 && | 85 | if (elapsed_time != 0 && |
@@ -95,9 +93,9 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) | |||
95 | DCCP_SKB_CB(skb)->dccpd_opt_len += len; | 93 | DCCP_SKB_CB(skb)->dccpd_opt_len += len; |
96 | 94 | ||
97 | to = skb_push(skb, len); | 95 | to = skb_push(skb, len); |
98 | len = av->dccpav_vec_len; | 96 | len = av->av_vec_len; |
99 | from = av->dccpav_buf + av->dccpav_buf_head; | 97 | from = av->av_buf + av->av_buf_head; |
100 | tail = av->dccpav_buf + DCCP_MAX_ACKVEC_LEN; | 98 | tail = av->av_buf + DCCP_MAX_ACKVEC_LEN; |
101 | 99 | ||
102 | for (i = 0; i < nr_opts; ++i) { | 100 | for (i = 0; i < nr_opts; ++i) { |
103 | int copylen = len; | 101 | int copylen = len; |
@@ -116,7 +114,7 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) | |||
116 | to += tailsize; | 114 | to += tailsize; |
117 | len -= tailsize; | 115 | len -= tailsize; |
118 | copylen -= tailsize; | 116 | copylen -= tailsize; |
119 | from = av->dccpav_buf; | 117 | from = av->av_buf; |
120 | } | 118 | } |
121 | 119 | ||
122 | memcpy(to, from, copylen); | 120 | memcpy(to, from, copylen); |
@@ -134,19 +132,19 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) | |||
134 | * buf_head; ack_ackno will equal buf_ackno; and ack_nonce will | 132 | * buf_head; ack_ackno will equal buf_ackno; and ack_nonce will |
135 | * equal buf_nonce. | 133 | * equal buf_nonce. |
136 | */ | 134 | */ |
137 | avr->dccpavr_ack_seqno = DCCP_SKB_CB(skb)->dccpd_seq; | 135 | avr->avr_ack_seqno = DCCP_SKB_CB(skb)->dccpd_seq; |
138 | avr->dccpavr_ack_ptr = av->dccpav_buf_head; | 136 | avr->avr_ack_ptr = av->av_buf_head; |
139 | avr->dccpavr_ack_ackno = av->dccpav_buf_ackno; | 137 | avr->avr_ack_ackno = av->av_buf_ackno; |
140 | avr->dccpavr_ack_nonce = av->dccpav_buf_nonce; | 138 | avr->avr_ack_nonce = av->av_buf_nonce; |
141 | avr->dccpavr_sent_len = av->dccpav_vec_len; | 139 | avr->avr_sent_len = av->av_vec_len; |
142 | 140 | ||
143 | dccp_ackvec_insert_avr(av, avr); | 141 | dccp_ackvec_insert_avr(av, avr); |
144 | 142 | ||
145 | dccp_pr_debug("%s ACK Vector 0, len=%d, ack_seqno=%llu, " | 143 | dccp_pr_debug("%s ACK Vector 0, len=%d, ack_seqno=%llu, " |
146 | "ack_ackno=%llu\n", | 144 | "ack_ackno=%llu\n", |
147 | dccp_role(sk), avr->dccpavr_sent_len, | 145 | dccp_role(sk), avr->avr_sent_len, |
148 | (unsigned long long)avr->dccpavr_ack_seqno, | 146 | (unsigned long long)avr->avr_ack_seqno, |
149 | (unsigned long long)avr->dccpavr_ack_ackno); | 147 | (unsigned long long)avr->avr_ack_ackno); |
150 | return 0; | 148 | return 0; |
151 | } | 149 | } |
152 | 150 | ||
@@ -155,12 +153,12 @@ struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority) | |||
155 | struct dccp_ackvec *av = kmem_cache_alloc(dccp_ackvec_slab, priority); | 153 | struct dccp_ackvec *av = kmem_cache_alloc(dccp_ackvec_slab, priority); |
156 | 154 | ||
157 | if (av != NULL) { | 155 | if (av != NULL) { |
158 | av->dccpav_buf_head = DCCP_MAX_ACKVEC_LEN - 1; | 156 | av->av_buf_head = DCCP_MAX_ACKVEC_LEN - 1; |
159 | av->dccpav_buf_ackno = UINT48_MAX + 1; | 157 | av->av_buf_ackno = UINT48_MAX + 1; |
160 | av->dccpav_buf_nonce = av->dccpav_buf_nonce = 0; | 158 | av->av_buf_nonce = 0; |
161 | av->dccpav_time = ktime_set(0, 0); | 159 | av->av_time = ktime_set(0, 0); |
162 | av->dccpav_vec_len = 0; | 160 | av->av_vec_len = 0; |
163 | INIT_LIST_HEAD(&av->dccpav_records); | 161 | INIT_LIST_HEAD(&av->av_records); |
164 | } | 162 | } |
165 | 163 | ||
166 | return av; | 164 | return av; |
@@ -171,12 +169,11 @@ void dccp_ackvec_free(struct dccp_ackvec *av) | |||
171 | if (unlikely(av == NULL)) | 169 | if (unlikely(av == NULL)) |
172 | return; | 170 | return; |
173 | 171 | ||
174 | if (!list_empty(&av->dccpav_records)) { | 172 | if (!list_empty(&av->av_records)) { |
175 | struct dccp_ackvec_record *avr, *next; | 173 | struct dccp_ackvec_record *avr, *next; |
176 | 174 | ||
177 | list_for_each_entry_safe(avr, next, &av->dccpav_records, | 175 | list_for_each_entry_safe(avr, next, &av->av_records, avr_node) { |
178 | dccpavr_node) { | 176 | list_del_init(&avr->avr_node); |
179 | list_del_init(&avr->dccpavr_node); | ||
180 | dccp_ackvec_record_delete(avr); | 177 | dccp_ackvec_record_delete(avr); |
181 | } | 178 | } |
182 | } | 179 | } |
@@ -187,13 +184,13 @@ void dccp_ackvec_free(struct dccp_ackvec *av) | |||
187 | static inline u8 dccp_ackvec_state(const struct dccp_ackvec *av, | 184 | static inline u8 dccp_ackvec_state(const struct dccp_ackvec *av, |
188 | const u32 index) | 185 | const u32 index) |
189 | { | 186 | { |
190 | return av->dccpav_buf[index] & DCCP_ACKVEC_STATE_MASK; | 187 | return av->av_buf[index] & DCCP_ACKVEC_STATE_MASK; |
191 | } | 188 | } |
192 | 189 | ||
193 | static inline u8 dccp_ackvec_len(const struct dccp_ackvec *av, | 190 | static inline u8 dccp_ackvec_len(const struct dccp_ackvec *av, |
194 | const u32 index) | 191 | const u32 index) |
195 | { | 192 | { |
196 | return av->dccpav_buf[index] & DCCP_ACKVEC_LEN_MASK; | 193 | return av->av_buf[index] & DCCP_ACKVEC_LEN_MASK; |
197 | } | 194 | } |
198 | 195 | ||
199 | /* | 196 | /* |
@@ -208,29 +205,29 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av, | |||
208 | unsigned int gap; | 205 | unsigned int gap; |
209 | long new_head; | 206 | long new_head; |
210 | 207 | ||
211 | if (av->dccpav_vec_len + packets > DCCP_MAX_ACKVEC_LEN) | 208 | if (av->av_vec_len + packets > DCCP_MAX_ACKVEC_LEN) |
212 | return -ENOBUFS; | 209 | return -ENOBUFS; |
213 | 210 | ||
214 | gap = packets - 1; | 211 | gap = packets - 1; |
215 | new_head = av->dccpav_buf_head - packets; | 212 | new_head = av->av_buf_head - packets; |
216 | 213 | ||
217 | if (new_head < 0) { | 214 | if (new_head < 0) { |
218 | if (gap > 0) { | 215 | if (gap > 0) { |
219 | memset(av->dccpav_buf, DCCP_ACKVEC_STATE_NOT_RECEIVED, | 216 | memset(av->av_buf, DCCP_ACKVEC_STATE_NOT_RECEIVED, |
220 | gap + new_head + 1); | 217 | gap + new_head + 1); |
221 | gap = -new_head; | 218 | gap = -new_head; |
222 | } | 219 | } |
223 | new_head += DCCP_MAX_ACKVEC_LEN; | 220 | new_head += DCCP_MAX_ACKVEC_LEN; |
224 | } | 221 | } |
225 | 222 | ||
226 | av->dccpav_buf_head = new_head; | 223 | av->av_buf_head = new_head; |
227 | 224 | ||
228 | if (gap > 0) | 225 | if (gap > 0) |
229 | memset(av->dccpav_buf + av->dccpav_buf_head + 1, | 226 | memset(av->av_buf + av->av_buf_head + 1, |
230 | DCCP_ACKVEC_STATE_NOT_RECEIVED, gap); | 227 | DCCP_ACKVEC_STATE_NOT_RECEIVED, gap); |
231 | 228 | ||
232 | av->dccpav_buf[av->dccpav_buf_head] = state; | 229 | av->av_buf[av->av_buf_head] = state; |
233 | av->dccpav_vec_len += packets; | 230 | av->av_vec_len += packets; |
234 | return 0; | 231 | return 0; |
235 | } | 232 | } |
236 | 233 | ||
@@ -243,7 +240,7 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, | |||
243 | /* | 240 | /* |
244 | * Check at the right places if the buffer is full, if it is, tell the | 241 | * Check at the right places if the buffer is full, if it is, tell the |
245 | * caller to start dropping packets till the HC-Sender acks our ACK | 242 | * caller to start dropping packets till the HC-Sender acks our ACK |
246 | * vectors, when we will free up space in dccpav_buf. | 243 | * vectors, when we will free up space in av_buf. |
247 | * | 244 | * |
248 | * We may well decide to do buffer compression, etc, but for now lets | 245 | * We may well decide to do buffer compression, etc, but for now lets |
249 | * just drop. | 246 | * just drop. |
@@ -263,22 +260,20 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, | |||
263 | */ | 260 | */ |
264 | 261 | ||
265 | /* See if this is the first ackno being inserted */ | 262 | /* See if this is the first ackno being inserted */ |
266 | if (av->dccpav_vec_len == 0) { | 263 | if (av->av_vec_len == 0) { |
267 | av->dccpav_buf[av->dccpav_buf_head] = state; | 264 | av->av_buf[av->av_buf_head] = state; |
268 | av->dccpav_vec_len = 1; | 265 | av->av_vec_len = 1; |
269 | } else if (after48(ackno, av->dccpav_buf_ackno)) { | 266 | } else if (after48(ackno, av->av_buf_ackno)) { |
270 | const u64 delta = dccp_delta_seqno(av->dccpav_buf_ackno, | 267 | const u64 delta = dccp_delta_seqno(av->av_buf_ackno, ackno); |
271 | ackno); | ||
272 | 268 | ||
273 | /* | 269 | /* |
274 | * Look if the state of this packet is the same as the | 270 | * Look if the state of this packet is the same as the |
275 | * previous ackno and if so if we can bump the head len. | 271 | * previous ackno and if so if we can bump the head len. |
276 | */ | 272 | */ |
277 | if (delta == 1 && | 273 | if (delta == 1 && |
278 | dccp_ackvec_state(av, av->dccpav_buf_head) == state && | 274 | dccp_ackvec_state(av, av->av_buf_head) == state && |
279 | (dccp_ackvec_len(av, av->dccpav_buf_head) < | 275 | dccp_ackvec_len(av, av->av_buf_head) < DCCP_ACKVEC_LEN_MASK) |
280 | DCCP_ACKVEC_LEN_MASK)) | 276 | av->av_buf[av->av_buf_head]++; |
281 | av->dccpav_buf[av->dccpav_buf_head]++; | ||
282 | else if (dccp_ackvec_set_buf_head_state(av, delta, state)) | 277 | else if (dccp_ackvec_set_buf_head_state(av, delta, state)) |
283 | return -ENOBUFS; | 278 | return -ENOBUFS; |
284 | } else { | 279 | } else { |
@@ -290,14 +285,14 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, | |||
290 | * the byte corresponding to S. (Indexing structures | 285 | * the byte corresponding to S. (Indexing structures |
291 | * could reduce the complexity of this scan.) | 286 | * could reduce the complexity of this scan.) |
292 | */ | 287 | */ |
293 | u64 delta = dccp_delta_seqno(ackno, av->dccpav_buf_ackno); | 288 | u64 delta = dccp_delta_seqno(ackno, av->av_buf_ackno); |
294 | u32 index = av->dccpav_buf_head; | 289 | u32 index = av->av_buf_head; |
295 | 290 | ||
296 | while (1) { | 291 | while (1) { |
297 | const u8 len = dccp_ackvec_len(av, index); | 292 | const u8 len = dccp_ackvec_len(av, index); |
298 | const u8 state = dccp_ackvec_state(av, index); | 293 | const u8 state = dccp_ackvec_state(av, index); |
299 | /* | 294 | /* |
300 | * valid packets not yet in dccpav_buf have a reserved | 295 | * valid packets not yet in av_buf have a reserved |
301 | * entry, with a len equal to 0. | 296 | * entry, with a len equal to 0. |
302 | */ | 297 | */ |
303 | if (state == DCCP_ACKVEC_STATE_NOT_RECEIVED && | 298 | if (state == DCCP_ACKVEC_STATE_NOT_RECEIVED && |
@@ -305,7 +300,7 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, | |||
305 | reserved seat! */ | 300 | reserved seat! */ |
306 | dccp_pr_debug("Found %llu reserved seat!\n", | 301 | dccp_pr_debug("Found %llu reserved seat!\n", |
307 | (unsigned long long)ackno); | 302 | (unsigned long long)ackno); |
308 | av->dccpav_buf[index] = state; | 303 | av->av_buf[index] = state; |
309 | goto out; | 304 | goto out; |
310 | } | 305 | } |
311 | /* len == 0 means one packet */ | 306 | /* len == 0 means one packet */ |
@@ -318,8 +313,8 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, | |||
318 | } | 313 | } |
319 | } | 314 | } |
320 | 315 | ||
321 | av->dccpav_buf_ackno = ackno; | 316 | av->av_buf_ackno = ackno; |
322 | av->dccpav_time = ktime_get_real(); | 317 | av->av_time = ktime_get_real(); |
323 | out: | 318 | out: |
324 | return 0; | 319 | return 0; |
325 | 320 | ||
@@ -349,9 +344,9 @@ void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len) | |||
349 | 344 | ||
350 | void dccp_ackvec_print(const struct dccp_ackvec *av) | 345 | void dccp_ackvec_print(const struct dccp_ackvec *av) |
351 | { | 346 | { |
352 | dccp_ackvector_print(av->dccpav_buf_ackno, | 347 | dccp_ackvector_print(av->av_buf_ackno, |
353 | av->dccpav_buf + av->dccpav_buf_head, | 348 | av->av_buf + av->av_buf_head, |
354 | av->dccpav_vec_len); | 349 | av->av_vec_len); |
355 | } | 350 | } |
356 | #endif | 351 | #endif |
357 | 352 | ||
@@ -361,17 +356,15 @@ static void dccp_ackvec_throw_record(struct dccp_ackvec *av, | |||
361 | struct dccp_ackvec_record *next; | 356 | struct dccp_ackvec_record *next; |
362 | 357 | ||
363 | /* sort out vector length */ | 358 | /* sort out vector length */ |
364 | if (av->dccpav_buf_head <= avr->dccpavr_ack_ptr) | 359 | if (av->av_buf_head <= avr->avr_ack_ptr) |
365 | av->dccpav_vec_len = avr->dccpavr_ack_ptr - av->dccpav_buf_head; | 360 | av->av_vec_len = avr->avr_ack_ptr - av->av_buf_head; |
366 | else | 361 | else |
367 | av->dccpav_vec_len = DCCP_MAX_ACKVEC_LEN - 1 | 362 | av->av_vec_len = DCCP_MAX_ACKVEC_LEN - 1 - |
368 | - av->dccpav_buf_head | 363 | av->av_buf_head + avr->avr_ack_ptr; |
369 | + avr->dccpavr_ack_ptr; | ||
370 | 364 | ||
371 | /* free records */ | 365 | /* free records */ |
372 | list_for_each_entry_safe_from(avr, next, &av->dccpav_records, | 366 | list_for_each_entry_safe_from(avr, next, &av->av_records, avr_node) { |
373 | dccpavr_node) { | 367 | list_del_init(&avr->avr_node); |
374 | list_del_init(&avr->dccpavr_node); | ||
375 | dccp_ackvec_record_delete(avr); | 368 | dccp_ackvec_record_delete(avr); |
376 | } | 369 | } |
377 | } | 370 | } |
@@ -386,16 +379,16 @@ void dccp_ackvec_check_rcv_ackno(struct dccp_ackvec *av, struct sock *sk, | |||
386 | * windows. We will be receiving ACKs for stuff we sent a while back | 379 | * windows. We will be receiving ACKs for stuff we sent a while back |
387 | * -sorbo. | 380 | * -sorbo. |
388 | */ | 381 | */ |
389 | list_for_each_entry_reverse(avr, &av->dccpav_records, dccpavr_node) { | 382 | list_for_each_entry_reverse(avr, &av->av_records, avr_node) { |
390 | if (ackno == avr->dccpavr_ack_seqno) { | 383 | if (ackno == avr->avr_ack_seqno) { |
391 | dccp_pr_debug("%s ACK packet 0, len=%d, ack_seqno=%llu, " | 384 | dccp_pr_debug("%s ACK packet 0, len=%d, ack_seqno=%llu, " |
392 | "ack_ackno=%llu, ACKED!\n", | 385 | "ack_ackno=%llu, ACKED!\n", |
393 | dccp_role(sk), 1, | 386 | dccp_role(sk), 1, |
394 | (unsigned long long)avr->dccpavr_ack_seqno, | 387 | (unsigned long long)avr->avr_ack_seqno, |
395 | (unsigned long long)avr->dccpavr_ack_ackno); | 388 | (unsigned long long)avr->avr_ack_ackno); |
396 | dccp_ackvec_throw_record(av, avr); | 389 | dccp_ackvec_throw_record(av, avr); |
397 | break; | 390 | break; |
398 | } else if (avr->dccpavr_ack_seqno > ackno) | 391 | } else if (avr->avr_ack_seqno > ackno) |
399 | break; /* old news */ | 392 | break; /* old news */ |
400 | } | 393 | } |
401 | } | 394 | } |
@@ -409,7 +402,7 @@ static void dccp_ackvec_check_rcv_ackvector(struct dccp_ackvec *av, | |||
409 | struct dccp_ackvec_record *avr; | 402 | struct dccp_ackvec_record *avr; |
410 | 403 | ||
411 | /* Check if we actually sent an ACK vector */ | 404 | /* Check if we actually sent an ACK vector */ |
412 | if (list_empty(&av->dccpav_records)) | 405 | if (list_empty(&av->av_records)) |
413 | return; | 406 | return; |
414 | 407 | ||
415 | i = len; | 408 | i = len; |
@@ -418,8 +411,7 @@ static void dccp_ackvec_check_rcv_ackvector(struct dccp_ackvec *av, | |||
418 | * I think it might be more efficient to work backwards. See comment on | 411 | * I think it might be more efficient to work backwards. See comment on |
419 | * rcv_ackno. -sorbo. | 412 | * rcv_ackno. -sorbo. |
420 | */ | 413 | */ |
421 | avr = list_entry(av->dccpav_records.next, struct dccp_ackvec_record, | 414 | avr = list_entry(av->av_records.next, struct dccp_ackvec_record, avr_node); |
422 | dccpavr_node); | ||
423 | while (i--) { | 415 | while (i--) { |
424 | const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK; | 416 | const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK; |
425 | u64 ackno_end_rl; | 417 | u64 ackno_end_rl; |
@@ -430,15 +422,14 @@ static void dccp_ackvec_check_rcv_ackvector(struct dccp_ackvec *av, | |||
430 | * If our AVR sequence number is greater than the ack, go | 422 | * If our AVR sequence number is greater than the ack, go |
431 | * forward in the AVR list until it is not so. | 423 | * forward in the AVR list until it is not so. |
432 | */ | 424 | */ |
433 | list_for_each_entry_from(avr, &av->dccpav_records, | 425 | list_for_each_entry_from(avr, &av->av_records, avr_node) { |
434 | dccpavr_node) { | 426 | if (!after48(avr->avr_ack_seqno, *ackno)) |
435 | if (!after48(avr->dccpavr_ack_seqno, *ackno)) | ||
436 | goto found; | 427 | goto found; |
437 | } | 428 | } |
438 | /* End of the dccpav_records list, not found, exit */ | 429 | /* End of the av_records list, not found, exit */ |
439 | break; | 430 | break; |
440 | found: | 431 | found: |
441 | if (between48(avr->dccpavr_ack_seqno, ackno_end_rl, *ackno)) { | 432 | if (between48(avr->avr_ack_seqno, ackno_end_rl, *ackno)) { |
442 | const u8 state = *vector & DCCP_ACKVEC_STATE_MASK; | 433 | const u8 state = *vector & DCCP_ACKVEC_STATE_MASK; |
443 | if (state != DCCP_ACKVEC_STATE_NOT_RECEIVED) { | 434 | if (state != DCCP_ACKVEC_STATE_NOT_RECEIVED) { |
444 | dccp_pr_debug("%s ACK vector 0, len=%d, " | 435 | dccp_pr_debug("%s ACK vector 0, len=%d, " |
@@ -446,9 +437,9 @@ found: | |||
446 | "ACKED!\n", | 437 | "ACKED!\n", |
447 | dccp_role(sk), len, | 438 | dccp_role(sk), len, |
448 | (unsigned long long) | 439 | (unsigned long long) |
449 | avr->dccpavr_ack_seqno, | 440 | avr->avr_ack_seqno, |
450 | (unsigned long long) | 441 | (unsigned long long) |
451 | avr->dccpavr_ack_ackno); | 442 | avr->avr_ack_ackno); |
452 | dccp_ackvec_throw_record(av, avr); | 443 | dccp_ackvec_throw_record(av, avr); |
453 | break; | 444 | break; |
454 | } | 445 | } |
diff --git a/net/dccp/ackvec.h b/net/dccp/ackvec.h index 9671ecd17e00..bcb64fb4acef 100644 --- a/net/dccp/ackvec.h +++ b/net/dccp/ackvec.h | |||
@@ -32,54 +32,54 @@ | |||
32 | * | 32 | * |
33 | * This data structure is the one defined in RFC 4340, Appendix A. | 33 | * This data structure is the one defined in RFC 4340, Appendix A. |
34 | * | 34 | * |
35 | * @dccpav_buf_head - circular buffer head | 35 | * @av_buf_head - circular buffer head |
36 | * @dccpav_buf_tail - circular buffer tail | 36 | * @av_buf_tail - circular buffer tail |
37 | * @dccpav_buf_ackno - ack # of the most recent packet acknowledgeable in the | 37 | * @av_buf_ackno - ack # of the most recent packet acknowledgeable in the |
38 | * buffer (i.e. %dccpav_buf_head) | 38 | * buffer (i.e. %av_buf_head) |
39 | * @dccpav_buf_nonce - the one-bit sum of the ECN Nonces on all packets acked | 39 | * @av_buf_nonce - the one-bit sum of the ECN Nonces on all packets acked |
40 | * by the buffer with State 0 | 40 | * by the buffer with State 0 |
41 | * | 41 | * |
42 | * Additionally, the HC-Receiver must keep some information about the | 42 | * Additionally, the HC-Receiver must keep some information about the |
43 | * Ack Vectors it has recently sent. For each packet sent carrying an | 43 | * Ack Vectors it has recently sent. For each packet sent carrying an |
44 | * Ack Vector, it remembers four variables: | 44 | * Ack Vector, it remembers four variables: |
45 | * | 45 | * |
46 | * @dccpav_records - list of dccp_ackvec_record | 46 | * @av_records - list of dccp_ackvec_record |
47 | * @dccpav_ack_nonce - the one-bit sum of the ECN Nonces for all State 0. | 47 | * @av_ack_nonce - the one-bit sum of the ECN Nonces for all State 0. |
48 | * | 48 | * |
49 | * @dccpav_time - the time in usecs | 49 | * @av_time - the time in usecs |
50 | * @dccpav_buf - circular buffer of acknowledgeable packets | 50 | * @av_buf - circular buffer of acknowledgeable packets |
51 | */ | 51 | */ |
52 | struct dccp_ackvec { | 52 | struct dccp_ackvec { |
53 | u64 dccpav_buf_ackno; | 53 | u64 av_buf_ackno; |
54 | struct list_head dccpav_records; | 54 | struct list_head av_records; |
55 | ktime_t dccpav_time; | 55 | ktime_t av_time; |
56 | u16 dccpav_buf_head; | 56 | u16 av_buf_head; |
57 | u16 dccpav_vec_len; | 57 | u16 av_vec_len; |
58 | u8 dccpav_buf_nonce; | 58 | u8 av_buf_nonce; |
59 | u8 dccpav_ack_nonce; | 59 | u8 av_ack_nonce; |
60 | u8 dccpav_buf[DCCP_MAX_ACKVEC_LEN]; | 60 | u8 av_buf[DCCP_MAX_ACKVEC_LEN]; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | /** struct dccp_ackvec_record - ack vector record | 63 | /** struct dccp_ackvec_record - ack vector record |
64 | * | 64 | * |
65 | * ACK vector record as defined in Appendix A of spec. | 65 | * ACK vector record as defined in Appendix A of spec. |
66 | * | 66 | * |
67 | * The list is sorted by dccpavr_ack_seqno | 67 | * The list is sorted by avr_ack_seqno |
68 | * | 68 | * |
69 | * @dccpavr_node - node in dccpav_records | 69 | * @avr_node - node in av_records |
70 | * @dccpavr_ack_seqno - sequence number of the packet this record was sent on | 70 | * @avr_ack_seqno - sequence number of the packet this record was sent on |
71 | * @dccpavr_ack_ackno - sequence number being acknowledged | 71 | * @avr_ack_ackno - sequence number being acknowledged |
72 | * @dccpavr_ack_ptr - pointer into dccpav_buf where this record starts | 72 | * @avr_ack_ptr - pointer into av_buf where this record starts |
73 | * @dccpavr_ack_nonce - dccpav_ack_nonce at the time this record was sent | 73 | * @avr_ack_nonce - av_ack_nonce at the time this record was sent |
74 | * @dccpavr_sent_len - length of the record in dccpav_buf | 74 | * @avr_sent_len - lenght of the record in av_buf |
75 | */ | 75 | */ |
76 | struct dccp_ackvec_record { | 76 | struct dccp_ackvec_record { |
77 | struct list_head dccpavr_node; | 77 | struct list_head avr_node; |
78 | u64 dccpavr_ack_seqno; | 78 | u64 avr_ack_seqno; |
79 | u64 dccpavr_ack_ackno; | 79 | u64 avr_ack_ackno; |
80 | u16 dccpavr_ack_ptr; | 80 | u16 avr_ack_ptr; |
81 | u16 dccpavr_sent_len; | 81 | u16 avr_sent_len; |
82 | u8 dccpavr_ack_nonce; | 82 | u8 avr_ack_nonce; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | struct sock; | 85 | struct sock; |
@@ -105,7 +105,7 @@ extern int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb); | |||
105 | 105 | ||
106 | static inline int dccp_ackvec_pending(const struct dccp_ackvec *av) | 106 | static inline int dccp_ackvec_pending(const struct dccp_ackvec *av) |
107 | { | 107 | { |
108 | return av->dccpav_vec_len; | 108 | return av->av_vec_len; |
109 | } | 109 | } |
110 | #else /* CONFIG_IP_DCCP_ACKVEC */ | 110 | #else /* CONFIG_IP_DCCP_ACKVEC */ |
111 | static inline int dccp_ackvec_init(void) | 111 | static inline int dccp_ackvec_init(void) |