Whamcloud - gitweb
land v0.9.1 on HEAD, in preparation for a 1.0.x branch
[fs/lustre-release.git] / lnet / lnet / api-init.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * api/api-init.c
5  * Initialization and global data for the p30 user side library
6  *
7  *  Copyright (c) 2001-2003 Cluster File Systems, Inc.
8  *  Copyright (c) 2001-2002 Sandia National Laboratories
9  *
10  *   This file is part of Lustre, http://www.sf.net/projects/lustre/
11  *
12  *   Lustre is free software; you can redistribute it and/or
13  *   modify it under the terms of version 2 of the GNU General Public
14  *   License as published by the Free Software Foundation.
15  *
16  *   Lustre is distributed in the hope that it will be useful,
17  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *   GNU General Public License for more details.
20  *
21  *   You should have received a copy of the GNU General Public License
22  *   along with Lustre; if not, write to the Free Software
23  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25
26 #include <portals/api-support.h>
27
28 int ptl_init;
29 unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL | S_GMNAL | S_IBNAL);
30 unsigned int portal_debug = ~0;
31 unsigned int portal_cerror = 1;
32 unsigned int portal_printk;
33 unsigned int portal_stack;
34
35 #ifdef __KERNEL__
36 atomic_t portal_kmemory = ATOMIC_INIT(0);
37 #endif
38
39 int __p30_initialized;
40 int __p30_myr_initialized;
41 int __p30_ip_initialized;
42 ptl_handle_ni_t __myr_ni_handle;
43 ptl_handle_ni_t __ip_ni_handle;
44
45 int __p30_myr_timeout = 10;
46 int __p30_ip_timeout;
47
48 int PtlInit(void)
49 {
50
51         if (ptl_init)
52                 return PTL_OK;
53
54         ptl_ni_init();
55         ptl_me_init();
56         ptl_eq_init();
57         ptl_init = 1;
58         __p30_initialized = 1;
59
60         return PTL_OK;
61 }
62
63
64 void PtlFini(void)
65 {
66
67         /* Reverse order of initialization */
68         ptl_eq_fini();
69         ptl_me_fini();
70         ptl_ni_fini();
71         ptl_init = 0;
72 }