Whamcloud - gitweb
LU-2675 lnet: remove lnet/include/lnet/linux/
[fs/lustre-release.git] / lnet / include / lnet / lib-types.h
index 41fa32b..6d2bb38 100644 (file)
 #ifndef __LNET_LIB_TYPES_H__
 #define __LNET_LIB_TYPES_H__
 
-#if defined(__linux__)
-#include <lnet/linux/lib-types.h>
-#elif defined(__APPLE__)
-#include <lnet/darwin/lib-types.h>
-#elif defined(__WINNT__)
-#include <lnet/winnt/lib-types.h>
-#include <libcfs/libcfs_pack.h>
-#include <libcfs/libcfs_unpack.h>
-#else
-#error Unsupported Operating System
-#endif
+#ifdef __KERNEL__
+# include <linux/uio.h>
+# include <linux/types.h>
+#else /* !__KERNEL__ */
+# define LNET_USE_LIB_FREELIST
+# include <sys/types.h>
+#endif /* __KERNEL__ */
 
 #include <libcfs/libcfs.h>
 #include <libcfs/list.h>
 #include <lnet/types.h>
+#include <lnet/lnetctl.h>
 
 #define WIRE_ATTR       __attribute__((packed))
 
@@ -217,6 +214,7 @@ typedef struct lnet_msg {
         unsigned int          msg_rtrcredit:1;    /* taken a globel router credit */
         unsigned int          msg_peerrtrcredit:1; /* taken a peer router credit */
         unsigned int          msg_onactivelist:1; /* on the activelist */
+       unsigned int          msg_rdma_get:1;
 
         struct lnet_peer     *msg_txpeer;         /* peer I'm sending to */
         struct lnet_peer     *msg_rxpeer;         /* peer I received from */
@@ -413,7 +411,7 @@ struct lnet_tx_queue {
        struct list_head        tq_delayed;     /* delayed TXs */
 };
 
-#define LNET_MAX_INTERFACES   16
+#define LNET_MAX_INTERFACES    16
 
 typedef struct lnet_ni {
 #ifdef __KERNEL__
@@ -454,6 +452,7 @@ typedef struct lnet_ni {
 #define LNET_PING_FEAT_INVAL           (0)             /* no feature */
 #define LNET_PING_FEAT_BASE            (1 << 0)        /* just a ping */
 #define LNET_PING_FEAT_NI_STATUS       (1 << 1)        /* return NI status */
+#define LNET_PING_FEAT_RTE_DISABLED    (1 << 2)        /* Routing enabled */
 
 #define LNET_PING_FEAT_MASK            (LNET_PING_FEAT_BASE | \
                                         LNET_PING_FEAT_NI_STATUS)
@@ -574,6 +573,11 @@ typedef struct {
        __u32                   lrn_net;
 } lnet_remotenet_t;
 
+/** lnet message has credit and can be submitted to lnd for send/receive */
+#define LNET_CREDIT_OK         0
+/** lnet message is waiting for credit */
+#define LNET_CREDIT_WAIT       1
+
 typedef struct {
        /* my free buffer pool */
        struct list_head        rbp_bufs;
@@ -595,23 +599,28 @@ typedef struct {
        lnet_kiov_t              rb_kiov[0];    /* the buffer space */
 } lnet_rtrbuf_t;
 
-typedef struct {
-        __u32        msgs_alloc;
-        __u32        msgs_max;
-        __u32        errors;
-        __u32        send_count;
-        __u32        recv_count;
-        __u32        route_count;
-        __u32        drop_count;
-        __u64        send_length;
-        __u64        recv_length;
-        __u64        route_length;
-        __u64        drop_length;
+typedef struct lnet_counters {
+       __u32 msgs_alloc;
+       __u32 msgs_max;
+       __u32 errors;
+       __u32 send_count;
+       __u32 recv_count;
+       __u32 route_count;
+       __u32 drop_count;
+       __u64 send_length;
+       __u64 recv_length;
+       __u64 route_length;
+       __u64 drop_length;
 } WIRE_ATTR lnet_counters_t;
 
 #define LNET_PEER_HASHSIZE   503                /* prime! */
 
-#define LNET_NRBPOOLS         3                 /* # different router buffer pools */
+#define LNET_TINY_BUF_IDX      0
+#define LNET_SMALL_BUF_IDX     1
+#define LNET_LARGE_BUF_IDX     2
+
+/* # different router buffer pools */
+#define LNET_NRBPOOLS          (LNET_LARGE_BUF_IDX + 1)
 
 enum {
        /* Didn't match anything */
@@ -698,7 +707,7 @@ typedef struct lnet_portal {
        /* Match table for each CPT */
        struct lnet_match_table **ptl_mtables;
        /* spread rotor of incoming "PUT" */
-       int                     ptl_rotor;
+       unsigned int            ptl_rotor;
        /* # active entries for this portal */
        int                     ptl_mt_nmaps;
        /* array of active entries' cpu-partition-id */
@@ -782,6 +791,8 @@ typedef struct
        struct lnet_peer_table          **ln_peer_tables;
        /* failure simulation */
        struct list_head                ln_test_peers;
+       struct list_head                ln_drop_rules;
+       struct list_head                ln_delay_rules;
 
        struct list_head                ln_nis;         /* LND instances */
        /* NIs bond on specific CPT(s) */
@@ -821,6 +832,7 @@ typedef struct
 
        struct mutex                    ln_api_mutex;
        struct mutex                    ln_lnd_mutex;
+       struct mutex                    ln_delay_mutex;
 #else
 # ifndef HAVE_LIBPTHREAD
        int                             ln_api_mutex;
@@ -848,6 +860,13 @@ typedef struct
        /* test protocol compatibility flags */
        int                             ln_testprotocompat;
 
+       /* 0 - load the NIs from the mod params
+        * 1 - do not load the NIs from the mod params
+        * Reverse logic to ensure that other calls to LNetNIInit
+        * need no change
+        */
+       bool                            ln_nis_from_mod_params;
+
 #ifndef __KERNEL__
        /* Temporary workaround to allow uOSS and test programs force
         * server mode in userspace. The only place where we use it is