Whamcloud - gitweb
Landing b_hd_newconfig on HEAD
[fs/lustre-release.git] / lnet / klnds / gmlnd / gmlnd_module.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (c) 2003 Los Alamos National Laboratory (LANL)
5  *
6  *   This file is part of Lustre, http://www.lustre.org/
7  *
8  *   Lustre is free software; you can redistribute it and/or
9  *   modify it under the terms of version 2 of the GNU General Public
10  *   License as published by the Free Software Foundation.
11  *
12  *   Lustre is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with Lustre; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21
22 #include "gmlnd.h"
23
24
25 static int port = 4;
26 CFS_MODULE_PARM(port, "i", int, 0444,
27                 "GM port to use for communications");
28
29 static int ntx = 256;
30 CFS_MODULE_PARM(ntx, "i", int, 0444,
31                 "# tx descriptors");
32
33 static int credits = 128;
34 CFS_MODULE_PARM(credits, "i", int, 0444,
35                 "# concurrent sends");
36
37 static int peer_credits = 8;
38 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
39                 "# concurrent sends per peer");
40
41 static int nlarge_tx_bufs = 32;
42 CFS_MODULE_PARM(nlarge_tx_bufs, "i", int, 0444,
43                 "# large tx message buffers");
44
45 static int nrx_small = 128;
46 CFS_MODULE_PARM(nrx_small, "i", int, 0444,
47                 "# small rx message buffers");
48
49 static int nrx_large = 64;
50 CFS_MODULE_PARM(nrx_large, "i", int, 0444,
51                 "# large rx message buffers");
52
53 gmnal_tunables_t gmnal_tunables = {
54         .gm_port            = &port,
55         .gm_ntx             = &ntx,
56         .gm_credits         = &credits,
57         .gm_peer_credits    = &peer_credits,
58         .gm_nlarge_tx_bufs  = &nlarge_tx_bufs,
59         .gm_nrx_small       = &nrx_small,
60         .gm_nrx_large       = &nrx_large,
61 };
62
63 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
64 static ctl_table gmnal_ctl_table[] = {
65         {1, "port", &port,
66          sizeof (int), 0444, NULL, &proc_dointvec},
67         {2, "ntx", &ntx, 
68          sizeof (int), 0444, NULL, &proc_dointvec},
69         {3, "credits", &credits,
70          sizeof (int), 0444, NULL, &proc_dointvec},
71         {4, "peer_credits", &peer_credits,
72          sizeof (int), 0444, NULL, &proc_dointvec},
73         {5, "nlarge_tx_bufs", &nlarge_tx_bufs,
74          sizeof (int), 0444, NULL, &proc_dointvec},
75         {6, "nrx_small", &nrx_small,
76          sizeof (int), 0444, NULL, &proc_dointvec},
77         {7, "nrx_large", &nrx_large,
78          sizeof (int), 0444, NULL, &proc_dointvec},
79         {0}
80 };
81
82 static ctl_table gmnal_top_ctl_table[] = {
83         {207, "gmnal", NULL, 0, 0555, gmnal_ctl_table},
84         {0}
85 };
86 #endif
87
88 static int __init
89 gmnal_load(void)
90 {
91         int     status;
92         CDEBUG(D_TRACE, "This is the gmnal module initialisation routine\n");
93
94 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
95         gmnal_tunables.gm_sysctl =
96                 register_sysctl_table(gmnal_top_ctl_table, 0);
97         
98         if (gmnal_tunables.gm_sysctl == NULL)
99                 CWARN("Can't setup /proc tunables\n");
100 #endif
101         CDEBUG(D_NET, "Calling gmnal_init\n");
102         status = gmnal_init();
103         if (status == 0) {
104                 CDEBUG(D_NET, "Portals GMNAL initialised ok\n");
105         } else {
106                 CDEBUG(D_NET, "Portals GMNAL Failed to initialise\n");
107                 return(-ENODEV);
108         }
109
110         CDEBUG(D_NET, "This is the end of the gmnal init routine");
111
112         return(0);
113 }
114
115 static void __exit
116 gmnal_unload(void)
117 {
118         gmnal_fini();
119 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
120         if (gmnal_tunables.gm_sysctl != NULL)
121                 unregister_sysctl_table(gmnal_tunables.gm_sysctl);
122 #endif
123 }
124
125 module_init(gmnal_load);
126 module_exit(gmnal_unload);
127
128 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
129 MODULE_DESCRIPTION("Kernel GM LND v1.01");
130 MODULE_LICENSE("GPL");