Commit cbf1107126af2950623fafdaa5c9df43ab00f046

Authored by Trond Myklebust
1 parent 80e52aced1

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>

Showing 2 changed files with 73 additions and 0 deletions Side-by-side Diff

Documentation/kernel-parameters.txt
... ... @@ -2391,6 +2391,18 @@
2391 2391 stifb= [HW]
2392 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 2406 sunrpc.pool_mode=
2395 2407 [NFS]
2396 2408 Control how the NFS server code allocates CPUs to
... ... @@ -2406,6 +2418,15 @@
2406 2418 percpu one pool for each CPU
2407 2419 pernode one pool for each NUMA node (equivalent
2408 2420 to global on non-NUMA machines)
  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.
2409 2430  
2410 2431 swiotlb= [IA-64] Number of I/O TLB slabs
2411 2432  
net/sunrpc/xprtsock.c
... ... @@ -2412,4 +2412,55 @@
2412 2412 xprt_unregister_transport(&xs_udp_transport);
2413 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);