summaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/lib
diff options
context:
space:
mode:
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