示例#1
0
/**
 *  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)
 *  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.
 */
int tfrc_rx_handle_loss(struct tfrc_rx_hist *h,
            struct tfrc_loss_hist *lh,
            struct sk_buff *skb, u32 ndp,
            u32 (*calc_first_li)(struct sock *), struct sock *sk)
{
    int is_new_loss = 0;

    if (h->loss_count == 1) {
        __one_after_loss(h, skb, ndp);
    } else if (h->loss_count != 2) {
        DCCP_BUG("invalid loss_count %d", h->loss_count);
    } else if (__two_after_loss(h, skb, ndp)) {
        /*
         * Update Loss Interval database and recycle RX records
         */
        is_new_loss = tfrc_lh_interval_add(lh, h, calc_first_li, sk);
        __three_after_loss(h);
    }
    return is_new_loss;
}
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)
{
	int is_new_loss = 0;

	if (h->loss_count == 0) {
		__do_track_loss(h, skb, ndp);
	} else if (h->loss_count == 1) {
		__one_after_loss(h, skb, ndp);
	} else if (h->loss_count != 2) {
		DCCP_BUG("invalid loss_count %d", h->loss_count);
	} else if (__two_after_loss(h, skb, ndp)) {
		/*
                                                         
   */
		is_new_loss = tfrc_lh_interval_add(lh, h, calc_first_li, sk);
		__three_after_loss(h);
	}
	return is_new_loss;
}