net/dccp/ccids/lib/loss_interval.c
changeset 2 d1f6d8b6f81c
parent 0 aa628870c1d3
equal deleted inserted replaced
1:0056487c491e 2:d1f6d8b6f81c
    58 			kmem_cache_free(tfrc_lh_slab,
    58 			kmem_cache_free(tfrc_lh_slab,
    59 					lh->ring[LIH_INDEX(lh->counter)]);
    59 					lh->ring[LIH_INDEX(lh->counter)]);
    60 			lh->ring[LIH_INDEX(lh->counter)] = NULL;
    60 			lh->ring[LIH_INDEX(lh->counter)] = NULL;
    61 		}
    61 		}
    62 }
    62 }
    63 EXPORT_SYMBOL_GPL(tfrc_lh_cleanup);
       
    64 
    63 
    65 static void tfrc_lh_calc_i_mean(struct tfrc_loss_hist *lh)
    64 static void tfrc_lh_calc_i_mean(struct tfrc_loss_hist *lh)
    66 {
    65 {
    67 	u32 i_i, i_tot0 = 0, i_tot1 = 0, w_tot = 0;
    66 	u32 i_i, i_tot0 = 0, i_tot1 = 0, w_tot = 0;
    68 	int i, k = tfrc_lh_length(lh) - 1; /* k is as in rfc3448bis, 5.4 */
    67 	int i, k = tfrc_lh_length(lh) - 1; /* k is as in rfc3448bis, 5.4 */
   119 	cur->li_length = len;
   118 	cur->li_length = len;
   120 	tfrc_lh_calc_i_mean(lh);
   119 	tfrc_lh_calc_i_mean(lh);
   121 
   120 
   122 	return (lh->i_mean < old_i_mean);
   121 	return (lh->i_mean < old_i_mean);
   123 }
   122 }
   124 EXPORT_SYMBOL_GPL(tfrc_lh_update_i_mean);
       
   125 
   123 
   126 /* Determine if `new_loss' does begin a new loss interval [RFC 4342, 10.2] */
   124 /* Determine if `new_loss' does begin a new loss interval [RFC 4342, 10.2] */
   127 static inline u8 tfrc_lh_is_new_loss(struct tfrc_loss_interval *cur,
   125 static inline u8 tfrc_lh_is_new_loss(struct tfrc_loss_interval *cur,
   128 				     struct tfrc_rx_hist_entry *new_loss)
   126 				     struct tfrc_rx_hist_entry *new_loss)
   129 {
   127 {
   167 
   165 
   168 		tfrc_lh_calc_i_mean(lh);
   166 		tfrc_lh_calc_i_mean(lh);
   169 	}
   167 	}
   170 	return 1;
   168 	return 1;
   171 }
   169 }
   172 EXPORT_SYMBOL_GPL(tfrc_lh_interval_add);
       
   173 
   170 
   174 int __init tfrc_li_init(void)
   171 int __init tfrc_li_init(void)
   175 {
   172 {
   176 	tfrc_lh_slab = kmem_cache_create("tfrc_li_hist",
   173 	tfrc_lh_slab = kmem_cache_create("tfrc_li_hist",
   177 					 sizeof(struct tfrc_loss_interval), 0,
   174 					 sizeof(struct tfrc_loss_interval), 0,