aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2006-12-05 16:35:54 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-12-06 10:46:53 -0500
commitfbf76683ff9d1462ec0b2f90ec6ea4793652318c (patch)
tree22a5738d7eb984ae7315e471814f43c5ea8d8b2e /net/sunrpc/xprtsock.c
parent282b32e17f64be2204f1ac96d7f40f92cb768cd7 (diff)
SUNRPC: relocate the creation of socket-specific tunables
Clean-up: The RPC client currently creates some sysctls that are specific to the socket transport. Move those entirely into xprtsock.c. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c107
1 files changed, 104 insertions, 3 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 70131c36f371..21438d7dc47b 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -46,6 +46,92 @@ unsigned int xprt_min_resvport = RPC_DEF_MIN_RESVPORT;
46unsigned int xprt_max_resvport = RPC_DEF_MAX_RESVPORT; 46unsigned int xprt_max_resvport = RPC_DEF_MAX_RESVPORT;
47 47
48/* 48/*
49 * We can register our own files under /proc/sys/sunrpc by
50 * calling register_sysctl_table() again. The files in that
51 * directory become the union of all files registered there.
52 *
53 * We simply need to make sure that we don't collide with
54 * someone else's file names!
55 */
56
57#ifdef RPC_DEBUG
58
59static unsigned int min_slot_table_size = RPC_MIN_SLOT_TABLE;
60static unsigned int max_slot_table_size = RPC_MAX_SLOT_TABLE;
61static unsigned int xprt_min_resvport_limit = RPC_MIN_RESVPORT;
62static unsigned int xprt_max_resvport_limit = RPC_MAX_RESVPORT;
63
64static struct ctl_table_header *sunrpc_table_header;
65
66/*
67 * FIXME: changing the UDP slot table size should also resize the UDP
68 * socket buffers for existing UDP transports
69 */
70static ctl_table xs_tunables_table[] = {
71 {
72 .ctl_name = CTL_SLOTTABLE_UDP,
73 .procname = "udp_slot_table_entries",
74 .data = &xprt_udp_slot_table_entries,
75 .maxlen = sizeof(unsigned int),
76 .mode = 0644,
77 .proc_handler = &proc_dointvec_minmax,
78 .strategy = &sysctl_intvec,
79 .extra1 = &min_slot_table_size,
80 .extra2 = &max_slot_table_size
81 },
82 {
83 .ctl_name = CTL_SLOTTABLE_TCP,
84 .procname = "tcp_slot_table_entries",
85 .data = &xprt_tcp_slot_table_entries,
86 .maxlen = sizeof(unsigned int),
87 .mode = 0644,
88 .proc_handler = &proc_dointvec_minmax,
89 .strategy = &sysctl_intvec,
90 .extra1 = &min_slot_table_size,
91 .extra2 = &max_slot_table_size
92 },
93 {
94 .ctl_name = CTL_MIN_RESVPORT,
95 .procname = "min_resvport",
96 .data = &xprt_min_resvport,
97 .maxlen = sizeof(unsigned int),
98 .mode = 0644,
99 .proc_handler = &proc_dointvec_minmax,
100 .strategy = &sysctl_intvec,
101 .extra1 = &xprt_min_resvport_limit,
102 .extra2 = &xprt_max_resvport_limit
103 },
104 {
105 .ctl_name = CTL_MAX_RESVPORT,
106 .procname = "max_resvport",
107 .data = &xprt_max_resvport,
108 .maxlen = sizeof(unsigned int),
109 .mode = 0644,
110 .proc_handler = &proc_dointvec_minmax,
111 .strategy = &sysctl_intvec,
112 .extra1 = &xprt_min_resvport_limit,
113 .extra2 = &xprt_max_resvport_limit
114 },
115 {
116 .ctl_name = 0,
117 },
118};
119
120static ctl_table sunrpc_table[] = {
121 {
122 .ctl_name = CTL_SUNRPC,
123 .procname = "sunrpc",
124 .mode = 0555,
125 .child = xs_tunables_table
126 },
127 {
128 .ctl_name = 0,
129 },
130};
131
132#endif
133
134/*
49 * How many times to try sending a request on a socket before waiting 135 * How many times to try sending a request on a socket before waiting
50 * for the socket buffer to clear. 136 * for the socket buffer to clear.
51 */ 137 */
@@ -1504,19 +1590,34 @@ struct rpc_xprt *xs_setup_tcp(struct sockaddr *addr, size_t addrlen, struct rpc_
1504} 1590}
1505 1591
1506/** 1592/**
1507 * init_socket_xprt - stub 1593 * init_socket_xprt - set up xprtsock's sysctls
1508 * 1594 *
1509 */ 1595 */
1510int init_socket_xprt(void) 1596int init_socket_xprt(void)
1511{ 1597{
1598#ifdef RPC_DEBUG
1599 if (!sunrpc_table_header) {
1600 sunrpc_table_header = register_sysctl_table(sunrpc_table, 1);
1601#ifdef CONFIG_PROC_FS
1602 if (sunrpc_table[0].de)
1603 sunrpc_table[0].de->owner = THIS_MODULE;
1604#endif
1605 }
1606#endif
1607
1512 return 0; 1608 return 0;
1513} 1609}
1514 1610
1515/** 1611/**
1516 * cleanup_socket_xprt - stub 1612 * cleanup_socket_xprt - remove xprtsock's sysctls
1517 * 1613 *
1518 */ 1614 */
1519void cleanup_socket_xprt(void) 1615void cleanup_socket_xprt(void)
1520{ 1616{
1521 return; 1617#ifdef RPC_DEBUG
1618 if (sunrpc_table_header) {
1619 unregister_sysctl_table(sunrpc_table_header);
1620 sunrpc_table_header = NULL;
1621 }
1622#endif
1522} 1623}