Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41907
b: refs/heads/master
c: a79ef76
h: refs/heads/master
i:
  41905: c7edfbf
  41903: abd4910
v: v3
  • Loading branch information
Gerrit Renker authored and David S. Miller committed Dec 3, 2006
1 parent dee36a6 commit 6cdab41
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 841bac1d607d8bf2e068e4b24393fb77372814e3
refs/heads/master: a79ef76f4d8424324c2f108824a7398571193f43
66 changes: 35 additions & 31 deletions trunk/net/dccp/ccids/ccid3.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ static inline void ccid3_update_send_time(struct ccid3_hc_tx_sock *hctx)
* X = max(min(2 * X, 2 * X_recv), s / R);
* tld = now;
*/
static void ccid3_hc_tx_update_x(struct sock *sk)
static void ccid3_hc_tx_update_x(struct sock *sk, struct timeval *now)

{
struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
const __u32 old_x = hctx->ccid3hctx_x;
Expand All @@ -138,23 +139,20 @@ static void ccid3_hc_tx_update_x(struct sock *sk)
hctx->ccid3hctx_x_calc = tfrc_calc_x(hctx->ccid3hctx_s,
hctx->ccid3hctx_rtt,
hctx->ccid3hctx_p);
hctx->ccid3hctx_x = max_t(u32, min_t(u32, hctx->ccid3hctx_x_calc,
2 * hctx->ccid3hctx_x_recv),
(hctx->ccid3hctx_s /
TFRC_MAX_BACK_OFF_TIME));
} else {
struct timeval now;
hctx->ccid3hctx_x = max_t(u32, min(hctx->ccid3hctx_x_calc,
hctx->ccid3hctx_x_recv * 2),
hctx->ccid3hctx_s / TFRC_T_MBI);

} else if (timeval_delta(now, &hctx->ccid3hctx_t_ld) >=
hctx->ccid3hctx_rtt) {
hctx->ccid3hctx_x = max(min(hctx->ccid3hctx_x_recv,
hctx->ccid3hctx_x ) * 2,
usecs_div(hctx->ccid3hctx_s,
hctx->ccid3hctx_rtt) );
hctx->ccid3hctx_t_ld = *now;
} else
ccid3_pr_debug("Not changing X\n");

dccp_timestamp(sk, &now);
if (timeval_delta(&now, &hctx->ccid3hctx_t_ld) >=
hctx->ccid3hctx_rtt) {
hctx->ccid3hctx_x = max_t(u32, min_t(u32, hctx->ccid3hctx_x_recv,
hctx->ccid3hctx_x) * 2,
usecs_div(hctx->ccid3hctx_s,
hctx->ccid3hctx_rtt));
hctx->ccid3hctx_t_ld = now;
}
}
if (hctx->ccid3hctx_x != old_x)
ccid3_update_send_time(hctx);
}
Expand Down Expand Up @@ -196,12 +194,9 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)

switch (hctx->ccid3hctx_state) {
case TFRC_SSTATE_NO_FBACK:
/* Halve send rate */
hctx->ccid3hctx_x /= 2;
if (hctx->ccid3hctx_x < (hctx->ccid3hctx_s /
TFRC_MAX_BACK_OFF_TIME))
hctx->ccid3hctx_x = (hctx->ccid3hctx_s /
TFRC_MAX_BACK_OFF_TIME);
/* RFC 3448, 4.4: Halve send rate directly */
hctx->ccid3hctx_x = min_t(u32, hctx->ccid3hctx_x / 2,
hctx->ccid3hctx_s / TFRC_T_MBI);

ccid3_pr_debug("%s, sk=%p, state=%s, updated tx rate to %d "
"bytes/s\n",
Expand All @@ -221,6 +216,8 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
if (!hctx->ccid3hctx_idle ||
(hctx->ccid3hctx_x_recv >=
4 * usecs_div(hctx->ccid3hctx_s, hctx->ccid3hctx_rtt))) {
struct timeval now;

ccid3_pr_debug("%s, sk=%p, state=%s, not idle\n",
dccp_role(sk), sk,
ccid3_tx_state_name(hctx->ccid3hctx_state));
Expand All @@ -238,12 +235,13 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
if (hctx->ccid3hctx_p < TFRC_SMALLEST_P ||
hctx->ccid3hctx_x_calc > 2 * hctx->ccid3hctx_x_recv)
hctx->ccid3hctx_x_recv = max_t(u32, hctx->ccid3hctx_x_recv / 2,
hctx->ccid3hctx_s / (2 * TFRC_MAX_BACK_OFF_TIME));
hctx->ccid3hctx_s / (2 * TFRC_T_MBI));
else
hctx->ccid3hctx_x_recv = hctx->ccid3hctx_x_calc / 4;

/* Update sending rate */
ccid3_hc_tx_update_x(sk);
dccp_timestamp(sk, &now);
ccid3_hc_tx_update_x(sk, &now);
}
/*
* Schedule no feedback timer to expire in
Expand Down Expand Up @@ -473,11 +471,21 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
* q is a constant, RFC 3448 recomments 0.9
*/
if (hctx->ccid3hctx_state == TFRC_SSTATE_NO_FBACK) {
/* Use Larger Initial Windows [RFC 4342, sec. 5]
* We deviate in that we use `s' instead of `MSS'. */
u16 w_init = max( 4 * hctx->ccid3hctx_s,
max(2 * hctx->ccid3hctx_s, 4380));
hctx->ccid3hctx_rtt = r_sample;
hctx->ccid3hctx_x = usecs_div(w_init, r_sample);
hctx->ccid3hctx_t_ld = now;

ccid3_update_send_time(hctx);
ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK);
hctx->ccid3hctx_rtt = r_sample;
} else
} else {
hctx->ccid3hctx_rtt = (hctx->ccid3hctx_rtt * 9) / 10 +
r_sample / 10;
ccid3_hc_tx_update_x(sk, &now);
}

ccid3_pr_debug("%s, sk=%p, New RTT estimate=%uus, "
"r_sample=%us\n", dccp_role(sk), sk,
Expand All @@ -502,9 +510,6 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
/* unschedule no feedback timer */
sk_stop_timer(sk, &hctx->ccid3hctx_no_feedback_timer);

/* Update sending rate (and likely t_ipi, t_nom, and delta) */
ccid3_hc_tx_update_x(sk);

/* remove all packets older than the one acked from history */
dccp_tx_hist_purge_older(ccid3_tx_hist,
&hctx->ccid3hctx_hist, packet);
Expand All @@ -514,7 +519,6 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
*/
sk->sk_write_space(sk);


/* Update timeout interval. We use the alternative variant of
* [RFC 3448, 3.1] which sets the upper bound of t_rto to one
* second, as it is suggested for TCP (see RFC 2988, 2.4). */
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/dccp/ccids/ccid3.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
/* In usecs - half the scheduling granularity as per RFC3448 4.6 */
#define TFRC_OPSYS_HALF_TIME_GRAN (USEC_PER_SEC / (2 * HZ))

/* In seconds */
#define TFRC_MAX_BACK_OFF_TIME 64
/* Parameter t_mbi from [RFC 3448, 4.3]: backoff interval in seconds */
#define TFRC_T_MBI 64

#define TFRC_SMALLEST_P 40

Expand Down

0 comments on commit 6cdab41

Please sign in to comment.