: Ringbuffer to track loss interval history
PATCH 16/43 : Ringbuffer to track loss interval history
[TFRC]: Ringbuffer to track loss interval history
A ringbuffer-based implementation of loss interval history is easier to maintain, allocate, and update.
This patch provides the basic data structures for a ringbuffer-based loss interval history, from which the principles of the implementation are already visible.
The patch compiles standalone, as functions tackled by subsequent patches have been commented out for the moment, this will be done step-by-step by the subsequent remaining patches.
Detailed documentation is in section 6 of
http://www.erg.abdn.ac.uk/users/gerrit/dccp/docs/ccid3_packet_reception/
Signed-off-by Gerrit Renker <[email protected]>
--- net/dccp/ccids/ccid3.c | 2 + net/dccp/ccids/lib/loss_interval.c | 17 +++++++++-- net/dccp/ccids/lib/loss_interval.h | 55 ++++++++++++++++++++++++++++++------- 3 files changed, 62 insertions(+), 12 deletions(-)
net/dccp/ccids/lib/loss_interval.c +14 -3
@@ -18,6 +18,8 @@struct dccp_li_hist *dccp_li_hist_new (const char *name) { +#if 0 /* XXX also subsequent patch */ +return NULL ;struct dccp_li_hist *hist =kmalloc (sizeof (*hist),GFP_ATOMIC );static const char dccp_li_hist_mask[] ="li_hist_%s" ;char *slab_name;
@@ -45,21 +47,25 @@ out_free_hist:kfree (hist); hist =NULL ; goto out; +#endif }EXPORT_SYMBOL_GPL (dccp_li_hist_new);void dccp_li_hist_delete (struct dccp_li_hist *hist) { +#if 0 /* XXX next patch */ const char * name =kmem_cache_name (hist->dccplih_slab);kmem_cache_destroy (hist->dccplih_slab);kfree (name);kfree (hist); +#endif }EXPORT_SYMBOL_GPL (dccp_li_hist_delete); +#if 0 /* XXX subsequent patch */ void dccp_li_hist_purge (struct dccp_li_hist *hist,struct list_head *list) {struct dccp_li_hist_entry *entry, *next;
@@ -69,6 +75,7 @@ void dccp_li_hist_purge(struct dccp_li_h kmem_cache_free(hist->dccplih_slab, entry); } } +#endif EXPORT_SYMBOL_GPL (dccp_li_hist_purge);
@@ -77,12 +84,13 @@ EXPORT_SYMBOL_GPL(dccp_li_hist_purge);* These are integers as per section 8 of RFC3448. We can then divide by 4 * * when we use it. */ -static const int dccp_li_hist_w[DCCP_LI_HIST_IVAL_F_LENGTH ] = { -4 ,4 ,4 ,4 ,3 ,2 ,1 ,1 , -}; +static const int tfrc_lh_weights[NINTERVAL ] = {4 ,4 ,4 ,4 ,3 ,2 ,1 ,1 };u32 dccp_li_hist_calc_i_mean (struct list_head *list) { +#ifndef DONE_WITH_TRANSITION /* XXX subsequent patch */ +return 0 ; +#else struct dccp_li_hist_entry *li_entry, *li_next;int i =0 ;u32 i_tot;
@@ -114,10 +122,12 @@ u32 dccp_li_hist_calc_i_mean(struct list }return i_tot / w_tot; +#endif }EXPORT_SYMBOL_GPL (dccp_li_hist_calc_i_mean); +/* XXX next patch int dccp_li_hist_interval_new(struct dccp_li_hist *hist, struct list_head *list, const u64 seq_loss, const u8 win_loss) {
@@ -141,3 +151,4 @@ int dccp_li_hist_interval_new(struct dcc} EXPORT_SYMBOL_GPL(dccp_li_hist_interval_new); +*/
net/dccp/ccids/ccid3.c +2 -0
@@ -861,6 +861,7 @@ static u32 ccid3_hc_rx_calc_first_li(strstatic void ccid3_hc_rx_update_li (struct sock *sk,u64 seq_loss,u8 win_loss) { +#if 0 /* XXX subsequent patch */ struct ccid3_hc_rx_sock *hcrx =ccid3_hc_rx_sk (sk);struct dccp_li_hist_entry *head;u64 seq_temp;
@@ -904,6 +905,7 @@ static void ccid3_hc_rx_update_li(struct entry->dccplih_interval = seq_temp; entry->dccplih_win_count = win_loss; } +#endif }static void ccid3_hc_rx_packet_recv (struct sock *sk,struct sk_buff *skb)
net/dccp/ccids/lib/loss_interval.h +46 -9
74 lines not on this page · raw message
Quoted 2 lines · Gerrit Renker
[TFRC]: Ringbuffer to track loss interval history
Acked-by Ian McDonald <[email protected]>
Signature · 3 lines
Web: http://wand.net.nz/~iam4/ Blog: http://iansblog.jandi.co.nz WAND Network Research Group