diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-08-09 15:06:19 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-08-09 15:06:19 -0400 |
commit | cbf1107126af2950623fafdaa5c9df43ab00f046 (patch) | |
tree | 101e9a26fc86218f567e5c99aad3ddadfdab2691 | |
parent | 80e52aced138bb41b045a8595a87510f27d8d8c5 (diff) |
SUNRPC: convert some sysctls into module parameters
Parameters like the minimum reserved port, and the number of slot entries
should really be module parameters rather than sysctls.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | Documentation/kernel-parameters.txt | 21 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 52 |
2 files changed, 73 insertions, 0 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index dd1a6d4bb747..2f1820683b69 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -2391,6 +2391,18 @@ and is between 256 and 4096 characters. It is defined in the file | |||
2391 | stifb= [HW] | 2391 | stifb= [HW] |
2392 | Format: bpp:<bpp1>[:<bpp2>[:<bpp3>...]] | 2392 | Format: bpp:<bpp1>[:<bpp2>[:<bpp3>...]] |
2393 | 2393 | ||
2394 | sunrpc.min_resvport= | ||
2395 | sunrpc.max_resvport= | ||
2396 | [NFS,SUNRPC] | ||
2397 | SunRPC servers often require that client requests | ||
2398 | originate from a privileged port (i.e. a port in the | ||
2399 | range 0 < portnr < 1024). | ||
2400 | An administrator who wishes to reserve some of these | ||
2401 | ports for other uses may adjust the range that the | ||
2402 | kernel's sunrpc client considers to be privileged | ||
2403 | using these two parameters to set the minimum and | ||
2404 | maximum port values. | ||
2405 | |||
2394 | sunrpc.pool_mode= | 2406 | sunrpc.pool_mode= |
2395 | [NFS] | 2407 | [NFS] |
2396 | Control how the NFS server code allocates CPUs to | 2408 | Control how the NFS server code allocates CPUs to |
@@ -2407,6 +2419,15 @@ and is between 256 and 4096 characters. It is defined in the file | |||
2407 | pernode one pool for each NUMA node (equivalent | 2419 | pernode one pool for each NUMA node (equivalent |
2408 | to global on non-NUMA machines) | 2420 | to global on non-NUMA machines) |
2409 | 2421 | ||
2422 | sunrpc.tcp_slot_table_entries= | ||
2423 | sunrpc.udp_slot_table_entries= | ||
2424 | [NFS,SUNRPC] | ||
2425 | Sets the upper limit on the number of simultaneous | ||
2426 | RPC calls that can be sent from the client to a | ||
2427 | server. Increasing these values may allow you to | ||
2428 | improve throughput, but will also increase the | ||
2429 | amount of memory reserved for use by the client. | ||
2430 | |||
2410 | swiotlb= [IA-64] Number of I/O TLB slabs | 2431 | swiotlb= [IA-64] Number of I/O TLB slabs |
2411 | 2432 | ||
2412 | switches= [HW,M68k] | 2433 | switches= [HW,M68k] |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 83c73c4d017a..585a864c1c4c 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -2412,3 +2412,55 @@ void cleanup_socket_xprt(void) | |||
2412 | xprt_unregister_transport(&xs_udp_transport); | 2412 | xprt_unregister_transport(&xs_udp_transport); |
2413 | xprt_unregister_transport(&xs_tcp_transport); | 2413 | xprt_unregister_transport(&xs_tcp_transport); |
2414 | } | 2414 | } |
2415 | |||
2416 | static int param_set_uint_minmax(const char *val, struct kernel_param *kp, | ||
2417 | unsigned int min, unsigned int max) | ||
2418 | { | ||
2419 | unsigned long num; | ||
2420 | int ret; | ||
2421 | |||
2422 | if (!val) | ||
2423 | return -EINVAL; | ||
2424 | ret = strict_strtoul(val, 0, &num); | ||
2425 | if (ret == -EINVAL || num < min || num > max) | ||
2426 | return -EINVAL; | ||
2427 | *((unsigned int *)kp->arg) = num; | ||
2428 | return 0; | ||
2429 | } | ||
2430 | |||
2431 | static int param_set_portnr(const char *val, struct kernel_param *kp) | ||
2432 | { | ||
2433 | return param_set_uint_minmax(val, kp, | ||
2434 | RPC_MIN_RESVPORT, | ||
2435 | RPC_MAX_RESVPORT); | ||
2436 | } | ||
2437 | |||
2438 | static int param_get_portnr(char *buffer, struct kernel_param *kp) | ||
2439 | { | ||
2440 | return param_get_uint(buffer, kp); | ||
2441 | } | ||
2442 | #define param_check_portnr(name, p) \ | ||
2443 | __param_check(name, p, unsigned int); | ||
2444 | |||
2445 | module_param_named(min_resvport, xprt_min_resvport, portnr, 0644); | ||
2446 | module_param_named(max_resvport, xprt_max_resvport, portnr, 0644); | ||
2447 | |||
2448 | static int param_set_slot_table_size(const char *val, struct kernel_param *kp) | ||
2449 | { | ||
2450 | return param_set_uint_minmax(val, kp, | ||
2451 | RPC_MIN_SLOT_TABLE, | ||
2452 | RPC_MAX_SLOT_TABLE); | ||
2453 | } | ||
2454 | |||
2455 | static int param_get_slot_table_size(char *buffer, struct kernel_param *kp) | ||
2456 | { | ||
2457 | return param_get_uint(buffer, kp); | ||
2458 | } | ||
2459 | #define param_check_slot_table_size(name, p) \ | ||
2460 | __param_check(name, p, unsigned int); | ||
2461 | |||
2462 | module_param_named(tcp_slot_table_entries, xprt_tcp_slot_table_entries, | ||
2463 | slot_table_size, 0644); | ||
2464 | module_param_named(udp_slot_table_entries, xprt_udp_slot_table_entries, | ||
2465 | slot_table_size, 0644); | ||
2466 | |||