Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 111545
b: refs/heads/master
c: 88e97a9
h: refs/heads/master
i:
  111543: 76ec290
v: v3
  • Loading branch information
Gerrit Renker committed Sep 4, 2008
1 parent f664375 commit c9add78
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 57 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: 68c89ee53571a441799c03d5e240c6441bced620
refs/heads/master: 88e97a93342c0b9e835d510921e7b2df8547d1bd
37 changes: 11 additions & 26 deletions trunk/net/dccp/ccids/ccid3.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,41 +657,26 @@ static u32 ccid3_first_li(struct sock *sk)
static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
{
struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
enum ccid3_fback_type do_feedback = CCID3_FBACK_NONE;
const u64 ndp = dccp_sk(sk)->dccps_options_received.dccpor_ndp;
const bool is_data_packet = dccp_data_packet(skb);

/*
* Perform loss detection and handle pending losses
*/
if (tfrc_rx_handle_loss(&hcrx->hist, &hcrx->li_hist,
skb, ndp, ccid3_first_li, sk)) {
do_feedback = CCID3_FBACK_PARAM_CHANGE;
goto done_receiving;
}

if (unlikely(hcrx->feedback == CCID3_FBACK_NONE)) {
if (is_data_packet)
do_feedback = CCID3_FBACK_INITIAL;
goto update_records;
}

if (tfrc_rx_hist_loss_pending(&hcrx->hist))
return; /* done receiving */

if (tfrc_rx_congestion_event(&hcrx->hist, &hcrx->li_hist,
skb, ndp, ccid3_first_li, sk))
ccid3_hc_rx_send_feedback(sk, skb, CCID3_FBACK_PARAM_CHANGE);
/*
* Feedback for first non-empty data packet (RFC 3448, 6.3)
*/
else if (unlikely(hcrx->feedback == CCID3_FBACK_NONE && is_data_packet))
ccid3_hc_rx_send_feedback(sk, skb, CCID3_FBACK_INITIAL);
/*
* Check if the periodic once-per-RTT feedback is due; RFC 4342, 10.3
*/
if (is_data_packet &&
SUB16(dccp_hdr(skb)->dccph_ccval, hcrx->last_counter) > 3)
do_feedback = CCID3_FBACK_PERIODIC;

update_records:
tfrc_rx_hist_add_packet(&hcrx->hist, skb, ndp);

done_receiving:
if (do_feedback)
ccid3_hc_rx_send_feedback(sk, skb, do_feedback);
else if (!tfrc_rx_hist_loss_pending(&hcrx->hist) && is_data_packet &&
SUB16(dccp_hdr(skb)->dccph_ccval, hcrx->last_counter) > 3)
ccid3_hc_rx_send_feedback(sk, skb, CCID3_FBACK_PERIODIC);
}

static int ccid3_hc_rx_init(struct ccid *ccid, struct sock *sk)
Expand Down
10 changes: 5 additions & 5 deletions trunk/net/dccp/ccids/lib/loss_interval.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,18 @@ static inline u8 tfrc_lh_is_new_loss(struct tfrc_loss_interval *cur,
* @sk: Used by @calc_first_li in caller-specific way (subtyping)
* Updates I_mean and returns 1 if a new interval has in fact been added to @lh.
*/
int tfrc_lh_interval_add(struct tfrc_loss_hist *lh, struct tfrc_rx_hist *rh,
u32 (*calc_first_li)(struct sock *), struct sock *sk)
bool tfrc_lh_interval_add(struct tfrc_loss_hist *lh, struct tfrc_rx_hist *rh,
u32 (*calc_first_li)(struct sock *), struct sock *sk)
{
struct tfrc_loss_interval *cur = tfrc_lh_peek(lh), *new;

if (cur != NULL && !tfrc_lh_is_new_loss(cur, tfrc_rx_hist_loss_prev(rh)))
return 0;
return false;

new = tfrc_lh_demand_next(lh);
if (unlikely(new == NULL)) {
DCCP_CRIT("Cannot allocate/add loss record.");
return 0;
return false;
}

new->li_seqno = tfrc_rx_hist_loss_prev(rh)->tfrchrx_seqno;
Expand All @@ -169,7 +169,7 @@ int tfrc_lh_interval_add(struct tfrc_loss_hist *lh, struct tfrc_rx_hist *rh,

tfrc_lh_calc_i_mean(lh);
}
return 1;
return true;
}
EXPORT_SYMBOL_GPL(tfrc_lh_interval_add);

Expand Down
2 changes: 1 addition & 1 deletion trunk/net/dccp/ccids/lib/loss_interval.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static inline u8 tfrc_lh_length(struct tfrc_loss_hist *lh)

struct tfrc_rx_hist;

extern int tfrc_lh_interval_add(struct tfrc_loss_hist *, struct tfrc_rx_hist *,
extern bool tfrc_lh_interval_add(struct tfrc_loss_hist *, struct tfrc_rx_hist *,
u32 (*first_li)(struct sock *), struct sock *);
extern void tfrc_lh_update_i_mean(struct tfrc_loss_hist *lh, struct sk_buff *);
extern void tfrc_lh_cleanup(struct tfrc_loss_hist *lh);
Expand Down
37 changes: 18 additions & 19 deletions trunk/net/dccp/ccids/lib/packet_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,8 @@ static void __do_track_loss(struct tfrc_rx_hist *h, struct sk_buff *skb, u64 n1)
u64 s0 = tfrc_rx_hist_loss_prev(h)->tfrchrx_seqno,
s1 = DCCP_SKB_CB(skb)->dccpd_seq;

if (!dccp_loss_free(s0, s1, n1)) { /* gap between S0 and S1 */
if (!dccp_loss_free(s0, s1, n1)) /* gap between S0 and S1 */
h->loss_count = 1;
tfrc_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 1), skb, n1);
}
}

