13 #include <linux/kernel.h>
14 #include <linux/slab.h>
15 #include <linux/export.h>
18 static struct kmem_cache *dccp_ackvec_record_slab;
22 struct dccp_ackvec *
av = kmem_cache_zalloc(dccp_ackvec_slab, priority);
37 INIT_LIST_HEAD(&av->av_records);
43 dccp_ackvec_purge_records(av);
74 dccp_ackvec_purge_records(av);
81 dccp_pr_debug(
"Added Vector, ack_seqno=%llu, ack_ackno=%llu (rl=%u)\n",
110 static inline u16 __ackvec_idx_add(
const u16 a,
const u16 b)
115 static inline u16 __ackvec_idx_sub(
const u16 a,
const u16 b)
134 static void dccp_ackvec_update_old(
struct dccp_ackvec *av,
s64 distance,
140 if (
unlikely(dccp_ackvec_is_empty(av)))
144 u8 runlen = dccp_ackvec_runlen(av->
av_buf + ptr);
146 if (distance + runlen >= 0) {
166 (
unsigned long long)seqno, state);
170 distance += runlen + 1;
171 ptr = __ackvec_idx_add(ptr, 1);
177 static void dccp_ackvec_reserve_seats(
struct dccp_ackvec *av,
u16 num)
199 static void dccp_ackvec_add_new(
struct dccp_ackvec *av,
u32 num_packets,
202 u32 num_cells = num_packets;
205 u32 lost_packets = num_packets - 1;
207 DCCP_WARN(
"Warning: large burst loss (%u)\n", lost_packets);
220 for (num_packets = num_cells = 1; lost_packets; ++num_cells) {
231 DCCP_CRIT(
"Ack Vector buffer overflow: dropping old entries\n");
243 dccp_ackvec_reserve_seats(av, num_packets - 1);
254 if (dccp_ackvec_is_empty(av)) {
255 dccp_ackvec_add_new(av, 1, seqno, state);
262 if (num_packets == 1 &&
263 dccp_ackvec_state(current_head) == state &&
269 }
else if (num_packets > 0) {
270 dccp_ackvec_add_new(av, num_packets, seqno, state);
272 dccp_ackvec_update_old(av, num_packets, seqno, state);
288 u8 runlen_now, eff_runlen;
291 avr = dccp_ackvec_lookup(&av->
av_records, ackno);
316 if (runlen_now > eff_runlen) {
371 INIT_LIST_HEAD(parsed_chunks);
380 if (dccp_ackvec_slab ==
NULL)
386 if (dccp_ackvec_record_slab ==
NULL)
387 goto out_destroy_slab;
393 dccp_ackvec_slab =
NULL;
395 DCCP_CRIT(
"Unable to create Ack Vector slab cache");
401 if (dccp_ackvec_slab !=
NULL) {
403 dccp_ackvec_slab =
NULL;
405 if (dccp_ackvec_record_slab !=
NULL) {
407 dccp_ackvec_record_slab =
NULL;