Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6440
b: refs/heads/master
c: 072ab6c
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and David S. Miller committed Aug 29, 2005
1 parent 272736c commit f90dfac
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 127 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: 36729c1a73c354a155db18d64d9e79b86c446fcf
refs/heads/master: 072ab6c68e3dd158b68d97eaff16734474d2f8f8
122 changes: 2 additions & 120 deletions trunk/net/dccp/ccids/ccid3.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,125 +744,6 @@ static inline void ccid3_hc_rx_set_state(struct sock *sk,
hcrx->ccid3hcrx_state = state;
}

static int ccid3_hc_rx_add_hist(struct sock *sk,
struct dccp_rx_hist_entry *packet)
{
struct dccp_sock *dp = dccp_sk(sk);
struct ccid3_hc_rx_sock *hcrx = dp->dccps_hc_rx_ccid_private;
struct dccp_rx_hist_entry *entry, *next, *iter;
u8 num_later = 0;

iter = dccp_rx_hist_head(&hcrx->ccid3hcrx_hist);
if (iter == NULL)
dccp_rx_hist_add_entry(&hcrx->ccid3hcrx_hist, packet);
else {
const u64 seqno = packet->dccphrx_seqno;

if (after48(seqno, iter->dccphrx_seqno))
dccp_rx_hist_add_entry(&hcrx->ccid3hcrx_hist, packet);
else {
if (dccp_rx_hist_entry_data_packet(iter))
num_later = 1;

list_for_each_entry_continue(iter,
&hcrx->ccid3hcrx_hist,
dccphrx_node) {
if (after48(seqno, iter->dccphrx_seqno)) {
dccp_rx_hist_add_entry(&iter->dccphrx_node,
packet);
goto trim_history;
}

if (dccp_rx_hist_entry_data_packet(iter))
num_later++;

if (num_later == TFRC_RECV_NUM_LATE_LOSS) {
dccp_rx_hist_entry_delete(ccid3_rx_hist,
packet);
ccid3_pr_debug("%s, sk=%p, packet"
"(%llu) already lost!\n",
dccp_role(sk), sk,
seqno);
return 1;
}
}

if (num_later < TFRC_RECV_NUM_LATE_LOSS)
dccp_rx_hist_add_entry(&hcrx->ccid3hcrx_hist,
packet);
/*
* FIXME: else what? should we destroy the packet
* like above?
*/
}
}

trim_history:
/*
* Trim history (remove all packets after the NUM_LATE_LOSS + 1
* data packets)
*/
num_later = TFRC_RECV_NUM_LATE_LOSS + 1;

if (!list_empty(&hcrx->ccid3hcrx_li_hist)) {
list_for_each_entry_safe(entry, next, &hcrx->ccid3hcrx_hist,
dccphrx_node) {
if (num_later == 0) {
list_del_init(&entry->dccphrx_node);
dccp_rx_hist_entry_delete(ccid3_rx_hist, entry);
} else if (dccp_rx_hist_entry_data_packet(entry))
--num_later;
}
} else {
int step = 0;
u8 win_count = 0; /* Not needed, but lets shut up gcc */
int tmp;
/*
* We have no loss interval history so we need at least one
* rtt:s of data packets to approximate rtt.
*/
list_for_each_entry_safe(entry, next, &hcrx->ccid3hcrx_hist,
dccphrx_node) {
if (num_later == 0) {
switch (step) {
case 0:
step = 1;
/* OK, find next data packet */
num_later = 1;
break;
case 1:
step = 2;
/* OK, find next data packet */
num_later = 1;
win_count = entry->dccphrx_ccval;
break;
case 2:
tmp = win_count - entry->dccphrx_ccval;
if (tmp < 0)
tmp += TFRC_WIN_COUNT_LIMIT;
if (tmp > TFRC_WIN_COUNT_PER_RTT + 1) {
/*
* We have found a packet older
* than one rtt remove the rest
*/
step = 3;
} else /* OK, find next data packet */
num_later = 1;
break;
case 3:
list_del_init(&entry->dccphrx_node);
dccp_rx_hist_entry_delete(ccid3_rx_hist,
entry);
break;
}
} else if (dccp_rx_hist_entry_data_packet(entry))
--num_later;
}
}

return 0;
}

static void ccid3_hc_rx_send_feedback(struct sock *sk)
{
struct dccp_sock *dp = dccp_sk(sk);
Expand Down Expand Up @@ -1185,7 +1066,8 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)

win_count = packet->dccphrx_ccval;

ins = ccid3_hc_rx_add_hist(sk, packet);
ins = dccp_rx_hist_add_packet(ccid3_rx_hist, &hcrx->ccid3hcrx_hist,
&hcrx->ccid3hcrx_li_hist, packet);

if (DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK)
return;
Expand Down
6 changes: 0 additions & 6 deletions trunk/net/dccp/ccids/ccid3.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,11 @@
/* In usecs - half the scheduling granularity as per RFC3448 4.6 */
#define TFRC_OPSYS_HALF_TIME_GRAN (USEC_PER_SEC / (2 * HZ))

