Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58912
b: refs/heads/master
c: d83258a
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and David S. Miller committed Jul 11, 2007
1 parent e93165e commit 9f98507
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 22 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: 6bc7efe8efa627077f8f65d01dbb762fc9356a2f
refs/heads/master: d83258a3da1d3c7ae7b75549c8bf7ed689562c62
62 changes: 41 additions & 21 deletions trunk/net/dccp/ccids/ccid3.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,9 +823,12 @@ static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb)
*
* returns estimated loss interval in usecs */

static u32 ccid3_hc_rx_calc_first_li(struct sock *sk)
static u32 ccid3_hc_rx_calc_first_li(struct sock *sk,
struct list_head *hist_list,
struct timeval *last_feedback,
u16 s, u32 bytes_recv,
u32 previous_x_recv)
{
struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
struct dccp_rx_hist_entry *entry, *next, *tail = NULL;
u32 x_recv, p;
suseconds_t rtt, delta;
Expand All @@ -835,8 +838,7 @@ static u32 ccid3_hc_rx_calc_first_li(struct sock *sk)
int step = 0;
u64 fval;

list_for_each_entry_safe(entry, next, &hcrx->ccid3hcrx_hist,
dccphrx_node) {
list_for_each_entry_safe(entry, next, hist_list, dccphrx_node) {
if (dccp_rx_hist_entry_data_packet(entry)) {
tail = entry;

Expand Down Expand Up @@ -895,19 +897,20 @@ static u32 ccid3_hc_rx_calc_first_li(struct sock *sk)
}

dccp_timestamp(sk, &tstamp);
delta = timeval_delta(&tstamp, &hcrx->ccid3hcrx_tstamp_last_feedback);
delta = timeval_delta(&tstamp, last_feedback);
DCCP_BUG_ON(delta <= 0);

x_recv = scaled_div32(hcrx->ccid3hcrx_bytes_recv, delta);
x_recv = scaled_div32(bytes_recv, delta);
if (x_recv == 0) { /* would also trigger divide-by-zero */
DCCP_WARN("X_recv==0\n");
if ((x_recv = hcrx->ccid3hcrx_x_recv) == 0) {
if (previous_x_recv == 0) {
DCCP_BUG("stored value of X_recv is zero");
return ~0;
}
x_recv = previous_x_recv;
}

fval = scaled_div(hcrx->ccid3hcrx_s, rtt);
fval = scaled_div(s, rtt);
fval = scaled_div32(fval, x_recv);
p = tfrc_calc_x_reverse_lookup(fval);

Expand All @@ -920,26 +923,36 @@ static u32 ccid3_hc_rx_calc_first_li(struct sock *sk)
return 1000000 / p;
}

static void ccid3_hc_rx_update_li(struct sock *sk, u64 seq_loss, u8 win_loss)
static void ccid3_hc_rx_update_li(struct sock *sk,
struct list_head *li_hist_list,
struct list_head *hist_list,
struct timeval *last_feedback,
u16 s, u32 bytes_recv,
u32 previous_x_recv,
u64 seq_loss, u8 win_loss)
{
struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
struct dccp_li_hist_entry *head;
u64 seq_temp;

if (list_empty(&hcrx->ccid3hcrx_li_hist)) {
if (list_empty(li_hist_list)) {
if (!dccp_li_hist_interval_new(ccid3_li_hist,
&hcrx->ccid3hcrx_li_hist, seq_loss, win_loss))
li_hist_list, seq_loss,
win_loss))
return;

head = list_entry(hcrx->ccid3hcrx_li_hist.next,
struct dccp_li_hist_entry, dccplih_node);
head->dccplih_interval = ccid3_hc_rx_calc_first_li(sk);
head = list_entry(li_hist_list->next, struct dccp_li_hist_entry,
dccplih_node);
head->dccplih_interval =
ccid3_hc_rx_calc_first_li(sk, hist_list,
last_feedback, s,
bytes_recv,
previous_x_recv);
} else {
struct dccp_li_hist_entry *entry;
struct list_head *tail;

head = list_entry(hcrx->ccid3hcrx_li_hist.next,
struct dccp_li_hist_entry, dccplih_node);
head = list_entry(li_hist_list->next, struct dccp_li_hist_entry,
dccplih_node);
/* FIXME win count check removed as was wrong */
/* should make this check with receive history */
/* and compare there as per section 10.2 of RFC4342 */
Expand All @@ -954,9 +967,9 @@ static void ccid3_hc_rx_update_li(struct sock *sk, u64 seq_loss, u8 win_loss)
return;
}

list_add(&entry->dccplih_node, &hcrx->ccid3hcrx_li_hist);
list_add(&entry->dccplih_node, li_hist_list);

tail = hcrx->ccid3hcrx_li_hist.prev;
tail = li_hist_list->prev;
list_del(tail);
kmem_cache_free(ccid3_li_hist->dccplih_slab, tail);

Expand Down Expand Up @@ -992,8 +1005,15 @@ static int ccid3_hc_rx_detect_loss(struct sock *sk,
while (dccp_delta_seqno(hcrx->ccid3hcrx_seqno_nonloss, seqno)
> TFRC_RECV_NUM_LATE_LOSS) {
loss = 1;
ccid3_hc_rx_update_li(sk, hcrx->ccid3hcrx_seqno_nonloss,
hcrx->ccid3hcrx_ccval_nonloss);
ccid3_hc_rx_update_li(sk,
&hcrx->ccid3hcrx_li_hist,
&hcrx->ccid3hcrx_hist,
&hcrx->ccid3hcrx_tstamp_last_feedback,
hcrx->ccid3hcrx_s,
hcrx->ccid3hcrx_bytes_recv,
hcrx->ccid3hcrx_x_recv,
hcrx->ccid3hcrx_seqno_nonloss,
hcrx->ccid3hcrx_ccval_nonloss);
tmp_seqno = hcrx->ccid3hcrx_seqno_nonloss;
dccp_inc_seqno(&tmp_seqno);
hcrx->ccid3hcrx_seqno_nonloss = tmp_seqno;
Expand Down

0 comments on commit 9f98507

Please sign in to comment.