Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 1 | /* |
Gerrit Renker | 129fa44 | 2009-01-04 21:45:33 -0800 | [diff] [blame] | 2 | * TFRC library initialisation |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 3 | * |
4 | * Copyright (c) 2007 The University of Aberdeen, Scotland, UK | ||||
5 | * Copyright (c) 2007 Arnaldo Carvalho de Melo <acme@redhat.com> | ||||
6 | */ | ||||
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 7 | #include "tfrc.h" |
8 | |||||
9 | #ifdef CONFIG_IP_DCCP_TFRC_DEBUG | ||||
10 | int tfrc_debug; | ||||
Gerrit Renker | 157439f | 2008-08-23 13:28:27 +0200 | [diff] [blame] | 11 | module_param(tfrc_debug, bool, 0644); |
Gerrit Renker | 129fa44 | 2009-01-04 21:45:33 -0800 | [diff] [blame] | 12 | MODULE_PARM_DESC(tfrc_debug, "Enable TFRC debug messages"); |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 13 | #endif |
14 | |||||
Gerrit Renker | 129fa44 | 2009-01-04 21:45:33 -0800 | [diff] [blame] | 15 | int __init tfrc_lib_init(void) |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 16 | { |
Gerrit Renker | 954c2db | 2007-12-12 14:06:14 -0200 | [diff] [blame] | 17 | int rc = tfrc_li_init(); |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 18 | |
Gerrit Renker | df8f83f | 2007-12-12 12:24:49 -0200 | [diff] [blame] | 19 | if (rc) |
20 | goto out; | ||||
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 21 | |
Gerrit Renker | df8f83f | 2007-12-12 12:24:49 -0200 | [diff] [blame] | 22 | rc = tfrc_tx_packet_history_init(); |
23 | if (rc) | ||||
24 | goto out_free_loss_intervals; | ||||
25 | |||||
26 | rc = tfrc_rx_packet_history_init(); | ||||
27 | if (rc) | ||||
28 | goto out_free_tx_history; | ||||
29 | return 0; | ||||
30 | |||||
31 | out_free_tx_history: | ||||
32 | tfrc_tx_packet_history_exit(); | ||||
33 | out_free_loss_intervals: | ||||
Gerrit Renker | 954c2db | 2007-12-12 14:06:14 -0200 | [diff] [blame] | 34 | tfrc_li_exit(); |
Gerrit Renker | df8f83f | 2007-12-12 12:24:49 -0200 | [diff] [blame] | 35 | out: |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 36 | return rc; |
37 | } | ||||
38 | |||||
Leonardo Potenza | 1b6725d | 2009-01-09 23:06:28 -0800 | [diff] [blame] | 39 | void tfrc_lib_exit(void) |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 40 | { |
Gerrit Renker | df8f83f | 2007-12-12 12:24:49 -0200 | [diff] [blame] | 41 | tfrc_rx_packet_history_exit(); |
42 | tfrc_tx_packet_history_exit(); | ||||
Gerrit Renker | 954c2db | 2007-12-12 14:06:14 -0200 | [diff] [blame] | 43 | tfrc_li_exit(); |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 44 | } |