Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 111501
b: refs/heads/master
c: 535c55d
h: refs/heads/master
i:
  111499: 111c05f
v: v3
  • Loading branch information
Gerrit Renker committed Sep 4, 2008
1 parent e3a04ad commit c2051ec
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3306c781ff13aea89606435c134ec84e3c608681
refs/heads/master: 535c55df136ad2783d444e54d518a8fae8bdbf79
9 changes: 4 additions & 5 deletions trunk/net/dccp/ccids/ccid3.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,10 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)

/* Update loss event rate (which is scaled by 1e6) */
pinv = opt_recv->ccid3or_loss_event_rate;
if (pinv == ~0U || pinv == 0) /* see RFC 4342, 8.5 */
if (pinv == 0)
hctx->p = 0;
else /* can not exceed 100% */
hctx->p = scaled_div(1, pinv);
else
hctx->p = tfrc_invert_loss_event_rate(pinv);

/*
* Update allowed sending rate X as per draft rfc3448bis-00, 4.2/3
Expand Down Expand Up @@ -854,8 +854,7 @@ static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len,
return -EINVAL;
rx_info.tfrcrx_x_recv = hcrx->x_recv;
rx_info.tfrcrx_rtt = hcrx->rtt;
rx_info.tfrcrx_p = hcrx->p_inverse == 0 ? ~0U :
scaled_div(1, hcrx->p_inverse);
rx_info.tfrcrx_p = tfrc_invert_loss_event_rate(hcrx->p_inverse);
len = sizeof(rx_info);
val = &rx_info;
break;
Expand Down
1 change: 1 addition & 0 deletions trunk/net/dccp/ccids/lib/tfrc.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ static inline u32 tfrc_ewma(const u32 avg, const u32 newval, const u8 weight)

extern u32 tfrc_calc_x(u16 s, u32 R, u32 p);
extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue);
extern u32 tfrc_invert_loss_event_rate(u32 loss_event_rate);

extern int tfrc_tx_packet_history_init(void);
extern void tfrc_tx_packet_history_exit(void);
Expand Down
17 changes: 15 additions & 2 deletions trunk/net/dccp/ccids/lib/tfrc_equation.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,6 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p)
result = scaled_div(s, R);
return scaled_div32(result, f);
}

EXPORT_SYMBOL_GPL(tfrc_calc_x);

/**
Expand Down Expand Up @@ -693,5 +692,19 @@ u32 tfrc_calc_x_reverse_lookup(u32 fvalue)
index = tfrc_binsearch(fvalue, 0);
return (index + 1) * 1000000 / TFRC_CALC_X_ARRSIZE;
}

EXPORT_SYMBOL_GPL(tfrc_calc_x_reverse_lookup);

/**
* tfrc_invert_loss_event_rate - Compute p so that 10^6 corresponds to 100%
* When @loss_event_rate is large, there is a chance that p is truncated to 0.
* To avoid re-entering slow-start in that case, we set p = TFRC_SMALLEST_P > 0.
*/
u32 tfrc_invert_loss_event_rate(u32 loss_event_rate)
{
if (loss_event_rate == UINT_MAX) /* see RFC 4342, 8.5 */
return 0;
if (unlikely(loss_event_rate == 0)) /* map 1/0 into 100% */
return 1000000;
return max_t(u32, scaled_div(1, loss_event_rate), TFRC_SMALLEST_P);
}
EXPORT_SYMBOL_GPL(tfrc_invert_loss_event_rate);

0 comments on commit c2051ec

Please sign in to comment.