diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2010-08-22 15:41:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-23 23:13:29 -0400 |
commit | 67b67e365f07d6dc70f3bb266af3268bac0a4836 (patch) | |
tree | 58cc9640f8859c1e13262267efaa507a035c3a77 /net/dccp/ccids/ccid3.c | |
parent | 21dc330157454046dd7c494961277d76e1c957fe (diff) |
ccid: ccid-2/3 code cosmetics
This patch collects cosmetics-only changes to separate these from
code changes:
* update with regard to CodingStyle and whitespace changes,
* documentation:
- adding/revising comments,
- remove CCID-3 RX socket documentation which is either
duplicate or refers to fields that no longer exist,
* expand embedded tfrc_tx_info struct inline for consistency,
removing indirections via #define.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ccids/ccid3.c')
-rw-r--r-- | net/dccp/ccids/ccid3.c | 30 |
1 files changed, 18 insertions, 12 deletions
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, | |||
372 | static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | 372 | static 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); |