sysctl.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 zero = 0;
  17. static const unsigned one = 1;
  18. static const unsigned four = 4;
  19. static const unsigned n_65535 = 65535;
  20. static const unsigned n_max_acks = RXRPC_MAXACKS;
  21. /*
  22. * RxRPC operating parameters.
  23. *
  24. * See Documentation/networking/rxrpc.txt and the variable definitions for more
  25. * information on the individual parameters.
  26. */
  27. static struct ctl_table rxrpc_sysctl_table[] = {
  28. /* Values measured in milliseconds */
  29. {
  30. .procname = "req_ack_delay",
  31. .data = &rxrpc_requested_ack_delay,
  32. .maxlen = sizeof(unsigned),
  33. .mode = 0644,
  34. .proc_handler = proc_dointvec_ms_jiffies,
  35. .extra1 = (void *)&zero,
  36. },
  37. {
  38. .procname = "soft_ack_delay",
  39. .data = &rxrpc_soft_ack_delay,
  40. .maxlen = sizeof(unsigned),
  41. .mode = 0644,
  42. .proc_handler = proc_dointvec_ms_jiffies,
  43. .extra1 = (void *)&one,
  44. },
  45. {
  46. .procname = "idle_ack_delay",
  47. .data = &rxrpc_idle_ack_delay,
  48. .maxlen = sizeof(unsigned),
  49. .mode = 0644,
  50. .proc_handler = proc_dointvec_ms_jiffies,
  51. .extra1 = (void *)&one,
  52. },
  53. {
  54. .procname = "resend_timeout",
  55. .data = &rxrpc_resend_timeout,
  56. .maxlen = sizeof(unsigned),
  57. .mode = 0644,
  58. .proc_handler = proc_dointvec_ms_jiffies,
  59. .extra1 = (void *)&one,
  60. },
  61. /* Values measured in seconds but used in jiffies */
  62. {
  63. .procname = "max_call_lifetime",
  64. .data = &rxrpc_max_call_lifetime,
  65. .maxlen = sizeof(unsigned),
  66. .mode = 0644,
  67. .proc_handler = proc_dointvec_jiffies,
  68. .extra1 = (void *)&one,
  69. },
  70. {
  71. .procname = "dead_call_expiry",
  72. .data = &rxrpc_dead_call_expiry,
  73. .maxlen = sizeof(unsigned),
  74. .mode = 0644,
  75. .proc_handler = proc_dointvec_jiffies,
  76. .extra1 = (void *)&one,
  77. },
  78. /* Values measured in seconds */
  79. {
  80. .procname = "connection_expiry",
  81. .data = &rxrpc_connection_expiry,
  82. .maxlen = sizeof(unsigned),
  83. .mode = 0644,
  84. .proc_handler = proc_dointvec_minmax,
  85. .extra1 = (void *)&one,
  86. },
  87. {
  88. .procname = "transport_expiry",
  89. .data = &rxrpc_transport_expiry,
  90. .maxlen = sizeof(unsigned),
  91. .mode = 0644,
  92. .proc_handler = proc_dointvec_minmax,
  93. .extra1 = (void *)&one,
  94. },
  95. /* Non-time values */
  96. {
  97. .procname = "rx_window_size",
  98. .data = &rxrpc_rx_window_size,
  99. .maxlen = sizeof(unsigned),
  100. .mode = 0644,
  101. .proc_handler = proc_dointvec_minmax,
  102. .extra1 = (void *)&one,
  103. .extra2 = (void *)&n_max_acks,
  104. },
  105. {
  106. .procname = "rx_mtu",
  107. .data = &rxrpc_rx_mtu,
  108. .maxlen = sizeof(unsigned),
  109. .mode = 0644,
  110. .proc_handler = proc_dointvec_minmax,
  111. .extra1 = (void *)&one,
  112. .extra1 = (void *)&n_65535,
  113. },
  114. {
  115. .procname = "rx_jumbo_max",
  116. .data = &rxrpc_rx_jumbo_max,
  117. .maxlen = sizeof(unsigned),
  118. .mode = 0644,
  119. .proc_handler = proc_dointvec_minmax,
  120. .extra1 = (void *)&one,
  121. .extra2 = (void *)&four,
  122. },
  123. { }
  124. };
  125. int __init rxrpc_sysctl_init(void)
  126. {
  127. rxrpc_sysctl_reg_table = register_net_sysctl(&init_net, "net/rxrpc",
  128. rxrpc_sysctl_table);
  129. if (!rxrpc_sysctl_reg_table)
  130. return -ENOMEM;
  131. return 0;
  132. }
  133. void rxrpc_sysctl_exit(void)
  134. {
  135. if (rxrpc_sysctl_reg_table)
  136. unregister_net_sysctl_table(rxrpc_sysctl_reg_table);
  137. }