1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
30 * Use is subject to license terms.
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
42 #define LST_INIT_NONE 0
43 #define LST_INIT_RPC 1
45 #define LST_INIT_CONSOLE 3
47 extern int lstcon_console_init(void);
48 extern int lstcon_console_fini(void);
50 static int lst_init_step = LST_INIT_NONE;
53 lnet_selftest_fini (void)
55 switch (lst_init_step) {
57 case LST_INIT_CONSOLE:
58 lstcon_console_fini();
74 lnet_selftest_structure_assertion(void)
76 CLASSERT(sizeof(srpc_msg_t) == 160);
77 CLASSERT(sizeof(srpc_test_reqst_t) == 70);
78 CLASSERT(offsetof(srpc_msg_t, msg_body.tes_reqst.tsr_concur) == 72);
79 CLASSERT(offsetof(srpc_msg_t, msg_body.tes_reqst.tsr_ndest) == 78);
80 CLASSERT(sizeof(srpc_stat_reply_t) == 136);
81 CLASSERT(sizeof(srpc_stat_reqst_t) == 28);
85 lnet_selftest_init (void)
91 CERROR("LST can't startup rpc\n");
94 lst_init_step = LST_INIT_RPC;
98 CERROR("LST can't startup framework\n");
101 lst_init_step = LST_INIT_FW;
104 rc = lstcon_console_init();
106 CERROR("LST can't startup console\n");
109 lst_init_step = LST_INIT_CONSOLE;
114 lnet_selftest_fini();
120 MODULE_DESCRIPTION("LNet Selftest");
121 MODULE_LICENSE("GPL");
123 cfs_module(lnet, "0.9.0", lnet_selftest_init, lnet_selftest_fini);
128 selftest_wait_events (void)
133 /* Consume all pending events */
134 while (srpc_check_event(0))
136 evts += stt_check_events();
137 evts += swi_check_events();
138 if (evts != 0) break;
140 /* Nothing happened, block for events */
141 evts += srpc_check_event(stt_poll_interval());
142 /* We may have blocked, check for expired timers */
143 evts += stt_check_events();
144 if (evts == 0) /* timed out and still no event */