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) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
31 * This file is part of Lustre, http://www.lustre.org/
32 * Lustre is a trademark of Sun Microsystems, Inc.
35 #ifndef __LNET_API_H__
36 #define __LNET_API_H__
38 /** \defgroup lnet LNet
40 * The Lustre Networking subsystem.
42 * LNet is an asynchronous message-passing API, which provides an unreliable
43 * connectionless service that can't guarantee any order. It supports OFA IB,
44 * TCP/IP, and Cray Portals, and routes between heterogeneous networks.
48 #include <lnet/types.h>
50 /** \defgroup lnet_init_fini Initialization and cleanup
51 * The LNet must be properly initialized before any LNet calls can be made.
53 int LNetNIInit(lnet_pid_t requested_pid);
55 /** @} lnet_init_fini */
57 /** \defgroup lnet_addr LNet addressing and basic types
59 * Addressing scheme and basic data types of LNet.
61 * The LNet API is memory-oriented, so LNet must be able to address not only
62 * end-points but also memory region within a process address space.
63 * An ::lnet_nid_t addresses an end-point. An ::lnet_pid_t identifies a process
64 * in a node. A portal represents an opening in the address space of a
65 * process. Match bits is criteria to identify a region of memory inside a
66 * portal, and offset specifies an offset within the memory region.
68 * LNet creates a table of portals for each process during initialization.
69 * This table has MAX_PORTALS entries and its size can't be dynamically
70 * changed. A portal stays empty until the owning process starts to add
71 * memory regions to it. A portal is sometimes called an index because
72 * it's an entry in the portals table of a process.
76 int LNetGetId(unsigned int index, lnet_process_id_t *id);
77 int LNetDist(lnet_nid_t nid, lnet_nid_t *srcnid, __u32 *order);
78 void LNetSnprintHandle(char *str, int str_len, lnet_handle_any_t handle);
83 /** \defgroup lnet_me Match entries
85 * A match entry (abbreviated as ME) describes a set of criteria to accept
88 * A portal is essentially a match list plus a set of attributes. A match
89 * list is a chain of MEs. Each ME includes a pointer to a memory descriptor
90 * and a set of match criteria. The match criteria can be used to reject
91 * incoming requests based on process ID or the match bits provided in the
92 * request. MEs can be dynamically inserted into a match list by LNetMEAttach()
93 * and LNetMEInsert(), and removed from its list by LNetMEUnlink().
95 int LNetMEAttach(unsigned int portal,
96 lnet_process_id_t match_id_in,
99 lnet_unlink_t unlink_in,
100 lnet_ins_pos_t pos_in,
101 lnet_handle_me_t *handle_out);
103 int LNetMEInsert(lnet_handle_me_t current_in,
104 lnet_process_id_t match_id_in,
106 __u64 ignore_bits_in,
107 lnet_unlink_t unlink_in,
108 lnet_ins_pos_t position_in,
109 lnet_handle_me_t *handle_out);
111 int LNetMEUnlink(lnet_handle_me_t current_in);
114 /** \defgroup lnet_md Memory descriptors
116 * A memory descriptor contains information about a region of a user's
117 * memory (either in kernel or user space) and optionally points to an
118 * event queue where information about the operations performed on the
119 * memory descriptor are recorded. Memory descriptor is abbreviated as
120 * MD and can be used interchangeably with the memory region it describes.
122 * The LNet API provides two operations to create MDs: LNetMDAttach()
123 * and LNetMDBind(); one operation to unlink and release the resources
124 * associated with a MD: LNetMDUnlink().
126 int LNetMDAttach(lnet_handle_me_t current_in,
128 lnet_unlink_t unlink_in,
129 lnet_handle_md_t *handle_out);
131 int LNetMDBind(lnet_md_t md_in,
132 lnet_unlink_t unlink_in,
133 lnet_handle_md_t *handle_out);
135 int LNetMDUnlink(lnet_handle_md_t md_in);
138 /** \defgroup lnet_eq Events and event queues
140 * Event queues (abbreviated as EQ) are used to log operations performed on
141 * local MDs. In particular, they signal the completion of a data transmission
142 * into or out of a MD. They can also be used to hold acknowledgments for
143 * completed PUT operations and indicate when a MD has been unlinked. Multiple
144 * MDs can share a single EQ. An EQ may have an optional event handler
145 * associated with it. If an event handler exists, it will be run for each
146 * event that is deposited into the EQ.
148 * In addition to the lnet_handle_eq_t, the LNet API defines two types
149 * associated with events: The ::lnet_event_kind_t defines the kinds of events
150 * that can be stored in an EQ. The lnet_event_t defines a structure that
151 * holds the information about with an event.
153 * There are five functions for dealing with EQs: LNetEQAlloc() is used to
154 * create an EQ and allocate the resources needed, while LNetEQFree()
155 * releases these resources and free the EQ. LNetEQGet() retrieves the next
156 * event from an EQ, and LNetEQWait() can be used to block a process until
157 * an EQ has at least one event. LNetEQPoll() can be used to test or wait
160 int LNetEQAlloc(unsigned int count_in,
161 lnet_eq_handler_t handler,
162 lnet_handle_eq_t *handle_out);
164 int LNetEQFree(lnet_handle_eq_t eventq_in);
166 int LNetEQGet(lnet_handle_eq_t eventq_in,
167 lnet_event_t *event_out);
170 int LNetEQWait(lnet_handle_eq_t eventq_in,
171 lnet_event_t *event_out);
173 int LNetEQPoll(lnet_handle_eq_t *eventqs_in,
176 lnet_event_t *event_out,
180 /** \defgroup lnet_data Data movement operations
182 * The LNet API provides two data movement operations: LNetPut()
185 int LNetPut(lnet_nid_t self,
186 lnet_handle_md_t md_in,
187 lnet_ack_req_t ack_req_in,
188 lnet_process_id_t target_in,
189 unsigned int portal_in,
191 unsigned int offset_in,
194 int LNetGet(lnet_nid_t self,
195 lnet_handle_md_t md_in,
196 lnet_process_id_t target_in,
197 unsigned int portal_in,
199 unsigned int offset_in);
203 /** \defgroup lnet_misc Miscellaneous operations.
204 * Miscellaneous operations.
207 int LNetSetLazyPortal(int portal);
208 int LNetClearLazyPortal(int portal);
209 int LNetCtl(unsigned int cmd, void *arg);