Whamcloud - gitweb
LU-6034 lnet: add default case for check summing
[fs/lustre-release.git] / lnet / include / lnet / types.h
index 9ae5fcb..ac9799b 100644 (file)
@@ -26,6 +26,8 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -38,7 +40,7 @@
 /** \addtogroup lnet
  * @{ */
 
-#include <libcfs/libcfs.h>
+#include <libcfs/types.h>
 
 /** \addtogroup lnet_addr
  * @{ */
@@ -70,16 +72,45 @@ typedef __u32 lnet_pid_t;
 /** wildcard PID that matches any lnet_pid_t */
 #define LNET_PID_ANY      ((lnet_pid_t) -1)
 
-#ifdef CRAY_XT3
-typedef __u32 lnet_uid_t;
-#define LNET_UID_ANY      ((lnet_uid_t) -1)
-#endif
-
 #define LNET_PID_RESERVED 0xf0000000 /* reserved bits in PID */
 #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 */
+
+static inline __u32 LNET_NIDADDR(lnet_nid_t nid)
+{
+       return nid & 0xffffffff;
+}
+
+static inline __u32 LNET_NIDNET(lnet_nid_t nid)
+{
+       return (nid >> 32) & 0xffffffff;
+}
+
+static inline lnet_nid_t LNET_MKNID(__u32 net, __u32 addr)
+{
+       return (((__u64)net) << 32) | addr;
+}
+
+static inline __u32 LNET_NETNUM(__u32 net)
+{
+       return net & 0xffff;
+}
+
+static inline __u32 LNET_NETTYP(__u32 net)
+{
+       return (net >> 16) & 0xffff;
+}
+
+static inline __u32 LNET_MKNET(__u32 type, __u32 num)
+{
+       return (type << 16) | num;
+}
+
 /**
  * Objects maintained by the LNet are accessed through handles. Handle types
  * have names of the form lnet_handle_xx_t, where xx is one of the two letter
@@ -159,8 +190,12 @@ typedef enum {
  * or after the last item in the list.
  */
 typedef enum {
-        LNET_INS_BEFORE,
-        LNET_INS_AFTER
+       /** insert ME before current position or head of the list */
+       LNET_INS_BEFORE,
+       /** insert ME after current position or tail of the list */
+       LNET_INS_AFTER,
+       /** attach ME at tail of local CPU partition ME list */
+       LNET_INS_LOCAL
 } lnet_ins_pos_t;
 
 /** @} lnet_me */
@@ -268,17 +303,20 @@ typedef struct {
         lnet_handle_eq_t eq_handle;
 } lnet_md_t;
 
-/* Max Transfer Unit (minimum supported everywhere) */
-#define LNET_MTU_BITS   20
-#define LNET_MTU        (1<<LNET_MTU_BITS)
+/* Max Transfer Unit (minimum supported everywhere).
+ * CAVEAT EMPTOR, with multinet (i.e. routers forwarding between networks)
+ * these limits are system wide and not interface-local. */
+#define LNET_MTU_BITS  20
+#define LNET_MTU       (1 << LNET_MTU_BITS)
 
 /** limit on the number of fragments in discontiguous MDs */
 #define LNET_MAX_IOV    256
 
 /* Max payload size */
-#ifndef LNET_MAX_PAYLOAD
-# error "LNET_MAX_PAYLOAD must be defined in config.h"
+#ifndef CONFIG_LNET_MAX_PAYLOAD
+# error "CONFIG_LNET_MAX_PAYLOAD must be defined in config.h"
 #else
+# define LNET_MAX_PAYLOAD      CONFIG_LNET_MAX_PAYLOAD
 # if (LNET_MAX_PAYLOAD < LNET_MTU)
 #  error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb"
 # elif defined(__KERNEL__)
@@ -322,16 +360,16 @@ typedef struct iovec lnet_md_iovec_t;
  * A page-based fragment of a MD.
  */
 typedef struct {
-        /** Pointer to the page where the fragment resides */
-        cfs_page_t      *kiov_page;
-        /** Length in bytes of the fragment */
-        unsigned int     kiov_len;
-        /**
-         * Starting offset of the fragment within the page. Note that the
-         * end of the fragment must not pass the end of the page; i.e.,
-         * kiov_len + kiov_offset <= CFS_PAGE_SIZE.
-         */
-        unsigned int     kiov_offset;
+       /** Pointer to the page where the fragment resides */
+       struct page      *kiov_page;
+       /** Length in bytes of the fragment */
+       unsigned int     kiov_len;
+       /**
+        * Starting offset of the fragment within the page. Note that the
+        * end of the fragment must not pass the end of the page; i.e.,
+        * kiov_len + kiov_offset <= PAGE_CACHE_SIZE.
+        */
+       unsigned int     kiov_offset;
 } lnet_kiov_t;
 /** @} lnet_md */
 
@@ -342,8 +380,8 @@ typedef struct {
  * Six types of events can be logged in an event queue.
  */
 typedef enum {
-        /** An incoming GET operation has completed on the MD. */
-        LNET_EVENT_GET,
+       /** An incoming GET operation has completed on the MD. */
+       LNET_EVENT_GET          = 1,
         /**
          * An incoming PUT operation has completed on the MD. The
          * underlying layers will not alter the memory (on behalf of this
@@ -383,14 +421,6 @@ typedef enum {
 typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t;
 #define LNET_SEQ_GT(a,b)        (((signed LNET_SEQ_BASETYPE)((a) - (b))) > 0)
 
-/* XXX
- * cygwin need the pragma line, not clear if it's needed in other places.
- * checking!!!
- */
-#ifdef __CYGWIN__
-#pragma pack(push, 4)
-#endif
-
 /**
  * Information about an event on a MD.
  */
@@ -456,19 +486,12 @@ typedef struct {
          * \see lnet_md_t::options
          */
         unsigned int        offset;
-#ifdef CRAY_XT3
-        lnet_uid_t          uid;
-#endif
-
         /**
          * The sequence number for this event. Sequence numbers are unique
          * to each event.
          */
         volatile lnet_seq_t sequence;
 } lnet_event_t;
-#ifdef __CYGWIN__
-#pragma pop
-#endif
 
 /**
  * Event queue handler function type.