blob: 4902029854d83af04f37015f5e4ff30a5c04584e [file] [log] [blame]
Gerrit Renkerc40616c2007-12-06 12:26:38 -02001/*
Gerrit Renker129fa442009-01-04 21:45:33 -08002 * TFRC library initialisation
Gerrit Renkerc40616c2007-12-06 12:26:38 -02003 *
4 * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
5 * Copyright (c) 2007 Arnaldo Carvalho de Melo <acme@redhat.com>
6 */
Gerrit Renkerc40616c2007-12-06 12:26:38 -02007#include "tfrc.h"
8
9#ifdef CONFIG_IP_DCCP_TFRC_DEBUG
10int tfrc_debug;
Gerrit Renker157439f2008-08-23 13:28:27 +020011module_param(tfrc_debug, bool, 0644);
Gerrit Renker129fa442009-01-04 21:45:33 -080012MODULE_PARM_DESC(tfrc_debug, "Enable TFRC debug messages");
Gerrit Renkerc40616c2007-12-06 12:26:38 -020013#endif
14
Gerrit Renker129fa442009-01-04 21:45:33 -080015int __init tfrc_lib_init(void)
Gerrit Renkerc40616c2007-12-06 12:26:38 -020016{
Gerrit Renker954c2db2007-12-12 14:06:14 -020017 int rc = tfrc_li_init();
Gerrit Renkerc40616c2007-12-06 12:26:38 -020018
Gerrit Renkerdf8f83f2007-12-12 12:24:49 -020019 if (rc)
20 goto out;
Gerrit Renkerc40616c2007-12-06 12:26:38 -020021
Gerrit Renkerdf8f83f2007-12-12 12:24:49 -020022 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
31out_free_tx_history:
32 tfrc_tx_packet_history_exit();
33out_free_loss_intervals:
Gerrit Renker954c2db2007-12-12 14:06:14 -020034 tfrc_li_exit();
Gerrit Renkerdf8f83f2007-12-12 12:24:49 -020035out:
Gerrit Renkerc40616c2007-12-06 12:26:38 -020036 return rc;
37}
38
Leonardo Potenza1b6725d2009-01-09 23:06:28 -080039void tfrc_lib_exit(void)
Gerrit Renkerc40616c2007-12-06 12:26:38 -020040{
Gerrit Renkerdf8f83f2007-12-12 12:24:49 -020041 tfrc_rx_packet_history_exit();
42 tfrc_tx_packet_history_exit();
Gerrit Renker954c2db2007-12-12 14:06:14 -020043 tfrc_li_exit();
Gerrit Renkerc40616c2007-12-06 12:26:38 -020044}