aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2007-11-20 15:01:59 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:54:42 -0500
commita5358fdc9c52e44d79dcd144375e089e166508d7 (patch)
treeddd84d7a6115700ff93f24d367d59c8ad03a9adc /net
parenteb279b79c46be767ecffadaa8ed6be3e3555e93d (diff)
[CCID3]: Accurately determine idle & application-limited periods
This fixes/updates the handling of idle and application-limited periods in CCID3, which currently is broken: there is no detection as to how long a sender has been idle - there is only one flag which is toggled in between function calls. Being obsolete now, the `idle' flag is removed. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/dccp/ccids/ccid3.c18
-rw-r--r--net/dccp/ccids/ccid3.h2
2 files changed, 10 insertions, 10 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index c025236ce49b..94a322863844 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -119,6 +119,13 @@ static inline void ccid3_update_send_interval(struct ccid3_hc_tx_sock *hctx)
119 119
120} 120}
121 121
122static u32 ccid3_hc_tx_idle_rtt(struct ccid3_hc_tx_sock *hctx, ktime_t now)
123{
124 u32 delta = ktime_us_delta(now, hctx->ccid3hctx_t_last_win_count);
125
126 return delta / hctx->ccid3hctx_rtt;
127}
128
122/** 129/**
123 * ccid3_hc_tx_update_x - Update allowed sending rate X 130 * ccid3_hc_tx_update_x - Update allowed sending rate X
124 * @stamp: most recent time if available - can be left NULL. 131 * @stamp: most recent time if available - can be left NULL.
@@ -139,10 +146,11 @@ static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp)
139 146
140 /* 147 /*
141 * Handle IDLE periods: do not reduce below RFC3390 initial sending rate 148 * Handle IDLE periods: do not reduce below RFC3390 initial sending rate
142 * when idling [RFC 4342, 5.1]. See also draft-ietf-dccp-rfc3448bis. 149 * when idling [RFC 4342, 5.1]. Definition of idling is from rfc3448bis:
150 * a sender is idle if it has not sent anything over a 2-RTT-period.
143 * For consistency with X and X_recv, min_rate is also scaled by 2^6. 151 * For consistency with X and X_recv, min_rate is also scaled by 2^6.
144 */ 152 */
145 if (unlikely(hctx->ccid3hctx_idle)) { 153 if (ccid3_hc_tx_idle_rtt(hctx, now) >= 2) {
146 min_rate = rfc3390_initial_rate(sk); 154 min_rate = rfc3390_initial_rate(sk);
147 min_rate = max(min_rate, 2 * hctx->ccid3hctx_x_recv); 155 min_rate = max(min_rate, 2 * hctx->ccid3hctx_x_recv);
148 } 156 }
@@ -228,8 +236,6 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
228 ccid3_pr_debug("%s(%p, state=%s) - entry \n", dccp_role(sk), sk, 236 ccid3_pr_debug("%s(%p, state=%s) - entry \n", dccp_role(sk), sk,
229 ccid3_tx_state_name(hctx->ccid3hctx_state)); 237 ccid3_tx_state_name(hctx->ccid3hctx_state));
230 238
231 hctx->ccid3hctx_idle = 1;
232
233 switch (hctx->ccid3hctx_state) { 239 switch (hctx->ccid3hctx_state) {
234 case TFRC_SSTATE_NO_FBACK: 240 case TFRC_SSTATE_NO_FBACK:
235 /* RFC 3448, 4.4: Halve send rate directly */ 241 /* RFC 3448, 4.4: Halve send rate directly */
@@ -372,7 +378,6 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
372 /* prepare to send now (add options etc.) */ 378 /* prepare to send now (add options etc.) */
373 dp->dccps_hc_tx_insert_options = 1; 379 dp->dccps_hc_tx_insert_options = 1;
374 DCCP_SKB_CB(skb)->dccpd_ccval = hctx->ccid3hctx_last_win_count; 380 DCCP_SKB_CB(skb)->dccpd_ccval = hctx->ccid3hctx_last_win_count;
375 hctx->ccid3hctx_idle = 0;
376 381
377 /* set the nominal send time for the next following packet */ 382 /* set the nominal send time for the next following packet */
378 hctx->ccid3hctx_t_nom = ktime_add_us(hctx->ccid3hctx_t_nom, 383 hctx->ccid3hctx_t_nom = ktime_add_us(hctx->ccid3hctx_t_nom,
@@ -531,9 +536,6 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
531 536
532 sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, 537 sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer,
533 jiffies + usecs_to_jiffies(t_nfb)); 538 jiffies + usecs_to_jiffies(t_nfb));
534
535 /* set idle flag */
536 hctx->ccid3hctx_idle = 1;
537 break; 539 break;
538 case TFRC_SSTATE_NO_SENT: /* fall through */ 540 case TFRC_SSTATE_NO_SENT: /* fall through */
539 case TFRC_SSTATE_TERM: /* ignore feedback when closing */ 541 case TFRC_SSTATE_TERM: /* ignore feedback when closing */
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h
index 83467c34ed2b..36eca34228f0 100644
--- a/net/dccp/ccids/ccid3.h
+++ b/net/dccp/ccids/ccid3.h
@@ -88,7 +88,6 @@ enum ccid3_hc_tx_states {
88 * @ccid3hctx_t_last_win_count - Timestamp of earliest packet 88 * @ccid3hctx_t_last_win_count - Timestamp of earliest packet
89 * with last_win_count value sent 89 * with last_win_count value sent
90 * @ccid3hctx_no_feedback_timer - Handle to no feedback timer 90 * @ccid3hctx_no_feedback_timer - Handle to no feedback timer
91 * @ccid3hctx_idle - Flag indicating that sender is idling
92 * @ccid3hctx_t_ld - Time last doubled during slow start 91 * @ccid3hctx_t_ld - Time last doubled during slow start
93 * @ccid3hctx_t_nom - Nominal send time of next packet 92 * @ccid3hctx_t_nom - Nominal send time of next packet
94 * @ccid3hctx_delta - Send timer delta (RFC 3448, 4.6) in usecs 93 * @ccid3hctx_delta - Send timer delta (RFC 3448, 4.6) in usecs
@@ -107,7 +106,6 @@ struct ccid3_hc_tx_sock {
107 u16 ccid3hctx_s; 106 u16 ccid3hctx_s;
108 enum ccid3_hc_tx_states ccid3hctx_state:8; 107 enum ccid3_hc_tx_states ccid3hctx_state:8;
109 u8 ccid3hctx_last_win_count; 108 u8 ccid3hctx_last_win_count;
110 u8 ccid3hctx_idle;
111 ktime_t ccid3hctx_t_last_win_count; 109 ktime_t ccid3hctx_t_last_win_count;
112 struct timer_list ccid3hctx_no_feedback_timer; 110 struct timer_list ccid3hctx_no_feedback_timer;
113 ktime_t ccid3hctx_t_ld; 111 ktime_t ccid3hctx_t_ld;