aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/ccids/ccid2.c4
-rw-r--r--net/dccp/ccids/ccid3.c30
-rw-r--r--net/dccp/ccids/ccid3.h19
3 files changed, 27 insertions, 26 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index 9b3ae9922be1..f564211c3885 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -193,8 +193,8 @@ static void ccid2_hc_tx_rto_expire(unsigned long data)
193 hc->tx_ssthresh = hc->tx_cwnd / 2; 193 hc->tx_ssthresh = hc->tx_cwnd / 2;
194 if (hc->tx_ssthresh < 2) 194 if (hc->tx_ssthresh < 2)
195 hc->tx_ssthresh = 2; 195 hc->tx_ssthresh = 2;
196 hc->tx_cwnd = 1; 196 hc->tx_cwnd = 1;
197 hc->tx_pipe = 0; 197 hc->tx_pipe = 0;
198 198
199 /* clear state about stuff we sent */ 199 /* clear state about stuff we sent */
200 hc->tx_seqt = hc->tx_seqh; 200 hc->tx_seqt = hc->tx_seqh;
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 95f752986497..a666f3febf2b 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -218,9 +218,9 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
218 218
219 /* 219 /*
220 * Determine new allowed sending rate X as per draft rfc3448bis-00, 4.4 220 * Determine new allowed sending rate X as per draft rfc3448bis-00, 4.4
221 * RTO is 0 if and only if no feedback has been received yet.
221 */ 222 */
222 if (hc->tx_t_rto == 0 || /* no feedback received yet */ 223 if (hc->tx_t_rto == 0 || hc->tx_p == 0) {
223 hc->tx_p == 0) {
224 224
225 /* halve send rate directly */ 225 /* halve send rate directly */
226 hc->tx_x = max(hc->tx_x / 2, 226 hc->tx_x = max(hc->tx_x / 2,
@@ -256,7 +256,7 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
256 * Set new timeout for the nofeedback timer. 256 * Set new timeout for the nofeedback timer.
257 * See comments in packet_recv() regarding the value of t_RTO. 257 * See comments in packet_recv() regarding the value of t_RTO.
258 */ 258 */
259 if (unlikely(hc->tx_t_rto == 0)) /* no feedback yet */ 259 if (unlikely(hc->tx_t_rto == 0)) /* no feedback received yet */
260 t_nfb = TFRC_INITIAL_TIMEOUT; 260 t_nfb = TFRC_INITIAL_TIMEOUT;
261 else 261 else
262 t_nfb = max(hc->tx_t_rto, 2 * hc->tx_t_ipi); 262 t_nfb = max(hc->tx_t_rto, 2 * hc->tx_t_ipi);
@@ -372,7 +372,7 @@ static void ccid3_hc_tx_packet_sent(struct sock *sk, int more,
372static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) 372static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
373{ 373{
374 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk); 374 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk);
375 struct ccid3_options_received *opt_recv; 375 struct ccid3_options_received *opt_recv = &hc->tx_options_received;
376 ktime_t now; 376 ktime_t now;
377 unsigned long t_nfb; 377 unsigned long t_nfb;
378 u32 pinv, r_sample; 378 u32 pinv, r_sample;
@@ -386,7 +386,6 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
386 hc->tx_state != TFRC_SSTATE_NO_FBACK) 386 hc->tx_state != TFRC_SSTATE_NO_FBACK)
387 return; 387 return;
388 388
389 opt_recv = &hc->tx_options_received;
390 now = ktime_get_real(); 389 now = ktime_get_real();
391 390
392 /* Estimate RTT from history if ACK number is valid */ 391 /* Estimate RTT from history if ACK number is valid */
@@ -489,11 +488,9 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option,
489 int rc = 0; 488 int rc = 0;
490 const struct dccp_sock *dp = dccp_sk(sk); 489 const struct dccp_sock *dp = dccp_sk(sk);
491 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk); 490 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk);
492 struct ccid3_options_received *opt_recv; 491 struct ccid3_options_received *opt_recv = &hc->tx_options_received;
493 __be32 opt_val; 492 __be32 opt_val;
494 493
495 opt_recv = &hc->tx_options_received;
496
497 if (opt_recv->ccid3or_seqno != dp->dccps_gsr) { 494 if (opt_recv->ccid3or_seqno != dp->dccps_gsr) {
498 opt_recv->ccid3or_seqno = dp->dccps_gsr; 495 opt_recv->ccid3or_seqno = dp->dccps_gsr;
499 opt_recv->ccid3or_loss_event_rate = ~0; 496 opt_recv->ccid3or_loss_event_rate = ~0;
@@ -582,6 +579,7 @@ static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len,
582 u32 __user *optval, int __user *optlen) 579 u32 __user *optval, int __user *optlen)
583{ 580{
584 const struct ccid3_hc_tx_sock *hc; 581 const struct ccid3_hc_tx_sock *hc;
582 struct tfrc_tx_info tfrc;
585 const void *val; 583 const void *val;
586 584
587 /* Listen socks doesn't have a private CCID block */ 585 /* Listen socks doesn't have a private CCID block */
@@ -591,10 +589,17 @@ static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len,
591 hc = ccid3_hc_tx_sk(sk); 589 hc = ccid3_hc_tx_sk(sk);
592 switch (optname) { 590 switch (optname) {
593 case DCCP_SOCKOPT_CCID_TX_INFO: 591 case DCCP_SOCKOPT_CCID_TX_INFO:
594 if (len < sizeof(hc->tx_tfrc)) 592 if (len < sizeof(tfrc))
595 return -EINVAL; 593 return -EINVAL;
596 len = sizeof(hc->tx_tfrc); 594 tfrc.tfrctx_x = hc->tx_x;
597 val = &hc->tx_tfrc; 595 tfrc.tfrctx_x_recv = hc->tx_x_recv;
596 tfrc.tfrctx_x_calc = hc->tx_x_calc;
597 tfrc.tfrctx_rtt = hc->tx_rtt;
598 tfrc.tfrctx_p = hc->tx_p;
599 tfrc.tfrctx_rto = hc->tx_t_rto;
600 tfrc.tfrctx_ipi = hc->tx_t_ipi;
601 len = sizeof(tfrc);
602 val = &tfrc;
598 break; 603 break;
599 default: 604 default:
600 return -ENOPROTOOPT; 605 return -ENOPROTOOPT;
@@ -749,10 +754,11 @@ static u32 ccid3_first_li(struct sock *sk)
749 x_recv = scaled_div32(hc->rx_bytes_recv, delta); 754 x_recv = scaled_div32(hc->rx_bytes_recv, delta);
750 if (x_recv == 0) { /* would also trigger divide-by-zero */ 755 if (x_recv == 0) { /* would also trigger divide-by-zero */
751 DCCP_WARN("X_recv==0\n"); 756 DCCP_WARN("X_recv==0\n");
752 if ((x_recv = hc->rx_x_recv) == 0) { 757 if (hc->rx_x_recv == 0) {
753 DCCP_BUG("stored value of X_recv is zero"); 758 DCCP_BUG("stored value of X_recv is zero");
754 return ~0U; 759 return ~0U;
755 } 760 }
761 x_recv = hc->rx_x_recv;
756 } 762 }
757 763
758 fval = scaled_div(hc->rx_s, hc->rx_rtt); 764 fval = scaled_div(hc->rx_s, hc->rx_rtt);
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h
index 032635776653..b1864243be07 100644
--- a/net/dccp/ccids/ccid3.h
+++ b/net/dccp/ccids/ccid3.h
@@ -95,14 +95,13 @@ enum ccid3_hc_tx_states {
95 * @tx_options_received: Parsed set of retrieved options 95 * @tx_options_received: Parsed set of retrieved options
96 */ 96 */
97struct ccid3_hc_tx_sock { 97struct ccid3_hc_tx_sock {
98 struct tfrc_tx_info tx_tfrc; 98 u64 tx_x;
99#define tx_x tx_tfrc.tfrctx_x 99 u64 tx_x_recv;
100#define tx_x_recv tx_tfrc.tfrctx_x_recv 100 u32 tx_x_calc;
101#define tx_x_calc tx_tfrc.tfrctx_x_calc 101 u32 tx_rtt;
102#define tx_rtt tx_tfrc.tfrctx_rtt 102 u32 tx_p;
103#define tx_p tx_tfrc.tfrctx_p 103 u32 tx_t_rto;
104#define tx_t_rto tx_tfrc.tfrctx_rto 104 u32 tx_t_ipi;
105#define tx_t_ipi tx_tfrc.tfrctx_ipi
106 u16 tx_s; 105 u16 tx_s;
107 enum ccid3_hc_tx_states tx_state:8; 106 enum ccid3_hc_tx_states tx_state:8;
108 u8 tx_last_win_count; 107 u8 tx_last_win_count;
@@ -131,16 +130,12 @@ enum ccid3_hc_rx_states {
131 130
132/** 131/**
133 * struct ccid3_hc_rx_sock - CCID3 receiver half-connection socket 132 * struct ccid3_hc_rx_sock - CCID3 receiver half-connection socket
134 * @rx_x_recv: Receiver estimate of send rate (RFC 3448 4.3)
135 * @rx_rtt: Receiver estimate of rtt (non-standard)
136 * @rx_p: Current loss event rate (RFC 3448 5.4)
137 * @rx_last_counter: Tracks window counter (RFC 4342, 8.1) 133 * @rx_last_counter: Tracks window counter (RFC 4342, 8.1)
138 * @rx_state: Receiver state, one of %ccid3_hc_rx_states 134 * @rx_state: Receiver state, one of %ccid3_hc_rx_states
139 * @rx_bytes_recv: Total sum of DCCP payload bytes 135 * @rx_bytes_recv: Total sum of DCCP payload bytes
140 * @rx_x_recv: Receiver estimate of send rate (RFC 3448, sec. 4.3) 136 * @rx_x_recv: Receiver estimate of send rate (RFC 3448, sec. 4.3)
141 * @rx_rtt: Receiver estimate of RTT 137 * @rx_rtt: Receiver estimate of RTT
142 * @rx_tstamp_last_feedback: Time at which last feedback was sent 138 * @rx_tstamp_last_feedback: Time at which last feedback was sent
143 * @rx_tstamp_last_ack: Time at which last feedback was sent
144 * @rx_hist: Packet history (loss detection + RTT sampling) 139 * @rx_hist: Packet history (loss detection + RTT sampling)
145 * @rx_li_hist: Loss Interval database 140 * @rx_li_hist: Loss Interval database
146 * @rx_s: Received packet size in bytes 141 * @rx_s: Received packet size in bytes