xref: /onnv-gate/usr/src/uts/common/io/ib/clients/rdsv3/ib_sysctl.c (revision 13118:e192495818d4)
112198SEiji.Ota@Sun.COM /*
212198SEiji.Ota@Sun.COM  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
312198SEiji.Ota@Sun.COM  */
412198SEiji.Ota@Sun.COM 
512198SEiji.Ota@Sun.COM /*
612763SGiri.Adari@Sun.COM  * This file contains code imported from the OFED rds source file ib_sysctl.c
712763SGiri.Adari@Sun.COM  * Oracle elects to have and use the contents of ib_sysctl.c under and governed
812763SGiri.Adari@Sun.COM  * by the OpenIB.org BSD license (see below for full license text). However,
912763SGiri.Adari@Sun.COM  * the following notice accompanied the original version of this file:
1012763SGiri.Adari@Sun.COM  */
1112763SGiri.Adari@Sun.COM 
1212763SGiri.Adari@Sun.COM /*
1312198SEiji.Ota@Sun.COM  * Copyright (c) 2006 Oracle.  All rights reserved.
1412198SEiji.Ota@Sun.COM  *
1512198SEiji.Ota@Sun.COM  * This software is available to you under a choice of one of two
1612198SEiji.Ota@Sun.COM  * licenses.  You may choose to be licensed under the terms of the GNU
1712198SEiji.Ota@Sun.COM  * General Public License (GPL) Version 2, available from the file
1812198SEiji.Ota@Sun.COM  * COPYING in the main directory of this source tree, or the
1912198SEiji.Ota@Sun.COM  * OpenIB.org BSD license below:
2012198SEiji.Ota@Sun.COM  *
2112198SEiji.Ota@Sun.COM  *     Redistribution and use in source and binary forms, with or
2212198SEiji.Ota@Sun.COM  *     without modification, are permitted provided that the following
2312198SEiji.Ota@Sun.COM  *     conditions are met:
2412198SEiji.Ota@Sun.COM  *
2512198SEiji.Ota@Sun.COM  *      - Redistributions of source code must retain the above
2612198SEiji.Ota@Sun.COM  *        copyright notice, this list of conditions and the following
2712198SEiji.Ota@Sun.COM  *        disclaimer.
2812198SEiji.Ota@Sun.COM  *
2912198SEiji.Ota@Sun.COM  *      - Redistributions in binary form must reproduce the above
3012198SEiji.Ota@Sun.COM  *        copyright notice, this list of conditions and the following
3112198SEiji.Ota@Sun.COM  *        disclaimer in the documentation and/or other materials
3212198SEiji.Ota@Sun.COM  *        provided with the distribution.
3312198SEiji.Ota@Sun.COM  *
3412198SEiji.Ota@Sun.COM  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
3512198SEiji.Ota@Sun.COM  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3612198SEiji.Ota@Sun.COM  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
3712198SEiji.Ota@Sun.COM  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
3812198SEiji.Ota@Sun.COM  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
3912198SEiji.Ota@Sun.COM  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
4012198SEiji.Ota@Sun.COM  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4112198SEiji.Ota@Sun.COM  * SOFTWARE.
4212198SEiji.Ota@Sun.COM  *
4312198SEiji.Ota@Sun.COM  */
4412198SEiji.Ota@Sun.COM #include <sys/ib/clients/rdsv3/ib.h>
4512580SGiri.Adari@Sun.COM #include <sys/ib/clients/rdsv3/rdsv3_debug.h>
4612198SEiji.Ota@Sun.COM 
4712198SEiji.Ota@Sun.COM unsigned long rdsv3_ib_sysctl_max_send_wr = RDSV3_IB_DEFAULT_SEND_WR;
4812198SEiji.Ota@Sun.COM unsigned long rdsv3_ib_sysctl_max_recv_wr = RDSV3_IB_DEFAULT_RECV_WR;
49*13118SEiji.Ota@Sun.COM unsigned long rdsv3_ib_sysctl_max_recv_allocation = RDSV3_IB_MAX_RECV_ALLOC;
5012198SEiji.Ota@Sun.COM /* hardware will fail CQ creation long before this */
5112198SEiji.Ota@Sun.COM 
5212198SEiji.Ota@Sun.COM unsigned long rdsv3_ib_sysctl_max_unsig_wrs = 16;
5312198SEiji.Ota@Sun.COM 
5412198SEiji.Ota@Sun.COM unsigned long rdsv3_ib_sysctl_max_unsig_bytes = (16 << 20);
5512198SEiji.Ota@Sun.COM 
5612794SGiri.Adari@Sun.COM unsigned long rdsv3_max_bcopy_size;
5712794SGiri.Adari@Sun.COM 
5812198SEiji.Ota@Sun.COM /*
5912198SEiji.Ota@Sun.COM  * This sysctl does nothing.
6012198SEiji.Ota@Sun.COM  *
6112198SEiji.Ota@Sun.COM  * Backwards compatibility with RDS 3.0 wire protocol
6212198SEiji.Ota@Sun.COM  * disables initial FC credit exchange.
6312198SEiji.Ota@Sun.COM  * If it's ever possible to drop 3.0 support,
6412198SEiji.Ota@Sun.COM  * setting this to 1 and moving init/refill of send/recv
6512198SEiji.Ota@Sun.COM  * rings from ib_cm_connect_complete() back into ib_setup_qp()
6612198SEiji.Ota@Sun.COM  * will cause credits to be added before protocol negotiation.
6712198SEiji.Ota@Sun.COM  */
6812198SEiji.Ota@Sun.COM unsigned int rdsv3_ib_sysctl_flow_control = 0;
6912198SEiji.Ota@Sun.COM 
7012198SEiji.Ota@Sun.COM void
rdsv3_ib_sysctl_exit(void)7112198SEiji.Ota@Sun.COM rdsv3_ib_sysctl_exit(void)
7212198SEiji.Ota@Sun.COM {
7312198SEiji.Ota@Sun.COM }
7412198SEiji.Ota@Sun.COM 
7512198SEiji.Ota@Sun.COM int
rdsv3_ib_sysctl_init(void)7612198SEiji.Ota@Sun.COM rdsv3_ib_sysctl_init(void)
7712198SEiji.Ota@Sun.COM {
7812580SGiri.Adari@Sun.COM 	RDSV3_DPRINTF2("rdsv3_ib_sysctl_init",
7912580SGiri.Adari@Sun.COM 	    "rdsv3_ib_sysctl_max_send_wr = 0x%lx "
8012580SGiri.Adari@Sun.COM 	    "rdsv3_ib_sysctl_max_recv_wr = 0x%lx "
8112580SGiri.Adari@Sun.COM 	    "rdsv3_ib_sysctl_max_recv_allocation = 0x%lx "
8212580SGiri.Adari@Sun.COM 	    "rdsv3_ib_sysctl_max_unsig_wrs = 0x%lx "
8312580SGiri.Adari@Sun.COM 	    "rdsv3_ib_sysctl_max_unsig_bytes = 0x%lx "
8412580SGiri.Adari@Sun.COM 	    "rdsv3_ib_sysctl_flow_control = 0x%x",
8512580SGiri.Adari@Sun.COM 	    rdsv3_ib_sysctl_max_send_wr,
8612580SGiri.Adari@Sun.COM 	    rdsv3_ib_sysctl_max_recv_wr,
8712580SGiri.Adari@Sun.COM 	    rdsv3_ib_sysctl_max_recv_allocation,
8812580SGiri.Adari@Sun.COM 	    rdsv3_ib_sysctl_max_unsig_wrs,
8912580SGiri.Adari@Sun.COM 	    rdsv3_ib_sysctl_max_unsig_bytes,
9012580SGiri.Adari@Sun.COM 	    rdsv3_ib_sysctl_flow_control);
9112794SGiri.Adari@Sun.COM 
9212794SGiri.Adari@Sun.COM 	rdsv3_max_bcopy_size = rdsv3_ib_sysctl_max_send_wr * RDSV3_FRAG_SIZE;
9312198SEiji.Ota@Sun.COM 	return (0);
9412198SEiji.Ota@Sun.COM }
95