diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-05-02 19:44:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-05-02 19:44:07 -0400 |
commit | 84994e16f25dabe234be4fc2d323ec9db95b87cb (patch) | |
tree | d30cc0144afe0f4640e432b4c0bd4a0f1f86c9ed /net | |
parent | 0c0b0aca66b3a58e12a216d992a0b534eff210e0 (diff) |
dccp: ccid2.c, ccid3.c use clamp(), clamp_t()
Makes the intention of the nested min/max clear.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/dccp/ccids/ccid2.c | 2 | ||||
-rw-r--r-- | net/dccp/ccids/ccid3.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index b5b52ebb2693..8e9580874216 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c | |||
@@ -716,7 +716,7 @@ static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk) | |||
716 | * packets for new connections, following the rules from [RFC3390]". | 716 | * packets for new connections, following the rules from [RFC3390]". |
717 | * We need to convert the bytes of RFC3390 into the packets of RFC 4341. | 717 | * We need to convert the bytes of RFC3390 into the packets of RFC 4341. |
718 | */ | 718 | */ |
719 | hctx->ccid2hctx_cwnd = min(4U, max(2U, 4380U / dp->dccps_mss_cache)); | 719 | hctx->ccid2hctx_cwnd = clamp(4380U / dp->dccps_mss_cache, 2U, 4U); |
720 | 720 | ||
721 | /* Make sure that Ack Ratio is enabled and within bounds. */ | 721 | /* Make sure that Ack Ratio is enabled and within bounds. */ |
722 | max_ratio = DIV_ROUND_UP(hctx->ccid2hctx_cwnd, 2); | 722 | max_ratio = DIV_ROUND_UP(hctx->ccid2hctx_cwnd, 2); |
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index e76f460af0ea..cd61dea2eea1 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -88,8 +88,8 @@ static void ccid3_hc_tx_set_state(struct sock *sk, | |||
88 | static inline u64 rfc3390_initial_rate(struct sock *sk) | 88 | static inline u64 rfc3390_initial_rate(struct sock *sk) |
89 | { | 89 | { |
90 | const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); | 90 | const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); |
91 | const __u32 w_init = min_t(__u32, 4 * hctx->ccid3hctx_s, | 91 | const __u32 w_init = clamp_t(__u32, 4380U, |
92 | max_t(__u32, 2 * hctx->ccid3hctx_s, 4380)); | 92 | 2 * hctx->ccid3hctx_s, 4 * hctx->ccid3hctx_s); |
93 | 93 | ||
94 | return scaled_div(w_init << 6, hctx->ccid3hctx_rtt); | 94 | return scaled_div(w_init << 6, hctx->ccid3hctx_rtt); |
95 | } | 95 | } |