Whamcloud - gitweb
LU-7734 lnet: cpt locking
[fs/lustre-release.git] / lnet / include / lnet / types.h
index 768aae7..6b9a949 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -77,8 +73,6 @@ typedef __u32 lnet_pid_t;
 #define LNET_PID_USERFLAG 0x80000000 /* set in userspace peers */
 #define LNET_PID_LUSTRE 12345
 
-#define LNET_TIME_FOREVER    (-1)
-
 /* how an LNET NID encodes net:address */
 /** extract the address part of an lnet_nid_t */
 
@@ -115,7 +109,7 @@ static inline __u32 LNET_MKNET(__u32 type, __u32 num)
 #define WIRE_ATTR      __attribute__((packed))
 
 /* Packed version of lnet_process_id_t to transfer via network */
-typedef struct {
+typedef struct lnet_process_id_packed {
        lnet_nid_t nid;
        lnet_pid_t pid; /* node id / process id */
 } WIRE_ATTR lnet_process_id_packed_t;
@@ -124,7 +118,7 @@ typedef struct {
  * one epoch (i.e. new cookie when the interface restarts or the node
  * reboots).  The object cookie only matches one object on that interface
  * during that object's lifetime (i.e. no cookie re-use). */
-typedef struct {
+typedef struct lnet_handle_wire {
        __u64 wh_interface_cookie;
        __u64 wh_object_cookie;
 } WIRE_ATTR lnet_handle_wire_t;
@@ -141,38 +135,38 @@ typedef enum {
  * byte boundary in the message header.  Note that all types used in these
  * wire structs MUST be fixed size and the smaller types are placed at the
  * end. */
-typedef struct lnet_ack {
-       lnet_handle_wire_t      dst_wmd;
+struct lnet_ack {
+       struct lnet_handle_wire dst_wmd;
        __u64                   match_bits;
        __u32                   mlength;
-} WIRE_ATTR lnet_ack_t;
+} WIRE_ATTR;
 
-typedef struct lnet_put {
-       lnet_handle_wire_t      ack_wmd;
+struct lnet_put {
+       struct lnet_handle_wire ack_wmd;
        __u64                   match_bits;
        __u64                   hdr_data;
        __u32                   ptl_index;
        __u32                   offset;
-} WIRE_ATTR lnet_put_t;
+} WIRE_ATTR;
 
-typedef struct lnet_get {
-       lnet_handle_wire_t      return_wmd;
+struct lnet_get {
+       struct lnet_handle_wire return_wmd;
        __u64                   match_bits;
        __u32                   ptl_index;
        __u32                   src_offset;
        __u32                   sink_length;
-} WIRE_ATTR lnet_get_t;
+} WIRE_ATTR;
 
-typedef struct lnet_reply {
-       lnet_handle_wire_t      dst_wmd;
-} WIRE_ATTR lnet_reply_t;
+struct lnet_reply {
+       struct lnet_handle_wire dst_wmd;
+} WIRE_ATTR;
 
-typedef struct lnet_hello {
+struct lnet_hello {
        __u64                   incarnation;
        __u32                   type;
-} WIRE_ATTR lnet_hello_t;
+} WIRE_ATTR;
 
-typedef struct {
+typedef struct lnet_hdr {
        lnet_nid_t      dest_nid;
        lnet_nid_t      src_nid;
        lnet_pid_t      dest_pid;
@@ -181,11 +175,11 @@ typedef struct {
        __u32           payload_length; /* payload data to follow */
        /*<------__u64 aligned------->*/
        union {
-               lnet_ack_t      ack;
-               lnet_put_t      put;
-               lnet_get_t      get;
-               lnet_reply_t    reply;
-               lnet_hello_t    hello;
+               struct lnet_ack         ack;
+               struct lnet_put         put;
+               struct lnet_get         get;
+               struct lnet_reply       reply;
+               struct lnet_hello       hello;
        } msg;
 } WIRE_ATTR lnet_hdr_t;
 
@@ -198,7 +192,7 @@ typedef struct {
  * exchange HELLO messages when a connection is first established.  Individual
  * LNDs can put whatever else they fancy in lnet_hdr_t::msg.
  */
-typedef struct {
+typedef struct lnet_magicversion {
        __u32   magic;          /* LNET_PROTO_TCP_MAGIC */
        __u16   version_major;  /* increment on incompatible change */
        __u16   version_minor;  /* increment on compatible change */
@@ -220,7 +214,7 @@ typedef struct {
 #define LNET_PROTO_TCP_VERSION_MINOR   0
 
 /* Acceptor connection request */
-typedef struct {
+typedef struct lnet_acceptor_connreq {
        __u32   acr_magic;      /* PTL_ACCEPTOR_PROTO_MAGIC */
        __u32   acr_version;    /* protocol version */
        __u64   acr_nid;        /* target NID */
@@ -415,6 +409,7 @@ typedef struct {
         * - LNET_MD_IOVEC: The start and length fields specify an array of
         *   struct iovec.
         * - LNET_MD_MAX_SIZE: The max_size field is valid.
+        * - LNET_MD_BULK_HANDLE: The bulk_handle field is valid.
         *
         * Note:
         * - LNET_MD_KIOV or LNET_MD_IOVEC allows for a scatter/gather
@@ -438,6 +433,15 @@ typedef struct {
         * descriptor are not logged.
         */
        lnet_handle_eq_t eq_handle;
+       /**
+        * The bulk MD handle which was registered to describe the buffers
+        * either to be used to transfer data to the peer or receive data
+        * from the peer. This allows LNet to properly determine the NUMA
+        * node on which the memory was allocated and use that to select the
+        * nearest local network interface. This value is only used
+        * if the LNET_MD_BULK_HANDLE option is set.
+        */
+       lnet_handle_md_t bulk_handle;
 } lnet_md_t;
 
 /* Max Transfer Unit (minimum supported everywhere).
@@ -468,6 +472,8 @@ typedef struct {
 #define LNET_MD_MAX_SIZE            (1 << 7)
 /** See lnet_md_t::options. */
 #define LNET_MD_KIOV                (1 << 8)
+/** See lnet_md_t::options. */
+#define LNET_MD_BULK_HANDLE         (1 << 9)
 
 /* For compatibility with Cray Portals */
 #define LNET_MD_PHYS                        0
@@ -551,20 +557,22 @@ typedef struct {
        lnet_process_id_t   target;
        /** The identifier (nid, pid) of the initiator. */
        lnet_process_id_t   initiator;
+       /** The source NID on the initiator. */
+       lnet_process_id_t   source;
        /**
         * The NID of the immediate sender. If the request has been forwarded
         * by routers, this is the NID of the last hop; otherwise it's the
-        * same as the initiator.
+        * same as the source.
         */
-       lnet_nid_t          sender;
+       lnet_nid_t          sender;
        /** Indicates the type of the event. */
        lnet_event_kind_t   type;
        /** The portal table index specified in the request */
-       unsigned int        pt_index;
+       unsigned int        pt_index;
        /** A copy of the match bits specified in the request. */
-       __u64               match_bits;
+       __u64               match_bits;
        /** The length (in bytes) specified in the request. */
-       unsigned int        rlength;
+       unsigned int        rlength;
        /**
         * The length (in bytes) of the data that was manipulated by the
         * operation. For truncated operations, the manipulated length will be
@@ -572,7 +580,7 @@ typedef struct {
         * see lnet_md_t). For all other operations, the manipulated length
         * will be the length of the requested operation, i.e. rlength.
         */
-       unsigned int        mlength;
+       unsigned int        mlength;
        /**
         * The handle to the MD associated with the event. The handle may be
         * invalid if the MD has been unlinked.
@@ -583,31 +591,31 @@ typedef struct {
         * been processed. In particular, the threshold field in md will
         * reflect the value of the threshold after the operation occurred.
         */
-       lnet_md_t           md;
+       lnet_md_t           md;
        /**
         * 64 bits of out-of-band user data. Only valid for LNET_EVENT_PUT.
         * \see LNetPut
         */
-       __u64               hdr_data;
+       __u64               hdr_data;
        /**
         * Indicates the completion status of the operation. It's 0 for
         * successful operations, otherwise it's an error code.
         */
-       int                 status;
+       int                 status;
        /**
         * Indicates whether the MD has been unlinked. Note that:
         * - An event with unlinked set is the last event on the MD.
         * - This field is also set for an explicit LNET_EVENT_UNLINK event.
         * \see LNetMDUnlink
         */
-       int                 unlinked;
+       int                 unlinked;
        /**
         * The displacement (in bytes) into the memory region that the
         * operation used. The offset can be determined by the operation for
         * a remote managed MD or by the local MD.
         * \see lnet_md_t::options
         */
-       unsigned int        offset;
+       unsigned int        offset;
        /**
         * The sequence number for this event. Sequence numbers are unique
         * to each event.