blob: 62b5828acde0906b71fc39955c9f2b36582d395a [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 */
Paul Gortmakerd9b93842011-09-18 13:21:27 -04007#include <linux/moduleparam.h>
Gerrit Renkerc40616c2007-12-06 12:26:38 -02008#include "tfrc.h"
9
10#ifdef CONFIG_IP_DCCP_TFRC_DEBUG
Gerrit Renker09db3082014-02-13 19:02:33 -070011bool tfrc_debug;
Gerrit Renker157439f2008-08-23 13:28:27 +020012module_param(tfrc_debug, bool, 0644);
Gerrit Renker129fa442009-01-04 21:45:33 -080013MODULE_PARM_DESC(tfrc_debug, "Enable TFRC debug messages");
Gerrit Renkerc40616c2007-12-06 12:26:38 -020014#endif
15
Gerrit Renker129fa442009-01-04 21:45:33 -080016int __init tfrc_lib_init(void)
Gerrit Renkerc40616c2007-12-06 12:26:38 -020017{
Gerrit Renker954c2db2007-12-12 14:06:14 -020018 int rc = tfrc_li_init();
Gerrit Renkerc40616c2007-12-06 12:26:38 -020019
Gerrit Renkerdf8f83f2007-12-12 12:24:49 -020020 if (rc)
21 goto out;
Gerrit Renkerc40616c2007-12-06 12:26:38 -020022
Gerrit Renkerdf8f83f2007-12-12 12:24:49 -020023 rc = tfrc_tx_packet_history_init();
24 if (rc)
25 goto out_free_loss_intervals;
26
27 rc = tfrc_rx_packet_history_init();
28 if (rc)
29 goto out_free_tx_history;
30 return 0;
31
32out_free_tx_history:
33 tfrc_tx_packet_history_exit();
34out_free_loss_intervals:
Gerrit Renker954c2db2007-12-12 14:06:14 -020035 tfrc_li_exit();
Gerrit Renkerdf8f83f2007-12-12 12:24:49 -020036out:
Gerrit Renkerc40616c2007-12-06 12:26:38 -020037 return rc;
38}
39
Leonardo Potenza1b6725d2009-01-09 23:06:28 -080040void tfrc_lib_exit(void)
Gerrit Renkerc40616c2007-12-06 12:26:38 -020041{
Gerrit Renkerdf8f83f2007-12-12 12:24:49 -020042 tfrc_rx_packet_history_exit();
43 tfrc_tx_packet_history_exit();
Gerrit Renker954c2db2007-12-12 14:06:14 -020044 tfrc_li_exit();
Gerrit Renkerc40616c2007-12-06 12:26:38 -020045}