diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-08-10 12:29:27 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 18:56:33 -0400 |
commit | cef07fd6029c20f95571d09cefce45ee3276a920 (patch) | |
tree | 7d559e7006438b3f256e516d60ca89d153bcaf9d /net/dccp | |
parent | 8c60f3fab55712f23f2bd557ceedfbb00c649f37 (diff) |
[CCID3]: Ditch USEC_IN_SEC as time.h has USEC_PER_SEC
That is equivalent, no need to have a private one.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/ccids/ccid3.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 15c25f622000..80f12c990c00 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -55,12 +55,10 @@ extern int ccid3_debug; | |||
55 | #define TFRC_STD_PACKET_SIZE 256 | 55 | #define TFRC_STD_PACKET_SIZE 256 |
56 | #define TFRC_MAX_PACKET_SIZE 65535 | 56 | #define TFRC_MAX_PACKET_SIZE 65535 |
57 | 57 | ||
58 | #define USEC_IN_SEC 1000000 | 58 | #define TFRC_INITIAL_TIMEOUT (2 * USEC_PER_SEC) |
59 | |||
60 | #define TFRC_INITIAL_TIMEOUT (2 * USEC_IN_SEC) | ||
61 | /* two seconds as per CCID3 spec 11 */ | 59 | /* two seconds as per CCID3 spec 11 */ |
62 | 60 | ||
63 | #define TFRC_OPSYS_HALF_TIME_GRAN (USEC_IN_SEC / (2 * HZ)) | 61 | #define TFRC_OPSYS_HALF_TIME_GRAN (USEC_PER_SEC / (2 * HZ)) |
64 | /* above is in usecs - half the scheduling granularity as per RFC3448 4.6 */ | 62 | /* above is in usecs - half the scheduling granularity as per RFC3448 4.6 */ |
65 | 63 | ||
66 | #define TFRC_WIN_COUNT_PER_RTT 4 | 64 | #define TFRC_WIN_COUNT_PER_RTT 4 |
@@ -155,20 +153,23 @@ static inline void ccid3_hc_tx_set_state(struct sock *sk, enum ccid3_hc_tx_state | |||
155 | hctx->ccid3hctx_state = state; | 153 | hctx->ccid3hctx_state = state; |
156 | } | 154 | } |
157 | 155 | ||
158 | static void timeval_sub(struct timeval large, struct timeval small, struct timeval *result) { | 156 | static void timeval_sub(struct timeval large, struct timeval small, |
159 | 157 | struct timeval *result) | |
158 | { | ||
160 | result->tv_sec = large.tv_sec-small.tv_sec; | 159 | result->tv_sec = large.tv_sec-small.tv_sec; |
161 | if (large.tv_usec < small.tv_usec) { | 160 | if (large.tv_usec < small.tv_usec) { |
162 | (result->tv_sec)--; | 161 | (result->tv_sec)--; |
163 | result->tv_usec = USEC_IN_SEC+large.tv_usec-small.tv_usec; | 162 | result->tv_usec = USEC_PER_SEC + |
163 | large.tv_usec - small.tv_usec; | ||
164 | } else | 164 | } else |
165 | result->tv_usec = large.tv_usec-small.tv_usec; | 165 | result->tv_usec = large.tv_usec-small.tv_usec; |
166 | } | 166 | } |
167 | 167 | ||
168 | static inline void timeval_fix(struct timeval *tv) { | 168 | static inline void timeval_fix(struct timeval *tv) |
169 | if (tv->tv_usec >= USEC_IN_SEC) { | 169 | { |
170 | if (tv->tv_usec >= USEC_PER_SEC) { | ||
170 | tv->tv_sec++; | 171 | tv->tv_sec++; |
171 | tv->tv_usec -= USEC_IN_SEC; | 172 | tv->tv_usec -= USEC_PER_SEC; |
172 | } | 173 | } |
173 | } | 174 | } |
174 | 175 | ||
@@ -1185,7 +1186,8 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
1185 | r_sample); | 1186 | r_sample); |
1186 | 1187 | ||
1187 | /* Update timeout interval */ | 1188 | /* Update timeout interval */ |
1188 | inet_csk(sk)->icsk_rto = max_t(u32, 4 * hctx->ccid3hctx_rtt, USEC_IN_SEC); | 1189 | inet_csk(sk)->icsk_rto = max_t(u32, 4 * hctx->ccid3hctx_rtt, |
1190 | USEC_PER_SEC); | ||
1189 | 1191 | ||
1190 | /* Update receive rate */ | 1192 | /* Update receive rate */ |
1191 | hctx->ccid3hctx_x_recv = x_recv; /* x_recv in bytes per second */ | 1193 | hctx->ccid3hctx_x_recv = x_recv; /* x_recv in bytes per second */ |
@@ -1210,7 +1212,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
1210 | 1212 | ||
1211 | /* Update next send time */ | 1213 | /* Update next send time */ |
1212 | if (hctx->ccid3hctx_t_ipi > (hctx->ccid3hctx_t_nom).tv_usec) { | 1214 | if (hctx->ccid3hctx_t_ipi > (hctx->ccid3hctx_t_nom).tv_usec) { |
1213 | (hctx->ccid3hctx_t_nom).tv_usec += USEC_IN_SEC; | 1215 | hctx->ccid3hctx_t_nom.tv_usec += USEC_PER_SEC; |
1214 | (hctx->ccid3hctx_t_nom).tv_sec--; | 1216 | (hctx->ccid3hctx_t_nom).tv_sec--; |
1215 | } | 1217 | } |
1216 | /* FIXME - if no feedback then t_ipi can go > 1 second */ | 1218 | /* FIXME - if no feedback then t_ipi can go > 1 second */ |
@@ -1344,7 +1346,7 @@ static int ccid3_hc_tx_init(struct sock *sk) | |||
1344 | 1346 | ||
1345 | hctx->ccid3hctx_x = hctx->ccid3hctx_s; /* set transmission rate to 1 packet per second */ | 1347 | hctx->ccid3hctx_x = hctx->ccid3hctx_s; /* set transmission rate to 1 packet per second */ |
1346 | hctx->ccid3hctx_rtt = 4; /* See ccid3_hc_tx_packet_sent win_count calculatation */ | 1348 | hctx->ccid3hctx_rtt = 4; /* See ccid3_hc_tx_packet_sent win_count calculatation */ |
1347 | inet_csk(sk)->icsk_rto = USEC_IN_SEC; | 1349 | inet_csk(sk)->icsk_rto = USEC_PER_SEC; |
1348 | hctx->ccid3hctx_state = TFRC_SSTATE_NO_SENT; | 1350 | hctx->ccid3hctx_state = TFRC_SSTATE_NO_SENT; |
1349 | INIT_LIST_HEAD(&hctx->ccid3hctx_hist); | 1351 | INIT_LIST_HEAD(&hctx->ccid3hctx_hist); |
1350 | init_timer(&hctx->ccid3hctx_no_feedback_timer); | 1352 | init_timer(&hctx->ccid3hctx_no_feedback_timer); |
@@ -1531,7 +1533,8 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk) | |||
1531 | 1533 | ||
1532 | if (delta == 0) | 1534 | if (delta == 0) |
1533 | delta = 1; /* to prevent divide by zero */ | 1535 | delta = 1; /* to prevent divide by zero */ |
1534 | hcrx->ccid3hcrx_x_recv = (hcrx->ccid3hcrx_bytes_recv * USEC_IN_SEC) / delta; | 1536 | hcrx->ccid3hcrx_x_recv = (hcrx->ccid3hcrx_bytes_recv * |
1537 | USEC_PER_SEC) / delta; | ||
1535 | } | 1538 | } |
1536 | break; | 1539 | break; |
1537 | default: | 1540 | default: |
@@ -1669,7 +1672,7 @@ static u32 ccid3_hc_rx_calc_first_li(struct sock *sk) | |||
1669 | } | 1672 | } |
1670 | found: | 1673 | found: |
1671 | timeval_sub(tstamp,tail->dccphrx_tstamp,&tmp_tv); | 1674 | timeval_sub(tstamp,tail->dccphrx_tstamp,&tmp_tv); |
1672 | rtt = (tmp_tv.tv_sec * USEC_IN_SEC + tmp_tv.tv_usec) * 4 / interval; | 1675 | rtt = (tmp_tv.tv_sec * USEC_PER_SEC + tmp_tv.tv_usec) * 4 / interval; |
1673 | ccid3_pr_debug("%s, sk=%p, approximated RTT to %uus\n", | 1676 | ccid3_pr_debug("%s, sk=%p, approximated RTT to %uus\n", |
1674 | dccp_role(sk), sk, rtt); | 1677 | dccp_role(sk), sk, rtt); |
1675 | if (rtt == 0) | 1678 | if (rtt == 0) |
@@ -1679,7 +1682,7 @@ found: | |||
1679 | if (delta == 0) | 1682 | if (delta == 0) |
1680 | delta = 1; | 1683 | delta = 1; |
1681 | 1684 | ||
1682 | x_recv = (hcrx->ccid3hcrx_bytes_recv * USEC_IN_SEC) / delta; | 1685 | x_recv = (hcrx->ccid3hcrx_bytes_recv * USEC_PER_SEC) / delta; |
1683 | 1686 | ||
1684 | tmp1 = (u64)x_recv * (u64)rtt; | 1687 | tmp1 = (u64)x_recv * (u64)rtt; |
1685 | do_div(tmp1,10000000); | 1688 | do_div(tmp1,10000000); |