Whamcloud - gitweb
0d5c7f078ce9ca89ba3f870fa00ae3ed2ec6500d
[fs/lustre-release.git] / lnet / include / lnet / api.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
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.
11  *
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).
17  *
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
21  *
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
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
30  * Use is subject to license terms.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  */
36
37 #ifndef __LNET_API_H__
38 #define __LNET_API_H__
39
40 #include <lnet/types.h>
41
42 int LNetInit(void);
43 void LNetFini(void);
44
45 int LNetNIInit(lnet_pid_t requested_pid);
46 int LNetNIFini(void);
47
48 int LNetGetId(unsigned int index, lnet_process_id_t *id);
49 int LNetDist(lnet_nid_t nid, lnet_nid_t *srcnid, __u32 *order);
50 int LNetCtl(unsigned int cmd, void *arg);
51 void LNetSnprintHandle (char *str, int str_len, lnet_handle_any_t handle);
52
53 /*
54  * Portals
55  */
56 int LNetSetLazyPortal(int portal);
57 int LNetClearLazyPortal(int portal);
58
59 /*
60  * Match entries
61  */
62 int LNetMEAttach(unsigned int      portal,
63                  lnet_process_id_t match_id_in, 
64                  __u64             match_bits_in,
65                  __u64             ignore_bits_in, 
66                  lnet_unlink_t     unlink_in,
67                  lnet_ins_pos_t    pos_in, 
68                  lnet_handle_me_t *handle_out);
69
70 int LNetMEInsert(lnet_handle_me_t  current_in, 
71                  lnet_process_id_t match_id_in,
72                  __u64             match_bits_in, 
73                  __u64             ignore_bits_in,
74                  lnet_unlink_t     unlink_in, 
75                  lnet_ins_pos_t    position_in,
76                  lnet_handle_me_t *handle_out);
77
78 int LNetMEUnlink(lnet_handle_me_t current_in);
79
80 /*
81  * Memory descriptors
82  */
83 int LNetMDAttach(lnet_handle_me_t  current_in, 
84                  lnet_md_t         md_in,
85                  lnet_unlink_t     unlink_in, 
86                  lnet_handle_md_t *handle_out);
87
88 int LNetMDBind(lnet_md_t         md_in,
89                lnet_unlink_t     unlink_in, 
90                lnet_handle_md_t *handle_out);
91
92 int LNetMDUnlink(lnet_handle_md_t md_in);
93
94 /*
95  * Event queues
96  */
97 int LNetEQAlloc(unsigned int       count_in,
98                 lnet_eq_handler_t  handler,
99                 lnet_handle_eq_t  *handle_out);
100
101 int LNetEQFree(lnet_handle_eq_t eventq_in);
102
103 int LNetEQGet(lnet_handle_eq_t  eventq_in, 
104               lnet_event_t     *event_out);
105
106
107 int LNetEQWait(lnet_handle_eq_t  eventq_in, 
108                lnet_event_t     *event_out);
109
110 int LNetEQPoll(lnet_handle_eq_t *eventqs_in, 
111                int               neq_in, 
112                int               timeout_ms,
113                lnet_event_t     *event_out, 
114                int              *which_eq_out);
115
116 /*
117  * Data movement
118  */
119 int LNetPut(lnet_nid_t        self,
120             lnet_handle_md_t  md_in, 
121             lnet_ack_req_t    ack_req_in,
122             lnet_process_id_t target_in, 
123             unsigned int      portal_in,
124             __u64             match_bits_in,
125             unsigned int      offset_in, 
126             __u64             hdr_data_in);
127
128 int LNetGet(lnet_nid_t        self,
129             lnet_handle_md_t  md_in, 
130             lnet_process_id_t target_in,
131             unsigned int      portal_in, 
132             __u64             match_bits_in, 
133             unsigned int      offset_in);
134
135
136 int LNetSetAsync(lnet_process_id_t id, int nasync);
137
138 #ifndef __KERNEL__
139 /* Temporary workaround to allow uOSS and test programs force server
140  * mode in userspace. See comments near ln_server_mode_flag in
141  * lnet/lib-types.h */
142
143 void lnet_server_mode();
144 #endif        
145
146 #endif