Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2006 Oracle.  All rights reserved.
0003  *
0004  * This software is available to you under a choice of one of two
0005  * licenses.  You may choose to be licensed under the terms of the GNU
0006  * General Public License (GPL) Version 2, available from the file
0007  * COPYING in the main directory of this source tree, or the
0008  * OpenIB.org BSD license below:
0009  *
0010  *     Redistribution and use in source and binary forms, with or
0011  *     without modification, are permitted provided that the following
0012  *     conditions are met:
0013  *
0014  *      - Redistributions of source code must retain the above
0015  *        copyright notice, this list of conditions and the following
0016  *        disclaimer.
0017  *
0018  *      - Redistributions in binary form must reproduce the above
0019  *        copyright notice, this list of conditions and the following
0020  *        disclaimer in the documentation and/or other materials
0021  *        provided with the distribution.
0022  *
0023  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0024  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0025  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0026  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
0027  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
0028  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0029  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0030  * SOFTWARE.
0031  *
0032  */
0033 #include <linux/kernel.h>
0034 #include <linux/sysctl.h>
0035 #include <linux/proc_fs.h>
0036 
0037 #include "rds.h"
0038 
0039 static struct ctl_table_header *rds_sysctl_reg_table;
0040 
0041 static unsigned long rds_sysctl_reconnect_min = 1;
0042 static unsigned long rds_sysctl_reconnect_max = ~0UL;
0043 
0044 unsigned long rds_sysctl_reconnect_min_jiffies;
0045 unsigned long rds_sysctl_reconnect_max_jiffies = HZ;
0046 
0047 unsigned int  rds_sysctl_max_unacked_packets = 8;
0048 unsigned int  rds_sysctl_max_unacked_bytes = (16 << 20);
0049 
0050 unsigned int rds_sysctl_ping_enable = 1;
0051 
0052 static struct ctl_table rds_sysctl_rds_table[] = {
0053     {
0054         .procname       = "reconnect_min_delay_ms",
0055         .data       = &rds_sysctl_reconnect_min_jiffies,
0056         .maxlen         = sizeof(unsigned long),
0057         .mode           = 0644,
0058         .proc_handler   = proc_doulongvec_ms_jiffies_minmax,
0059         .extra1     = &rds_sysctl_reconnect_min,
0060         .extra2     = &rds_sysctl_reconnect_max_jiffies,
0061     },
0062     {
0063         .procname       = "reconnect_max_delay_ms",
0064         .data       = &rds_sysctl_reconnect_max_jiffies,
0065         .maxlen         = sizeof(unsigned long),
0066         .mode           = 0644,
0067         .proc_handler   = proc_doulongvec_ms_jiffies_minmax,
0068         .extra1     = &rds_sysctl_reconnect_min_jiffies,
0069         .extra2     = &rds_sysctl_reconnect_max,
0070     },
0071     {
0072         .procname   = "max_unacked_packets",
0073         .data       = &rds_sysctl_max_unacked_packets,
0074         .maxlen         = sizeof(int),
0075         .mode           = 0644,
0076         .proc_handler   = proc_dointvec,
0077     },
0078     {
0079         .procname   = "max_unacked_bytes",
0080         .data       = &rds_sysctl_max_unacked_bytes,
0081         .maxlen         = sizeof(int),
0082         .mode           = 0644,
0083         .proc_handler   = proc_dointvec,
0084     },
0085     {
0086         .procname   = "ping_enable",
0087         .data       = &rds_sysctl_ping_enable,
0088         .maxlen         = sizeof(int),
0089         .mode           = 0644,
0090         .proc_handler   = proc_dointvec,
0091     },
0092     { }
0093 };
0094 
0095 void rds_sysctl_exit(void)
0096 {
0097     unregister_net_sysctl_table(rds_sysctl_reg_table);
0098 }
0099 
0100 int rds_sysctl_init(void)
0101 {
0102     rds_sysctl_reconnect_min = msecs_to_jiffies(1);
0103     rds_sysctl_reconnect_min_jiffies = rds_sysctl_reconnect_min;
0104 
0105     rds_sysctl_reg_table =
0106         register_net_sysctl(&init_net, "net/rds", rds_sysctl_rds_table);
0107     if (!rds_sysctl_reg_table)
0108         return -ENOMEM;
0109     return 0;
0110 }