Skip to content

Commit

Permalink
dccp ccid-3: Fix "t_ipi explosion" bug
Browse files Browse the repository at this point in the history
The identification of this bug is thanks to Cheng Wei and Tomasz
Grobelny.

To avoid divide-by-zero, the implementation previously ignored RTTs
smaller than 4 microseconds when performing integer division RTT/4.

When the RTT reached a value less than 4 microseconds (as observed on
loopback), this prevented the Window Counter CCVal value from
advancing. As a result, the receiver stopped sending feedback. This in
turn caused non-ending expiries of the nofeedback timer at the sender,
so that the sending rate was progressively reduced until reaching the
minimum of one packet per 64 seconds.

The patch fixes this bug by handling integer division more
intelligently. Due to consistent use of dccp_sample_rtt(),
divide-by-zero-RTT is avoided.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gerrit Renker authored and David S. Miller committed May 27, 2008
1 parent 6079a46 commit 825de27
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions net/dccp/ccids/ccid3.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,17 @@ static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hctx, int len)

/*
* Update Window Counter using the algorithm from [RFC 4342, 8.1].
* The algorithm is not applicable if RTT < 4 microseconds.
* As elsewhere, RTT > 0 is assumed by using dccp_sample_rtt().
*/
static inline void ccid3_hc_tx_update_win_count(struct ccid3_hc_tx_sock *hctx,
ktime_t now)
{
u32 quarter_rtts;

if (unlikely(hctx->ccid3hctx_rtt < 4)) /* avoid divide-by-zero */
return;

quarter_rtts = ktime_us_delta(now, hctx->ccid3hctx_t_last_win_count);
quarter_rtts /= hctx->ccid3hctx_rtt / 4;
u32 delta = ktime_us_delta(now, hctx->ccid3hctx_t_last_win_count),
quarter_rtts = (4 * delta) / hctx->ccid3hctx_rtt;

if (quarter_rtts > 0) {
hctx->ccid3hctx_t_last_win_count = now;
hctx->ccid3hctx_last_win_count += min_t(u32, quarter_rtts, 5);
hctx->ccid3hctx_last_win_count += min(quarter_rtts, 5U);
hctx->ccid3hctx_last_win_count &= 0xF; /* mod 16 */
}
}
Expand Down

0 comments on commit 825de27

Please sign in to comment.