dccp ccid-3: Fix a loss detection bug

This fixes a bug in the logic of the TFRC loss detection:
 * new_loss_indicated() should not be called while a loss is pending;
 * but the code allows this;
 * thus, for two subsequent gaps in the sequence space, when loss_count
   has not yet reached NDUPACK=3, the loss_count is falsely reduced to 1.

To avoid further and similar problems, all loss handling and loss detection is
now done inside tfrc_rx_hist_handle_loss(), using an appropriate routine to
track new losses.

Further changes:
----------------
 * added a reminder that no RX history operations should be performed when
   rx_handle_loss() has identified a (new) loss, since the function takes
   care of packet reordering during loss detection;
 * made tfrc_rx_hist_loss_pending() bool (thanks to an earlier suggestion
   by Arnaldo);		 
 * removed unused functions.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
This commit is contained in:
Gerrit Renker
2008-07-13 11:51:40 +01:00
parent 5b5d0e7048
commit b552c6231f
3 changed files with 27 additions and 33 deletions

View File

@@ -118,30 +118,10 @@ static inline struct tfrc_rx_hist_entry *
return h->ring[h->loss_start];
}
/* initialise loss detection and disable RTT sampling */
static inline void tfrc_rx_hist_loss_indicated(struct tfrc_rx_hist *h)
{
h->loss_count = 1;
}
/* indicate whether previously a packet was detected missing */
static inline int tfrc_rx_hist_loss_pending(const struct tfrc_rx_hist *h)
static inline bool tfrc_rx_hist_loss_pending(const struct tfrc_rx_hist *h)
{
return h->loss_count;
}
/* any data packets missing between last reception and skb ? */
static inline int tfrc_rx_hist_new_loss_indicated(struct tfrc_rx_hist *h,
const struct sk_buff *skb,
u32 ndp)
{
int delta = dccp_delta_seqno(tfrc_rx_hist_last_rcv(h)->tfrchrx_seqno,
DCCP_SKB_CB(skb)->dccpd_seq);
if (delta > 1 && ndp < delta)
tfrc_rx_hist_loss_indicated(h);
return tfrc_rx_hist_loss_pending(h);
return h->loss_count > 0;
}
extern void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h,