aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2006-11-27 09:22:48 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:30:36 -0500
commitf5c2d6367b04fd5ba98a5f9846b5fb870423968a (patch)
tree139687b3ec6b86b1938e7d55571880b9a88bf936 /net/dccp
parent90feeb951f61a80d3a8f8e5ced25b9ec78867eaf (diff)
[DCCP] ccid3: Simplify control flow in the calculation of t_ipi
This patch performs a simplifying (performance) optimisation: In each call of the inline function ccid3_calc_new_t_ipi(), the state is tested against TFRC_SSTATE_NO_FBACK. This is expensive when the function is called very often. A simpler solution, implemented by this patch, is to adapt the control flow. Background:
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/ccids/ccid3.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index d7b688e9f983..df88c54b2ec5 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -103,13 +103,7 @@ static void ccid3_hc_tx_set_state(struct sock *sk,
103/* Calculate new t_ipi (inter packet interval) by t_ipi = s / X_inst */ 103/* Calculate new t_ipi (inter packet interval) by t_ipi = s / X_inst */
104static inline void ccid3_calc_new_t_ipi(struct ccid3_hc_tx_sock *hctx) 104static inline void ccid3_calc_new_t_ipi(struct ccid3_hc_tx_sock *hctx)
105{ 105{
106 /* 106 hctx->ccid3hctx_t_ipi = usecs_div(hctx->ccid3hctx_s, hctx->ccid3hctx_x);
107 * If no feedback spec says t_ipi is 1 second (set elsewhere and then
108 * doubles after every no feedback timer (separate function)
109 */
110 if (hctx->ccid3hctx_state != TFRC_SSTATE_NO_FBACK)
111 hctx->ccid3hctx_t_ipi = usecs_div(hctx->ccid3hctx_s,
112 hctx->ccid3hctx_x);
113} 107}
114 108
115/* Calculate new delta by delta = min(t_ipi / 2, t_gran / 2) */ 109/* Calculate new delta by delta = min(t_ipi / 2, t_gran / 2) */
@@ -395,6 +389,8 @@ static void ccid3_hc_tx_packet_sent(struct sock *sk, int more, int len)
395 "as a data packet", dccp_role(sk)); 389 "as a data packet", dccp_role(sk));
396 return; 390 return;
397 case TFRC_SSTATE_NO_FBACK: 391 case TFRC_SSTATE_NO_FBACK:
392 /* t_nom, t_ipi, delta do not change until feedback arrives */
393 return;
398 case TFRC_SSTATE_FBACK: 394 case TFRC_SSTATE_FBACK:
399 if (len > 0) { 395 if (len > 0) {
400 timeval_sub_usecs(&hctx->ccid3hctx_t_nom, 396 timeval_sub_usecs(&hctx->ccid3hctx_t_nom,