#define TFRC_WIN_COUNT_PER_RTT 4
#define TFRC_WIN_COUNT_LIMIT 16

/* In seconds */
#define TFRC_MAX_BACK_OFF_TIME 64

#define TFRC_SMALLEST_P 40

/* Number of later packets received before one is considered lost */
#define TFRC_RECV_NUM_LATE_LOSS 3

enum ccid3_options {
TFRC_OPT_LOSS_EVENT_RATE = 192,
TFRC_OPT_LOSS_INTERVALS = 193,
Expand Down
111 changes: 111 additions & 0 deletions trunk/net/dccp/ccids/lib/packet_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,117 @@ struct dccp_rx_hist_entry *

EXPORT_SYMBOL_GPL(dccp_rx_hist_find_data_packet);

int dccp_rx_hist_add_packet(struct dccp_rx_hist *hist,
struct list_head *rx_list,
struct list_head *li_list,
struct dccp_rx_hist_entry *packet)
{
struct dccp_rx_hist_entry *entry, *next, *iter;
u8 num_later = 0;

iter = dccp_rx_hist_head(rx_list);
if (iter == NULL)
dccp_rx_hist_add_entry(rx_list, packet);
else {
const u64 seqno = packet->dccphrx_seqno;

if (after48(seqno, iter->dccphrx_seqno))
dccp_rx_hist_add_entry(rx_list, packet);
else {
if (dccp_rx_hist_entry_data_packet(iter))
num_later = 1;

list_for_each_entry_continue(iter, rx_list,
dccphrx_node) {
if (after48(seqno, iter->dccphrx_seqno)) {
dccp_rx_hist_add_entry(&iter->dccphrx_node,
packet);
goto trim_history;
}

if (dccp_rx_hist_entry_data_packet(iter))
num_later++;

if (num_later == TFRC_RECV_NUM_LATE_LOSS) {
dccp_rx_hist_entry_delete(hist, packet);
return 1;
}
}

if (num_later < TFRC_RECV_NUM_LATE_LOSS)
dccp_rx_hist_add_entry(rx_list, packet);
/*
* FIXME: else what? should we destroy the packet
* like above?
*/
}
}

trim_history:
/*
* Trim history (remove all packets after the NUM_LATE_LOSS + 1
* data packets)
*/
num_later = TFRC_RECV_NUM_LATE_LOSS + 1;

if (!list_empty(li_list)) {
list_for_each_entry_safe(entry, next, rx_list, dccphrx_node) {
if (num_later == 0) {
list_del_init(&entry->dccphrx_node);
dccp_rx_hist_entry_delete(hist, entry);
} else if (dccp_rx_hist_entry_data_packet(entry))
--num_later;
}
} else {
int step = 0;
u8 win_count = 0; /* Not needed, but lets shut up gcc */
int tmp;
/*
* We have no loss interval history so we need at least one
* rtt:s of data packets to approximate rtt.
*/
list_for_each_entry_safe(entry, next, rx_list, dccphrx_node) {
if (num_later == 0) {
switch (step) {
case 0:
step = 1;
/* OK, find next data packet */
num_later = 1;
break;
case 1:
step = 2;
/* OK, find next data packet */
num_later = 1;
win_count = entry->dccphrx_ccval;
break;
case 2:
tmp = win_count - entry->dccphrx_ccval;
if (tmp < 0)
tmp += TFRC_WIN_COUNT_LIMIT;
if (tmp > TFRC_WIN_COUNT_PER_RTT + 1) {
/*
* We have found a packet older
* than one rtt remove the rest
*/
step = 3;
} else /* OK, find next data packet */
num_later = 1;
break;
case 3:
list_del_init(&entry->dccphrx_node);
dccp_rx_hist_entry_delete(hist, entry);
break;
}
} else if (dccp_rx_hist_entry_data_packet(entry))
--num_later;
}
}

return 0;
}

EXPORT_SYMBOL_GPL(dccp_rx_hist_add_packet);

struct dccp_tx_hist *dccp_tx_hist_new(const char *name)
{
struct dccp_tx_hist *hist = kmalloc(sizeof(*hist), GFP_ATOMIC);
Expand Down
11 changes: 11 additions & 0 deletions trunk/net/dccp/ccids/lib/packet_history.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@

#include "../../dccp.h"

/* Number of later packets received before one is considered lost */
#define TFRC_RECV_NUM_LATE_LOSS 3

#define TFRC_WIN_COUNT_PER_RTT 4
#define TFRC_WIN_COUNT_LIMIT 16

struct dccp_tx_hist_entry {
struct list_head dccphtx_node;
u64 dccphtx_seqno:48,
Expand Down Expand Up @@ -182,4 +188,9 @@ static inline int
entry->dccphrx_type == DCCP_PKT_DATAACK;
}

extern int dccp_rx_hist_add_packet(struct dccp_rx_hist *hist,
struct list_head *rx_list,
struct list_head *li_list,
struct dccp_rx_hist_entry *packet);

#endif /* _DCCP_PKT_HIST_ */

0 comments on commit f90dfac

Please sign in to comment.