Skip to content

Commit

Permalink
dccp tfrc: Perform early loss detection
Browse files Browse the repository at this point in the history
This enables the TFRC code to begin loss detection (as soon as the module
is loaded), using the latest updates from rfc3448bis-06, 6.3.1:

 * when the first data packet(s) are lost or marked, set
 * X_target = s/(2*R) => f(p) = s/(R * X_target) = 2,
 * corresponding to a loss rate of ~ 20.64%.

The handle_loss() function is now called right at the begin of rx_packet_recv()
and thus no longer protected against duplicates: hence a call to rx_duplicate()
has been added.  Such a call makes sense now, as the previous patch initialises
the first entry with a sequence number of GSR.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
  • Loading branch information
Gerrit Renker committed Sep 4, 2008
1 parent 24b8d34 commit d20ed95
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
48 changes: 39 additions & 9 deletions net/dccp/ccids/ccid3.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,28 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk,
hcrx->p_inverse = ~0U; /* see RFC 4342, 8.5 */
break;
case CCID3_FBACK_PARAM_CHANGE:
if (unlikely(hcrx->state == TFRC_RSTATE_NO_DATA)) {
/*
* rfc3448bis-06, 6.3.1: First packet(s) lost or marked
* FIXME: in rfc3448bis the receiver returns X_recv=0
* here as it normally would in the first feedback packet.
* However this is not possible yet, since the code still
* uses RFC 3448, i.e.
* If (p > 0)
* Calculate X_calc using the TCP throughput equation.
* X = max(min(X_calc, 2*X_recv), s/t_mbi);
* would bring X down to s/t_mbi. That is why we return
* X_recv according to rfc3448bis-06 for the moment.
*/
u32 rtt = hcrx->rtt ? : DCCP_FALLBACK_RTT, s = hcrx->s;

if (s == 0) {
DCCP_WARN("No sample for s, using fallback\n");
s = TCP_MIN_RCVMSS;
}
hcrx->x_recv = scaled_div32(s, 2 * rtt);
break;
}
/*
* When parameters change (new loss or p > p_prev), we do not
* have a reliable estimate for R_m of [RFC 3448, 6.2] and so
Expand Down Expand Up @@ -650,6 +672,14 @@ static u32 ccid3_first_li(struct sock *sk)
u32 x_recv, p, delta;
u64 fval;

/*
* rfc3448bis-06, 6.3.1: First data packet(s) are marked or lost. Set p
* to give the equivalent of X_target = s/(2*R). Thus fval = 2 and so p
* is about 20.64%. This yields an interval length of 4.84 (rounded up).
*/
if (unlikely(hcrx->state == TFRC_RSTATE_NO_DATA))
return 5;

if (hcrx->rtt == 0) {
DCCP_WARN("No RTT estimate available, using fallback RTT\n");
hcrx->rtt = DCCP_FALLBACK_RTT;
Expand Down Expand Up @@ -683,6 +713,15 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
const u64 ndp = dccp_sk(sk)->dccps_options_received.dccpor_ndp;
const bool is_data_packet = dccp_data_packet(skb);

/*
* Perform loss detection and handle pending losses
*/
if (tfrc_rx_handle_loss(&hcrx->hist, &hcrx->li_hist,
skb, ndp, ccid3_first_li, sk)) {
do_feedback = CCID3_FBACK_PARAM_CHANGE;
goto done_receiving;
}

if (unlikely(hcrx->state == TFRC_RSTATE_NO_DATA)) {
if (is_data_packet) {
const u32 payload = skb->len - dccp_hdr(skb)->dccph_doff * 4;
Expand Down Expand Up @@ -710,15 +749,6 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
hcrx->bytes_recv += payload;
}

/*
* Perform loss detection and handle pending losses
*/
if (tfrc_rx_handle_loss(&hcrx->hist, &hcrx->li_hist,
skb, ndp, ccid3_first_li, sk)) {
do_feedback = CCID3_FBACK_PARAM_CHANGE;
goto done_receiving;
}

if (tfrc_rx_hist_loss_pending(&hcrx->hist))
return; /* done receiving */

Expand Down
3 changes: 3 additions & 0 deletions net/dccp/ccids/lib/packet_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ int tfrc_rx_handle_loss(struct tfrc_rx_hist *h,
{
int is_new_loss = 0;

if (tfrc_rx_hist_duplicate(h, skb))
return 0;

if (h->loss_count == 0) {
__do_track_loss(h, skb, ndp);
} else if (h->loss_count == 1) {
Expand Down

0 comments on commit d20ed95

Please sign in to comment.