tfrc.c 883 B

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