xref: /kernel/linux/linux-5.10/net/dccp/ccids/lib/tfrc.c (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * TFRC library initialisation
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
68c2ecf20Sopenharmony_ci * Copyright (c) 2007 Arnaldo Carvalho de Melo <acme@redhat.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci#include <linux/moduleparam.h>
98c2ecf20Sopenharmony_ci#include "tfrc.h"
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifdef CONFIG_IP_DCCP_TFRC_DEBUG
128c2ecf20Sopenharmony_cibool tfrc_debug;
138c2ecf20Sopenharmony_cimodule_param(tfrc_debug, bool, 0644);
148c2ecf20Sopenharmony_ciMODULE_PARM_DESC(tfrc_debug, "Enable TFRC debug messages");
158c2ecf20Sopenharmony_ci#endif
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciint __init tfrc_lib_init(void)
188c2ecf20Sopenharmony_ci{
198c2ecf20Sopenharmony_ci	int rc = tfrc_li_init();
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci	if (rc)
228c2ecf20Sopenharmony_ci		goto out;
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci	rc = tfrc_tx_packet_history_init();
258c2ecf20Sopenharmony_ci	if (rc)
268c2ecf20Sopenharmony_ci		goto out_free_loss_intervals;
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	rc = tfrc_rx_packet_history_init();
298c2ecf20Sopenharmony_ci	if (rc)
308c2ecf20Sopenharmony_ci		goto out_free_tx_history;
318c2ecf20Sopenharmony_ci	return 0;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciout_free_tx_history:
348c2ecf20Sopenharmony_ci	tfrc_tx_packet_history_exit();
358c2ecf20Sopenharmony_ciout_free_loss_intervals:
368c2ecf20Sopenharmony_ci	tfrc_li_exit();
378c2ecf20Sopenharmony_ciout:
388c2ecf20Sopenharmony_ci	return rc;
398c2ecf20Sopenharmony_ci}
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_civoid tfrc_lib_exit(void)
428c2ecf20Sopenharmony_ci{
438c2ecf20Sopenharmony_ci	tfrc_rx_packet_history_exit();
448c2ecf20Sopenharmony_ci	tfrc_tx_packet_history_exit();
458c2ecf20Sopenharmony_ci	tfrc_li_exit();
468c2ecf20Sopenharmony_ci}
47