static void __one_after_loss(struct tfrc_rx_hist *h, struct sk_buff *skb, u32 n2)
Expand Down Expand Up @@ -328,33 +326,34 @@ static void __three_after_loss(struct tfrc_rx_hist *h)
}

/**
* tfrc_rx_handle_loss - Loss detection and further processing
* @h: The non-empty RX history object
* @lh: Loss Intervals database to update
* @skb: Currently received packet
* @ndp: The NDP count belonging to @skb
* @calc_first_li: Caller-dependent computation of first loss interval in @lh
* @sk: Used by @calc_first_li (see tfrc_lh_interval_add)
* tfrc_rx_congestion_event - Loss detection and further processing
* @h: The non-empty RX history object
* @lh: Loss Intervals database to update
* @skb: Currently received packet
* @ndp: The NDP count belonging to @skb
* @first_li: Caller-dependent computation of first loss interval in @lh
* @sk: Used by @calc_first_li (see tfrc_lh_interval_add)
* Chooses action according to pending loss, updates LI database when a new
* loss was detected, and does required post-processing. Returns 1 when caller
* should send feedback, 0 otherwise.
* Since it also takes care of reordering during loss detection and updates the
* records accordingly, the caller should not perform any more RX history
* operations when loss_count is greater than 0 after calling this function.
*/
int tfrc_rx_handle_loss(struct tfrc_rx_hist *h,
struct tfrc_loss_hist *lh,
struct sk_buff *skb, const u64 ndp,
u32 (*calc_first_li)(struct sock *), struct sock *sk)
bool tfrc_rx_congestion_event(struct tfrc_rx_hist *h,
struct tfrc_loss_hist *lh,
struct sk_buff *skb, const u64 ndp,
u32 (*first_li)(struct sock *), struct sock *sk)
{
int is_new_loss = 0;
bool new_event = false;

if (tfrc_rx_hist_duplicate(h, skb))
return 0;

if (h->loss_count == 0) {
__do_track_loss(h, skb, ndp);
tfrc_rx_hist_sample_rtt(h, skb);
tfrc_rx_hist_add_packet(h, skb, ndp);
} else if (h->loss_count == 1) {
__one_after_loss(h, skb, ndp);
} else if (h->loss_count != 2) {
Expand All @@ -363,7 +362,7 @@ int tfrc_rx_handle_loss(struct tfrc_rx_hist *h,
/*
* Update Loss Interval database and recycle RX records
*/
is_new_loss = tfrc_lh_interval_add(lh, h, calc_first_li, sk);
new_event = tfrc_lh_interval_add(lh, h, first_li, sk);
__three_after_loss(h);
}

Expand All @@ -378,12 +377,12 @@ int tfrc_rx_handle_loss(struct tfrc_rx_hist *h,
}

/* RFC 3448, 6.1: update I_0, whose growth implies p <= p_prev */
if (!is_new_loss)
if (!new_event)
tfrc_lh_update_i_mean(lh, skb);

return is_new_loss;
return new_event;
}
EXPORT_SYMBOL_GPL(tfrc_rx_handle_loss);
EXPORT_SYMBOL_GPL(tfrc_rx_congestion_event);

/* Compute the sending rate X_recv measured between feedback intervals */
u32 tfrc_rx_hist_x_recv(struct tfrc_rx_hist *h, const u32 last_x_recv)
Expand Down
10 changes: 5 additions & 5 deletions trunk/net/dccp/ccids/lib/packet_history.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ extern void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h,
extern int tfrc_rx_hist_duplicate(struct tfrc_rx_hist *h, struct sk_buff *skb);

struct tfrc_loss_hist;
extern int tfrc_rx_handle_loss(struct tfrc_rx_hist *h,
struct tfrc_loss_hist *lh,
struct sk_buff *skb, const u64 ndp,
u32 (*first_li)(struct sock *sk),
struct sock *sk);
extern bool tfrc_rx_congestion_event(struct tfrc_rx_hist *h,
struct tfrc_loss_hist *lh,
struct sk_buff *skb, const u64 ndp,
u32 (*first_li)(struct sock *sk),
struct sock *sk);
extern void tfrc_rx_hist_sample_rtt(struct tfrc_rx_hist *h,
const struct sk_buff *skb);
extern int tfrc_rx_hist_init(struct tfrc_rx_hist *h, struct sock *sk);
Expand Down

0 comments on commit c9add78

Please sign in to comment.