summaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/lib
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:41 +0200
commit34a081be8e14b7ada70e069b65b05d54db4af497 (patch)
tree0304cc3c06e1ee9139d6dab01df07c8d073cd323 /net/dccp/ccids/lib
parent3ca7aea04152255bb65275b0018d3c673bc1f4e7 (diff)
downloadop-kernel-dev-34a081be8e14b7ada70e069b65b05d54db4af497.zip
op-kernel-dev-34a081be8e14b7ada70e069b65b05d54db4af497.tar.gz
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.c10
-rw-r--r--net/dccp/ccids/lib/packet_history.h16
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 8ea9690..ee34b45 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,
__three_after_loss(h);
}
+ /*
+ * Update moving-average of `s' and the sum of received payload bytes.
+ */
+ if (dccp_data_packet(skb)) {
+ const u32 payload = skb->len - dccp_hdr(skb)->dccph_doff * 4;
+
+ h->packet_size = tfrc_ewma(h->packet_size, payload, 9);
+ h->bytes_recvd += payload;
+ }
+
/* RFC 3448, 6.1: update I_0, whose growth implies p <= p_prev */
if (!is_new_loss)
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 e9d8097..b7c87a1 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 {
* @loss_count: Number of entries in circular history
* @loss_start: Movable index (for loss detection)
* @rtt_sample_prev: Used during RTT sampling, points to candidate entry
+ * @packet_size: Packet size in bytes (as per RFC 3448, 3.1)
+ * @bytes_recvd: Number of bytes received since last sending feedback
*/
struct tfrc_rx_hist {
struct tfrc_rx_hist_entry *ring[TFRC_NDUPACK + 1];
u8 loss_count:2,
loss_start:2;
#define rtt_sample_prev loss_start
+ u32 packet_size,
+ bytes_recvd;
};
/**
@@ -140,6 +144,18 @@ static inline bool tfrc_rx_hist_loss_pending(const struct tfrc_rx_hist *h)
return h->loss_count > 0;
}
+/*
+ * Accessor functions to retrieve parameters sampled by the RX history
+ */
+static inline u32 tfrc_rx_hist_packet_size(const struct tfrc_rx_hist *h)
+{
+ if (h->packet_size == 0) {
+ DCCP_WARN("No sample for s, using fallback\n");
+ return TCP_MIN_RCVMSS;
+ }
+ return h->packet_size;
+}
+
extern void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h,
const struct sk_buff *skb, const u64 ndp);
OpenPOWER on IntegriCloud