aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ackvec.h
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2010-11-10 15:21:35 -0500
committerGerrit Renker <gerrit@erg.abdn.ac.uk>2010-11-10 15:21:35 -0500
commitb3d14bff12a38ad13a174eb0cc83d2ac7169eee4 (patch)
tree2248e4d994ce857113c34ce5f754c554e17d8d9e /net/dccp/ackvec.h
parent7d870936602533836bba821bd5c679c62c52a95f (diff)
dccp ccid-2: Implementation of circular Ack Vector buffer with overflow handling
This completes the implementation of a circular buffer for Ack Vectors, by extending the current (linear array-based) implementation. The changes are: (a) An `overflow' flag to deal with the case of overflow. As before, dynamic growth of the buffer will not be supported; but code will be added to deal robustly with overflowing Ack Vector buffers. (b) A `tail_seqno' field. When naively implementing the algorithm of Appendix A in RFC 4340, problems arise whenever subsequent Ack Vector records overlap, which can bring the entire run length calculation completely out of synch. (This is documented on http://www.erg.abdn.ac.uk/users/gerrit/dccp/notes/\ ack_vectors/tracking_tail_ackno/ .) (c) The buffer length is now computed dynamically (i.e. current fill level), as the span between head to tail. As a result, dccp_ackvec_pending() is now simpler - the #ifdef is no longer necessary since buf_empty is always true when IP_DCCP_ACKVEC is not configured. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/ackvec.h')
-rw-r--r--net/dccp/ackvec.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/dccp/ackvec.h b/net/dccp/ackvec.h
index 3e894a0173a7..23880be8fc29 100644
--- a/net/dccp/ackvec.h
+++ b/net/dccp/ackvec.h
@@ -21,6 +21,7 @@
21 * the maximum size of a single Ack Vector. Setting %DCCPAV_NUM_ACKVECS to 1 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 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. 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.
24 */ 25 */
25#define DCCPAV_NUM_ACKVECS 2 26#define DCCPAV_NUM_ACKVECS 2
26#define DCCPAV_MAX_ACKVEC_LEN (DCCP_SINGLE_OPT_MAXLEN * DCCPAV_NUM_ACKVECS) 27#define DCCPAV_MAX_ACKVEC_LEN (DCCP_SINGLE_OPT_MAXLEN * DCCPAV_NUM_ACKVECS)
@@ -55,8 +56,10 @@ static inline u8 dccp_ackvec_state(const u8 *cell)
55 * @av_buf_head: head index; begin of live portion in @av_buf 56 * @av_buf_head: head index; begin of live portion in @av_buf
56 * @av_buf_tail: tail index; first index _after_ the live portion in @av_buf 57 * @av_buf_tail: tail index; first index _after_ the live portion in @av_buf
57 * @av_buf_ackno: highest seqno of acknowledgeable packet recorded in @av_buf 58 * @av_buf_ackno: highest seqno of acknowledgeable packet recorded in @av_buf
59 * @av_tail_ackno: lowest seqno of acknowledgeable packet recorded in @av_buf
58 * @av_buf_nonce: ECN nonce sums, each covering subsequent segments of up to 60 * @av_buf_nonce: ECN nonce sums, each covering subsequent segments of up to
59 * %DCCP_SINGLE_OPT_MAXLEN cells in the live portion of @av_buf 61 * %DCCP_SINGLE_OPT_MAXLEN cells in the live portion of @av_buf
62 * @av_overflow: if 1 then buf_head == buf_tail indicates buffer wraparound
60 * @av_records: list of %dccp_ackvec_record (Ack Vectors sent previously) 63 * @av_records: list of %dccp_ackvec_record (Ack Vectors sent previously)
61 * @av_veclen: length of the live portion of @av_buf 64 * @av_veclen: length of the live portion of @av_buf
62 */ 65 */
@@ -65,7 +68,9 @@ struct dccp_ackvec {
65 u16 av_buf_head; 68 u16 av_buf_head;
66 u16 av_buf_tail; 69 u16 av_buf_tail;
67 u64 av_buf_ackno:48; 70 u64 av_buf_ackno:48;
71 u64 av_tail_ackno:48;
68 bool av_buf_nonce[DCCPAV_NUM_ACKVECS]; 72 bool av_buf_nonce[DCCPAV_NUM_ACKVECS];
73 u8 av_overflow:1;
69 struct list_head av_records; 74 struct list_head av_records;
70 u16 av_vec_len; 75 u16 av_vec_len;
71}; 76};
@@ -112,9 +117,10 @@ extern int dccp_ackvec_parse(struct sock *sk, const struct sk_buff *skb,
112 const u8 *value, const u8 len); 117 const u8 *value, const u8 len);
113 118
114extern int dccp_ackvec_update_records(struct dccp_ackvec *av, u64 seq, u8 sum); 119extern int dccp_ackvec_update_records(struct dccp_ackvec *av, u64 seq, u8 sum);
120extern u16 dccp_ackvec_buflen(const struct dccp_ackvec *av);
115 121
116static inline int dccp_ackvec_pending(const struct dccp_ackvec *av) 122static inline bool dccp_ackvec_is_empty(const struct dccp_ackvec *av)
117{ 123{
118 return av->av_vec_len; 124 return av->av_overflow == 0 && av->av_buf_head == av->av_buf_tail;
119} 125}
120#endif /* _ACKVEC_H */ 126#endif /* _ACKVEC_H */