sysctl.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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_RXTX_BUFF_SIZE - 1;
  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,
  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,
  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,
  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,
  60. .extra1 = (void *)&one,
  61. },
  62. {
  63. .procname = "idle_conn_expiry",
  64. .data = &rxrpc_conn_idle_client_expiry,
  65. .maxlen = sizeof(unsigned int),
  66. .mode = 0644,
  67. .proc_handler = proc_dointvec_ms_jiffies,
  68. .extra1 = (void *)&one,
  69. },
  70. {
  71. .procname = "idle_conn_fast_expiry",
  72. .data = &rxrpc_conn_idle_client_fast_expiry,
  73. .maxlen = sizeof(unsigned int),
  74. .mode = 0644,
  75. .proc_handler = proc_dointvec_ms_jiffies,
  76. .extra1 = (void *)&one,
  77. },
  78. /* Values measured in seconds but used in jiffies */
  79. {
  80. .procname = "max_call_lifetime",
  81. .data = &rxrpc_max_call_lifetime,
  82. .maxlen = sizeof(unsigned int),
  83. .mode = 0644,
  84. .proc_handler = proc_dointvec,
  85. .extra1 = (void *)&one,
  86. },
  87. /* Non-time values */
  88. {
  89. .procname = "max_client_conns",
  90. .data = &rxrpc_max_client_connections,
  91. .maxlen = sizeof(unsigned int),
  92. .mode = 0644,
  93. .proc_handler = proc_dointvec_minmax,
  94. .extra1 = (void *)&rxrpc_reap_client_connections,
  95. },
  96. {
  97. .procname = "reap_client_conns",
  98. .data = &rxrpc_reap_client_connections,
  99. .maxlen = sizeof(unsigned int),
  100. .mode = 0644,
  101. .proc_handler = proc_dointvec_minmax,
  102. .extra1 = (void *)&one,
  103. .extra2 = (void *)&rxrpc_max_client_connections,
  104. },
  105. {
  106. .procname = "max_backlog",
  107. .data = &rxrpc_max_backlog,
  108. .maxlen = sizeof(unsigned int),
  109. .mode = 0644,
  110. .proc_handler = proc_dointvec_minmax,
  111. .extra1 = (void *)&four,
  112. .extra2 = (void *)&thirtytwo,
  113. },
  114. {
  115. .procname = "rx_window_size",
  116. .data = &rxrpc_rx_window_size,
  117. .maxlen = sizeof(unsigned int),
  118. .mode = 0644,
  119. .proc_handler = proc_dointvec_minmax,
  120. .extra1 = (void *)&one,
  121. .extra2 = (void *)&n_max_acks,
  122. },
  123. {
  124. .procname = "rx_mtu",
  125. .data = &rxrpc_rx_mtu,
  126. .maxlen = sizeof(unsigned int),
  127. .mode = 0644,
  128. .proc_handler = proc_dointvec_minmax,
  129. .extra1 = (void *)&one,
  130. .extra2 = (void *)&n_65535,
  131. },
  132. {
  133. .procname = "rx_jumbo_max",
  134. .data = &rxrpc_rx_jumbo_max,
  135. .maxlen = sizeof(unsigned int),
  136. .mode = 0644,
  137. .proc_handler = proc_dointvec_minmax,
  138. .extra1 = (void *)&one,
  139. .extra2 = (void *)&four,
  140. },
  141. { }
  142. };
  143. int __init rxrpc_sysctl_init(void)
  144. {
  145. rxrpc_sysctl_reg_table = register_net_sysctl(&init_net, "net/rxrpc",
  146. rxrpc_sysctl_table);
  147. if (!rxrpc_sysctl_reg_table)
  148. return -ENOMEM;
  149. return 0;
  150. }
  151. void rxrpc_sysctl_exit(void)
  152. {
  153. if (rxrpc_sysctl_reg_table)
  154. unregister_net_sysctl_table(rxrpc_sysctl_reg_table);
  155. }