4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2012, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
37 #define DEBUG_SUBSYSTEM S_LNET
51 static int lst_init_step = LST_INIT_NONE;
53 struct cfs_wi_sched *lst_sched_serial;
54 struct cfs_wi_sched **lst_sched_test;
57 lnet_selftest_exit(void)
61 switch (lst_init_step) {
62 case LST_INIT_CONSOLE:
63 lstcon_console_fini();
68 case LST_INIT_WI_TEST:
70 i < cfs_cpt_number(lnet_cpt_table()); i++) {
71 if (lst_sched_test[i] == NULL)
73 cfs_wi_sched_destroy(lst_sched_test[i]);
75 LIBCFS_FREE(lst_sched_test,
76 sizeof(lst_sched_test[0]) *
77 cfs_cpt_number(lnet_cpt_table()));
78 lst_sched_test = NULL;
80 case LST_INIT_WI_SERIAL:
81 cfs_wi_sched_destroy(lst_sched_serial);
82 lst_sched_serial = NULL;
92 lnet_selftest_structure_assertion(void)
94 CLASSERT(sizeof(srpc_msg_t) == 160);
95 CLASSERT(sizeof(srpc_test_reqst_t) == 70);
96 CLASSERT(offsetof(srpc_msg_t, msg_body.tes_reqst.tsr_concur) == 72);
97 CLASSERT(offsetof(srpc_msg_t, msg_body.tes_reqst.tsr_ndest) == 78);
98 CLASSERT(sizeof(srpc_stat_reply_t) == 136);
99 CLASSERT(sizeof(srpc_stat_reqst_t) == 28);
103 lnet_selftest_init(void)
109 rc = cfs_wi_sched_create("lst_s", lnet_cpt_table(), CFS_CPT_ANY,
110 1, &lst_sched_serial);
112 CERROR("Failed to create serial WI scheduler for LST\n");
115 lst_init_step = LST_INIT_WI_SERIAL;
117 nscheds = cfs_cpt_number(lnet_cpt_table());
118 LIBCFS_ALLOC(lst_sched_test, sizeof(lst_sched_test[0]) * nscheds);
119 if (lst_sched_test == NULL)
122 lst_init_step = LST_INIT_WI_TEST;
123 for (i = 0; i < nscheds; i++) {
124 int nthrs = cfs_cpt_weight(lnet_cpt_table(), i);
126 /* reserve at least one CPU for LND */
127 nthrs = max(nthrs - 1, 1);
128 rc = cfs_wi_sched_create("lst_t", lnet_cpt_table(), i,
129 nthrs, &lst_sched_test[i]);
131 CERROR("Failed to create CPT affinity WI scheduler "
139 CERROR("LST can't startup rpc\n");
142 lst_init_step = LST_INIT_RPC;
146 CERROR("LST can't startup framework\n");
149 lst_init_step = LST_INIT_FW;
151 rc = lstcon_console_init();
153 CERROR("LST can't startup console\n");
156 lst_init_step = LST_INIT_CONSOLE;
159 lnet_selftest_exit();
163 MODULE_AUTHOR("OpenSFS, Inc. <http://www.lustre.org/>");
164 MODULE_DESCRIPTION("LNet Selftest");
165 MODULE_VERSION("2.8.0");
166 MODULE_LICENSE("GPL");
168 module_init(lnet_selftest_init);
169 module_exit(lnet_selftest_exit);