aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/ccids')
-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 be1b8baaf298..90bc0a7da8e4 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -54,7 +54,6 @@ static const char *ccid3_tx_state_name(enum ccid3_hc_tx_states state)
54 [TFRC_SSTATE_NO_SENT] = "NO_SENT", 54 [TFRC_SSTATE_NO_SENT] = "NO_SENT",
55 [TFRC_SSTATE_NO_FBACK] = "NO_FBACK", 55 [TFRC_SSTATE_NO_FBACK] = "NO_FBACK",
56 [TFRC_SSTATE_FBACK] = "FBACK", 56 [TFRC_SSTATE_FBACK] = "FBACK",
57 [TFRC_SSTATE_TERM] = "TERM",
58 }; 57 };
59 58
60 return ccid3_state_names[state]; 59 return ccid3_state_names[state];
@@ -208,10 +207,13 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
208 ccid3_pr_debug("%s(%p, state=%s) - entry\n", dccp_role(sk), sk, 207 ccid3_pr_debug("%s(%p, state=%s) - entry\n", dccp_role(sk), sk,
209 ccid3_tx_state_name(hc->tx_state)); 208 ccid3_tx_state_name(hc->tx_state));
210 209
210 /* Ignore and do not restart after leaving the established state */
211 if ((1 << sk->sk_state) & ~(DCCPF_OPEN | DCCPF_PARTOPEN))
212 goto out;
213
214 /* Reset feedback state to "no feedback received" */
211 if (hc->tx_state == TFRC_SSTATE_FBACK) 215 if (hc->tx_state == TFRC_SSTATE_FBACK)
212 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK); 216 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK);
213 else if (hc->tx_state != TFRC_SSTATE_NO_FBACK)
214 goto out;
215 217
216 /* 218 /*
217 * Determine new allowed sending rate X as per draft rfc3448bis-00, 4.4 219 * Determine new allowed sending rate X as per draft rfc3448bis-00, 4.4
@@ -287,8 +289,7 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
287 if (unlikely(skb->len == 0)) 289 if (unlikely(skb->len == 0))
288 return -EBADMSG; 290 return -EBADMSG;
289 291
290 switch (hc->tx_state) { 292 if (hc->tx_state == TFRC_SSTATE_NO_SENT) {
291 case TFRC_SSTATE_NO_SENT:
292 sk_reset_timer(sk, &hc->tx_no_feedback_timer, (jiffies + 293 sk_reset_timer(sk, &hc->tx_no_feedback_timer, (jiffies +
293 usecs_to_jiffies(TFRC_INITIAL_TIMEOUT))); 294 usecs_to_jiffies(TFRC_INITIAL_TIMEOUT)));
294 hc->tx_last_win_count = 0; 295 hc->tx_last_win_count = 0;
@@ -323,9 +324,8 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
323 ccid3_update_send_interval(hc); 324 ccid3_update_send_interval(hc);
324 325
325 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK); 326 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK);
326 break; 327
327 case TFRC_SSTATE_NO_FBACK: 328 } else {
328 case TFRC_SSTATE_FBACK:
329 delay = ktime_us_delta(hc->tx_t_nom, now); 329 delay = ktime_us_delta(hc->tx_t_nom, now);
330 ccid3_pr_debug("delay=%ld\n", (long)delay); 330 ccid3_pr_debug("delay=%ld\n", (long)delay);
331 /* 331 /*
@@ -340,10 +340,6 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
340 return (u32)delay / USEC_PER_MSEC; 340 return (u32)delay / USEC_PER_MSEC;
341 341
342 ccid3_hc_tx_update_win_count(hc, now); 342 ccid3_hc_tx_update_win_count(hc, now);
343 break;
344 case TFRC_SSTATE_TERM:
345 DCCP_BUG("%s(%p) - Illegal state TERM", dccp_role(sk), sk);
346 return -EINVAL;
347 } 343 }
348 344
349 /* prepare to send now (add options etc.) */ 345 /* prepare to send now (add options etc.) */
@@ -379,11 +375,6 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
379 if (!(DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK || 375 if (!(DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK ||
380 DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_DATAACK)) 376 DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_DATAACK))
381 return; 377 return;
382 /* ... and only in the established state */
383 if (hc->tx_state != TFRC_SSTATE_FBACK &&
384 hc->tx_state != TFRC_SSTATE_NO_FBACK)
385 return;
386
387 /* 378 /*
388 * Locate the acknowledged packet in the TX history. 379 * Locate the acknowledged packet in the TX history.
389 * 380 *
@@ -529,9 +520,7 @@ static void ccid3_hc_tx_exit(struct sock *sk)
529{ 520{
530 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk); 521 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk);
531 522
532 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_TERM);
533 sk_stop_timer(sk, &hc->tx_no_feedback_timer); 523 sk_stop_timer(sk, &hc->tx_no_feedback_timer);
534
535 tfrc_tx_hist_purge(&hc->tx_hist); 524 tfrc_tx_hist_purge(&hc->tx_hist);
536} 525}
537 526
@@ -590,7 +579,6 @@ static const char *ccid3_rx_state_name(enum ccid3_hc_rx_states state)
590 static const char *const ccid3_rx_state_names[] = { 579 static const char *const ccid3_rx_state_names[] = {
591 [TFRC_RSTATE_NO_DATA] = "NO_DATA", 580 [TFRC_RSTATE_NO_DATA] = "NO_DATA",
592 [TFRC_RSTATE_DATA] = "DATA", 581 [TFRC_RSTATE_DATA] = "DATA",
593 [TFRC_RSTATE_TERM] = "TERM",
594 }; 582 };
595 583
596 return ccid3_rx_state_names[state]; 584 return ccid3_rx_state_names[state];
@@ -616,14 +604,9 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk,
616{ 604{
617 struct ccid3_hc_rx_sock *hc = ccid3_hc_rx_sk(sk); 605 struct ccid3_hc_rx_sock *hc = ccid3_hc_rx_sk(sk);
618 struct dccp_sock *dp = dccp_sk(sk); 606 struct dccp_sock *dp = dccp_sk(sk);
619 ktime_t now; 607 ktime_t now = ktime_get_real();
620 s64 delta = 0; 608 s64 delta = 0;
621 609
622 if (unlikely(hc->rx_state == TFRC_RSTATE_TERM))
623 return;
624
625 now = ktime_get_real();
626
627 switch (fbtype) { 610 switch (fbtype) {
628 case CCID3_FBACK_INITIAL: 611 case CCID3_FBACK_INITIAL:
629 hc->rx_x_recv = 0; 612 hc->rx_x_recv = 0;
@@ -827,8 +810,6 @@ static void ccid3_hc_rx_exit(struct sock *sk)
827{ 810{
828 struct ccid3_hc_rx_sock *hc = ccid3_hc_rx_sk(sk); 811 struct ccid3_hc_rx_sock *hc = ccid3_hc_rx_sk(sk);
829 812
830 ccid3_hc_rx_set_state(sk, TFRC_RSTATE_TERM);
831
832 tfrc_rx_hist_purge(&hc->rx_hist); 813 tfrc_rx_hist_purge(&hc->rx_hist);
833 tfrc_lh_cleanup(&hc->rx_li_hist); 814 tfrc_lh_cleanup(&hc->rx_li_hist);
834} 815}
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h
index 9eb90b863abd..89b047b0c79b 100644
--- a/net/dccp/ccids/ccid3.h
+++ b/net/dccp/ccids/ccid3.h
@@ -77,7 +77,6 @@ enum ccid3_hc_tx_states {
77 TFRC_SSTATE_NO_SENT = 1, 77 TFRC_SSTATE_NO_SENT = 1,
78 TFRC_SSTATE_NO_FBACK, 78 TFRC_SSTATE_NO_FBACK,
79 TFRC_SSTATE_FBACK, 79 TFRC_SSTATE_FBACK,
80 TFRC_SSTATE_TERM,
81}; 80};
82 81
83/** 82/**
@@ -130,7 +129,6 @@ static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk)
130enum ccid3_hc_rx_states { 129enum ccid3_hc_rx_states {
131 TFRC_RSTATE_NO_DATA = 1, 130 TFRC_RSTATE_NO_DATA = 1,
132 TFRC_RSTATE_DATA, 131 TFRC_RSTATE_DATA,
133 TFRC_RSTATE_TERM = 127,
134}; 132};
135 133
136/** 134/**