sysctl.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* sysctls for configuring RxRPC operating parameters
  2. *
  3. * Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #include <linux/sysctl.h>
  12. #include <net/sock.h>
  13. #include <net/af_rxrpc.h>
  14. #include "ar-internal.h"
  15. static struct ctl_table_header *rxrpc_sysctl_reg_table;
  16. static const unsigned int zero = 0;
  17. static const unsigned int one = 1;
  18. static const unsigned int four = 4;
  19. static const unsigned int thirtytwo = 32;
  20. static const unsigned int n_65535 = 65535;
  21. static const unsigned int n_max_acks = RXRPC_MAXACKS;
  22. /*
  23. * RxRPC operating parameters.
  24. *
  25. * See Documentation/networking/rxrpc.txt and the variable definitions for more
  26. * information on the individual parameters.
  27. */
  28. static struct ctl_table rxrpc_sysctl_table[] = {
  29. /* Values measured in milliseconds */
  30. {
  31. .procname = "req_ack_delay",
  32. .data = &rxrpc_requested_ack_delay,
  33. .maxlen = sizeof(unsigned int),
  34. .mode = 0644,
  35. .proc_handler = proc_dointvec_ms_jiffies,
  36. .extra1 = (void *)&zero,
  37. },
  38. {
  39. .procname = "soft_ack_delay",
  40. .data = &rxrpc_soft_ack_delay,
  41. .maxlen = sizeof(unsigned int),
  42. .mode = 0644,
  43. .proc_handler = proc_dointvec_ms_jiffies,
  44. .extra1 = (void *)&one,
  45. },
  46. {
  47. .procname = "idle_ack_delay",
  48. .data = &rxrpc_idle_ack_delay,
  49. .maxlen = sizeof(unsigned int),
  50. .mode = 0644,
  51. .proc_handler = proc_dointvec_ms_jiffies,
  52. .extra1 = (void *)&one,
  53. },
  54. {
  55. .procname = "resend_timeout",
  56. .data = &rxrpc_resend_timeout,
  57. .maxlen = sizeof(unsigned int),
  58. .mode = 0644,
  59. .proc_handler = proc_dointvec_ms_jiffies,
  60. .extra1 = (void *)&one,
  61. },
  62. /* Values measured in seconds but used in jiffies */
  63. {
  64. .procname = "max_call_lifetime",
  65. .data = &rxrpc_max_call_lifetime,
  66. .maxlen = sizeof(unsigned int),
  67. .mode = 0644,
  68. .proc_handler = proc_dointvec_jiffies,
  69. .extra1 = (void *)&one,
  70. },
  71. {
  72. .procname = "dead_call_expiry",
  73. .data = &rxrpc_dead_call_expiry,
  74. .maxlen = sizeof(unsigned int),
  75. .mode = 0644,
  76. .proc_handler = proc_dointvec_jiffies,
  77. .extra1 = (void *)&one,
  78. },
  79. /* Values measured in seconds */
  80. {
  81. .procname = "connection_expiry",
  82. .data = &rxrpc_connection_expiry,
  83. .maxlen = sizeof(unsigned int),
  84. .mode = 0644,
  85. .proc_handler = proc_dointvec_minmax,
  86. .extra1 = (void *)&one,
  87. },
  88. /* Non-time values */
  89. {
  90. .procname = "max_backlog",
  91. .data = &rxrpc_max_backlog,
  92. .maxlen = sizeof(unsigned int),
  93. .mode = 0644,
  94. .proc_handler = proc_dointvec_minmax,
  95. .extra1 = (void *)&four,
  96. .extra2 = (void *)&thirtytwo,
  97. },
  98. {
  99. .procname = "rx_window_size",
  100. .data = &rxrpc_rx_window_size,
  101. .maxlen = sizeof(unsigned int),
  102. .mode = 0644,
  103. .proc_handler = proc_dointvec_minmax,
  104. .extra1 = (void *)&one,
  105. .extra2 = (void *)&n_max_acks,
  106. },
  107. {
  108. .procname = "rx_mtu",
  109. .data = &rxrpc_rx_mtu,
  110. .maxlen = sizeof(unsigned int),
  111. .mode = 0644,
  112. .proc_handler = proc_dointvec_minmax,
  113. .extra1 = (void *)&one,
  114. .extra2 = (void *)&n_65535,
  115. },
  116. {
  117. .procname = "rx_jumbo_max",
  118. .data = &rxrpc_rx_jumbo_max,
  119. .maxlen = sizeof(unsigned int),
  120. .mode = 0644,
  121. .proc_handler = proc_dointvec_minmax,
  122. .extra1 = (void *)&one,
  123. .extra2 = (void *)&four,
  124. },
  125. { }
  126. };
  127. int __init rxrpc_sysctl_init(void)
  128. {
  129. rxrpc_sysctl_reg_table = register_net_sysctl(&init_net, "net/rxrpc",
  130. rxrpc_sysctl_table);
  131. if (!rxrpc_sysctl_reg_table)
  132. return -ENOMEM;
  133. return 0;
  134. }
  135. void rxrpc_sysctl_exit(void)
  136. {
  137. if (rxrpc_sysctl_reg_table)
  138. unregister_net_sysctl_table(rxrpc_sysctl_reg_table);
  139. }