Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ackvec.h
Go to the documentation of this file.
1 #ifndef _ACKVEC_H
2 #define _ACKVEC_H
3 /*
4  * net/dccp/ackvec.h
5  *
6  * An implementation of Ack Vectors for the DCCP protocol
7  * Copyright (c) 2007 University of Aberdeen, Scotland, UK
8  * Copyright (c) 2005 Arnaldo Carvalho de Melo <[email protected]>
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/dccp.h>
15 #include <linux/compiler.h>
16 #include <linux/list.h>
17 #include <linux/types.h>
18 
19 /*
20  * Ack Vector buffer space is static, in multiples of %DCCP_SINGLE_OPT_MAXLEN,
21  * the maximum size of a single Ack Vector. Setting %DCCPAV_NUM_ACKVECS to 1
22  * will be sufficient for most cases of low Ack Ratios, using a value of 2 gives
23  * more headroom if Ack Ratio is higher or when the sender acknowledges slowly.
24  * The maximum value is bounded by the u16 types for indices and functions.
25  */
26 #define DCCPAV_NUM_ACKVECS 2
27 #define DCCPAV_MAX_ACKVEC_LEN (DCCP_SINGLE_OPT_MAXLEN * DCCPAV_NUM_ACKVECS)
28 
29 /* Estimated minimum average Ack Vector length - used for updating MPS */
30 #define DCCPAV_MIN_OPTLEN 16
31 
32 /* Threshold for coping with large bursts of losses */
33 #define DCCPAV_BURST_THRESH (DCCPAV_MAX_ACKVEC_LEN / 8)
34 
40 };
41 #define DCCPAV_MAX_RUNLEN 0x3F
42 
43 static inline u8 dccp_ackvec_runlen(const u8 *cell)
44 {
45  return *cell & DCCPAV_MAX_RUNLEN;
46 }
47 
48 static inline u8 dccp_ackvec_state(const u8 *cell)
49 {
50  return *cell & ~DCCPAV_MAX_RUNLEN;
51 }
52 
69 struct dccp_ackvec {
78 };
79 
102 };
103 
104 extern int dccp_ackvec_init(void);
105 extern void dccp_ackvec_exit(void);
106 
107 extern struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority);
108 extern void dccp_ackvec_free(struct dccp_ackvec *av);
109 
110 extern void dccp_ackvec_input(struct dccp_ackvec *av, struct sk_buff *skb);
111 extern int dccp_ackvec_update_records(struct dccp_ackvec *av, u64 seq, u8 sum);
112 extern void dccp_ackvec_clear_state(struct dccp_ackvec *av, const u64 ackno);
113 extern u16 dccp_ackvec_buflen(const struct dccp_ackvec *av);
114 
115 static inline bool dccp_ackvec_is_empty(const struct dccp_ackvec *av)
116 {
117  return av->av_overflow == 0 && av->av_buf_head == av->av_buf_tail;
118 }
119 
130  u8 *vec,
131  len,
132  nonce:1;
133  struct list_head node;
134 };
135 
136 extern int dccp_ackvec_parsed_add(struct list_head *head,
137  u8 *vec, u8 len, u8 nonce);
138 extern void dccp_ackvec_parsed_cleanup(struct list_head *parsed_chunks);
139 #endif /* _ACKVEC_H */