Whamcloud - gitweb
LU-6034 lnet: add default case for check summing
[fs/lustre-release.git] / lnet / include / lnet / types.h
index 2e7d269..ac9799b 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -40,7 +40,7 @@
 /** \addtogroup lnet
  * @{ */
 
-#include <libcfs/libcfs.h>
+#include <libcfs/types.h>
 
 /** \addtogroup lnet_addr
  * @{ */
@@ -74,9 +74,43 @@ typedef __u32 lnet_pid_t;
 
 #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
@@ -279,9 +313,10 @@ typedef struct {
 #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__)
@@ -325,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 */
 
@@ -386,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.
  */
@@ -465,9 +492,6 @@ typedef struct {
          */
         volatile lnet_seq_t sequence;
 } lnet_event_t;
-#ifdef __CYGWIN__
-#pragma pop
-#endif
 
 /**
  * Event queue handler function type.