summaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/lib/packet_history.c
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 07:30:19 +0200
committerGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 07:45:42 +0200
commit68c89ee53571a441799c03d5e240c6441bced620 (patch)
treea355d77fd0bf9e57375601286bf4b792456b423e /net/dccp/ccids/lib/packet_history.c
parent22338f09bd60434a3f1d6608f0fa55972067985f (diff)
downloadop-kernel-dev-68c89ee53571a441799c03d5e240c6441bced620.zip
op-kernel-dev-68c89ee53571a441799c03d5e240c6441bced620.tar.gz
dccp ccid-3: Update the computation of X_recv
This updates the computation of X_recv with regard to Errata 610/611 for RFC 4342 and draft rfc3448bis-06, ensuring that at least an interval of 1 RTT is used to compute X_recv. The change is wrapped into a new function ccid3_hc_rx_x_recv(). Further changes: ---------------- * feedback is not sent when no data packets arrived (bytes_recv == 0), as per rfc3448bis-06, 6.2; * take the timestamp for the feedback /after/ dccp_send_ack() returns, to avoid taking the transmission time into account (in case layer-2 is busy); * clearer handling of failure in ccid3_first_li(). Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/ccids/lib/packet_history.c')
-rw-r--r--net/dccp/ccids/lib/packet_history.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/net/dccp/ccids/lib/packet_history.c b/net/dccp/ccids/lib/packet_history.c
index 5c4ded1..547ad09 100644
--- a/net/dccp/ccids/lib/packet_history.c
+++ b/net/dccp/ccids/lib/packet_history.c
@@ -385,6 +385,36 @@ int tfrc_rx_handle_loss(struct tfrc_rx_hist *h,
}
EXPORT_SYMBOL_GPL(tfrc_rx_handle_loss);
+/* Compute the sending rate X_recv measured between feedback intervals */
+u32 tfrc_rx_hist_x_recv(struct tfrc_rx_hist *h, const u32 last_x_recv)
+{
+ u64 bytes = h->bytes_recvd, last_rtt = h->rtt_estimate;
+ s64 delta = ktime_to_us(net_timedelta(h->bytes_start));
+
+ WARN_ON(delta <= 0);
+ /*
+ * Ensure that the sampling interval for X_recv is at least one RTT,
+ * by extending the sampling interval backwards in time, over the last
+ * R_(m-1) seconds, as per rfc3448bis-06, 6.2.
+ * To reduce noise (e.g. when the RTT changes often), this is only
+ * done when delta is smaller than RTT/2.
+ */
+ if (last_x_recv > 0 && delta < last_rtt/2) {
+ tfrc_pr_debug("delta < RTT ==> %ld us < %u us\n",
+ (long)delta, (unsigned)last_rtt);
+
+ delta = (bytes ? delta : 0) + last_rtt;
+ bytes += div_u64((u64)last_x_recv * last_rtt, USEC_PER_SEC);
+ }
+
+ if (unlikely(bytes == 0)) {
+ DCCP_WARN("X_recv == 0, using old value of %u\n", last_x_recv);
+ return last_x_recv;
+ }
+ return scaled_div32(bytes, delta);
+}
+EXPORT_SYMBOL_GPL(tfrc_rx_hist_x_recv);
+
void tfrc_rx_hist_purge(struct tfrc_rx_hist *h)
{
int i;
OpenPOWER on IntegriCloud