diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-09-04 01:30:19 -0400 |
---|---|---|
committer | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-09-04 01:45:41 -0400 |
commit | 34a081be8e14b7ada70e069b65b05d54db4af497 (patch) | |
tree | 0304cc3c06e1ee9139d6dab01df07c8d073cd323 /net/dccp/ccids/lib | |
parent | 3ca7aea04152255bb65275b0018d3c673bc1f4e7 (diff) |
dccp tfrc: Let dccp_tfrc_lib do the sampling work
This migrates more TFRC-related code into the dccp_tfrc_lib:
* sampling of the packet size `s' (which is only needed until the first
loss interval is computed (ccid3_first_li));
* updating the byte-counter `bytes_recvd' in between sending feedbacks.
The result is a better separation of CCID-3 specific and TFRC specific
code, which aids future integration with ECN and e.g. CCID-4.
Further changes:
----------------
* replaced magic number of 536 with equivalent constant TCP_MIN_RCVMSS;
(this constant is also used when no estimate for `s' is available).
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/ccids/lib')
-rw-r--r-- | net/dccp/ccids/lib/packet_history.c | 10 | ||||
-rw-r--r-- | net/dccp/ccids/lib/packet_history.h | 16 |
2 files changed, 26 insertions, 0 deletions
diff --git a/net/dccp/ccids/lib/packet_history.c b/net/dccp/ccids/lib/packet_history.c index 8ea96903033d..ee34b4564242 100644 --- a/net/dccp/ccids/lib/packet_history.c +++ b/net/dccp/ccids/lib/packet_history.c | |||
@@ -352,6 +352,16 @@ int tfrc_rx_handle_loss(struct tfrc_rx_hist *h, | |||
352 | __three_after_loss(h); | 352 | __three_after_loss(h); |
353 | } | 353 | } |
354 | 354 | ||
355 | /* | ||
356 | * Update moving-average of `s' and the sum of received payload bytes. | ||
357 | */ | ||
358 | if (dccp_data_packet(skb)) { | ||
359 | const u32 payload = skb->len - dccp_hdr(skb)->dccph_doff * 4; | ||
360 | |||
361 | h->packet_size = tfrc_ewma(h->packet_size, payload, 9); | ||
362 | h->bytes_recvd += payload; | ||
363 | } | ||
364 | |||
355 | /* RFC 3448, 6.1: update I_0, whose growth implies p <= p_prev */ | 365 | /* RFC 3448, 6.1: update I_0, whose growth implies p <= p_prev */ |
356 | if (!is_new_loss) | 366 | if (!is_new_loss) |
357 | tfrc_lh_update_i_mean(lh, skb); | 367 | tfrc_lh_update_i_mean(lh, skb); |
diff --git a/net/dccp/ccids/lib/packet_history.h b/net/dccp/ccids/lib/packet_history.h index e9d8097947d5..b7c87a1a2720 100644 --- a/net/dccp/ccids/lib/packet_history.h +++ b/net/dccp/ccids/lib/packet_history.h | |||
@@ -91,12 +91,16 @@ struct tfrc_rx_hist_entry { | |||
91 | * @loss_count: Number of entries in circular history | 91 | * @loss_count: Number of entries in circular history |
92 | * @loss_start: Movable index (for loss detection) | 92 | * @loss_start: Movable index (for loss detection) |
93 | * @rtt_sample_prev: Used during RTT sampling, points to candidate entry | 93 | * @rtt_sample_prev: Used during RTT sampling, points to candidate entry |
94 | * @packet_size: Packet size in bytes (as per RFC 3448, 3.1) | ||
95 | * @bytes_recvd: Number of bytes received since last sending feedback | ||
94 | */ | 96 | */ |
95 | struct tfrc_rx_hist { | 97 | struct tfrc_rx_hist { |
96 | struct tfrc_rx_hist_entry *ring[TFRC_NDUPACK + 1]; | 98 | struct tfrc_rx_hist_entry *ring[TFRC_NDUPACK + 1]; |
97 | u8 loss_count:2, | 99 | u8 loss_count:2, |
98 | loss_start:2; | 100 | loss_start:2; |
99 | #define rtt_sample_prev loss_start | 101 | #define rtt_sample_prev loss_start |
102 | u32 packet_size, | ||
103 | bytes_recvd; | ||
100 | }; | 104 | }; |
101 | 105 | ||
102 | /** | 106 | /** |
@@ -140,6 +144,18 @@ static inline bool tfrc_rx_hist_loss_pending(const struct tfrc_rx_hist *h) | |||
140 | return h->loss_count > 0; | 144 | return h->loss_count > 0; |
141 | } | 145 | } |
142 | 146 | ||
147 | /* | ||
148 | * Accessor functions to retrieve parameters sampled by the RX history | ||
149 | */ | ||
150 | static inline u32 tfrc_rx_hist_packet_size(const struct tfrc_rx_hist *h) | ||
151 | { | ||
152 | if (h->packet_size == 0) { | ||
153 | DCCP_WARN("No sample for s, using fallback\n"); | ||
154 | return TCP_MIN_RCVMSS; | ||
155 | } | ||
156 | return h->packet_size; | ||
157 | } | ||
158 | |||
143 | extern void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h, | 159 | extern void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h, |
144 | const struct sk_buff *skb, const u64 ndp); | 160 | const struct sk_buff *skb, const u64 ndp); |
145 | 161 | ||