Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 2 | /* |
Gerrit Renker | 129fa44 | 2009-01-04 21:45:33 -0800 | [diff] [blame] | 3 | * TFRC library initialisation |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 4 | * |
5 | * Copyright (c) 2007 The University of Aberdeen, Scotland, UK | ||||
6 | * Copyright (c) 2007 Arnaldo Carvalho de Melo <acme@redhat.com> | ||||
7 | */ | ||||
Paul Gortmaker | d9b9384 | 2011-09-18 13:21:27 -0400 | [diff] [blame] | 8 | #include <linux/moduleparam.h> |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 9 | #include "tfrc.h" |
10 | |||||
11 | #ifdef CONFIG_IP_DCCP_TFRC_DEBUG | ||||
Gerrit Renker | 09db308 | 2014-02-13 19:02:33 -0700 | [diff] [blame] | 12 | bool tfrc_debug; |
Gerrit Renker | 157439f | 2008-08-23 13:28:27 +0200 | [diff] [blame] | 13 | module_param(tfrc_debug, bool, 0644); |
Gerrit Renker | 129fa44 | 2009-01-04 21:45:33 -0800 | [diff] [blame] | 14 | MODULE_PARM_DESC(tfrc_debug, "Enable TFRC debug messages"); |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 15 | #endif |
16 | |||||
Gerrit Renker | 129fa44 | 2009-01-04 21:45:33 -0800 | [diff] [blame] | 17 | int __init tfrc_lib_init(void) |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 18 | { |
Gerrit Renker | 954c2db | 2007-12-12 14:06:14 -0200 | [diff] [blame] | 19 | int rc = tfrc_li_init(); |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 20 | |
Gerrit Renker | df8f83f | 2007-12-12 12:24:49 -0200 | [diff] [blame] | 21 | if (rc) |
22 | goto out; | ||||
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 23 | |
Gerrit Renker | df8f83f | 2007-12-12 12:24:49 -0200 | [diff] [blame] | 24 | 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 | |||||
33 | out_free_tx_history: | ||||
34 | tfrc_tx_packet_history_exit(); | ||||
35 | out_free_loss_intervals: | ||||
Gerrit Renker | 954c2db | 2007-12-12 14:06:14 -0200 | [diff] [blame] | 36 | tfrc_li_exit(); |
Gerrit Renker | df8f83f | 2007-12-12 12:24:49 -0200 | [diff] [blame] | 37 | out: |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 38 | return rc; |
39 | } | ||||
40 | |||||
Leonardo Potenza | 1b6725d | 2009-01-09 23:06:28 -0800 | [diff] [blame] | 41 | void tfrc_lib_exit(void) |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 42 | { |
Gerrit Renker | df8f83f | 2007-12-12 12:24:49 -0200 | [diff] [blame] | 43 | tfrc_rx_packet_history_exit(); |
44 | tfrc_tx_packet_history_exit(); | ||||
Gerrit Renker | 954c2db | 2007-12-12 14:06:14 -0200 | [diff] [blame] | 45 | tfrc_li_exit(); |
Gerrit Renker | c40616c | 2007-12-06 12:26:38 -0200 | [diff] [blame] | 46 | } |