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 "ib.h"
0038 
0039 static struct ctl_table_header *rds_ib_sysctl_hdr;
0040 
0041 unsigned long rds_ib_sysctl_max_send_wr = RDS_IB_DEFAULT_SEND_WR;
0042 unsigned long rds_ib_sysctl_max_recv_wr = RDS_IB_DEFAULT_RECV_WR;
0043 unsigned long rds_ib_sysctl_max_recv_allocation = (128 * 1024 * 1024) / RDS_FRAG_SIZE;
0044 static unsigned long rds_ib_sysctl_max_wr_min = 1;
0045 /* hardware will fail CQ creation long before this */
0046 static unsigned long rds_ib_sysctl_max_wr_max = (u32)~0;
0047 
0048 unsigned long rds_ib_sysctl_max_unsig_wrs = 16;
0049 static unsigned long rds_ib_sysctl_max_unsig_wr_min = 1;
0050 static unsigned long rds_ib_sysctl_max_unsig_wr_max = 64;
0051 
0052 /*
0053  * This sysctl does nothing.
0054  *
0055  * Backwards compatibility with RDS 3.0 wire protocol
0056  * disables initial FC credit exchange.
0057  * If it's ever possible to drop 3.0 support,
0058  * setting this to 1 and moving init/refill of send/recv
0059  * rings from ib_cm_connect_complete() back into ib_setup_qp()
0060  * will cause credits to be added before protocol negotiation.
0061  */
0062 unsigned int rds_ib_sysctl_flow_control = 0;
0063 
0064 static struct ctl_table rds_ib_sysctl_table[] = {
0065     {
0066         .procname       = "max_send_wr",
0067         .data       = &rds_ib_sysctl_max_send_wr,
0068         .maxlen         = sizeof(unsigned long),
0069         .mode           = 0644,
0070         .proc_handler   = proc_doulongvec_minmax,
0071         .extra1     = &rds_ib_sysctl_max_wr_min,
0072         .extra2     = &rds_ib_sysctl_max_wr_max,
0073     },
0074     {
0075         .procname       = "max_recv_wr",
0076         .data       = &rds_ib_sysctl_max_recv_wr,
0077         .maxlen         = sizeof(unsigned long),
0078         .mode           = 0644,
0079         .proc_handler   = proc_doulongvec_minmax,
0080         .extra1     = &rds_ib_sysctl_max_wr_min,
0081         .extra2     = &rds_ib_sysctl_max_wr_max,
0082     },
0083     {
0084         .procname       = "max_unsignaled_wr",
0085         .data       = &rds_ib_sysctl_max_unsig_wrs,
0086         .maxlen         = sizeof(unsigned long),
0087         .mode           = 0644,
0088         .proc_handler   = proc_doulongvec_minmax,
0089         .extra1     = &rds_ib_sysctl_max_unsig_wr_min,
0090         .extra2     = &rds_ib_sysctl_max_unsig_wr_max,
0091     },
0092     {
0093         .procname       = "max_recv_allocation",
0094         .data       = &rds_ib_sysctl_max_recv_allocation,
0095         .maxlen         = sizeof(unsigned long),
0096         .mode           = 0644,
0097         .proc_handler   = proc_doulongvec_minmax,
0098     },
0099     {
0100         .procname   = "flow_control",
0101         .data       = &rds_ib_sysctl_flow_control,
0102         .maxlen     = sizeof(rds_ib_sysctl_flow_control),
0103         .mode       = 0644,
0104         .proc_handler   = proc_dointvec,
0105     },
0106     { }
0107 };
0108 
0109 void rds_ib_sysctl_exit(void)
0110 {
0111     if (rds_ib_sysctl_hdr)
0112         unregister_net_sysctl_table(rds_ib_sysctl_hdr);
0113 }
0114 
0115 int rds_ib_sysctl_init(void)
0116 {
0117     rds_ib_sysctl_hdr = register_net_sysctl(&init_net, "net/rds/ib", rds_ib_sysctl_table);
0118     if (!rds_ib_sysctl_hdr)
0119         return -ENOMEM;
0120     return 0;
0121 }