^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * TFRC library initialisation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (c) 2007 Arnaldo Carvalho de Melo <acme@redhat.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/moduleparam.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include "tfrc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #ifdef CONFIG_IP_DCCP_TFRC_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) bool tfrc_debug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) module_param(tfrc_debug, bool, 0644);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) MODULE_PARM_DESC(tfrc_debug, "Enable TFRC debug messages");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) int __init tfrc_lib_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) int rc = tfrc_li_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) rc = tfrc_tx_packet_history_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) goto out_free_loss_intervals;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) rc = tfrc_rx_packet_history_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) goto out_free_tx_history;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) out_free_tx_history:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) tfrc_tx_packet_history_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) out_free_loss_intervals:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) tfrc_li_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) void tfrc_lib_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) tfrc_rx_packet_history_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) tfrc_tx_packet_history_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) tfrc_li_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) }