aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dccp/ccids/ccid3.c37
-rw-r--r--net/dccp/ccids/ccid3.h2
2 files changed, 9 insertions, 30 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index c1cc66edfad4..0751a8fa936a 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -56,7 +56,6 @@ static const char *ccid3_tx_state_name(enum ccid3_hc_tx_states state)
56 [TFRC_SSTATE_NO_SENT] = "NO_SENT", 56 [TFRC_SSTATE_NO_SENT] = "NO_SENT",
57 [TFRC_SSTATE_NO_FBACK] = "NO_FBACK", 57 [TFRC_SSTATE_NO_FBACK] = "NO_FBACK",
58 [TFRC_SSTATE_FBACK] = "FBACK", 58 [TFRC_SSTATE_FBACK] = "FBACK",
59 [TFRC_SSTATE_TERM] = "TERM",
60 }; 59 };
61 60
62 return ccid3_state_names[state]; 61 return ccid3_state_names[state];
@@ -210,10 +209,13 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
210 ccid3_pr_debug("%s(%p, state=%s) - entry \n", dccp_role(sk), sk, 209 ccid3_pr_debug("%s(%p, state=%s) - entry \n", dccp_role(sk), sk,
211 ccid3_tx_state_name(hctx->state)); 210 ccid3_tx_state_name(hctx->state));
212 211
212 /* Ignore and do not restart after leaving the established state */
213 if ((1 << sk->sk_state) & ~(DCCPF_OPEN | DCCPF_PARTOPEN))
214 goto out;
215
216 /* Reset feedback state to "no feedback received" */
213 if (hctx->state == TFRC_SSTATE_FBACK) 217 if (hctx->state == TFRC_SSTATE_FBACK)
214 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK); 218 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK);
215 else if (hctx->state != TFRC_SSTATE_NO_FBACK)
216 goto out;
217 219
218 /* 220 /*
219 * Determine new allowed sending rate X as per draft rfc3448bis-00, 4.4 221 * Determine new allowed sending rate X as per draft rfc3448bis-00, 4.4
@@ -288,8 +290,7 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
288 if (unlikely(skb->len == 0)) 290 if (unlikely(skb->len == 0))
289 return -EBADMSG; 291 return -EBADMSG;
290 292
291 switch (hctx->state) { 293 if (hctx->state == TFRC_SSTATE_NO_SENT) {
292 case TFRC_SSTATE_NO_SENT:
293 sk_reset_timer(sk, &hctx->no_feedback_timer, (jiffies + 294 sk_reset_timer(sk, &hctx->no_feedback_timer, (jiffies +
294 usecs_to_jiffies(TFRC_INITIAL_TIMEOUT))); 295 usecs_to_jiffies(TFRC_INITIAL_TIMEOUT)));
295 hctx->last_win_count = 0; 296 hctx->last_win_count = 0;
@@ -324,9 +325,8 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
324 ccid3_update_send_interval(hctx); 325 ccid3_update_send_interval(hctx);
325 326
326 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK); 327 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK);
327 break; 328
328 case TFRC_SSTATE_NO_FBACK: 329 } else {
329 case TFRC_SSTATE_FBACK:
330 delay = ktime_us_delta(hctx->t_nom, now); 330 delay = ktime_us_delta(hctx->t_nom, now);
331 ccid3_pr_debug("delay=%ld\n", (long)delay); 331 ccid3_pr_debug("delay=%ld\n", (long)delay);
332 /* 332 /*
@@ -341,10 +341,6 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
341 return (u32)delay / USEC_PER_MSEC; 341 return (u32)delay / USEC_PER_MSEC;
342 342
343 ccid3_hc_tx_update_win_count(hctx, now); 343 ccid3_hc_tx_update_win_count(hctx, now);
344 break;
345 case TFRC_SSTATE_TERM:
346 DCCP_BUG("%s(%p) - Illegal state TERM", dccp_role(sk), sk);
347 return -EINVAL;
348 } 344 }
349 345
350 /* prepare to send now (add options etc.) */ 346 /* prepare to send now (add options etc.) */
@@ -378,11 +374,6 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
378 if (!(DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK || 374 if (!(DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK ||
379 DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_DATAACK)) 375 DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_DATAACK))
380 return; 376 return;
381 /* ... and only in the established state */
382 if (hctx->state != TFRC_SSTATE_FBACK &&
383 hctx->state != TFRC_SSTATE_NO_FBACK)
384 return;
385
386 /* 377 /*
387 * Locate the acknowledged packet in the TX history. 378 * Locate the acknowledged packet in the TX history.
388 * 379 *
@@ -522,9 +513,7 @@ static void ccid3_hc_tx_exit(struct sock *sk)
522{ 513{
523 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 514 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
524 515
525 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_TERM);
526 sk_stop_timer(sk, &hctx->no_feedback_timer); 516 sk_stop_timer(sk, &hctx->no_feedback_timer);
527
528 tfrc_tx_hist_purge(&hctx->hist); 517 tfrc_tx_hist_purge(&hctx->hist);
529} 518}
530 519
@@ -583,7 +572,6 @@ static const char *ccid3_rx_state_name(enum ccid3_hc_rx_states state)
583 static char *ccid3_rx_state_names[] = { 572 static char *ccid3_rx_state_names[] = {
584 [TFRC_RSTATE_NO_DATA] = "NO_DATA", 573 [TFRC_RSTATE_NO_DATA] = "NO_DATA",
585 [TFRC_RSTATE_DATA] = "DATA", 574 [TFRC_RSTATE_DATA] = "DATA",
586 [TFRC_RSTATE_TERM] = "TERM",
587 }; 575 };
588 576
589 return ccid3_rx_state_names[state]; 577 return ccid3_rx_state_names[state];
@@ -609,14 +597,9 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk,
609{ 597{
610 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); 598 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
611 struct dccp_sock *dp = dccp_sk(sk); 599 struct dccp_sock *dp = dccp_sk(sk);
612 ktime_t now; 600 ktime_t now = ktime_get_real();
613 s64 delta = 0; 601 s64 delta = 0;
614 602
615 if (unlikely(hcrx->state == TFRC_RSTATE_TERM))
616 return;
617
618 now = ktime_get_real();
619
620 switch (fbtype) { 603 switch (fbtype) {
621 case CCID3_FBACK_INITIAL: 604 case CCID3_FBACK_INITIAL:
622 hcrx->x_recv = 0; 605 hcrx->x_recv = 0;
@@ -819,8 +802,6 @@ static void ccid3_hc_rx_exit(struct sock *sk)
819{ 802{
820 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); 803 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
821 804
822 ccid3_hc_rx_set_state(sk, TFRC_RSTATE_TERM);
823
824 tfrc_rx_hist_purge(&hcrx->hist); 805 tfrc_rx_hist_purge(&hcrx->hist);
825 tfrc_lh_cleanup(&hcrx->li_hist); 806 tfrc_lh_cleanup(&hcrx->li_hist);
826} 807}
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h
index de26db82d65f..7884159937aa 100644
--- a/net/dccp/ccids/ccid3.h
+++ b/net/dccp/ccids/ccid3.h
@@ -75,7 +75,6 @@ enum ccid3_hc_tx_states {
75 TFRC_SSTATE_NO_SENT = 1, 75 TFRC_SSTATE_NO_SENT = 1,
76 TFRC_SSTATE_NO_FBACK, 76 TFRC_SSTATE_NO_FBACK,
77 TFRC_SSTATE_FBACK, 77 TFRC_SSTATE_FBACK,
78 TFRC_SSTATE_TERM,
79}; 78};
80 79
81/** struct ccid3_hc_tx_sock - CCID3 sender half-connection socket 80/** struct ccid3_hc_tx_sock - CCID3 sender half-connection socket
@@ -126,7 +125,6 @@ static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk)
126enum ccid3_hc_rx_states { 125enum ccid3_hc_rx_states {
127 TFRC_RSTATE_NO_DATA = 1, 126 TFRC_RSTATE_NO_DATA = 1,
128 TFRC_RSTATE_DATA, 127 TFRC_RSTATE_DATA,
129 TFRC_RSTATE_TERM = 127,
130}; 128};
131 129
132/** struct ccid3_hc_rx_sock - CCID3 receiver half-connection socket 130/** struct ccid3_hc_rx_sock - CCID3 receiver half-connection socket