blob: d7f265e1f50c85e8e59d0668e786f9f21d5c36c6 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Gerrit Renkerc40616c2007-12-06 12:26:38 -02002/*
Gerrit Renker129fa442009-01-04 21:45:33 -08003 * TFRC library initialisation
Gerrit Renkerc40616c2007-12-06 12:26:38 -02004 *
5 * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
6 * Copyright (c) 2007 Arnaldo Carvalho de Melo <acme@redhat.com>
7 */
Paul Gortmakerd9b93842011-09-18 13:21:27 -04008#include <linux/moduleparam.h>
Gerrit Renkerc40616c2007-12-06 12:26:38 -02009#include "tfrc.h"
10
11#ifdef CONFIG_IP_DCCP_TFRC_DEBUG
Gerrit Renker09db3082014-02-13 19:02:33 -070012bool tfrc_debug;
Gerrit Renker157439f2008-08-23 13:28:27 +020013module_param(tfrc_debug, bool, 0644);
Gerrit Renker129fa442009-01-04 21:45:33 -080014MODULE_PARM_DESC(tfrc_debug, "Enable TFRC debug messages");
Gerrit Renkerc40616c2007-12-06 12:26:38 -020015#endif
16
Gerrit Renker129fa442009-01-04 21:45:33 -080017int __init tfrc_lib_init(void)
Gerrit Renkerc40616c2007-12-06 12:26:38 -020018{
Gerrit Renker954c2db2007-12-12 14:06:14 -020019 int rc = tfrc_li_init();
Gerrit Renkerc40616c2007-12-06 12:26:38 -020020
Gerrit Renkerdf8f83f2007-12-12 12:24:49 -020021 if (rc)
22 goto out;
Gerrit Renkerc40616c2007-12-06 12:26:38 -020023
Gerrit Renkerdf8f83f2007-12-12 12:24:49 -020024 rc = tfrc_tx_packet_history_init();
25 if (rc)
26 goto out_free_loss_intervals;
27
28 rc = tfrc_rx_packet_history_init();
29 if (rc)
30 goto out_free_tx_history;
31 return 0;
32
33out_free_tx_history:
34 tfrc_tx_packet_history_exit();
35out_free_loss_intervals:
Gerrit Renker954c2db2007-12-12 14:06:14 -020036 tfrc_li_exit();
Gerrit Renkerdf8f83f2007-12-12 12:24:49 -020037out:
Gerrit Renkerc40616c2007-12-06 12:26:38 -020038 return rc;
39}
40
Leonardo Potenza1b6725d2009-01-09 23:06:28 -080041void tfrc_lib_exit(void)
Gerrit Renkerc40616c2007-12-06 12:26:38 -020042{
Gerrit Renkerdf8f83f2007-12-12 12:24:49 -020043 tfrc_rx_packet_history_exit();
44 tfrc_tx_packet_history_exit();
Gerrit Renker954c2db2007-12-12 14:06:14 -020045 tfrc_li_exit();
Gerrit Renkerc40616c2007-12-06 12:26:38 -020046}