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 [sun.com URL with a
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 2008 Sun Microsystems, Inc. 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();
73 lnet_selftest_init (void)
79 CERROR("LST can't startup rpc\n");
82 lst_init_step = LST_INIT_RPC;
86 CERROR("LST can't startup framework\n");
89 lst_init_step = LST_INIT_FW;
92 rc = lstcon_console_init();
94 CERROR("LST can't startup console\n");
97 lst_init_step = LST_INIT_CONSOLE;
102 lnet_selftest_fini();
108 MODULE_DESCRIPTION("LNet Selftest");
109 MODULE_LICENSE("GPL");
111 cfs_module(lnet, "0.9.0", lnet_selftest_init, lnet_selftest_fini);
116 selftest_wait_events (void)
121 /* Consume all pending events */
122 while (srpc_check_event(0))
124 evts += stt_check_events();
125 evts += swi_check_events();
126 if (evts != 0) break;
128 /* Nothing happened, block for events */
129 evts += srpc_check_event(stt_poll_interval());
130 /* We may have blocked, check for expired timers */
131 evts += stt_check_events();
132 if (evts == 0) /* timed out and still no event */