Whamcloud - gitweb
LU-6142 lnet: replace white spaces with tabs for LNet core 75/19975/10
authorJames Simmons <uja.ornl@yahoo.com>
Tue, 13 Sep 2016 17:34:51 +0000 (13:34 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 21 Sep 2016 02:54:27 +0000 (02:54 +0000)
This work converts all the remaining white spaces left
in the LNet layer to the proper tab format. Fixed all
space prohibited warnings reported by checkpatch. Any
other space issues reported by checkpatch are also
addressed for the code that was retabbed.

Test-Parameters: trivial

Change-Id: I12589439c9532d1d3989deee00aa68c29f84db85
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: http://review.whamcloud.com/19975
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Frank Zago <fzago@cray.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
22 files changed:
lnet/include/lnet/api.h
lnet/include/lnet/lib-lnet.h
lnet/include/lnet/lib-types.h
lnet/include/lnet/lnetst.h
lnet/include/lnet/nidstr.h
lnet/include/lnet/socklnd.h
lnet/include/lnet/types.h
lnet/lnet/acceptor.c
lnet/lnet/api-ni.c
lnet/lnet/config.c
lnet/lnet/lib-eq.c
lnet/lnet/lib-md.c
lnet/lnet/lib-me.c
lnet/lnet/lib-move.c
lnet/lnet/lib-msg.c
lnet/lnet/lib-ptl.c
lnet/lnet/lo.c
lnet/lnet/net_fault.c
lnet/lnet/nidstrings.c
lnet/lnet/peer.c
lnet/lnet/router.c
lnet/lnet/router_proc.c

index f78bfd6..f8fbf66 100644 (file)
@@ -96,19 +96,19 @@ void LNetSnprintHandle(char *str, int str_len, lnet_handle_any_t handle);
  * request. MEs can be dynamically inserted into a match list by LNetMEAttach()
  * and LNetMEInsert(), and removed from its list by LNetMEUnlink().
  * @{ */
-int LNetMEAttach(unsigned int      portal,
-                lnet_process_id_t match_id_in, 
-                __u64             match_bits_in,
-                __u64             ignore_bits_in, 
-                lnet_unlink_t     unlink_in,
-                lnet_ins_pos_t    pos_in, 
+int LNetMEAttach(unsigned int     portal,
+                lnet_process_id_t match_id_in,
+                __u64             match_bits_in,
+                __u64             ignore_bits_in,
+                lnet_unlink_t     unlink_in,
+                lnet_ins_pos_t    pos_in,
                 lnet_handle_me_t *handle_out);
 
-int LNetMEInsert(lnet_handle_me_t  current_in, 
+int LNetMEInsert(lnet_handle_me_t  current_in,
                 lnet_process_id_t match_id_in,
-                __u64             match_bits_in, 
-                __u64             ignore_bits_in,
-                lnet_unlink_t     unlink_in, 
+                __u64             match_bits_in,
+                __u64             ignore_bits_in,
+                lnet_unlink_t     unlink_in,
                 lnet_ins_pos_t    position_in,
                 lnet_handle_me_t *handle_out);
 
@@ -127,13 +127,13 @@ int LNetMEUnlink(lnet_handle_me_t current_in);
  * and LNetMDBind(); one operation to unlink and release the resources
  * associated with a MD: LNetMDUnlink().
  * @{ */
-int LNetMDAttach(lnet_handle_me_t  current_in, 
-                lnet_md_t         md_in,
-                lnet_unlink_t     unlink_in, 
+int LNetMDAttach(lnet_handle_me_t  current_in,
+                lnet_md_t         md_in,
+                lnet_unlink_t     unlink_in,
                 lnet_handle_md_t *handle_out);
 
-int LNetMDBind(lnet_md_t         md_in,
-              lnet_unlink_t     unlink_in, 
+int LNetMDBind(lnet_md_t        md_in,
+              lnet_unlink_t     unlink_in,
               lnet_handle_md_t *handle_out);
 
 int LNetMDUnlink(lnet_handle_md_t md_in);
@@ -161,24 +161,24 @@ int LNetMDUnlink(lnet_handle_md_t md_in);
  * an EQ has at least one event. LNetEQPoll() can be used to test or wait
  * on multiple EQs.
  * @{ */
-int LNetEQAlloc(unsigned int       count_in,
+int LNetEQAlloc(unsigned int      count_in,
                lnet_eq_handler_t  handler,
                lnet_handle_eq_t  *handle_out);
 
 int LNetEQFree(lnet_handle_eq_t eventq_in);
 
-int LNetEQGet(lnet_handle_eq_t  eventq_in, 
+int LNetEQGet(lnet_handle_eq_t eventq_in,
              lnet_event_t     *event_out);
 
 
-int LNetEQWait(lnet_handle_eq_t  eventq_in, 
-              lnet_event_t     *event_out);
+int LNetEQWait(lnet_handle_eq_t  eventq_in,
+              lnet_event_t     *event_out);
 
-int LNetEQPoll(lnet_handle_eq_t *eventqs_in, 
-              int               neq_in, 
-              int               timeout_ms,
-              lnet_event_t     *event_out, 
-              int              *which_eq_out);
+int LNetEQPoll(lnet_handle_eq_t *eventqs_in,
+              int               neq_in,
+              int               timeout_ms,
+              lnet_event_t     *event_out,
+              int              *which_eq_out);
 /** @} lnet_eq */
 
 /** \defgroup lnet_data Data movement operations
@@ -186,20 +186,20 @@ int LNetEQPoll(lnet_handle_eq_t *eventqs_in,
  * The LNet API provides two data movement operations: LNetPut()
  * and LNetGet().
  * @{ */
-int LNetPut(lnet_nid_t        self,
-           lnet_handle_md_t  md_in, 
+int LNetPut(lnet_nid_t       self,
+           lnet_handle_md_t  md_in,
            lnet_ack_req_t    ack_req_in,
-           lnet_process_id_t target_in, 
+           lnet_process_id_t target_in,
            unsigned int      portal_in,
-           __u64             match_bits_in,
-           unsigned int      offset_in, 
-           __u64             hdr_data_in);
+           __u64             match_bits_in,
+           unsigned int      offset_in,
+           __u64             hdr_data_in);
 
-int LNetGet(lnet_nid_t        self,
-           lnet_handle_md_t  md_in, 
+int LNetGet(lnet_nid_t       self,
+           lnet_handle_md_t  md_in,
            lnet_process_id_t target_in,
-           unsigned int      portal_in, 
-           __u64             match_bits_in, 
+           unsigned int      portal_in,
+           __u64             match_bits_in,
            unsigned int      offset_in);
 /** @} lnet_data */
 
index 9bf2cd8..e3b5dfa 100644 (file)
@@ -50,7 +50,7 @@
 #include <lnet/lnet.h>
 #include <lnet/lib-types.h>
 
-extern lnet_t  the_lnet;                        /* THE network */
+extern lnet_t  the_lnet;                       /* THE network */
 
 #if (BITS_PER_LONG == 32)
 /* 2 CPTs, allowing more CPTs might make us under memory pressure */
@@ -65,14 +65,14 @@ extern lnet_t  the_lnet;                        /* THE network */
 #endif /* BITS_PER_LONG == 32 */
 
 /* max allowed CPT number */
-#define LNET_CPT_MAX            (1 << LNET_CPT_MAX_BITS)
+#define LNET_CPT_MAX           (1 << LNET_CPT_MAX_BITS)
 
-#define LNET_CPT_NUMBER         (the_lnet.ln_cpt_number)
-#define LNET_CPT_BITS           (the_lnet.ln_cpt_bits)
-#define LNET_CPT_MASK           ((1ULL << LNET_CPT_BITS) - 1)
+#define LNET_CPT_NUMBER                (the_lnet.ln_cpt_number)
+#define LNET_CPT_BITS          (the_lnet.ln_cpt_bits)
+#define LNET_CPT_MASK          ((1ULL << LNET_CPT_BITS) - 1)
 
 /** exclusive lock */
-#define LNET_LOCK_EX            CFS_PERCPT_LOCK_EX
+#define LNET_LOCK_EX           CFS_PERCPT_LOCK_EX
 
 static inline int lnet_is_route_alive(lnet_route_t *route)
 {
@@ -87,32 +87,32 @@ static inline int lnet_is_route_alive(lnet_route_t *route)
 
 static inline int lnet_is_wire_handle_none (lnet_handle_wire_t *wh)
 {
-        return (wh->wh_interface_cookie == LNET_WIRE_HANDLE_COOKIE_NONE &&
-                wh->wh_object_cookie == LNET_WIRE_HANDLE_COOKIE_NONE);
+       return (wh->wh_interface_cookie == LNET_WIRE_HANDLE_COOKIE_NONE &&
+               wh->wh_object_cookie == LNET_WIRE_HANDLE_COOKIE_NONE);
 }
 
 static inline int lnet_md_exhausted (lnet_libmd_t *md)
 {
-        return (md->md_threshold == 0 ||
-                ((md->md_options & LNET_MD_MAX_SIZE) != 0 &&
-                 md->md_offset + md->md_max_size > md->md_length));
+       return (md->md_threshold == 0 ||
+               ((md->md_options & LNET_MD_MAX_SIZE) != 0 &&
+                md->md_offset + md->md_max_size > md->md_length));
 }
 
 static inline int lnet_md_unlinkable (lnet_libmd_t *md)
 {
-        /* Should unlink md when its refcount is 0 and either:
-         *  - md has been flagged for deletion (by auto unlink or LNetM[DE]Unlink,
-         *    in the latter case md may not be exhausted).
-         *  - auto unlink is on and md is exhausted.
-         */
-        if (md->md_refcount != 0)
-                return 0;
+       /* Should unlink md when its refcount is 0 and either:
+        *  - md has been flagged for deletion (by auto unlink or LNetM[DE]Unlink,
+        *    in the latter case md may not be exhausted).
+        *  - auto unlink is on and md is exhausted.
+        */
+       if (md->md_refcount != 0)
+               return 0;
 
-        if ((md->md_flags & LNET_MD_FLAG_ZOMBIE) != 0)
-                return 1;
+       if ((md->md_flags & LNET_MD_FLAG_ZOMBIE) != 0)
+               return 1;
 
-        return ((md->md_flags & LNET_MD_FLAG_AUTO_UNLINK) != 0 &&
-                lnet_md_exhausted(md));
+       return ((md->md_flags & LNET_MD_FLAG_AUTO_UNLINK) != 0 &&
+               lnet_md_exhausted(md));
 }
 
 #define lnet_cpt_table()       (the_lnet.ln_cpt_table)
@@ -180,7 +180,7 @@ lnet_net_lock_current(void)
 #define lnet_ni_lock(ni)       spin_lock(&(ni)->ni_lock)
 #define lnet_ni_unlock(ni)     spin_unlock(&(ni)->ni_lock)
 
-#define MAX_PORTALS     64
+#define MAX_PORTALS    64
 
 #define LNET_SMALL_MD_SIZE   offsetof(lnet_libmd_t, md_iov.iov[1])
 extern struct kmem_cache *lnet_mes_cachep;      /* MEs kmem_cache */
@@ -190,10 +190,10 @@ extern struct kmem_cache *lnet_small_mds_cachep; /* <= LNET_SMALL_MD_SIZE bytes
 static inline lnet_eq_t *
 lnet_eq_alloc (void)
 {
-        lnet_eq_t *eq;
+       lnet_eq_t *eq;
 
-        LIBCFS_ALLOC(eq, sizeof(*eq));
-        return (eq);
+       LIBCFS_ALLOC(eq, sizeof(*eq));
+       return (eq);
 }
 
 static inline void
@@ -205,18 +205,18 @@ lnet_eq_free(lnet_eq_t *eq)
 static inline lnet_libmd_t *
 lnet_md_alloc (lnet_md_t *umd)
 {
-        lnet_libmd_t *md;
-        unsigned int  size;
-        unsigned int  niov;
+       lnet_libmd_t *md;
+       unsigned int  size;
+       unsigned int  niov;
 
-        if ((umd->options & LNET_MD_KIOV) != 0) {
-                niov = umd->length;
-                size = offsetof(lnet_libmd_t, md_iov.kiov[niov]);
-        } else {
-                niov = ((umd->options & LNET_MD_IOVEC) != 0) ?
-                       umd->length : 1;
-                size = offsetof(lnet_libmd_t, md_iov.iov[niov]);
-        }
+       if ((umd->options & LNET_MD_KIOV) != 0) {
+               niov = umd->length;
+               size = offsetof(lnet_libmd_t, md_iov.kiov[niov]);
+       } else {
+               niov = ((umd->options & LNET_MD_IOVEC) != 0) ?
+                      umd->length : 1;
+               size = offsetof(lnet_libmd_t, md_iov.iov[niov]);
+       }
 
        if (size <= LNET_SMALL_MD_SIZE) {
                md = kmem_cache_alloc(lnet_small_mds_cachep,
@@ -286,12 +286,12 @@ lnet_me_free(lnet_me_t *me)
 static inline lnet_msg_t *
 lnet_msg_alloc(void)
 {
-        lnet_msg_t *msg;
+       lnet_msg_t *msg;
 
-        LIBCFS_ALLOC(msg, sizeof(*msg));
+       LIBCFS_ALLOC(msg, sizeof(*msg));
 
-        /* no need to zero, LIBCFS_ALLOC does for us */
-        return (msg);
+       /* no need to zero, LIBCFS_ALLOC does for us */
+       return (msg);
 }
 
 static inline void
@@ -316,12 +316,12 @@ lnet_res_lh_invalidate(lnet_libhandle_t *lh)
 static inline void
 lnet_eq2handle (lnet_handle_eq_t *handle, lnet_eq_t *eq)
 {
-        if (eq == NULL) {
-                LNetInvalidateHandle(handle);
-                return;
-        }
+       if (eq == NULL) {
+               LNetInvalidateHandle(handle);
+               return;
+       }
 
-        handle->cookie = eq->eq_lh.lh_cookie;
+       handle->cookie = eq->eq_lh.lh_cookie;
 }
 
 static inline lnet_eq_t *
@@ -340,7 +340,7 @@ lnet_handle2eq(lnet_handle_eq_t *handle)
 static inline void
 lnet_md2handle (lnet_handle_md_t *handle, lnet_libmd_t *md)
 {
-        handle->cookie = md->md_lh.lh_cookie;
+       handle->cookie = md->md_lh.lh_cookie;
 }
 
 static inline lnet_libmd_t *
@@ -381,7 +381,7 @@ lnet_wire_handle2md(lnet_handle_wire_t *wh)
 static inline void
 lnet_me2handle (lnet_handle_me_t *handle, lnet_me_t *me)
 {
-        handle->cookie = me->me_lh.lh_cookie;
+       handle->cookie = me->me_lh.lh_cookie;
 }
 
 static inline lnet_me_t *
@@ -403,8 +403,8 @@ lnet_handle2me(lnet_handle_me_t *handle)
 static inline void
 lnet_peer_addref_locked(lnet_peer_t *lp)
 {
-        LASSERT (lp->lp_refcount > 0);
-        lp->lp_refcount++;
+       LASSERT(lp->lp_refcount > 0);
+       lp->lp_refcount++;
 }
 
 extern void lnet_destroy_peer_locked(lnet_peer_t *lp);
@@ -412,16 +412,16 @@ extern void lnet_destroy_peer_locked(lnet_peer_t *lp);
 static inline void
 lnet_peer_decref_locked(lnet_peer_t *lp)
 {
-        LASSERT (lp->lp_refcount > 0);
-        lp->lp_refcount--;
-        if (lp->lp_refcount == 0)
-                lnet_destroy_peer_locked(lp);
+       LASSERT(lp->lp_refcount > 0);
+       lp->lp_refcount--;
+       if (lp->lp_refcount == 0)
+               lnet_destroy_peer_locked(lp);
 }
 
 static inline int
 lnet_isrouter(lnet_peer_t *lp)
 {
-        return lp->lp_rtr_refcount != 0;
+       return lp->lp_rtr_refcount != 0;
 }
 
 static inline void
@@ -506,10 +506,10 @@ struct libcfs_ioctl_handler {
        int (*handle_ioctl)(unsigned int cmd, struct libcfs_ioctl_hdr *hdr);
 };
 
-#define DECLARE_IOCTL_HANDLER(ident, func)                      \
-       static struct libcfs_ioctl_handler ident = {            \
-               /* .item = */ LIST_HEAD_INIT(ident.item),       \
-               /* .handle_ioctl = */ func                      \
+#define DECLARE_IOCTL_HANDLER(ident, func)                     \
+       static struct libcfs_ioctl_handler ident = {            \
+               /* .item = */ LIST_HEAD_INIT(ident.item),       \
+               /* .handle_ioctl = */ func                      \
        }
 
 extern int libcfs_register_ioctl(struct libcfs_ioctl_handler *hand);
@@ -544,7 +544,7 @@ void lnet_msg_decommit(lnet_msg_t *msg, int cpt, int status);
 
 void lnet_eq_enqueue_event(lnet_eq_t *eq, lnet_event_t *ev);
 void lnet_prep_send(lnet_msg_t *msg, int type, lnet_process_id_t target,
-                    unsigned int offset, unsigned int len);
+                   unsigned int offset, unsigned int len);
 int lnet_send(lnet_nid_t nid, lnet_msg_t *msg, lnet_nid_t rtr_nid);
 void lnet_return_tx_credits_locked(lnet_msg_t *msg);
 void lnet_return_rx_credits_locked(lnet_msg_t *msg);
@@ -605,12 +605,12 @@ void lnet_portals_destroy(void);
 
 /* message functions */
 int lnet_parse (lnet_ni_t *ni, lnet_hdr_t *hdr,
-                lnet_nid_t fromnid, void *private, int rdma_req);
+               lnet_nid_t fromnid, void *private, int rdma_req);
 int lnet_parse_local(lnet_ni_t *ni, lnet_msg_t *msg);
 int lnet_parse_forward_locked(lnet_ni_t *ni, lnet_msg_t *msg);
 
 void lnet_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed,
-               unsigned int offset, unsigned int mlen, unsigned int rlen);
+              unsigned int offset, unsigned int mlen, unsigned int rlen);
 void lnet_ni_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg,
                  int delayed, unsigned int offset,
                  unsigned int mlen, unsigned int rlen);
@@ -658,7 +658,7 @@ void lnet_counters_reset(void);
 unsigned int lnet_iov_nob(unsigned int niov, struct kvec *iov);
 int lnet_extract_iov(int dst_niov, struct kvec *dst,
                      int src_niov, struct kvec *src,
-                      unsigned int offset, unsigned int len);
+                     unsigned int offset, unsigned int len);
 
 unsigned int lnet_kiov_nob (unsigned int niov, lnet_kiov_t *iov);
 int lnet_extract_kiov(int dst_niov, lnet_kiov_t *dst,
@@ -685,12 +685,12 @@ void lnet_copy_kiov2kiov(unsigned int ndkiov, lnet_kiov_t *dkiov,
 static inline void
 lnet_copy_iov2flat(int dlen, void *dest, unsigned int doffset,
                   unsigned int nsiov, struct kvec *siov, unsigned int soffset,
-                   unsigned int nob)
+                  unsigned int nob)
 {
        struct kvec diov = {/*.iov_base = */ dest, /*.iov_len = */ dlen};
 
-        lnet_copy_iov2iov(1, &diov, doffset,
-                          nsiov, siov, soffset, nob);
+       lnet_copy_iov2iov(1, &diov, doffset,
+                         nsiov, siov, soffset, nob);
 }
 
 static inline void
@@ -700,8 +700,8 @@ lnet_copy_kiov2flat(int dlen, void *dest, unsigned int doffset,
 {
        struct kvec diov = {/* .iov_base = */ dest, /* .iov_len = */ dlen};
 
-        lnet_copy_kiov2iov(1, &diov, doffset,
-                           nsiov, skiov, soffset, nob);
+       lnet_copy_kiov2iov(1, &diov, doffset,
+                          nsiov, skiov, soffset, nob);
 }
 
 static inline void
@@ -710,8 +710,8 @@ lnet_copy_flat2iov(unsigned int ndiov, struct kvec *diov, unsigned int doffset,
                   unsigned int nob)
 {
        struct kvec siov = {/*.iov_base = */ src, /*.iov_len = */slen};
-        lnet_copy_iov2iov(ndiov, diov, doffset,
-                          1, &siov, soffset, nob);
+       lnet_copy_iov2iov(ndiov, diov, doffset,
+                         1, &siov, soffset, nob);
 }
 
 static inline void
@@ -720,8 +720,8 @@ lnet_copy_flat2kiov(unsigned int ndiov, lnet_kiov_t *dkiov,
                    unsigned int soffset, unsigned int nob)
 {
        struct kvec siov = {/* .iov_base = */ src, /* .iov_len = */ slen};
-        lnet_copy_iov2kiov(ndiov, dkiov, doffset,
-                           1, &siov, soffset, nob);
+       lnet_copy_iov2kiov(ndiov, dkiov, doffset,
+                          1, &siov, soffset, nob);
 }
 
 void lnet_me_unlink(lnet_me_t *me);
@@ -733,9 +733,9 @@ void lnet_register_lnd(lnd_t *lnd);
 void lnet_unregister_lnd(lnd_t *lnd);
 
 int lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
-                 __u32 local_ip, __u32 peer_ip, int peer_port);
+                __u32 local_ip, __u32 peer_ip, int peer_port);
 void lnet_connect_console_error(int rc, lnet_nid_t peer_nid,
-                                __u32 peer_ip, int port);
+                               __u32 peer_ip, int port);
 int lnet_count_acceptor_nis(void);
 int lnet_acceptor_timeout(void);
 int lnet_acceptor_port(void);
index c8f0fb5..8781feb 100644 (file)
@@ -91,34 +91,34 @@ typedef struct lnet_msg {
        /* ready for pending on RX delay list */
        unsigned int            msg_rx_ready_delay:1;
 
-        unsigned int          msg_vmflush:1;      /* VM trying to free memory */
-        unsigned int          msg_target_is_router:1; /* sending to a router */
-        unsigned int          msg_routing:1;      /* being forwarded */
-        unsigned int          msg_ack:1;          /* ack on finalize (PUT) */
-        unsigned int          msg_sending:1;      /* outgoing message */
-        unsigned int          msg_receiving:1;    /* being received */
-        unsigned int          msg_txcredit:1;     /* taken an NI send credit */
-        unsigned int          msg_peertxcredit:1; /* taken a peer send credit */
-        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_vmflush:1;      /* VM trying to free memory */
+       unsigned int          msg_target_is_router:1; /* sending to a router */
+       unsigned int          msg_routing:1;      /* being forwarded */
+       unsigned int          msg_ack:1;          /* ack on finalize (PUT) */
+       unsigned int          msg_sending:1;      /* outgoing message */
+       unsigned int          msg_receiving:1;    /* being received */
+       unsigned int          msg_txcredit:1;     /* taken an NI send credit */
+       unsigned int          msg_peertxcredit:1; /* taken a peer send credit */
+       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 */
+       struct lnet_peer     *msg_txpeer;         /* peer I'm sending to */
+       struct lnet_peer     *msg_rxpeer;         /* peer I received from */
 
-        void                 *msg_private;
-        struct lnet_libmd    *msg_md;
+       void                 *msg_private;
+       struct lnet_libmd    *msg_md;
 
-        unsigned int          msg_len;
-        unsigned int          msg_wanted;
-        unsigned int          msg_offset;
-        unsigned int          msg_niov;
+       unsigned int          msg_len;
+       unsigned int          msg_wanted;
+       unsigned int          msg_offset;
+       unsigned int          msg_niov;
        struct kvec          *msg_iov;
-        lnet_kiov_t          *msg_kiov;
+       lnet_kiov_t          *msg_kiov;
 
-        lnet_event_t          msg_ev;
-        lnet_hdr_t            msg_hdr;
+       lnet_event_t          msg_ev;
+       lnet_hdr_t            msg_hdr;
 } lnet_msg_t;
 
 
@@ -128,7 +128,7 @@ typedef struct lnet_libhandle {
 } lnet_libhandle_t;
 
 #define lh_entry(ptr, type, member) \
-        ((type *)((char *)(ptr)-(char *)(&((type *)0)->member)))
+       ((type *)((char *)(ptr)-(char *)(&((type *)0)->member)))
 
 typedef struct lnet_eq {
        struct list_head        eq_list;
@@ -191,7 +191,7 @@ typedef struct {
 #define LNET_COOKIE_TYPE_BITS  2
 #define LNET_COOKIE_MASK       ((1ULL << LNET_COOKIE_TYPE_BITS) - 1ULL)
 
-struct lnet_ni;                                  /* forward ref */
+struct lnet_ni;                                         /* forward ref */
 struct socket;
 
 typedef struct lnet_lnd
@@ -203,61 +203,61 @@ typedef struct lnet_lnd
        /* fields initialized by the LND */
        __u32                   lnd_type;
 
-        int  (*lnd_startup) (struct lnet_ni *ni);
-        void (*lnd_shutdown) (struct lnet_ni *ni);
-        int  (*lnd_ctl)(struct lnet_ni *ni, unsigned int cmd, void *arg);
+       int  (*lnd_startup)(struct lnet_ni *ni);
+       void (*lnd_shutdown)(struct lnet_ni *ni);
+       int  (*lnd_ctl)(struct lnet_ni *ni, unsigned int cmd, void *arg);
 
-        /* In data movement APIs below, payload buffers are described as a set
-         * of 'niov' fragments which are...
-         * EITHER
+       /* In data movement APIs below, payload buffers are described as a set
+        * of 'niov' fragments which are...
+        * EITHER
         *    in virtual memory (struct kvec *iov != NULL)
-         * OR
-         *    in pages (kernel only: plt_kiov_t *kiov != NULL).
-         * The LND may NOT overwrite these fragment descriptors.
-         * An 'offset' and may specify a byte offset within the set of
-         * fragments to start from
-         */
-
-        /* Start sending a preformatted message.  'private' is NULL for PUT and
-         * GET messages; otherwise this is a response to an incoming message
-         * and 'private' is the 'private' passed to lnet_parse().  Return
-         * non-zero for immediate failure, otherwise complete later with
-         * lnet_finalize() */
-        int (*lnd_send)(struct lnet_ni *ni, void *private, lnet_msg_t *msg);
-
-        /* Start receiving 'mlen' bytes of payload data, skipping the following
-         * 'rlen' - 'mlen' bytes. 'private' is the 'private' passed to
-         * lnet_parse().  Return non-zero for immedaite failure, otherwise
-         * complete later with lnet_finalize().  This also gives back a receive
-         * credit if the LND does flow control. */
-        int (*lnd_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg,
-                        int delayed, unsigned int niov,
+        * OR
+        *    in pages (kernel only: plt_kiov_t *kiov != NULL).
+        * The LND may NOT overwrite these fragment descriptors.
+        * An 'offset' and may specify a byte offset within the set of
+        * fragments to start from
+        */
+
+       /* Start sending a preformatted message.  'private' is NULL for PUT and
+        * GET messages; otherwise this is a response to an incoming message
+        * and 'private' is the 'private' passed to lnet_parse().  Return
+        * non-zero for immediate failure, otherwise complete later with
+        * lnet_finalize() */
+       int (*lnd_send)(struct lnet_ni *ni, void *private, lnet_msg_t *msg);
+
+       /* Start receiving 'mlen' bytes of payload data, skipping the following
+        * 'rlen' - 'mlen' bytes. 'private' is the 'private' passed to
+        * lnet_parse().  Return non-zero for immedaite failure, otherwise
+        * complete later with lnet_finalize().  This also gives back a receive
+        * credit if the LND does flow control. */
+       int (*lnd_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg,
+                       int delayed, unsigned int niov,
                        struct kvec *iov, lnet_kiov_t *kiov,
-                        unsigned int offset, unsigned int mlen, unsigned int rlen);
+                       unsigned int offset, unsigned int mlen, unsigned int rlen);
 
-        /* lnet_parse() has had to delay processing of this message
-         * (e.g. waiting for a forwarding buffer or send credits).  Give the
-         * LND a chance to free urgently needed resources.  If called, return 0
-         * for success and do NOT give back a receive credit; that has to wait
-         * until lnd_recv() gets called.  On failure return < 0 and
-         * release resources; lnd_recv() will not be called. */
-        int (*lnd_eager_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg,
-                              void **new_privatep);
+       /* lnet_parse() has had to delay processing of this message
+        * (e.g. waiting for a forwarding buffer or send credits).  Give the
+        * LND a chance to free urgently needed resources.  If called, return 0
+        * for success and do NOT give back a receive credit; that has to wait
+        * until lnd_recv() gets called.  On failure return < 0 and
+        * release resources; lnd_recv() will not be called. */
+       int (*lnd_eager_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg,
+                             void **new_privatep);
 
-        /* notification of peer health */
-        void (*lnd_notify)(struct lnet_ni *ni, lnet_nid_t peer, int alive);
+       /* notification of peer health */
+       void (*lnd_notify)(struct lnet_ni *ni, lnet_nid_t peer, int alive);
 
-        /* query of peer aliveness */
-        void (*lnd_query)(struct lnet_ni *ni, lnet_nid_t peer, cfs_time_t *when);
+       /* query of peer aliveness */
+       void (*lnd_query)(struct lnet_ni *ni, lnet_nid_t peer, cfs_time_t *when);
 
-        /* accept a new connection */
+       /* accept a new connection */
        int (*lnd_accept)(struct lnet_ni *ni, struct socket *sock);
 } lnd_t;
 
 typedef struct {
-        lnet_nid_t ns_nid;
-        __u32      ns_status;
-        __u32      ns_unused;
+       lnet_nid_t ns_nid;
+       __u32      ns_status;
+       __u32      ns_unused;
 } WIRE_ATTR lnet_ni_status_t;
 
 struct lnet_tx_queue {
@@ -301,7 +301,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_RTE_DISABLED    (1 << 2)        /* Routing enabled */
 
 #define LNET_PING_FEAT_MASK            (LNET_PING_FEAT_BASE | \
                                         LNET_PING_FEAT_NI_STATUS)
@@ -380,8 +380,8 @@ typedef struct lnet_peer {
 } lnet_peer_t;
 
 /* peer hash size */
-#define LNET_PEER_HASH_BITS     9
-#define LNET_PEER_HASH_SIZE     (1 << LNET_PEER_HASH_BITS)
+#define LNET_PEER_HASH_BITS    9
+#define LNET_PEER_HASH_SIZE    (1 << LNET_PEER_HASH_BITS)
 
 /* peer hash table */
 struct lnet_peer_table {
@@ -450,7 +450,7 @@ typedef struct {
        lnet_kiov_t              rb_kiov[0];    /* the buffer space */
 } lnet_rtrbuf_t;
 
-#define LNET_PEER_HASHSIZE   503                /* prime! */
+#define LNET_PEER_HASHSIZE   503               /* prime! */
 
 enum {
        /* Didn't match anything */
@@ -460,15 +460,15 @@ enum {
        /* Must be discarded */
        LNET_MATCHMD_DROP       = (1 << 2),
        /* match and buffer is exhausted */
-       LNET_MATCHMD_EXHAUSTED  = (1 << 3),
+       LNET_MATCHMD_EXHAUSTED  = (1 << 3),
        /* match or drop */
-       LNET_MATCHMD_FINISH     = (LNET_MATCHMD_OK | LNET_MATCHMD_DROP),
+       LNET_MATCHMD_FINISH     = (LNET_MATCHMD_OK | LNET_MATCHMD_DROP),
 };
 
 /* Options for lnet_portal_t::ptl_options */
-#define LNET_PTL_LAZY               (1 << 0)
-#define LNET_PTL_MATCH_UNIQUE       (1 << 1)    /* unique match, for RDMA */
-#define LNET_PTL_MATCH_WILDCARD     (1 << 2)    /* wildcard match, request portal */
+#define LNET_PTL_LAZY              (1 << 0)
+#define LNET_PTL_MATCH_UNIQUE      (1 << 1)    /* unique match, for RDMA */
+#define LNET_PTL_MATCH_WILDCARD     (1 << 2)   /* wildcard match, request portal */
 
 /* parameter for matching operations (GET, PUT) */
 struct lnet_match_info {
@@ -498,13 +498,13 @@ struct lnet_match_info {
 struct lnet_match_table {
        /* reserved for upcoming patches, CPU partition ID */
        unsigned int            mt_cpt;
-       unsigned int            mt_portal;      /* portal index */
+       unsigned int            mt_portal;      /* portal index */
        /* match table is set as "enabled" if there's non-exhausted MD
         * attached on mt_mhash, it's only valid for wildcard portal */
        unsigned int            mt_enabled;
        /* bitmap to flag whether MEs on mt_hash are exhausted or not */
        __u64                   mt_exhausted[LNET_MT_EXHAUSTED_BMAP];
-       struct list_head        *mt_mhash;      /* matching hash */
+       struct list_head        *mt_mhash;      /* matching hash */
 };
 
 /* these are only useful for wildcard portal */
@@ -531,9 +531,9 @@ typedef struct lnet_portal {
        /* spread rotor of incoming "PUT" */
        unsigned int            ptl_rotor;
        /* # active entries for this portal */
-       int                     ptl_mt_nmaps;
+       int                     ptl_mt_nmaps;
        /* array of active entries' cpu-partition-id */
-       int                     ptl_mt_maps[0];
+       int                     ptl_mt_maps[0];
 } lnet_portal_t;
 
 #define LNET_LH_HASH_BITS      12
index 086ecbc..62a1131 100644 (file)
 #define LST_FEATS_EMPTY                (LST_FEAT_NONE)
 #define LST_FEATS_MASK         (LST_FEAT_NONE | LST_FEAT_BULK_LEN)
 
-#define LST_NAME_SIZE           32              /* max name buffer length */
-
-#define LSTIO_DEBUG             0xC00           /* debug */
-#define LSTIO_SESSION_NEW       0xC01           /* create session */
-#define LSTIO_SESSION_END       0xC02           /* end session */
-#define LSTIO_SESSION_INFO      0xC03           /* query session */
-#define LSTIO_GROUP_ADD         0xC10           /* add group */
-#define LSTIO_GROUP_LIST        0xC11           /* list all groups in session */
-#define LSTIO_GROUP_INFO        0xC12           /* query defailt infomation of specified group */
-#define LSTIO_GROUP_DEL         0xC13           /* delete group */
-#define LSTIO_NODES_ADD         0xC14           /* add nodes to specified group */
-#define LSTIO_GROUP_UPDATE      0xC15           /* update group */
-#define LSTIO_BATCH_ADD         0xC20           /* add batch */
-#define LSTIO_BATCH_START       0xC21           /* start batch */
-#define LSTIO_BATCH_STOP        0xC22           /* stop batch */
-#define LSTIO_BATCH_DEL         0xC23           /* delete batch */
-#define LSTIO_BATCH_LIST        0xC24           /* show all batches in the session */
-#define LSTIO_BATCH_INFO        0xC25           /* show defail of specified batch */
-#define LSTIO_TEST_ADD          0xC26           /* add test (to batch) */
-#define LSTIO_BATCH_QUERY       0xC27           /* query batch status */
-#define LSTIO_STAT_QUERY        0xC30           /* get stats */
-
-typedef struct {
-        lnet_nid_t              ses_nid;                /* nid of console node */
-        __u64                   ses_stamp;              /* time stamp */
-} lst_sid_t;                                            /*** session id */
+#define LST_NAME_SIZE          32              /* max name buffer length */
+
+#define LSTIO_DEBUG            0xC00           /* debug */
+#define LSTIO_SESSION_NEW      0xC01           /* create session */
+#define LSTIO_SESSION_END      0xC02           /* end session */
+#define LSTIO_SESSION_INFO     0xC03           /* query session */
+#define LSTIO_GROUP_ADD                0xC10           /* add group */
+#define LSTIO_GROUP_LIST       0xC11           /* list all groups in session */
+#define LSTIO_GROUP_INFO       0xC12           /* query defailt infomation of specified group */
+#define LSTIO_GROUP_DEL                0xC13           /* delete group */
+#define LSTIO_NODES_ADD                0xC14           /* add nodes to specified group */
+#define LSTIO_GROUP_UPDATE     0xC15           /* update group */
+#define LSTIO_BATCH_ADD                0xC20           /* add batch */
+#define LSTIO_BATCH_START      0xC21           /* start batch */
+#define LSTIO_BATCH_STOP       0xC22           /* stop batch */
+#define LSTIO_BATCH_DEL                0xC23           /* delete batch */
+#define LSTIO_BATCH_LIST       0xC24           /* show all batches in the session */
+#define LSTIO_BATCH_INFO       0xC25           /* show defail of specified batch */
+#define LSTIO_TEST_ADD         0xC26           /* add test (to batch) */
+#define LSTIO_BATCH_QUERY      0xC27           /* query batch status */
+#define LSTIO_STAT_QUERY       0xC30           /* get stats */
+
+typedef struct {
+       lnet_nid_t              ses_nid;                /* nid of console node */
+       __u64                   ses_stamp;              /* time stamp */
+} lst_sid_t;                                           /*** session id */
 
 extern lst_sid_t LST_INVALID_SID;
 
 typedef struct {
-        __u64                   bat_id;                 /* unique id in session */
-} lst_bid_t;                                            /*** batch id (group of tests) */
+       __u64                   bat_id;                 /* unique id in session */
+} lst_bid_t;                                           /*** batch id (group of tests) */
 
 /* Status of test node */
-#define LST_NODE_ACTIVE         0x1                     /* node in this session */
-#define LST_NODE_BUSY           0x2                     /* node is taken by other session */
-#define LST_NODE_DOWN           0x4                     /* node is down */
-#define LST_NODE_UNKNOWN        0x8                     /* node not in session */
+#define LST_NODE_ACTIVE                0x1                     /* node in this session */
+#define LST_NODE_BUSY          0x2                     /* node is taken by other session */
+#define LST_NODE_DOWN          0x4                     /* node is down */
+#define LST_NODE_UNKNOWN       0x8                     /* node not in session */
 
 typedef struct {
-        lnet_process_id_t       nde_id;                 /* id of node */
-        int                     nde_state;              /* state of node */
-} lstcon_node_ent_t;                                    /*** node entry, for list_group command */
+       lnet_process_id_t       nde_id;                 /* id of node */
+       int                     nde_state;              /* state of node */
+} lstcon_node_ent_t;                                   /*** node entry, for list_group command */
 
 typedef struct {
-        int                     nle_nnode;              /* # of nodes */
-        int                     nle_nactive;            /* # of active nodes */
-        int                     nle_nbusy;              /* # of busy nodes */
-        int                     nle_ndown;              /* # of down nodes */
-        int                     nle_nunknown;           /* # of unknown nodes */
-} lstcon_ndlist_ent_t;                                  /*** node_list entry, for list_batch command */
+       int                     nle_nnode;              /* # of nodes */
+       int                     nle_nactive;            /* # of active nodes */
+       int                     nle_nbusy;              /* # of busy nodes */
+       int                     nle_ndown;              /* # of down nodes */
+       int                     nle_nunknown;           /* # of unknown nodes */
+} lstcon_ndlist_ent_t;                                 /*** node_list entry, for list_batch command */
 
 typedef struct {
-        int                     tse_type;               /* test type */
-        int                     tse_loop;               /* loop count */
-        int                     tse_concur;             /* concurrency of test */
-} lstcon_test_ent_t;                                    /*** test summary entry, for list_batch command */
+       int                     tse_type;               /* test type */
+       int                     tse_loop;               /* loop count */
+       int                     tse_concur;             /* concurrency of test */
+} lstcon_test_ent_t;                                   /*** test summary entry, for list_batch command */
 
 typedef struct {
-        int                     bae_state;              /* batch status */
-        int                     bae_timeout;            /* batch timeout */
-        int                     bae_ntest;              /* # of tests in the batch */
-} lstcon_batch_ent_t;                                   /*** batch summary entry, for list_batch command */
+       int                     bae_state;              /* batch status */
+       int                     bae_timeout;            /* batch timeout */
+       int                     bae_ntest;              /* # of tests in the batch */
+} lstcon_batch_ent_t;                                  /*** batch summary entry, for list_batch command */
 
 typedef struct {
-        lstcon_ndlist_ent_t     tbe_cli_nle;            /* client (group) node_list entry */
-        lstcon_ndlist_ent_t     tbe_srv_nle;            /* server (group) node_list entry */
-        union {
-                lstcon_test_ent_t  tbe_test;            /* test entry */
-                lstcon_batch_ent_t tbe_batch;           /* batch entry */
-        } u;
-} lstcon_test_batch_ent_t;                              /*** test/batch verbose information entry,
-                                                         *** for list_batch command */
+       lstcon_ndlist_ent_t     tbe_cli_nle;            /* client (group) node_list entry */
+       lstcon_ndlist_ent_t     tbe_srv_nle;            /* server (group) node_list entry */
+       union {
+               lstcon_test_ent_t  tbe_test;            /* test entry */
+               lstcon_batch_ent_t tbe_batch;           /* batch entry */
+       } u;
+} lstcon_test_batch_ent_t;                             /*** test/batch verbose information entry,
+                                                        *** for list_batch command */
 
 typedef struct {
        struct list_head        rpe_link;               /* link chain */
@@ -128,173 +128,173 @@ typedef struct {
        int                     rpe_state;              /* peer's state */
        int                     rpe_rpc_errno;          /* RPC errno */
 
-        lst_sid_t               rpe_sid;                /* peer's session id */
-        int                     rpe_fwk_errno;          /* framework errno */
-        int                     rpe_priv[4];            /* private data */
-        char                    rpe_payload[0];         /* private reply payload */
+       lst_sid_t               rpe_sid;                /* peer's session id */
+       int                     rpe_fwk_errno;          /* framework errno */
+       int                     rpe_priv[4];            /* private data */
+       char                    rpe_payload[0];         /* private reply payload */
 } lstcon_rpc_ent_t;
 
 typedef struct {
-        int                     trs_rpc_stat[4];        /* RPCs stat (0: total, 1: failed, 2: finished, 4: reserved */
-        int                     trs_rpc_errno;          /* RPC errno */
-        int                     trs_fwk_stat[8];        /* framework stat */
-        int                     trs_fwk_errno;          /* errno of the first remote error */
-        void                   *trs_fwk_private;        /* private framework stat */
+       int                     trs_rpc_stat[4];        /* RPCs stat (0: total, 1: failed, 2: finished, 4: reserved */
+       int                     trs_rpc_errno;          /* RPC errno */
+       int                     trs_fwk_stat[8];        /* framework stat */
+       int                     trs_fwk_errno;          /* errno of the first remote error */
+       void                   *trs_fwk_private;        /* private framework stat */
 } lstcon_trans_stat_t;
 
 static inline int
 lstcon_rpc_stat_total(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_rpc_stat[0] : stat->trs_rpc_stat[0];
+       return inc ? ++stat->trs_rpc_stat[0] : stat->trs_rpc_stat[0];
 }
 
 static inline int
 lstcon_rpc_stat_success(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_rpc_stat[1] : stat->trs_rpc_stat[1];
+       return inc ? ++stat->trs_rpc_stat[1] : stat->trs_rpc_stat[1];
 }
 
 static inline int
 lstcon_rpc_stat_failure(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_rpc_stat[2] : stat->trs_rpc_stat[2];
+       return inc ? ++stat->trs_rpc_stat[2] : stat->trs_rpc_stat[2];
 }
 
 static inline int
 lstcon_sesop_stat_success(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
+       return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
 }
 
 static inline int
 lstcon_sesop_stat_failure(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
+       return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
 }
 
 static inline int
 lstcon_sesqry_stat_active(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
+       return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
 }
 
 static inline int
 lstcon_sesqry_stat_busy(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
+       return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
 }
 
 static inline int
 lstcon_sesqry_stat_unknown(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
+       return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
 }
 
 static inline int
 lstcon_tsbop_stat_success(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
+       return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
 }
 
 static inline int
 lstcon_tsbop_stat_failure(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
+       return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
 }
 
 static inline int
 lstcon_tsbqry_stat_idle(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
+       return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
 }
 
 static inline int
 lstcon_tsbqry_stat_run(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
+       return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
 }
 
 static inline int
 lstcon_tsbqry_stat_failure(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
+       return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2];
 }
 
 static inline int
 lstcon_statqry_stat_success(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
+       return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0];
 }
 
 static inline int
 lstcon_statqry_stat_failure(lstcon_trans_stat_t *stat, int inc)
 {
-        return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
+       return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1];
 }
 
 /* create a session */
 typedef struct {
-        int                     lstio_ses_key;          /* IN: local key */
-        int                     lstio_ses_timeout;      /* IN: session timeout */
-        int                     lstio_ses_force;        /* IN: force create ? */
+       int                     lstio_ses_key;          /* IN: local key */
+       int                     lstio_ses_timeout;      /* IN: session timeout */
+       int                     lstio_ses_force;        /* IN: force create ? */
        /** IN: session features */
        unsigned                lstio_ses_feats;
-       lst_sid_t __user       *lstio_ses_idp;          /* OUT: session id */
-        int                     lstio_ses_nmlen;        /* IN: name length */
-       char __user            *lstio_ses_namep;        /* IN: session name */
+       lst_sid_t __user       *lstio_ses_idp;          /* OUT: session id */
+       int                     lstio_ses_nmlen;        /* IN: name length */
+       char __user            *lstio_ses_namep;        /* IN: session name */
 } lstio_session_new_args_t;
 
 /* query current session */
 typedef struct {
-       lst_sid_t __user       *lstio_ses_idp;          /* OUT: session id */
-       int __user             *lstio_ses_keyp;         /* OUT: local key */
+       lst_sid_t __user       *lstio_ses_idp;          /* OUT: session id */
+       int __user             *lstio_ses_keyp;         /* OUT: local key */
        /** OUT: session features */
        unsigned __user        *lstio_ses_featp;
-       lstcon_ndlist_ent_t __user *lstio_ses_ndinfo;   /* OUT: */
-       int                     lstio_ses_nmlen;        /* IN: name length */
-       char __user            *lstio_ses_namep;        /* OUT: session name */
+       lstcon_ndlist_ent_t __user *lstio_ses_ndinfo;   /* OUT: */
+       int                     lstio_ses_nmlen;        /* IN: name length */
+       char __user            *lstio_ses_namep;        /* OUT: session name */
 } lstio_session_info_args_t;
 
 /* delete a session */
 typedef struct {
-        int                     lstio_ses_key;          /* IN: session key */
+       int                     lstio_ses_key;          /* IN: session key */
 } lstio_session_end_args_t;
 
-#define LST_OPC_SESSION         1
-#define LST_OPC_GROUP           2
-#define LST_OPC_NODES           3
-#define LST_OPC_BATCHCLI        4
-#define LST_OPC_BATCHSRV        5
+#define LST_OPC_SESSION                1
+#define LST_OPC_GROUP          2
+#define LST_OPC_NODES          3
+#define LST_OPC_BATCHCLI       4
+#define LST_OPC_BATCHSRV       5
 
 typedef struct {
-        int                     lstio_dbg_key;          /* IN: session key */
-        int                     lstio_dbg_type;         /* IN: debug sessin|batch|group|nodes list */
-        int                     lstio_dbg_flags;        /* IN: reserved debug flags */
-        int                     lstio_dbg_timeout;      /* IN: timeout of debug */
+       int                     lstio_dbg_key;          /* IN: session key */
+       int                     lstio_dbg_type;         /* IN: debug sessin|batch|group|nodes list */
+       int                     lstio_dbg_flags;        /* IN: reserved debug flags */
+       int                     lstio_dbg_timeout;      /* IN: timeout of debug */
 
-        int                     lstio_dbg_nmlen;        /* IN: len of name */
-       char __user            *lstio_dbg_namep;        /* IN: name of group|batch */
-        int                     lstio_dbg_count;        /* IN: # of test nodes to debug */
-       lnet_process_id_t __user *lstio_dbg_idsp;       /* IN: id of test nodes */
+       int                     lstio_dbg_nmlen;        /* IN: len of name */
+       char __user            *lstio_dbg_namep;        /* IN: name of group|batch */
+       int                     lstio_dbg_count;        /* IN: # of test nodes to debug */
+       lnet_process_id_t __user *lstio_dbg_idsp;       /* IN: id of test nodes */
        /* OUT: list head of result buffer */
        struct list_head __user *lstio_dbg_resultp;
 } lstio_debug_args_t;
 
 typedef struct {
-        int                     lstio_grp_key;          /* IN: session key */
-        int                     lstio_grp_nmlen;        /* IN: name length */
-       char __user            *lstio_grp_namep;        /* IN: group name */
+       int                     lstio_grp_key;          /* IN: session key */
+       int                     lstio_grp_nmlen;        /* IN: name length */
+       char __user            *lstio_grp_namep;        /* IN: group name */
 } lstio_group_add_args_t;
 
 typedef struct {
-        int                     lstio_grp_key;          /* IN: session key */
-        int                     lstio_grp_nmlen;        /* IN: name length */
-       char __user            *lstio_grp_namep;        /* IN: group name */
+       int                     lstio_grp_key;          /* IN: session key */
+       int                     lstio_grp_nmlen;        /* IN: name length */
+       char __user            *lstio_grp_namep;        /* IN: group name */
 } lstio_group_del_args_t;
 
-#define LST_GROUP_CLEAN         1                       /* remove inactive nodes in the group */
-#define LST_GROUP_REFRESH       2                       /* refresh inactive nodes in the group */
-#define LST_GROUP_RMND          3                       /* delete nodes from the group */
+#define LST_GROUP_CLEAN                1                       /* remove inactive nodes in the group */
+#define LST_GROUP_REFRESH      2                       /* refresh inactive nodes in the group */
+#define LST_GROUP_RMND         3                       /* delete nodes from the group */
 
 typedef struct {
        int                     lstio_grp_key;          /* IN: session key */
@@ -321,35 +321,35 @@ typedef struct {
 } lstio_group_nodes_args_t;
 
 typedef struct {
-        int                     lstio_grp_key;          /* IN: session key */
-        int                     lstio_grp_idx;          /* IN: group idx */
-        int                     lstio_grp_nmlen;        /* IN: name len */
-       char __user            *lstio_grp_namep;        /* OUT: name */
+       int                     lstio_grp_key;          /* IN: session key */
+       int                     lstio_grp_idx;          /* IN: group idx */
+       int                     lstio_grp_nmlen;        /* IN: name len */
+       char __user            *lstio_grp_namep;        /* OUT: name */
 } lstio_group_list_args_t;
 
 typedef struct {
-        int                     lstio_grp_key;          /* IN: session key */
-        int                     lstio_grp_nmlen;        /* IN: name len */
-       char __user            *lstio_grp_namep;        /* IN: name */
-       lstcon_ndlist_ent_t __user *lstio_grp_entp;         /* OUT: description of group */
+       int                     lstio_grp_key;          /* IN: session key */
+       int                     lstio_grp_nmlen;        /* IN: name len */
+       char __user            *lstio_grp_namep;        /* IN: name */
+       lstcon_ndlist_ent_t __user *lstio_grp_entp;         /* OUT: description of group */
 
-       int __user             *lstio_grp_idxp;         /* IN/OUT: node index */
-       int __user             *lstio_grp_ndentp;       /* IN/OUT: # of nodent */
-       lstcon_node_ent_t __user *lstio_grp_dentsp;     /* OUT: nodent array */
+       int __user             *lstio_grp_idxp;         /* IN/OUT: node index */
+       int __user             *lstio_grp_ndentp;       /* IN/OUT: # of nodent */
+       lstcon_node_ent_t __user *lstio_grp_dentsp;     /* OUT: nodent array */
 } lstio_group_info_args_t;
 
-#define LST_DEFAULT_BATCH       "batch"                 /* default batch name */
+#define LST_DEFAULT_BATCH      "batch"                 /* default batch name */
 
 typedef struct {
-        int                     lstio_bat_key;          /* IN: session key */
-        int                     lstio_bat_nmlen;        /* IN: name length */
-       char __user            *lstio_bat_namep;        /* IN: batch name */
+       int                     lstio_bat_key;          /* IN: session key */
+       int                     lstio_bat_nmlen;        /* IN: name length */
+       char __user            *lstio_bat_namep;        /* IN: batch name */
 } lstio_batch_add_args_t;
 
 typedef struct {
-        int                     lstio_bat_key;          /* IN: session key */
-        int                     lstio_bat_nmlen;        /* IN: name length */
-       char __user            *lstio_bat_namep;        /* IN: batch name */
+       int                     lstio_bat_key;          /* IN: session key */
+       int                     lstio_bat_nmlen;        /* IN: name length */
+       char __user            *lstio_bat_namep;        /* IN: batch name */
 } lstio_batch_del_args_t;
 
 typedef struct {
@@ -396,23 +396,23 @@ typedef struct {
 } lstio_batch_query_args_t;
 
 typedef struct {
-        int                     lstio_bat_key;          /* IN: session key */
-        int                     lstio_bat_idx;          /* IN: index */
-        int                     lstio_bat_nmlen;        /* IN: name length */
-       char __user            *lstio_bat_namep;        /* IN: batch name */
+       int                     lstio_bat_key;          /* IN: session key */
+       int                     lstio_bat_idx;          /* IN: index */
+       int                     lstio_bat_nmlen;        /* IN: name length */
+       char __user            *lstio_bat_namep;        /* IN: batch name */
 } lstio_batch_list_args_t;
 
 typedef struct {
-        int                     lstio_bat_key;          /* IN: session key */
-        int                     lstio_bat_nmlen;        /* IN: name length */
-       char __user            *lstio_bat_namep;        /* IN: name */
-        int                     lstio_bat_server;       /* IN: query server or not */
-        int                     lstio_bat_testidx;      /* IN: test index */
+       int                     lstio_bat_key;          /* IN: session key */
+       int                     lstio_bat_nmlen;        /* IN: name length */
+       char __user            *lstio_bat_namep;        /* IN: name */
+       int                     lstio_bat_server;       /* IN: query server or not */
+       int                     lstio_bat_testidx;      /* IN: test index */
        lstcon_test_batch_ent_t __user *lstio_bat_entp; /* OUT: batch ent */
 
-       int __user             *lstio_bat_idxp;         /* IN/OUT: index of node */
-       int __user             *lstio_bat_ndentp;       /* IN/OUT: # of nodent */
-       lstcon_node_ent_t __user *lstio_bat_dentsp;     /* array of nodent */
+       int __user             *lstio_bat_idxp;         /* IN/OUT: index of node */
+       int __user             *lstio_bat_ndentp;       /* IN/OUT: # of nodent */
+       lstcon_node_ent_t __user *lstio_bat_dentsp;     /* array of nodent */
 } lstio_batch_info_args_t;
 
 /* add stat in session */
@@ -434,28 +434,28 @@ typedef struct {
 } lstio_stat_args_t;
 
 typedef enum {
-        LST_TEST_BULK   = 1,
-        LST_TEST_PING   = 2
+       LST_TEST_BULK   = 1,
+       LST_TEST_PING   = 2
 } lst_test_type_t;
 
 /* create a test in a batch */
-#define LST_MAX_CONCUR          1024                    /* Max concurrency of test */
+#define LST_MAX_CONCUR         1024                    /* Max concurrency of test */
 
 typedef struct {
-        int                     lstio_tes_key;          /* IN: session key */
-        int                     lstio_tes_bat_nmlen;    /* IN: batch name len */
-       char __user            *lstio_tes_bat_name;     /* IN: batch name */
-        int                     lstio_tes_type;         /* IN: test type */
-        int                     lstio_tes_oneside;      /* IN: one sided test */
-        int                     lstio_tes_loop;         /* IN: loop count */
-        int                     lstio_tes_concur;       /* IN: concurrency */
+       int                     lstio_tes_key;          /* IN: session key */
+       int                     lstio_tes_bat_nmlen;    /* IN: batch name len */
+       char __user            *lstio_tes_bat_name;     /* IN: batch name */
+       int                     lstio_tes_type;         /* IN: test type */
+       int                     lstio_tes_oneside;      /* IN: one sided test */
+       int                     lstio_tes_loop;         /* IN: loop count */
+       int                     lstio_tes_concur;       /* IN: concurrency */
 
-        int                     lstio_tes_dist;         /* IN: node distribution in destination groups */
-        int                     lstio_tes_span;         /* IN: node span in destination groups */
-        int                     lstio_tes_sgrp_nmlen;   /* IN: source group name length */
-       char __user            *lstio_tes_sgrp_name;    /* IN: group name */
-        int                     lstio_tes_dgrp_nmlen;   /* IN: destination group name length */
-       char __user            *lstio_tes_dgrp_name;    /* IN: group name */
+       int                     lstio_tes_dist;         /* IN: node distribution in destination groups */
+       int                     lstio_tes_span;         /* IN: node span in destination groups */
+       int                     lstio_tes_sgrp_nmlen;   /* IN: source group name length */
+       char __user            *lstio_tes_sgrp_name;    /* IN: group name */
+       int                     lstio_tes_dgrp_nmlen;   /* IN: destination group name length */
+       char __user            *lstio_tes_dgrp_name;    /* IN: group name */
 
        /* IN: param buffer len */
        int                      lstio_tes_param_len;
@@ -465,53 +465,53 @@ typedef struct {
               ... more */
        void __user             *lstio_tes_param;
        /* OUT: private returned value */
-       int __user              *lstio_tes_retp;
+       int __user              *lstio_tes_retp;
        /* OUT: list head of result buffer */
        struct list_head __user *lstio_tes_resultp;
 } lstio_test_args_t;
 
 typedef enum {
-        LST_BRW_READ    = 1,
-        LST_BRW_WRITE   = 2
+       LST_BRW_READ    = 1,
+       LST_BRW_WRITE   = 2
 } lst_brw_type_t;
 
 typedef enum {
-        LST_BRW_CHECK_NONE   = 1,
-        LST_BRW_CHECK_SIMPLE = 2,
-        LST_BRW_CHECK_FULL   = 3
+       LST_BRW_CHECK_NONE   = 1,
+       LST_BRW_CHECK_SIMPLE = 2,
+       LST_BRW_CHECK_FULL   = 3
 } lst_brw_flags_t;
 
 typedef struct {
-        int                     blk_opc;                /* bulk operation code */
-        int                     blk_size;               /* size (bytes) */
-        int                     blk_time;               /* time of running the test*/
-        int                     blk_flags;              /* reserved flags */
+       int                     blk_opc;                /* bulk operation code */
+       int                     blk_size;               /* size (bytes) */
+       int                     blk_time;               /* time of running the test*/
+       int                     blk_flags;              /* reserved flags */
 } lst_test_bulk_param_t;
 
 typedef struct {
-        int                     png_size;               /* size of ping message */
-        int                     png_time;               /* time */
-        int                     png_loop;               /* loop */
-        int                     png_flags;              /* reserved flags */
+       int                     png_size;               /* size of ping message */
+       int                     png_time;               /* time */
+       int                     png_loop;               /* loop */
+       int                     png_flags;              /* reserved flags */
 } lst_test_ping_param_t;
 
 typedef struct {
-        __u32 errors;
-        __u32 rpcs_sent;
-        __u32 rpcs_rcvd;
-        __u32 rpcs_dropped;
-        __u32 rpcs_expired;
-        __u64 bulk_get;
-        __u64 bulk_put;
+       __u32 errors;
+       __u32 rpcs_sent;
+       __u32 rpcs_rcvd;
+       __u32 rpcs_dropped;
+       __u32 rpcs_expired;
+       __u64 bulk_get;
+       __u64 bulk_put;
 } WIRE_ATTR srpc_counters_t;
 
 typedef struct {
-        /** milliseconds since current session started */
-        __u32 running_ms;
-        __u32 active_batches;
-        __u32 zombie_sessions;
-        __u32 brw_errors;
-        __u32 ping_errors;
+       /** milliseconds since current session started */
+       __u32 running_ms;
+       __u32 active_batches;
+       __u32 zombie_sessions;
+       __u32 brw_errors;
+       __u32 ping_errors;
 } WIRE_ATTR sfw_counters_t;
 
 #endif
index b2863f1..bf5c0b3 100644 (file)
@@ -53,8 +53,8 @@ enum {
 
 struct list_head;
 
-#define LNET_NIDSTR_COUNT  1024    /* # of nidstrings */
-#define LNET_NIDSTR_SIZE   32      /* size of each one (see below for usage) */
+#define LNET_NIDSTR_COUNT 1024 /* # of nidstrings */
+#define LNET_NIDSTR_SIZE  32   /* size of each one (see below for usage) */
 
 /* support decl needed by both kernel and user space */
 char *libcfs_next_nidstring(void);
index 1271344..cc455b3 100644 (file)
 #include <lnet/types.h>
 
 #define SOCKLND_CONN_NONE     (-1)
-#define SOCKLND_CONN_ANY        0
-#define SOCKLND_CONN_CONTROL    1
-#define SOCKLND_CONN_BULK_IN    2
-#define SOCKLND_CONN_BULK_OUT   3
-#define SOCKLND_CONN_NTYPES     4
+#define SOCKLND_CONN_ANY       0
+#define SOCKLND_CONN_CONTROL   1
+#define SOCKLND_CONN_BULK_IN   2
+#define SOCKLND_CONN_BULK_OUT  3
+#define SOCKLND_CONN_NTYPES    4
 
-#define SOCKLND_CONN_ACK        SOCKLND_CONN_BULK_IN
+#define SOCKLND_CONN_ACK       SOCKLND_CONN_BULK_IN
 
 typedef struct {
-        __u32                   kshm_magic;     /* magic number of socklnd message */
-        __u32                   kshm_version;   /* version of socklnd message */
-        lnet_nid_t              kshm_src_nid;   /* sender's nid */
-        lnet_nid_t              kshm_dst_nid;   /* destination nid */
-        lnet_pid_t              kshm_src_pid;   /* sender's pid */
-        lnet_pid_t              kshm_dst_pid;   /* destination pid */
-        __u64                   kshm_src_incarnation; /* sender's incarnation */
-        __u64                   kshm_dst_incarnation; /* destination's incarnation */
-        __u32                   kshm_ctype;     /* connection type */
-        __u32                   kshm_nips;      /* # IP addrs */
-        __u32                   kshm_ips[0];    /* IP addrs */
+       __u32                   kshm_magic;     /* magic number of socklnd message */
+       __u32                   kshm_version;   /* version of socklnd message */
+       lnet_nid_t              kshm_src_nid;   /* sender's nid */
+       lnet_nid_t              kshm_dst_nid;   /* destination nid */
+       lnet_pid_t              kshm_src_pid;   /* sender's pid */
+       lnet_pid_t              kshm_dst_pid;   /* destination pid */
+       __u64                   kshm_src_incarnation; /* sender's incarnation */
+       __u64                   kshm_dst_incarnation; /* destination's incarnation */
+       __u32                   kshm_ctype;     /* connection type */
+       __u32                   kshm_nips;      /* # IP addrs */
+       __u32                   kshm_ips[0];    /* IP addrs */
 } WIRE_ATTR ksock_hello_msg_t;
 
 typedef struct {
-        lnet_hdr_t              ksnm_hdr;       /* lnet hdr */
+       lnet_hdr_t              ksnm_hdr;       /* lnet hdr */
 
-        /*
-         * ksnm_payload is removed because of winnt compiler's limitation:
-         * zero-sized array can only be placed at the tail of [nested]
-         * structure definitions. lnet payload will be stored just after
+       /*
+        * ksnm_payload is removed because of winnt compiler's limitation:
+        * zero-sized array can only be placed at the tail of [nested]
+        * structure definitions. lnet payload will be stored just after
         * the body of structure ksock_lnet_msg_t
-         */
+        */
 } WIRE_ATTR ksock_lnet_msg_t;
 
 typedef struct {
-        __u32                   ksm_type;       /* type of socklnd message */
-        __u32                   ksm_csum;       /* checksum if != 0 */
-        __u64                   ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */
-        union {
-                ksock_lnet_msg_t lnetmsg;       /* lnet message, it's empty if it's NOOP */
-        } WIRE_ATTR ksm_u;
+       __u32                   ksm_type;       /* type of socklnd message */
+       __u32                   ksm_csum;       /* checksum if != 0 */
+       __u64                   ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */
+       union {
+               ksock_lnet_msg_t lnetmsg;       /* lnet message, it's empty if it's NOOP */
+       } WIRE_ATTR ksm_u;
 } WIRE_ATTR ksock_msg_t;
 
 static inline void
 socklnd_init_msg(ksock_msg_t *msg, int type)
 {
-        msg->ksm_csum           = 0;
-        msg->ksm_type           = type;
-        msg->ksm_zc_cookies[0]  = msg->ksm_zc_cookies[1]  = 0;
+       msg->ksm_csum           = 0;
+       msg->ksm_type           = type;
+       msg->ksm_zc_cookies[0]  = msg->ksm_zc_cookies[1]  = 0;
 }
 
-#define KSOCK_MSG_NOOP          0xc0            /* ksm_u empty */
-#define KSOCK_MSG_LNET          0xc1            /* lnet msg */
+#define KSOCK_MSG_NOOP         0xc0            /* ksm_u empty */
+#define KSOCK_MSG_LNET         0xc1            /* lnet msg */
 
 /* We need to know this number to parse hello msg from ksocklnd in
  * other LND (usocklnd, for example) */
-#define KSOCK_PROTO_V2          2
-#define KSOCK_PROTO_V3          3
+#define KSOCK_PROTO_V2         2
+#define KSOCK_PROTO_V3         3
 
 #endif
index 4c67b27..768aae7 100644 (file)
@@ -49,7 +49,7 @@
 /** Portal reserved for LNet's own use.
  * \see lustre/include/lustre/lustre_idl.h for Lustre portal assignments.
  */
-#define LNET_RESERVED_PORTAL      0
+#define LNET_RESERVED_PORTAL     0
 
 /**
  * Address of an end-point in an LNet network.
@@ -69,9 +69,9 @@ typedef __u64 lnet_nid_t;
 typedef __u32 lnet_pid_t;
 
 /** wildcard NID that matches any end-point address */
-#define LNET_NID_ANY      ((lnet_nid_t) -1)
+#define LNET_NID_ANY     ((lnet_nid_t) -1)
 /** wildcard PID that matches any lnet_pid_t */
-#define LNET_PID_ANY      ((lnet_pid_t) -1)
+#define LNET_PID_ANY     ((lnet_pid_t) -1)
 
 #define LNET_PID_RESERVED 0xf0000000 /* reserved bits in PID */
 #define LNET_PID_USERFLAG 0x80000000 /* set in userspace peers */
@@ -259,7 +259,7 @@ typedef struct lnet_counters {
  * without loss of information.
  */
 typedef struct {
-        __u64         cookie;
+       __u64   cookie;
 } lnet_handle_any_t;
 
 typedef lnet_handle_any_t lnet_handle_eq_t;
@@ -273,7 +273,7 @@ typedef lnet_handle_any_t lnet_handle_me_t;
  */
 static inline void LNetInvalidateHandle(lnet_handle_any_t *h)
 {
-        h->cookie = LNET_WIRE_HANDLE_COOKIE_NONE;
+       h->cookie = LNET_WIRE_HANDLE_COOKIE_NONE;
 }
 
 /**
@@ -283,7 +283,7 @@ static inline void LNetInvalidateHandle(lnet_handle_any_t *h)
  */
 static inline int LNetHandleIsEqual (lnet_handle_any_t h1, lnet_handle_any_t h2)
 {
-        return (h1.cookie == h2.cookie);
+       return (h1.cookie == h2.cookie);
 }
 
 /**
@@ -293,17 +293,17 @@ static inline int LNetHandleIsEqual (lnet_handle_any_t h1, lnet_handle_any_t h2)
  */
 static inline int LNetHandleIsInvalid(lnet_handle_any_t h)
 {
-        return (LNET_WIRE_HANDLE_COOKIE_NONE == h.cookie);
+       return (LNET_WIRE_HANDLE_COOKIE_NONE == h.cookie);
 }
 
 /**
  * Global process ID.
  */
 typedef struct {
-        /** node id */
-        lnet_nid_t nid;
-        /** process id */
-        lnet_pid_t pid;
+       /** node id */
+       lnet_nid_t nid;
+       /** process id */
+       lnet_pid_t pid;
 } lnet_process_id_t;
 /** @} lnet_addr */
 
@@ -315,8 +315,8 @@ typedef struct {
  * automatically (LNET_UNLINK) or not (LNET_RETAIN).
  */
 typedef enum {
-        LNET_RETAIN = 0,
-        LNET_UNLINK
+       LNET_RETAIN = 0,
+       LNET_UNLINK
 } lnet_unlink_t;
 
 /**
@@ -345,99 +345,99 @@ typedef enum {
  * are used to initialize memory descriptors.
  */
 typedef struct {
-        /**
-         * Specify the memory region associated with the memory descriptor.
-         * If the options field has:
-         * - LNET_MD_KIOV bit set: The start field points to the starting
-         * address of an array of lnet_kiov_t and the length field specifies
-         * the number of entries in the array. The length can't be bigger
-         * than LNET_MAX_IOV. The lnet_kiov_t is used to describe page-based
-         * fragments that are not necessarily mapped in virtal memory.
-         * - LNET_MD_IOVEC bit set: The start field points to the starting
+       /**
+        * Specify the memory region associated with the memory descriptor.
+        * If the options field has:
+        * - LNET_MD_KIOV bit set: The start field points to the starting
+        * address of an array of lnet_kiov_t and the length field specifies
+        * the number of entries in the array. The length can't be bigger
+        * than LNET_MAX_IOV. The lnet_kiov_t is used to describe page-based
+        * fragments that are not necessarily mapped in virtal memory.
+        * - LNET_MD_IOVEC bit set: The start field points to the starting
         * address of an array of struct kvec and the length field specifies
-         * the number of entries in the array. The length can't be bigger
+        * the number of entries in the array. The length can't be bigger
         * than LNET_MAX_IOV. The struct kvec is used to describe fragments
-         * that have virtual addresses.
-         * - Otherwise: The memory region is contiguous. The start field
-         * specifies the starting address for the memory region and the
-         * length field specifies its length.
-         *
-         * When the memory region is fragmented, all fragments but the first
-         * one must start on page boundary, and all but the last must end on
-         * page boundary.
-         */
-        void            *start;
-        unsigned int     length;
-        /**
-         * Specifies the maximum number of operations that can be performed
-         * on the memory descriptor. An operation is any action that could
-         * possibly generate an event. In the usual case, the threshold value
-         * is decremented for each operation on the MD. When the threshold
-         * drops to zero, the MD becomes inactive and does not respond to
-         * operations. A threshold value of LNET_MD_THRESH_INF indicates that
-         * there is no bound on the number of operations that may be applied
-         * to a MD.
-         */
-        int              threshold;
-        /**
-         * Specifies the largest incoming request that the memory descriptor
-         * should respond to. When the unused portion of a MD (length -
-         * local offset) falls below this value, the MD becomes inactive and
-         * does not respond to further operations. This value is only used
-         * if the LNET_MD_MAX_SIZE option is set.
-         */
-        int              max_size;
-        /**
-         * Specifies the behavior of the memory descriptor. A bitwise OR
-         * of the following values can be used:
-         * - LNET_MD_OP_PUT: The LNet PUT operation is allowed on this MD.
-         * - LNET_MD_OP_GET: The LNet GET operation is allowed on this MD.
-         * - LNET_MD_MANAGE_REMOTE: The offset used in accessing the memory
-         *   region is provided by the incoming request. By default, the
-         *   offset is maintained locally. When maintained locally, the
-         *   offset is incremented by the length of the request so that
-         *   the next operation (PUT or GET) will access the next part of
-         *   the memory region. Note that only one offset variable exists
-         *   per memory descriptor. If both PUT and GET operations are
-         *   performed on a memory descriptor, the offset is updated each time.
-         * - LNET_MD_TRUNCATE: The length provided in the incoming request can
-         *   be reduced to match the memory available in the region (determined
-         *   by subtracting the offset from the length of the memory region).
-         *   By default, if the length in the incoming operation is greater
-         *   than the amount of memory available, the operation is rejected.
-         * - LNET_MD_ACK_DISABLE: An acknowledgment should not be sent for
-         *   incoming PUT operations, even if requested. By default,
-         *   acknowledgments are sent for PUT operations that request an
-         *   acknowledgment. Acknowledgments are never sent for GET operations.
-         *   The data sent in the REPLY serves as an implicit acknowledgment.
-         * - LNET_MD_KIOV: The start and length fields specify an array of
-         *   lnet_kiov_t.
-         * - LNET_MD_IOVEC: The start and length fields specify an array of
-         *   struct iovec.
-         * - LNET_MD_MAX_SIZE: The max_size field is valid.
-         *
-         * Note:
-         * - LNET_MD_KIOV or LNET_MD_IOVEC allows for a scatter/gather
-         *   capability for memory descriptors. They can't be both set.
-         * - When LNET_MD_MAX_SIZE is set, the total length of the memory
-         *   region (i.e. sum of all fragment lengths) must not be less than
-         *   \a max_size.
-         */
-        unsigned int     options;
-        /**
-         * A user-specified value that is associated with the memory
-         * descriptor. The value does not need to be a pointer, but must fit
-         * in the space used by a pointer. This value is recorded in events
-         * associated with operations on this MD.
-         */
-        void            *user_ptr;
-        /**
-         * A handle for the event queue used to log the operations performed on
-         * the memory region. If this argument is a NULL handle (i.e. nullified
-         * by LNetInvalidateHandle()), operations performed on this memory
-         * descriptor are not logged.
-         */
-        lnet_handle_eq_t eq_handle;
+        * that have virtual addresses.
+        * - Otherwise: The memory region is contiguous. The start field
+        * specifies the starting address for the memory region and the
+        * length field specifies its length.
+        *
+        * When the memory region is fragmented, all fragments but the first
+        * one must start on page boundary, and all but the last must end on
+        * page boundary.
+        */
+       void            *start;
+       unsigned int     length;
+       /**
+        * Specifies the maximum number of operations that can be performed
+        * on the memory descriptor. An operation is any action that could
+        * possibly generate an event. In the usual case, the threshold value
+        * is decremented for each operation on the MD. When the threshold
+        * drops to zero, the MD becomes inactive and does not respond to
+        * operations. A threshold value of LNET_MD_THRESH_INF indicates that
+        * there is no bound on the number of operations that may be applied
+        * to a MD.
+        */
+       int              threshold;
+       /**
+        * Specifies the largest incoming request that the memory descriptor
+        * should respond to. When the unused portion of a MD (length -
+        * local offset) falls below this value, the MD becomes inactive and
+        * does not respond to further operations. This value is only used
+        * if the LNET_MD_MAX_SIZE option is set.
+        */
+       int              max_size;
+       /**
+        * Specifies the behavior of the memory descriptor. A bitwise OR
+        * of the following values can be used:
+        * - LNET_MD_OP_PUT: The LNet PUT operation is allowed on this MD.
+        * - LNET_MD_OP_GET: The LNet GET operation is allowed on this MD.
+        * - LNET_MD_MANAGE_REMOTE: The offset used in accessing the memory
+        *   region is provided by the incoming request. By default, the
+        *   offset is maintained locally. When maintained locally, the
+        *   offset is incremented by the length of the request so that
+        *   the next operation (PUT or GET) will access the next part of
+        *   the memory region. Note that only one offset variable exists
+        *   per memory descriptor. If both PUT and GET operations are
+        *   performed on a memory descriptor, the offset is updated each time.
+        * - LNET_MD_TRUNCATE: The length provided in the incoming request can
+        *   be reduced to match the memory available in the region (determined
+        *   by subtracting the offset from the length of the memory region).
+        *   By default, if the length in the incoming operation is greater
+        *   than the amount of memory available, the operation is rejected.
+        * - LNET_MD_ACK_DISABLE: An acknowledgment should not be sent for
+        *   incoming PUT operations, even if requested. By default,
+        *   acknowledgments are sent for PUT operations that request an
+        *   acknowledgment. Acknowledgments are never sent for GET operations.
+        *   The data sent in the REPLY serves as an implicit acknowledgment.
+        * - LNET_MD_KIOV: The start and length fields specify an array of
+        *   lnet_kiov_t.
+        * - LNET_MD_IOVEC: The start and length fields specify an array of
+        *   struct iovec.
+        * - LNET_MD_MAX_SIZE: The max_size field is valid.
+        *
+        * Note:
+        * - LNET_MD_KIOV or LNET_MD_IOVEC allows for a scatter/gather
+        *   capability for memory descriptors. They can't be both set.
+        * - When LNET_MD_MAX_SIZE is set, the total length of the memory
+        *   region (i.e. sum of all fragment lengths) must not be less than
+        *   \a max_size.
+        */
+       unsigned int     options;
+       /**
+        * A user-specified value that is associated with the memory
+        * descriptor. The value does not need to be a pointer, but must fit
+        * in the space used by a pointer. This value is recorded in events
+        * associated with operations on this MD.
+        */
+       void            *user_ptr;
+       /**
+        * A handle for the event queue used to log the operations performed on
+        * the memory region. If this argument is a NULL handle (i.e. nullified
+        * by LNetInvalidateHandle()), operations performed on this memory
+        * descriptor are not logged.
+        */
+       lnet_handle_eq_t eq_handle;
 } lnet_md_t;
 
 /* Max Transfer Unit (minimum supported everywhere).
@@ -447,33 +447,33 @@ typedef struct {
 #define LNET_MTU       (1 << LNET_MTU_BITS)
 
 /** limit on the number of fragments in discontiguous MDs */
-#define LNET_MAX_IOV    256
+#define LNET_MAX_IOV   256
 
 /**
  * Options for the MD structure. See lnet_md_t::options.
  */
-#define LNET_MD_OP_PUT               (1 << 0)
+#define LNET_MD_OP_PUT              (1 << 0)
 /** See lnet_md_t::options. */
-#define LNET_MD_OP_GET               (1 << 1)
+#define LNET_MD_OP_GET              (1 << 1)
 /** See lnet_md_t::options. */
-#define LNET_MD_MANAGE_REMOTE        (1 << 2)
-/* unused                            (1 << 3) */
+#define LNET_MD_MANAGE_REMOTE       (1 << 2)
+/* unused                           (1 << 3) */
 /** See lnet_md_t::options. */
-#define LNET_MD_TRUNCATE             (1 << 4)
+#define LNET_MD_TRUNCATE            (1 << 4)
 /** See lnet_md_t::options. */
-#define LNET_MD_ACK_DISABLE          (1 << 5)
+#define LNET_MD_ACK_DISABLE         (1 << 5)
 /** See lnet_md_t::options. */
-#define LNET_MD_IOVEC                (1 << 6)
+#define LNET_MD_IOVEC               (1 << 6)
 /** See lnet_md_t::options. */
-#define LNET_MD_MAX_SIZE             (1 << 7)
+#define LNET_MD_MAX_SIZE            (1 << 7)
 /** See lnet_md_t::options. */
-#define LNET_MD_KIOV                 (1 << 8)
+#define LNET_MD_KIOV                (1 << 8)
 
 /* For compatibility with Cray Portals */
-#define LNET_MD_PHYS                         0
+#define LNET_MD_PHYS                        0
 
 /** Infinite threshold on MD operations. See lnet_md_t::threshold */
-#define LNET_MD_THRESH_INF       (-1)
+#define LNET_MD_THRESH_INF      (-1)
 
 /* NB lustre portals uses struct iovec internally! */
 typedef struct iovec lnet_md_iovec_t;
@@ -483,15 +483,15 @@ typedef struct iovec lnet_md_iovec_t;
  */
 typedef struct {
        /** Pointer to the page where the fragment resides */
-       struct page      *kiov_page;
+       struct page      *kiov_page;
        /** Length in bytes of the fragment */
-       unsigned int     kiov_len;
+       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_SIZE.
         */
-       unsigned int     kiov_offset;
+       unsigned int     kiov_offset;
 } lnet_kiov_t;
 /** @} lnet_md */
 
@@ -504,115 +504,115 @@ typedef struct {
 typedef enum {
        /** 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
-         * operation) once this event has been logged.
-         */
-        LNET_EVENT_PUT,
-        /**
-         * A REPLY operation has completed. This event is logged after the
-         * data (if any) from the REPLY has been written into the MD.
-         */
-        LNET_EVENT_REPLY,
-        /** An acknowledgment has been received. */
-        LNET_EVENT_ACK,
-        /**
-         * An outgoing send (PUT or GET) operation has completed. This event
-         * is logged after the entire buffer has been sent and it is safe for
-         * the caller to reuse the buffer.
-         *
-         * Note:
-         * - The LNET_EVENT_SEND doesn't guarantee message delivery. It can
-         *   happen even when the message has not yet been put out on wire.
-         * - It's unsafe to assume that in an outgoing GET operation
-         *   the LNET_EVENT_SEND event would happen before the
-         *   LNET_EVENT_REPLY event. The same holds for LNET_EVENT_SEND and
-         *   LNET_EVENT_ACK events in an outgoing PUT operation.
-         */
-        LNET_EVENT_SEND,
-        /**
-         * A MD has been unlinked. Note that LNetMDUnlink() does not
-         * necessarily trigger an LNET_EVENT_UNLINK event.
-         * \see LNetMDUnlink
-         */
-        LNET_EVENT_UNLINK,
+       /**
+        * An incoming PUT operation has completed on the MD. The
+        * underlying layers will not alter the memory (on behalf of this
+        * operation) once this event has been logged.
+        */
+       LNET_EVENT_PUT,
+       /**
+        * A REPLY operation has completed. This event is logged after the
+        * data (if any) from the REPLY has been written into the MD.
+        */
+       LNET_EVENT_REPLY,
+       /** An acknowledgment has been received. */
+       LNET_EVENT_ACK,
+       /**
+        * An outgoing send (PUT or GET) operation has completed. This event
+        * is logged after the entire buffer has been sent and it is safe for
+        * the caller to reuse the buffer.
+        *
+        * Note:
+        * - The LNET_EVENT_SEND doesn't guarantee message delivery. It can
+        *   happen even when the message has not yet been put out on wire.
+        * - It's unsafe to assume that in an outgoing GET operation
+        *   the LNET_EVENT_SEND event would happen before the
+        *   LNET_EVENT_REPLY event. The same holds for LNET_EVENT_SEND and
+        *   LNET_EVENT_ACK events in an outgoing PUT operation.
+        */
+       LNET_EVENT_SEND,
+       /**
+        * A MD has been unlinked. Note that LNetMDUnlink() does not
+        * necessarily trigger an LNET_EVENT_UNLINK event.
+        * \see LNetMDUnlink
+        */
+       LNET_EVENT_UNLINK,
 } lnet_event_kind_t;
 
-#define LNET_SEQ_BASETYPE       long
+#define LNET_SEQ_BASETYPE      long
 typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t;
-#define LNET_SEQ_GT(a,b)        (((signed LNET_SEQ_BASETYPE)((a) - (b))) > 0)
+#define LNET_SEQ_GT(a, b)      (((signed LNET_SEQ_BASETYPE)((a) - (b))) > 0)
 
 /**
  * Information about an event on a MD.
  */
 typedef struct {
-        /** The identifier (nid, pid) of the target. */
-        lnet_process_id_t   target;
-        /** The identifier (nid, pid) of the initiator. */
-        lnet_process_id_t   initiator;
-        /**
-         * 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.
-         */
-        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;
-        /** A copy of the match bits specified in the request. */
-        __u64               match_bits;
-        /** The length (in bytes) specified in the request. */
-        unsigned int        rlength;
-        /**
-         * The length (in bytes) of the data that was manipulated by the
-         * operation. For truncated operations, the manipulated length will be
-         * the number of bytes specified by the MD (possibly with an offset,
-         * 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;
-        /**
-         * The handle to the MD associated with the event. The handle may be
-         * invalid if the MD has been unlinked.
-         */
-        lnet_handle_md_t    md_handle;
-        /**
-         * A snapshot of the state of the MD immediately after the event has
-         * been processed. In particular, the threshold field in md will
-         * reflect the value of the threshold after the operation occurred.
-         */
-        lnet_md_t           md;
-        /**
-         * 64 bits of out-of-band user data. Only valid for LNET_EVENT_PUT.
-         * \see LNetPut
-         */
-        __u64               hdr_data;
-        /**
-         * Indicates the completion status of the operation. It's 0 for
-         * successful operations, otherwise it's an error code.
-         */
-        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;
-        /**
-         * 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;
-        /**
-         * The sequence number for this event. Sequence numbers are unique
-         * to each event.
-         */
-        volatile lnet_seq_t sequence;
+       /** The identifier (nid, pid) of the target. */
+       lnet_process_id_t   target;
+       /** The identifier (nid, pid) of the initiator. */
+       lnet_process_id_t   initiator;
+       /**
+        * 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.
+        */
+       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;
+       /** A copy of the match bits specified in the request. */
+       __u64               match_bits;
+       /** The length (in bytes) specified in the request. */
+       unsigned int        rlength;
+       /**
+        * The length (in bytes) of the data that was manipulated by the
+        * operation. For truncated operations, the manipulated length will be
+        * the number of bytes specified by the MD (possibly with an offset,
+        * 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;
+       /**
+        * The handle to the MD associated with the event. The handle may be
+        * invalid if the MD has been unlinked.
+        */
+       lnet_handle_md_t    md_handle;
+       /**
+        * A snapshot of the state of the MD immediately after the event has
+        * been processed. In particular, the threshold field in md will
+        * reflect the value of the threshold after the operation occurred.
+        */
+       lnet_md_t           md;
+       /**
+        * 64 bits of out-of-band user data. Only valid for LNET_EVENT_PUT.
+        * \see LNetPut
+        */
+       __u64               hdr_data;
+       /**
+        * Indicates the completion status of the operation. It's 0 for
+        * successful operations, otherwise it's an error code.
+        */
+       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;
+       /**
+        * 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;
+       /**
+        * The sequence number for this event. Sequence numbers are unique
+        * to each event.
+        */
+       volatile lnet_seq_t sequence;
 } lnet_event_t;
 
 /**
@@ -641,10 +641,10 @@ typedef void (*lnet_eq_handler_t)(lnet_event_t *event);
  * acknowledgments can be disabled for a MD.
  */
 typedef enum {
-        /** Request an acknowledgment */
-        LNET_ACK_REQ,
-        /** Request that no acknowledgment should be generated. */
-        LNET_NOACK_REQ
+       /** Request an acknowledgment */
+       LNET_ACK_REQ,
+       /** Request that no acknowledgment should be generated. */
+       LNET_NOACK_REQ
 } lnet_ack_req_t;
 /** @} lnet_data */
 
index 9bf15ca..57b8f46 100644 (file)
@@ -55,14 +55,14 @@ static struct {
 int
 lnet_acceptor_port(void)
 {
-        return accept_port;
+       return accept_port;
 }
 
 static inline int
 lnet_accept_magic(__u32 magic, __u32 constant)
 {
-        return (magic == constant ||
-                magic == __swab32(constant));
+       return (magic == constant ||
+               magic == __swab32(constant));
 }
 
 EXPORT_SYMBOL(lnet_acceptor_port);
@@ -83,132 +83,132 @@ static char *accept_type = NULL;
 static int
 lnet_acceptor_get_tunables(void)
 {
-        /* Userland acceptor uses 'accept_type' instead of 'accept', due to
-         * conflict with 'accept(2)', but kernel acceptor still uses 'accept'
-         * for compatibility. Hence the trick. */
-        accept_type = accept;
-        return 0;
+       /* Userland acceptor uses 'accept_type' instead of 'accept', due to
+        * conflict with 'accept(2)', but kernel acceptor still uses 'accept'
+        * for compatibility. Hence the trick. */
+       accept_type = accept;
+       return 0;
 }
 
 int
 lnet_acceptor_timeout(void)
 {
-        return accept_timeout;
+       return accept_timeout;
 }
 EXPORT_SYMBOL(lnet_acceptor_timeout);
 
 void
 lnet_connect_console_error (int rc, lnet_nid_t peer_nid,
-                           __u32 peer_ip, int peer_port)
+                          __u32 peer_ip, int peer_port)
 {
-        switch (rc) {
-        /* "normal" errors */
-        case -ECONNREFUSED:
+       switch (rc) {
+       /* "normal" errors */
+       case -ECONNREFUSED:
                CNETERR("Connection to %s at host %pI4h on port %d was "
-                        "refused: check that Lustre is running on that node.\n",
+                       "refused: check that Lustre is running on that node.\n",
                        libcfs_nid2str(peer_nid), &peer_ip, peer_port);
-                break;
-        case -EHOSTUNREACH:
-        case -ENETUNREACH:
+               break;
+       case -EHOSTUNREACH:
+       case -ENETUNREACH:
                CNETERR("Connection to %s at host %pI4h "
-                        "was unreachable: the network or that node may "
-                        "be down, or Lustre may be misconfigured.\n",
+                       "was unreachable: the network or that node may "
+                       "be down, or Lustre may be misconfigured.\n",
                        libcfs_nid2str(peer_nid), &peer_ip);
-                break;
-        case -ETIMEDOUT:
+               break;
+       case -ETIMEDOUT:
                CNETERR("Connection to %s at host %pI4h on "
-                        "port %d took too long: that node may be hung "
-                        "or experiencing high load.\n",
+                       "port %d took too long: that node may be hung "
+                       "or experiencing high load.\n",
                        libcfs_nid2str(peer_nid), &peer_ip, peer_port);
-                break;
-        case -ECONNRESET:
+               break;
+       case -ECONNRESET:
                LCONSOLE_ERROR_MSG(0x11b, "Connection to %s at host %pI4h"
-                                   " on port %d was reset: "
-                                   "is it running a compatible version of "
-                                   "Lustre and is %s one of its NIDs?\n",
+                                  " on port %d was reset: "
+                                  "is it running a compatible version of "
+                                  "Lustre and is %s one of its NIDs?\n",
                                   libcfs_nid2str(peer_nid), &peer_ip,
                                   peer_port, libcfs_nid2str(peer_nid));
-                break;
-        case -EPROTO:
-                LCONSOLE_ERROR_MSG(0x11c, "Protocol error connecting to %s at "
+               break;
+       case -EPROTO:
+               LCONSOLE_ERROR_MSG(0x11c, "Protocol error connecting to %s at "
                                   "host %pI4h on port %d: is it running "
-                                   "a compatible version of Lustre?\n",
+                                  "a compatible version of Lustre?\n",
                                   libcfs_nid2str(peer_nid), &peer_ip,
                                   peer_port);
-                break;
-        case -EADDRINUSE:
-                LCONSOLE_ERROR_MSG(0x11d, "No privileged ports available to "
+               break;
+       case -EADDRINUSE:
+               LCONSOLE_ERROR_MSG(0x11d, "No privileged ports available to "
                                   "connect to %s at host %pI4h on port "
-                                   "%d\n", libcfs_nid2str(peer_nid),
+                                  "%d\n", libcfs_nid2str(peer_nid),
                                   &peer_ip, peer_port);
-                break;
-        default:
-                LCONSOLE_ERROR_MSG(0x11e, "Unexpected error %d connecting to %s"
+               break;
+       default:
+               LCONSOLE_ERROR_MSG(0x11e, "Unexpected error %d connecting to %s"
                                   " at host %pI4h on port %d\n", rc,
-                                   libcfs_nid2str(peer_nid),
+                                  libcfs_nid2str(peer_nid),
                                   &peer_ip, peer_port);
-                break;
-        }
+               break;
+       }
 }
 EXPORT_SYMBOL(lnet_connect_console_error);
 
 int
 lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
-            __u32 local_ip, __u32 peer_ip, int peer_port)
+           __u32 local_ip, __u32 peer_ip, int peer_port)
 {
-        lnet_acceptor_connreq_t cr;
-       struct socket           *sock;
-        int                     rc;
-        int                     port;
-        int                     fatal;
+       lnet_acceptor_connreq_t cr;
+       struct socket           *sock;
+       int                     rc;
+       int                     port;
+       int                     fatal;
 
-        CLASSERT (sizeof(cr) <= 16);            /* not too big to be on the stack */
+       CLASSERT(sizeof(cr) <= 16);             /* not too big to be on the stack */
 
-        for (port = LNET_ACCEPTOR_MAX_RESERVED_PORT;
-             port >= LNET_ACCEPTOR_MIN_RESERVED_PORT;
-             --port) {
-                /* Iterate through reserved ports. */
+       for (port = LNET_ACCEPTOR_MAX_RESERVED_PORT;
+            port >= LNET_ACCEPTOR_MIN_RESERVED_PORT;
+            --port) {
+               /* Iterate through reserved ports. */
 
                rc = lnet_sock_connect(&sock, &fatal,
-                                         local_ip, port,
-                                         peer_ip, peer_port);
-                if (rc != 0) {
-                        if (fatal)
-                                goto failed;
-                        continue;
-                }
-
-                CLASSERT (LNET_PROTO_ACCEPTOR_VERSION == 1);
-
-                cr.acr_magic   = LNET_PROTO_ACCEPTOR_MAGIC;
-                cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
-                cr.acr_nid     = peer_nid;
-
-                if (the_lnet.ln_testprotocompat != 0) {
-                        /* single-shot proto check */
+                                        local_ip, port,
+                                        peer_ip, peer_port);
+               if (rc != 0) {
+                       if (fatal)
+                               goto failed;
+                       continue;
+               }
+
+               CLASSERT(LNET_PROTO_ACCEPTOR_VERSION == 1);
+
+               cr.acr_magic   = LNET_PROTO_ACCEPTOR_MAGIC;
+               cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
+               cr.acr_nid     = peer_nid;
+
+               if (the_lnet.ln_testprotocompat != 0) {
+                       /* single-shot proto check */
                        lnet_net_lock(LNET_LOCK_EX);
-                        if ((the_lnet.ln_testprotocompat & 4) != 0) {
-                                cr.acr_version++;
-                                the_lnet.ln_testprotocompat &= ~4;
-                        }
-                        if ((the_lnet.ln_testprotocompat & 8) != 0) {
-                                cr.acr_magic = LNET_PROTO_MAGIC;
-                                the_lnet.ln_testprotocompat &= ~8;
-                        }
+                       if ((the_lnet.ln_testprotocompat & 4) != 0) {
+                               cr.acr_version++;
+                               the_lnet.ln_testprotocompat &= ~4;
+                       }
+                       if ((the_lnet.ln_testprotocompat & 8) != 0) {
+                               cr.acr_magic = LNET_PROTO_MAGIC;
+                               the_lnet.ln_testprotocompat &= ~8;
+                       }
                        lnet_net_unlock(LNET_LOCK_EX);
-                }
+               }
 
                rc = lnet_sock_write(sock, &cr, sizeof(cr),
-                                       accept_timeout);
-                if (rc != 0)
-                        goto failed_sock;
+                                      accept_timeout);
+               if (rc != 0)
+                       goto failed_sock;
 
-                *sockp = sock;
-                return 0;
-        }
+               *sockp = sock;
+               return 0;
+       }
 
-        rc = -EADDRINUSE;
-        goto failed;
+       rc = -EADDRINUSE;
+       goto failed;
 
 failed_sock:
        sock_release(sock);
@@ -221,167 +221,167 @@ EXPORT_SYMBOL(lnet_connect);
 static int
 lnet_accept(struct socket *sock, __u32 magic)
 {
-        lnet_acceptor_connreq_t cr;
-        __u32                   peer_ip;
-        int                     peer_port;
-        int                     rc;
-        int                     flip;
-        lnet_ni_t              *ni;
-        char                   *str;
+       lnet_acceptor_connreq_t cr;
+       __u32                   peer_ip;
+       int                     peer_port;
+       int                     rc;
+       int                     flip;
+       lnet_ni_t              *ni;
+       char                   *str;
 
-        LASSERT (sizeof(cr) <= 16);             /* not too big for the stack */
+       LASSERT(sizeof(cr) <= 16);              /* not too big for the stack */
 
        rc = lnet_sock_getaddr(sock, true, &peer_ip, &peer_port);
-        LASSERT (rc == 0);                      /* we succeeded before */
+       LASSERT(rc == 0);                       /* we succeeded before */
 
-        if (!lnet_accept_magic(magic, LNET_PROTO_ACCEPTOR_MAGIC)) {
+       if (!lnet_accept_magic(magic, LNET_PROTO_ACCEPTOR_MAGIC)) {
 
-                if (lnet_accept_magic(magic, LNET_PROTO_MAGIC)) {
-                        /* future version compatibility!
-                         * When LNET unifies protocols over all LNDs, the first
-                         * thing sent will be a version query.  I send back
-                         * LNET_PROTO_ACCEPTOR_MAGIC to tell her I'm "old" */
+               if (lnet_accept_magic(magic, LNET_PROTO_MAGIC)) {
+                       /* future version compatibility!
+                        * When LNET unifies protocols over all LNDs, the first
+                        * thing sent will be a version query.  I send back
+                        * LNET_PROTO_ACCEPTOR_MAGIC to tell her I'm "old" */
 
-                        memset (&cr, 0, sizeof(cr));
-                        cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC;
-                        cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
+                       memset(&cr, 0, sizeof(cr));
+                       cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC;
+                       cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
                        rc = lnet_sock_write(sock, &cr, sizeof(cr),
-                                               accept_timeout);
+                                              accept_timeout);
 
-                        if (rc != 0)
-                                CERROR("Error sending magic+version in response"
+                       if (rc != 0)
+                               CERROR("Error sending magic+version in response"
                                       "to LNET magic from %pI4h: %d\n",
                                       &peer_ip, rc);
-                        return -EPROTO;
-                }
+                       return -EPROTO;
+               }
 
-                if (magic == le32_to_cpu(LNET_PROTO_TCP_MAGIC))
-                        str = "'old' socknal/tcpnal";
-                else
-                        str = "unrecognised";
+               if (magic == le32_to_cpu(LNET_PROTO_TCP_MAGIC))
+                       str = "'old' socknal/tcpnal";
+               else
+                       str = "unrecognised";
 
                LCONSOLE_ERROR_MSG(0x11f, "Refusing connection from %pI4h"
-                                   " magic %08x: %s acceptor protocol\n",
+                                  " magic %08x: %s acceptor protocol\n",
                                   &peer_ip, magic, str);
-                return -EPROTO;
-        }
+               return -EPROTO;
+       }
 
-        flip = (magic != LNET_PROTO_ACCEPTOR_MAGIC);
+       flip = (magic != LNET_PROTO_ACCEPTOR_MAGIC);
 
        rc = lnet_sock_read(sock, &cr.acr_version,
-                              sizeof(cr.acr_version),
-                              accept_timeout);
-        if (rc != 0) {
-                CERROR("Error %d reading connection request version from "
+                             sizeof(cr.acr_version),
+                             accept_timeout);
+       if (rc != 0) {
+               CERROR("Error %d reading connection request version from "
                       "%pI4h\n", rc, &peer_ip);
-                return -EIO;
-        }
+               return -EIO;
+       }
 
-        if (flip)
-                __swab32s(&cr.acr_version);
+       if (flip)
+               __swab32s(&cr.acr_version);
 
-        if (cr.acr_version != LNET_PROTO_ACCEPTOR_VERSION) {
-                /* future version compatibility!
-                 * An acceptor-specific protocol rev will first send a version
-                 * query.  I send back my current version to tell her I'm
-                 * "old". */
-                int peer_version = cr.acr_version;
+       if (cr.acr_version != LNET_PROTO_ACCEPTOR_VERSION) {
+               /* future version compatibility!
+                * An acceptor-specific protocol rev will first send a version
+                * query.  I send back my current version to tell her I'm
+                * "old". */
+               int peer_version = cr.acr_version;
 
-                memset (&cr, 0, sizeof(cr));
-                cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC;
-                cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
+               memset(&cr, 0, sizeof(cr));
+               cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC;
+               cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
 
                rc = lnet_sock_write(sock, &cr, sizeof(cr),
-                                       accept_timeout);
+                                      accept_timeout);
 
-                if (rc != 0)
-                        CERROR("Error sending magic+version in response"
+               if (rc != 0)
+                       CERROR("Error sending magic+version in response"
                               "to version %d from %pI4h: %d\n",
                               peer_version, &peer_ip, rc);
-                return -EPROTO;
-        }
+               return -EPROTO;
+       }
 
        rc = lnet_sock_read(sock, &cr.acr_nid,
-                              sizeof(cr) -
-                              offsetof(lnet_acceptor_connreq_t, acr_nid),
-                              accept_timeout);
-        if (rc != 0) {
-                CERROR("Error %d reading connection request from "
+                             sizeof(cr) -
+                             offsetof(lnet_acceptor_connreq_t, acr_nid),
+                             accept_timeout);
+       if (rc != 0) {
+               CERROR("Error %d reading connection request from "
                       "%pI4h\n", rc, &peer_ip);
-                return -EIO;
-        }
+               return -EIO;
+       }
 
-        if (flip)
-                __swab64s(&cr.acr_nid);
+       if (flip)
+               __swab64s(&cr.acr_nid);
 
-        ni = lnet_net2ni(LNET_NIDNET(cr.acr_nid));
-        if (ni == NULL ||               /* no matching net */
-            ni->ni_nid != cr.acr_nid) { /* right NET, wrong NID! */
-                if (ni != NULL)
-                        lnet_ni_decref(ni);
+       ni = lnet_net2ni(LNET_NIDNET(cr.acr_nid));
+       if (ni == NULL ||               /* no matching net */
+           ni->ni_nid != cr.acr_nid) { /* right NET, wrong NID! */
+               if (ni != NULL)
+                       lnet_ni_decref(ni);
                LCONSOLE_ERROR_MSG(0x120, "Refusing connection from %pI4h "
                                   "for %s: No matching NI\n",
                                   &peer_ip, libcfs_nid2str(cr.acr_nid));
-                return -EPERM;
-        }
+               return -EPERM;
+       }
 
-        if (ni->ni_lnd->lnd_accept == NULL) {
-                /* This catches a request for the loopback LND */
-                lnet_ni_decref(ni);
+       if (ni->ni_lnd->lnd_accept == NULL) {
+               /* This catches a request for the loopback LND */
+               lnet_ni_decref(ni);
                LCONSOLE_ERROR_MSG(0x121, "Refusing connection from %pI4h "
                                  "for %s: NI doesn not accept IP connections\n",
                                  &peer_ip, libcfs_nid2str(cr.acr_nid));
-                return -EPERM;
-        }
+               return -EPERM;
+       }
 
        CDEBUG(D_NET, "Accept %s from %pI4h\n",
               libcfs_nid2str(cr.acr_nid), &peer_ip);
 
-        rc = ni->ni_lnd->lnd_accept(ni, sock);
+       rc = ni->ni_lnd->lnd_accept(ni, sock);
 
-        lnet_ni_decref(ni);
-        return rc;
+       lnet_ni_decref(ni);
+       return rc;
 }
 
 static int
 lnet_acceptor(void *arg)
 {
        struct socket  *newsock;
-        int            rc;
-        __u32          magic;
-        __u32          peer_ip;
-        int            peer_port;
-       int            secure = (int)((uintptr_t)arg);
+       int            rc;
+       __u32          magic;
+       __u32          peer_ip;
+       int            peer_port;
+       int            secure = (int)((uintptr_t)arg);
 
-        LASSERT (lnet_acceptor_state.pta_sock == NULL);
+       LASSERT(lnet_acceptor_state.pta_sock == NULL);
 
-        cfs_block_allsigs();
+       cfs_block_allsigs();
 
        rc = lnet_sock_listen(&lnet_acceptor_state.pta_sock,
-                                0, accept_port, accept_backlog);
-        if (rc != 0) {
-                if (rc == -EADDRINUSE)
-                        LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port"
-                                           " %d: port already in use\n",
-                                           accept_port);
-                else
-                        LCONSOLE_ERROR_MSG(0x123, "Can't start acceptor on port "
-                                           "%d: unexpected error %d\n",
-                                           accept_port, rc);
-
-                lnet_acceptor_state.pta_sock = NULL;
-        } else {
-                LCONSOLE(0, "Accept %s, port %d\n", accept_type, accept_port);
-        }
+                               0, accept_port, accept_backlog);
+       if (rc != 0) {
+               if (rc == -EADDRINUSE)
+                       LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port"
+                                          " %d: port already in use\n",
+                                          accept_port);
+               else
+                       LCONSOLE_ERROR_MSG(0x123, "Can't start acceptor on port "
+                                          "%d: unexpected error %d\n",
+                                          accept_port, rc);
+
+               lnet_acceptor_state.pta_sock = NULL;
+       } else {
+               LCONSOLE(0, "Accept %s, port %d\n", accept_type, accept_port);
+       }
 
        /* set init status and unblock parent */
        lnet_acceptor_state.pta_shutdown = rc;
        complete(&lnet_acceptor_state.pta_signal);
 
-        if (rc != 0)
-                return rc;
+       if (rc != 0)
+               return rc;
 
-        while (!lnet_acceptor_state.pta_shutdown) {
+       while (!lnet_acceptor_state.pta_shutdown) {
 
                rc = lnet_sock_accept(&newsock, lnet_acceptor_state.pta_sock);
                if (rc != 0) {
@@ -400,30 +400,30 @@ lnet_acceptor(void *arg)
                }
 
                rc = lnet_sock_getaddr(newsock, true, &peer_ip, &peer_port);
-                if (rc != 0) {
-                        CERROR("Can't determine new connection's address\n");
-                        goto failed;
-                }
+               if (rc != 0) {
+                       CERROR("Can't determine new connection's address\n");
+                       goto failed;
+               }
 
-                if (secure && peer_port > LNET_ACCEPTOR_MAX_RESERVED_PORT) {
+               if (secure && peer_port > LNET_ACCEPTOR_MAX_RESERVED_PORT) {
                        CERROR("Refusing connection from %pI4h: "
                               "insecure port %d\n", &peer_ip, peer_port);
-                        goto failed;
-                }
+                       goto failed;
+               }
 
                rc = lnet_sock_read(newsock, &magic, sizeof(magic),
-                                      accept_timeout);
-                if (rc != 0) {
-                        CERROR("Error %d reading connection request from "
+                                     accept_timeout);
+               if (rc != 0) {
+                       CERROR("Error %d reading connection request from "
                               "%pI4h\n", rc, &peer_ip);
-                        goto failed;
-                }
+                       goto failed;
+               }
 
-                rc = lnet_accept(newsock, magic);
-                if (rc != 0)
-                        goto failed;
+               rc = lnet_accept(newsock, magic);
+               if (rc != 0)
+                       goto failed;
 
-                continue;
+               continue;
 
 failed:
                sock_release(newsock);
@@ -442,38 +442,38 @@ failed:
 static inline int
 accept2secure(const char *acc, long *sec)
 {
-        if (!strcmp(acc, "secure")) {
-                *sec = 1;
-                return 1;
-        } else if (!strcmp(acc, "all")) {
-                *sec = 0;
-                return 1;
-        } else if (!strcmp(acc, "none")) {
-                return 0;
-        } else {
-                LCONSOLE_ERROR_MSG(0x124, "Can't parse 'accept=\"%s\"'\n",
-                                   acc);
-                return -EINVAL;
-        }
+       if (!strcmp(acc, "secure")) {
+               *sec = 1;
+               return 1;
+       } else if (!strcmp(acc, "all")) {
+               *sec = 0;
+               return 1;
+       } else if (!strcmp(acc, "none")) {
+               return 0;
+       } else {
+               LCONSOLE_ERROR_MSG(0x124, "Can't parse 'accept=\"%s\"'\n",
+                                  acc);
+               return -EINVAL;
+       }
 }
 
 int
 lnet_acceptor_start(void)
 {
        struct task_struct *task;
-        int  rc;
-        long rc2;
-        long secure;
+       int  rc;
+       long rc2;
+       long secure;
 
        /* if acceptor is already running return immediately */
        if (!lnet_acceptor_state.pta_shutdown)
                return 0;
 
-        LASSERT (lnet_acceptor_state.pta_sock == NULL);
+       LASSERT(lnet_acceptor_state.pta_sock == NULL);
 
-        rc = lnet_acceptor_get_tunables();
-        if (rc != 0)
-                return rc;
+       rc = lnet_acceptor_get_tunables();
+       if (rc != 0)
+               return rc;
 
        init_completion(&lnet_acceptor_state.pta_signal);
        rc = accept2secure(accept_type, &secure);
index 641ee00..abb02d6 100644 (file)
@@ -40,7 +40,7 @@
 
 #define D_LNI D_CONSOLE
 
-lnet_t      the_lnet;                           /* THE state of the network */
+lnet_t     the_lnet;                           /* THE state of the network */
 EXPORT_SYMBOL(the_lnet);
 
 static char *ip2nets = "";
@@ -65,14 +65,14 @@ static int lnet_ping(lnet_process_id_t id, int timeout_ms,
 static char *
 lnet_get_routes(void)
 {
-        return routes;
+       return routes;
 }
 
 static char *
 lnet_get_networks(void)
 {
        char   *nets;
-       int     rc;
+       int     rc;
 
        if (*networks != 0 && *ip2nets != 0) {
                LCONSOLE_ERROR_MSG(0x101, "Please specify EITHER 'networks' or "
@@ -220,95 +220,95 @@ lnet_create_locks(void)
 
 static void lnet_assert_wire_constants(void)
 {
-        /* Wire protocol assertions generated by 'wirecheck'
-         * running on Linux robert.bartonsoftware.com 2.6.8-1.521
-         * #1 Mon Aug 16 09:01:18 EDT 2004 i686 athlon i386 GNU/Linux
-         * with gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) */
-
-        /* Constants... */
-        CLASSERT (LNET_PROTO_TCP_MAGIC == 0xeebc0ded);
-        CLASSERT (LNET_PROTO_TCP_VERSION_MAJOR == 1);
-        CLASSERT (LNET_PROTO_TCP_VERSION_MINOR == 0);
-        CLASSERT (LNET_MSG_ACK == 0);
-        CLASSERT (LNET_MSG_PUT == 1);
-        CLASSERT (LNET_MSG_GET == 2);
-        CLASSERT (LNET_MSG_REPLY == 3);
-        CLASSERT (LNET_MSG_HELLO == 4);
-
-        /* Checks for struct ptl_handle_wire_t */
-        CLASSERT ((int)sizeof(lnet_handle_wire_t) == 16);
-        CLASSERT ((int)offsetof(lnet_handle_wire_t, wh_interface_cookie) == 0);
-        CLASSERT ((int)sizeof(((lnet_handle_wire_t *)0)->wh_interface_cookie) == 8);
-        CLASSERT ((int)offsetof(lnet_handle_wire_t, wh_object_cookie) == 8);
-        CLASSERT ((int)sizeof(((lnet_handle_wire_t *)0)->wh_object_cookie) == 8);
-
-        /* Checks for struct lnet_magicversion_t */
-        CLASSERT ((int)sizeof(lnet_magicversion_t) == 8);
-        CLASSERT ((int)offsetof(lnet_magicversion_t, magic) == 0);
-        CLASSERT ((int)sizeof(((lnet_magicversion_t *)0)->magic) == 4);
-        CLASSERT ((int)offsetof(lnet_magicversion_t, version_major) == 4);
-        CLASSERT ((int)sizeof(((lnet_magicversion_t *)0)->version_major) == 2);
-        CLASSERT ((int)offsetof(lnet_magicversion_t, version_minor) == 6);
-        CLASSERT ((int)sizeof(((lnet_magicversion_t *)0)->version_minor) == 2);
-
-        /* Checks for struct lnet_hdr_t */
-        CLASSERT ((int)sizeof(lnet_hdr_t) == 72);
-        CLASSERT ((int)offsetof(lnet_hdr_t, dest_nid) == 0);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->dest_nid) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, src_nid) == 8);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->src_nid) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, dest_pid) == 16);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->dest_pid) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, src_pid) == 20);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->src_pid) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, type) == 24);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->type) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, payload_length) == 28);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->payload_length) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg) == 32);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg) == 40);
-
-        /* Ack */
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.ack.dst_wmd) == 32);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.ack.dst_wmd) == 16);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.ack.match_bits) == 48);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.ack.match_bits) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.ack.mlength) == 56);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.ack.mlength) == 4);
-
-        /* Put */
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.put.ack_wmd) == 32);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.put.ack_wmd) == 16);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.put.match_bits) == 48);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.put.match_bits) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.put.hdr_data) == 56);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.put.hdr_data) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.put.ptl_index) == 64);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.put.ptl_index) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.put.offset) == 68);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.put.offset) == 4);
-
-        /* Get */
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.get.return_wmd) == 32);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.get.return_wmd) == 16);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.get.match_bits) == 48);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.get.match_bits) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.get.ptl_index) == 56);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.get.ptl_index) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.get.src_offset) == 60);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.get.src_offset) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.get.sink_length) == 64);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.get.sink_length) == 4);
-
-        /* Reply */
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.reply.dst_wmd) == 32);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.reply.dst_wmd) == 16);
-
-        /* Hello */
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.hello.incarnation) == 32);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.hello.incarnation) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.hello.type) == 40);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.hello.type) == 4);
+       /* Wire protocol assertions generated by 'wirecheck'
+        * running on Linux robert.bartonsoftware.com 2.6.8-1.521
+        * #1 Mon Aug 16 09:01:18 EDT 2004 i686 athlon i386 GNU/Linux
+        * with gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) */
+
+       /* Constants... */
+       CLASSERT(LNET_PROTO_TCP_MAGIC == 0xeebc0ded);
+       CLASSERT(LNET_PROTO_TCP_VERSION_MAJOR == 1);
+       CLASSERT(LNET_PROTO_TCP_VERSION_MINOR == 0);
+       CLASSERT(LNET_MSG_ACK == 0);
+       CLASSERT(LNET_MSG_PUT == 1);
+       CLASSERT(LNET_MSG_GET == 2);
+       CLASSERT(LNET_MSG_REPLY == 3);
+       CLASSERT(LNET_MSG_HELLO == 4);
+
+       /* Checks for struct ptl_handle_wire_t */
+       CLASSERT((int)sizeof(lnet_handle_wire_t) == 16);
+       CLASSERT((int)offsetof(lnet_handle_wire_t, wh_interface_cookie) == 0);
+       CLASSERT((int)sizeof(((lnet_handle_wire_t *)0)->wh_interface_cookie) == 8);
+       CLASSERT((int)offsetof(lnet_handle_wire_t, wh_object_cookie) == 8);
+       CLASSERT((int)sizeof(((lnet_handle_wire_t *)0)->wh_object_cookie) == 8);
+
+       /* Checks for struct lnet_magicversion_t */
+       CLASSERT((int)sizeof(lnet_magicversion_t) == 8);
+       CLASSERT((int)offsetof(lnet_magicversion_t, magic) == 0);
+       CLASSERT((int)sizeof(((lnet_magicversion_t *)0)->magic) == 4);
+       CLASSERT((int)offsetof(lnet_magicversion_t, version_major) == 4);
+       CLASSERT((int)sizeof(((lnet_magicversion_t *)0)->version_major) == 2);
+       CLASSERT((int)offsetof(lnet_magicversion_t, version_minor) == 6);
+       CLASSERT((int)sizeof(((lnet_magicversion_t *)0)->version_minor) == 2);
+
+       /* Checks for struct lnet_hdr_t */
+       CLASSERT((int)sizeof(lnet_hdr_t) == 72);
+       CLASSERT((int)offsetof(lnet_hdr_t, dest_nid) == 0);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->dest_nid) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, src_nid) == 8);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->src_nid) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, dest_pid) == 16);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->dest_pid) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, src_pid) == 20);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->src_pid) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, type) == 24);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->type) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, payload_length) == 28);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->payload_length) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg) == 32);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg) == 40);
+
+       /* Ack */
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.ack.dst_wmd) == 32);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.ack.dst_wmd) == 16);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.ack.match_bits) == 48);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.ack.match_bits) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.ack.mlength) == 56);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.ack.mlength) == 4);
+
+       /* Put */
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.put.ack_wmd) == 32);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.ack_wmd) == 16);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.put.match_bits) == 48);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.match_bits) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.put.hdr_data) == 56);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.hdr_data) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.put.ptl_index) == 64);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.ptl_index) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.put.offset) == 68);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.offset) == 4);
+
+       /* Get */
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.get.return_wmd) == 32);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.return_wmd) == 16);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.get.match_bits) == 48);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.match_bits) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.get.ptl_index) == 56);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.ptl_index) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.get.src_offset) == 60);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.src_offset) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.get.sink_length) == 64);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.sink_length) == 4);
+
+       /* Reply */
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.reply.dst_wmd) == 32);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.reply.dst_wmd) == 16);
+
+       /* Hello */
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.hello.incarnation) == 32);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.hello.incarnation) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.hello.type) == 40);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.hello.type) == 4);
 }
 
 static lnd_t *lnet_find_lnd_by_type(__u32 type)
@@ -407,7 +407,7 @@ static __u64 lnet_create_interface_cookie(void)
         * even if it's only implemented to millisecond resolution is probably
         * easily good enough. */
        struct timeval tv;
-       __u64          cookie;
+       __u64          cookie;
        do_gettimeofday(&tv);
        cookie = tv.tv_sec;
        cookie *= 1000000;
@@ -1095,7 +1095,7 @@ lnet_ping_target_update(lnet_ping_info_t *pinfo, lnet_handle_md_t md_handle)
 static void
 lnet_ping_target_fini(void)
 {
-       int             rc;
+       int             rc;
 
        lnet_ping_md_unlink(the_lnet.ln_ping_info,
                            &the_lnet.ln_ping_target_md);
@@ -1675,30 +1675,30 @@ LNetNIFini()
 {
        mutex_lock(&the_lnet.ln_api_mutex);
 
-        LASSERT (the_lnet.ln_refcount > 0);
+       LASSERT(the_lnet.ln_refcount > 0);
 
-        if (the_lnet.ln_refcount != 1) {
-                the_lnet.ln_refcount--;
-        } else {
+       if (the_lnet.ln_refcount != 1) {
+               the_lnet.ln_refcount--;
+       } else {
                LASSERT(!the_lnet.ln_niinit_self);
 
                lnet_fault_fini();
 
-                lnet_proc_fini();
-                lnet_router_checker_stop();
-                lnet_ping_target_fini();
+               lnet_proc_fini();
+               lnet_router_checker_stop();
+               lnet_ping_target_fini();
 
-                /* Teardown fns that use my own API functions BEFORE here */
-                the_lnet.ln_refcount = 0;
+               /* Teardown fns that use my own API functions BEFORE here */
+               the_lnet.ln_refcount = 0;
 
-                lnet_acceptor_stop();
-                lnet_destroy_routes();
-                lnet_shutdown_lndnis();
-                lnet_unprepare();
-        }
+               lnet_acceptor_stop();
+               lnet_destroy_routes();
+               lnet_shutdown_lndnis();
+               lnet_unprepare();
+       }
 
        mutex_unlock(&the_lnet.ln_api_mutex);
-        return 0;
+       return 0;
 }
 EXPORT_SYMBOL(LNetNIFini);
 
@@ -1944,9 +1944,9 @@ LNetCtl(unsigned int cmd, void *arg)
 {
        struct libcfs_ioctl_data *data = arg;
        struct lnet_ioctl_config_data *config;
-       lnet_process_id_t         id = {0};
-       lnet_ni_t                *ni;
-       int                       rc;
+       lnet_process_id_t         id = {0};
+       lnet_ni_t                *ni;
+       int                       rc;
 
        CLASSERT(LIBCFS_IOC_DATA_MAX >= sizeof(struct lnet_ioctl_net_config) +
                                        sizeof(struct lnet_ioctl_config_data));
@@ -2206,20 +2206,20 @@ lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t __user *ids,
 {
        lnet_handle_eq_t     eqh;
        lnet_handle_md_t     mdh;
-       lnet_event_t         event;
-       lnet_md_t            md = { NULL };
-       int                  which;
-       int                  unlinked = 0;
-       int                  replied = 0;
-       const int            a_long_time = 60000; /* mS */
-       int                  infosz;
+       lnet_event_t         event;
+       lnet_md_t            md = { NULL };
+       int                  which;
+       int                  unlinked = 0;
+       int                  replied = 0;
+       const int            a_long_time = 60000; /* mS */
+       int                  infosz;
        lnet_ping_info_t    *info;
        lnet_process_id_t    tmpid;
-       int                  i;
-       int                  nob;
-       int                  rc;
-       int                  rc2;
-       sigset_t         blocked;
+       int                  i;
+       int                  nob;
+       int                  rc;
+       int                  rc2;
+       sigset_t         blocked;
 
        infosz = offsetof(lnet_ping_info_t, pi_ni[n_ids]);
 
@@ -2288,7 +2288,7 @@ lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t __user *ids,
                       (rc2 <= 0) ? -1 : event.status,
                       (rc2 > 0 && event.unlinked) ? " unlinked" : "");
 
-               LASSERT(rc2 != -EOVERFLOW);     /* can't miss anything */
+               LASSERT(rc2 != -EOVERFLOW);     /* can't miss anything */
 
                if (rc2 <= 0 || event.status != 0) {
                        /* timeout or error */
@@ -2326,7 +2326,7 @@ lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t __user *ids,
        nob = rc;
        LASSERT(nob >= 0 && nob <= infosz);
 
-       rc = -EPROTO;                           /* if I can't parse... */
+       rc = -EPROTO;                           /* if I can't parse... */
 
        if (nob < 8) {
                /* can't check magic/version */
@@ -2364,7 +2364,7 @@ lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t __user *ids,
                goto out_1;
        }
 
-       rc = -EFAULT;                           /* If I SEGV... */
+       rc = -EFAULT;                           /* If I SEGV... */
 
        memset(&tmpid, 0, sizeof(tmpid));
        for (i = 0; i < n_ids; i++) {
index 93ab8ba..bf88011 100644 (file)
@@ -47,24 +47,24 @@ struct lnet_text_buf {
 };
 
 static int lnet_tbnob = 0;                     /* track text buf allocation */
-#define LNET_MAX_TEXTBUF_NOB     (64<<10)      /* bound allocation */
+#define LNET_MAX_TEXTBUF_NOB    (64<<10)       /* bound allocation */
 #define LNET_SINGLE_TEXTBUF_NOB  (4<<10)
 
 static void
 lnet_syntax(char *name, char *str, int offset, int width)
 {
-        static char dots[LNET_SINGLE_TEXTBUF_NOB];
-        static char dashes[LNET_SINGLE_TEXTBUF_NOB];
+       static char dots[LNET_SINGLE_TEXTBUF_NOB];
+       static char dashes[LNET_SINGLE_TEXTBUF_NOB];
 
-        memset(dots, '.', sizeof(dots));
-        dots[sizeof(dots)-1] = 0;
-        memset(dashes, '-', sizeof(dashes));
-        dashes[sizeof(dashes)-1] = 0;
+       memset(dots, '.', sizeof(dots));
+       dots[sizeof(dots)-1] = 0;
+       memset(dashes, '-', sizeof(dashes));
+       dashes[sizeof(dashes)-1] = 0;
 
        LCONSOLE_ERROR_MSG(0x10f, "Error parsing '%s=\"%s\"'\n", name, str);
        LCONSOLE_ERROR_MSG(0x110, "here...........%.*s..%.*s|%.*s|\n",
-                           (int)strlen(name), dots, offset, dots,
-                            (width < 1) ? 0 : width - 1, dashes);
+                          (int)strlen(name), dots, offset, dots,
+                           (width < 1) ? 0 : width - 1, dashes);
 }
 
 static int
@@ -134,18 +134,18 @@ lnet_ni_alloc(__u32 net, struct cfs_expr_list *el, struct list_head *nilist)
        int                     rc;
        int                     i;
 
-        if (!lnet_net_unique(net, nilist)) {
-                LCONSOLE_ERROR_MSG(0x111, "Duplicate network specified: %s\n",
-                                   libcfs_net2str(net));
-                return NULL;
-        }
+       if (!lnet_net_unique(net, nilist)) {
+               LCONSOLE_ERROR_MSG(0x111, "Duplicate network specified: %s\n",
+                                  libcfs_net2str(net));
+               return NULL;
+       }
 
-        LIBCFS_ALLOC(ni, sizeof(*ni));
-        if (ni == NULL) {
-                CERROR("Out of memory creating network %s\n",
-                       libcfs_net2str(net));
-                return NULL;
-        }
+       LIBCFS_ALLOC(ni, sizeof(*ni));
+       if (ni == NULL) {
+               CERROR("Out of memory creating network %s\n",
+                      libcfs_net2str(net));
+               return NULL;
+       }
 
        spin_lock_init(&ni->ni_lock);
        INIT_LIST_HEAD(&ni->ni_cptlist);
@@ -220,7 +220,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
        if (strlen(networks) > LNET_SINGLE_TEXTBUF_NOB) {
                /* _WAY_ conservative */
                LCONSOLE_ERROR_MSG(0x112, "Can't parse networks: string too "
-                                   "long\n");
+                                  "long\n");
                return -EINVAL;
        }
 
@@ -271,21 +271,21 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
                                *square++ = ' ';
                }
 
-                if (bracket == NULL ||
+               if (bracket == NULL ||
                    (comma != NULL && comma < bracket)) {
 
-                        /* no interface list specified */
+                       /* no interface list specified */
 
                        if (comma != NULL)
                                *comma++ = 0;
                        net = libcfs_str2net(cfs_trimwhite(str));
 
                        if (net == LNET_NIDNET(LNET_NID_ANY)) {
-                                LCONSOLE_ERROR_MSG(0x113, "Unrecognised network"
-                                                   " type\n");
+                               LCONSOLE_ERROR_MSG(0x113, "Unrecognised network"
+                                                  " type\n");
                                tmp = str;
                                goto failed_syntax;
-                        }
+                       }
 
                        if (LNET_NETTYP(net) != LOLND && /* LO is implicit */
                            lnet_ni_alloc(net, el, nilist) == NULL)
@@ -335,7 +335,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
                        if (*iface == 0) {
                                tmp = iface;
                                goto failed_syntax;
-                        }
+                       }
 
                        if (niface == LNET_MAX_INTERFACES) {
                                LCONSOLE_ERROR_MSG(0x115, "Too many interfaces "
@@ -370,7 +370,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
                        if (*str != 0) {
                                tmp = str;
                                goto failed_syntax;
-                        }
+                       }
                        str = comma + 1;
                        continue;
                }
@@ -473,18 +473,18 @@ static int
 lnet_str2tbs_sep(struct list_head *tbs, char *str)
 {
        struct list_head  pending;
-       char             *sep;
-       int               nob;
-        int               i;
+       char             *sep;
+       int               nob;
+       int               i;
        struct lnet_text_buf  *ltb;
 
        INIT_LIST_HEAD(&pending);
 
        /* Split 'str' into separate commands */
        for (;;) {
-                /* skip leading whitespace */
+               /* skip leading whitespace */
                while (isspace(*str))
-                        str++;
+                       str++;
 
                /* scan for separator or comment */
                for (sep = str; *sep != 0; sep++)
@@ -499,11 +499,11 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str)
                                return -ENOMEM;
                        }
 
-                        for (i = 0; i < nob; i++)
+                       for (i = 0; i < nob; i++)
                                if (isspace(str[i]))
-                                        ltb->ltb_text[i] = ' ';
-                                else
-                                        ltb->ltb_text[i] = str[i];
+                                       ltb->ltb_text[i] = ' ';
+                               else
+                                       ltb->ltb_text[i] = str[i];
 
                        ltb->ltb_text[nob] = 0;
 
@@ -532,8 +532,8 @@ lnet_expand1tb(struct list_head *list,
               char *str, char *sep1, char *sep2,
               char *item, int itemlen)
 {
-       int              len1 = (int)(sep1 - str);
-       int              len2 = strlen(sep2 + 1);
+       int              len1 = (int)(sep1 - str);
+       int              len2 = strlen(sep2 + 1);
        struct lnet_text_buf *ltb;
 
        LASSERT (*sep1 == '[');
@@ -574,9 +574,9 @@ lnet_str2tbs_expand(struct list_head *tbs, char *str)
        if (sep == NULL)                        /* nothing to expand */
                return 0;
 
-        sep2 = strchr(sep, ']');
-        if (sep2 == NULL)
-                goto failed;
+       sep2 = strchr(sep, ']');
+       if (sep2 == NULL)
+               goto failed;
 
        for (parsed = sep; parsed < sep2; parsed = enditem) {
 
@@ -587,13 +587,13 @@ lnet_str2tbs_expand(struct list_head *tbs, char *str)
                if (enditem == parsed)          /* no empty items */
                        goto failed;
 
-                if (sscanf(parsed, "%d-%d/%d%n", &lo, &hi, &stride, &scanned) < 3) {
+               if (sscanf(parsed, "%d-%d/%d%n", &lo, &hi, &stride, &scanned) < 3) {
 
                        if (sscanf(parsed, "%d-%d%n", &lo, &hi, &scanned) < 2) {
 
                                /* simple string enumeration */
                                if (lnet_expand1tb(&pending, str, sep, sep2,
-                                                   parsed, (int)(enditem - parsed)) != 0)
+                                                  parsed, (int)(enditem - parsed)) != 0)
                                        goto failed;
 
                                continue;
@@ -619,7 +619,7 @@ lnet_str2tbs_expand(struct list_head *tbs, char *str)
                                goto failed;
 
                        if (lnet_expand1tb(&pending, str, sep, sep2,
-                                           num, nob) != 0)
+                                          num, nob) != 0)
                                goto failed;
                }
        }
@@ -635,12 +635,12 @@ lnet_str2tbs_expand(struct list_head *tbs, char *str)
 static int
 lnet_parse_hops (char *str, unsigned int *hops)
 {
-        int     len = strlen(str);
-        int     nob = len;
+       int     len = strlen(str);
+       int     nob = len;
 
-        return (sscanf(str, "%u%n", hops, &nob) >= 1 &&
-                nob == len &&
-                *hops > 0 && *hops < 256);
+       return (sscanf(str, "%u%n", hops, &nob) >= 1 &&
+               nob == len &&
+               *hops > 0 && *hops < 256);
 }
 
 #define LNET_PRIORITY_SEPARATOR (':')
@@ -679,22 +679,22 @@ static int
 lnet_parse_route (char *str, int *im_a_router)
 {
        /* static scratch buffer OK (single threaded) */
-       static char       cmd[LNET_SINGLE_TEXTBUF_NOB];
+       static char       cmd[LNET_SINGLE_TEXTBUF_NOB];
 
        struct list_head  nets;
        struct list_head  gateways;
        struct list_head *tmp1;
        struct list_head *tmp2;
-       __u32             net;
-       lnet_nid_t        nid;
+       __u32             net;
+       lnet_nid_t        nid;
        struct lnet_text_buf  *ltb;
-       int               rc;
-       char             *sep;
-       char             *token = str;
-       int               ntokens = 0;
-       int               myrc = -1;
+       int               rc;
+       char             *sep;
+       char             *token = str;
+       int               ntokens = 0;
+       int               myrc = -1;
        __u32             hops;
-       int               got_hops = 0;
+       int               got_hops = 0;
        unsigned int      priority = 0;
 
        INIT_LIST_HEAD(&gateways);
@@ -711,7 +711,7 @@ lnet_parse_route (char *str, int *im_a_router)
                        sep++;
                if (*sep == 0) {
                        if (ntokens < (got_hops ? 3 : 2))
-                                goto token_error;
+                               goto token_error;
                        break;
                }
 
@@ -726,13 +726,13 @@ lnet_parse_route (char *str, int *im_a_router)
 
                if (ntokens == 1) {
                        tmp2 = &nets;           /* expanding nets */
-                } else if (ntokens == 2 &&
-                           lnet_parse_hops(token, &hops)) {
-                        got_hops = 1;           /* got a hop count */
-                        continue;
-                } else {
+               } else if (ntokens == 2 &&
+                          lnet_parse_hops(token, &hops)) {
+                       got_hops = 1;           /* got a hop count */
+                       continue;
+               } else {
                        tmp2 = &gateways;       /* expanding gateways */
-                }
+               }
 
                ltb = lnet_new_text_buf(strlen(token));
                if (ltb == NULL)
@@ -760,7 +760,7 @@ lnet_parse_route (char *str, int *im_a_router)
                        if (ntokens == 1) {
                                net = libcfs_str2net(ltb->ltb_text);
                                if (net == LNET_NIDNET(LNET_NID_ANY) ||
-                                    LNET_NETTYP(net) == LOLND)
+                                   LNET_NETTYP(net) == LOLND)
                                        goto token_error;
                        } else {
                                rc = lnet_parse_priority(ltb->ltb_text,
@@ -770,7 +770,7 @@ lnet_parse_route (char *str, int *im_a_router)
 
                                nid = libcfs_str2nid(ltb->ltb_text);
                                if (nid == LNET_NID_ANY ||
-                                    LNET_NETTYP(LNET_NIDNET(nid)) == LOLND)
+                                   LNET_NETTYP(LNET_NIDNET(nid)) == LOLND)
                                        goto token_error;
                        }
                }
@@ -838,16 +838,16 @@ lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router)
                lnet_free_text_buf(ltb);
        }
 
-        return 0;
+       return 0;
 }
 
 int
 lnet_parse_routes (char *routes, int *im_a_router)
 {
        struct list_head tbs;
-       int              rc = 0;
+       int              rc = 0;
 
-        *im_a_router = 0;
+       *im_a_router = 0;
 
        INIT_LIST_HEAD(&tbs);
 
@@ -855,8 +855,8 @@ lnet_parse_routes (char *routes, int *im_a_router)
                CERROR("Error parsing routes\n");
                rc = -EINVAL;
        } else {
-                rc = lnet_parse_route_tbs(&tbs, im_a_router);
-        }
+               rc = lnet_parse_route_tbs(&tbs, im_a_router);
+       }
 
        LASSERT (lnet_tbnob == 0);
        return rc;
@@ -878,152 +878,152 @@ lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip)
 
        cfs_expr_list_free_list(&list);
 
-        return rc;
+       return rc;
 }
 
 static int
 lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip)
 {
-        static char tokens[LNET_SINGLE_TEXTBUF_NOB];
-
-        int   matched = 0;
-        int   ntokens = 0;
-        int   len;
-        char *net = NULL;
-        char *sep;
-        char *token;
-        int   rc;
-
-        LASSERT (strlen(net_entry) < sizeof(tokens));
-
-        /* work on a copy of the string */
-        strcpy(tokens, net_entry);
-        sep = tokens;
-        for (;;) {
-                /* scan for token start */
+       static char tokens[LNET_SINGLE_TEXTBUF_NOB];
+
+       int   matched = 0;
+       int   ntokens = 0;
+       int   len;
+       char *net = NULL;
+       char *sep;
+       char *token;
+       int   rc;
+
+       LASSERT(strlen(net_entry) < sizeof(tokens));
+
+       /* work on a copy of the string */
+       strcpy(tokens, net_entry);
+       sep = tokens;
+       for (;;) {
+               /* scan for token start */
                while (isspace(*sep))
-                        sep++;
-                if (*sep == 0)
-                        break;
+                       sep++;
+               if (*sep == 0)
+                       break;
 
-                token = sep++;
+               token = sep++;
 
-                /* scan for token end */
+               /* scan for token end */
                while (*sep != 0 && !isspace(*sep))
-                        sep++;
-                if (*sep != 0)
-                        *sep++ = 0;
+                       sep++;
+               if (*sep != 0)
+                       *sep++ = 0;
 
-                if (ntokens++ == 0) {
-                        net = token;
-                        continue;
-                }
+               if (ntokens++ == 0) {
+                       net = token;
+                       continue;
+               }
 
-                len = strlen(token);
+               len = strlen(token);
 
                rc = lnet_match_network_token(token, len, ipaddrs, nip);
-                if (rc < 0) {
-                        lnet_syntax("ip2nets", net_entry,
-                                    (int)(token - tokens), len);
-                        return rc;
-                }
+               if (rc < 0) {
+                       lnet_syntax("ip2nets", net_entry,
+                                   (int)(token - tokens), len);
+                       return rc;
+               }
 
-                matched |= (rc != 0);
-        }
+               matched |= (rc != 0);
+       }
 
-        if (!matched)
-                return 0;
+       if (!matched)
+               return 0;
 
-        strcpy(net_entry, net);                 /* replace with matched net */
-        return 1;
+       strcpy(net_entry, net);                 /* replace with matched net */
+       return 1;
 }
 
 static __u32
 lnet_netspec2net(char *netspec)
 {
-        char   *bracket = strchr(netspec, '(');
-        __u32   net;
+       char   *bracket = strchr(netspec, '(');
+       __u32   net;
 
-        if (bracket != NULL)
-                *bracket = 0;
+       if (bracket != NULL)
+               *bracket = 0;
 
-        net = libcfs_str2net(netspec);
+       net = libcfs_str2net(netspec);
 
-        if (bracket != NULL)
-                *bracket = '(';
+       if (bracket != NULL)
+               *bracket = '(';
 
-        return net;
+       return net;
 }
 
 static int
 lnet_splitnets(char *source, struct list_head *nets)
 {
-        int               offset = 0;
-        int               offset2;
-        int               len;
+       int               offset = 0;
+       int               offset2;
+       int               len;
        struct lnet_text_buf  *tb;
        struct lnet_text_buf  *tb2;
        struct list_head *t;
-        char             *sep;
-        char             *bracket;
-        __u32             net;
+       char             *sep;
+       char             *bracket;
+       __u32             net;
 
        LASSERT(!list_empty(nets));
        LASSERT(nets->next == nets->prev);      /* single entry */
 
        tb = list_entry(nets->next, struct lnet_text_buf, ltb_list);
 
-        for (;;) {
-                sep = strchr(tb->ltb_text, ',');
-                bracket = strchr(tb->ltb_text, '(');
+       for (;;) {
+               sep = strchr(tb->ltb_text, ',');
+               bracket = strchr(tb->ltb_text, '(');
 
                if (sep != NULL &&
                    bracket != NULL &&
                    bracket < sep) {
-                        /* netspec lists interfaces... */
+                       /* netspec lists interfaces... */
 
-                        offset2 = offset + (int)(bracket - tb->ltb_text);
-                        len = strlen(bracket);
+                       offset2 = offset + (int)(bracket - tb->ltb_text);
+                       len = strlen(bracket);
 
-                        bracket = strchr(bracket + 1, ')');
+                       bracket = strchr(bracket + 1, ')');
 
-                        if (bracket == NULL ||
-                            !(bracket[1] == ',' || bracket[1] == 0)) {
-                                lnet_syntax("ip2nets", source, offset2, len);
-                                return -EINVAL;
-                        }
+                       if (bracket == NULL ||
+                           !(bracket[1] == ',' || bracket[1] == 0)) {
+                               lnet_syntax("ip2nets", source, offset2, len);
+                               return -EINVAL;
+                       }
 
-                        sep = (bracket[1] == 0) ? NULL : bracket + 1;
-                }
+                       sep = (bracket[1] == 0) ? NULL : bracket + 1;
+               }
 
-                if (sep != NULL)
-                        *sep++ = 0;
+               if (sep != NULL)
+                       *sep++ = 0;
 
-                net = lnet_netspec2net(tb->ltb_text);
-                if (net == LNET_NIDNET(LNET_NID_ANY)) {
-                        lnet_syntax("ip2nets", source, offset,
-                                    strlen(tb->ltb_text));
-                        return -EINVAL;
-                }
+               net = lnet_netspec2net(tb->ltb_text);
+               if (net == LNET_NIDNET(LNET_NID_ANY)) {
+                       lnet_syntax("ip2nets", source, offset,
+                                   strlen(tb->ltb_text));
+                       return -EINVAL;
+               }
 
                list_for_each(t, nets) {
                        tb2 = list_entry(t, struct lnet_text_buf, ltb_list);
 
-                        if (tb2 == tb)
-                                continue;
+                       if (tb2 == tb)
+                               continue;
 
-                        if (net == lnet_netspec2net(tb2->ltb_text)) {
-                                /* duplicate network */
-                                lnet_syntax("ip2nets", source, offset,
-                                            strlen(tb->ltb_text));
-                                return -EINVAL;
-                        }
-                }
+                       if (net == lnet_netspec2net(tb2->ltb_text)) {
+                               /* duplicate network */
+                               lnet_syntax("ip2nets", source, offset,
+                                           strlen(tb->ltb_text));
+                               return -EINVAL;
+                       }
+               }
 
-                if (sep == NULL)
-                        return 0;
+               if (sep == NULL)
+                       return 0;
 
-                offset += (int)(sep - tb->ltb_text);
+               offset += (int)(sep - tb->ltb_text);
                len = strlen(sep);
                tb2 = lnet_new_text_buf(len);
                if (tb2 == NULL)
@@ -1058,18 +1058,18 @@ lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
        int               rc;
 
        INIT_LIST_HEAD(&raw_entries);
-        if (lnet_str2tbs_sep(&raw_entries, ip2nets) < 0) {
-                CERROR("Error parsing ip2nets\n");
-                LASSERT (lnet_tbnob == 0);
-                return -EINVAL;
-        }
+       if (lnet_str2tbs_sep(&raw_entries, ip2nets) < 0) {
+               CERROR("Error parsing ip2nets\n");
+               LASSERT(lnet_tbnob == 0);
+               return -EINVAL;
+       }
 
        INIT_LIST_HEAD(&matched_nets);
        INIT_LIST_HEAD(&current_nets);
-        networks[0] = 0;
-        count = 0;
-        len = 0;
-        rc = 0;
+       networks[0] = 0;
+       count = 0;
+       len = 0;
+       rc = 0;
 
        while (!list_empty(&raw_entries)) {
                tb = list_entry(raw_entries.next, struct lnet_text_buf,
@@ -1078,29 +1078,29 @@ lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
                strncpy(source, tb->ltb_text, sizeof(source));
                source[sizeof(source) - 1] = '\0';
 
-                /* replace ltb_text with the network(s) add on match */
-                rc = lnet_match_network_tokens(tb->ltb_text, ipaddrs, nip);
-                if (rc < 0)
-                        break;
+               /* replace ltb_text with the network(s) add on match */
+               rc = lnet_match_network_tokens(tb->ltb_text, ipaddrs, nip);
+               if (rc < 0)
+                       break;
 
                list_del(&tb->ltb_list);
 
-                if (rc == 0) {                  /* no match */
-                        lnet_free_text_buf(tb);
-                        continue;
-                }
+               if (rc == 0) {                  /* no match */
+                       lnet_free_text_buf(tb);
+                       continue;
+               }
 
-                /* split into separate networks */
+               /* split into separate networks */
                INIT_LIST_HEAD(&current_nets);
                list_add(&tb->ltb_list, &current_nets);
-                rc = lnet_splitnets(source, &current_nets);
-                if (rc < 0)
-                        break;
+               rc = lnet_splitnets(source, &current_nets);
+               if (rc < 0)
+                       break;
 
-                dup = 0;
+               dup = 0;
                list_for_each(t, &current_nets) {
                        tb = list_entry(t, struct lnet_text_buf, ltb_list);
-                        net1 = lnet_netspec2net(tb->ltb_text);
+                       net1 = lnet_netspec2net(tb->ltb_text);
                        LASSERT(net1 != LNET_NIDNET(LNET_NID_ANY));
 
                        list_for_each(t2, &matched_nets) {
@@ -1119,10 +1119,10 @@ lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
                                break;
                }
 
-                if (dup) {
-                        lnet_free_text_bufs(&current_nets);
-                        continue;
-                }
+               if (dup) {
+                       lnet_free_text_bufs(&current_nets);
+                       continue;
+               }
 
                list_for_each_safe(t, t2, &current_nets) {
                        tb = list_entry(t, struct lnet_text_buf, ltb_list);
@@ -1134,133 +1134,133 @@ lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
                                        "%s%s", (len == 0) ? "" : ",",
                                        tb->ltb_text);
 
-                        if (len >= sizeof(networks)) {
-                                CERROR("Too many matched networks\n");
-                                rc = -E2BIG;
-                                goto out;
-                        }
-                }
+                       if (len >= sizeof(networks)) {
+                               CERROR("Too many matched networks\n");
+                               rc = -E2BIG;
+                               goto out;
+                       }
+               }
 
-                count++;
-        }
+               count++;
+       }
 
  out:
-        lnet_free_text_bufs(&raw_entries);
-        lnet_free_text_bufs(&matched_nets);
-        lnet_free_text_bufs(&current_nets);
-        LASSERT (lnet_tbnob == 0);
+       lnet_free_text_bufs(&raw_entries);
+       lnet_free_text_bufs(&matched_nets);
+       lnet_free_text_bufs(&current_nets);
+       LASSERT(lnet_tbnob == 0);
 
-        if (rc < 0)
-                return rc;
+       if (rc < 0)
+               return rc;
 
-        *networksp = networks;
-        return count;
+       *networksp = networks;
+       return count;
 }
 
 static void
 lnet_ipaddr_free_enumeration(__u32 *ipaddrs, int nip)
 {
-        LIBCFS_FREE(ipaddrs, nip * sizeof(*ipaddrs));
+       LIBCFS_FREE(ipaddrs, nip * sizeof(*ipaddrs));
 }
 
 static int
 lnet_ipaddr_enumerate (__u32 **ipaddrsp)
 {
-        int        up;
-        __u32      netmask;
-        __u32     *ipaddrs;
-        __u32     *ipaddrs2;
-        int        nip;
-        char     **ifnames;
-       int        nif = lnet_ipif_enumerate(&ifnames);
-        int        i;
-        int        rc;
-
-        if (nif <= 0)
-                return nif;
-
-        LIBCFS_ALLOC(ipaddrs, nif * sizeof(*ipaddrs));
-        if (ipaddrs == NULL) {
-                CERROR("Can't allocate ipaddrs[%d]\n", nif);
+       int        up;
+       __u32      netmask;
+       __u32     *ipaddrs;
+       __u32     *ipaddrs2;
+       int        nip;
+       char     **ifnames;
+       int        nif = lnet_ipif_enumerate(&ifnames);
+       int        i;
+       int        rc;
+
+       if (nif <= 0)
+               return nif;
+
+       LIBCFS_ALLOC(ipaddrs, nif * sizeof(*ipaddrs));
+       if (ipaddrs == NULL) {
+               CERROR("Can't allocate ipaddrs[%d]\n", nif);
                lnet_ipif_free_enumeration(ifnames, nif);
-                return -ENOMEM;
-        }
+               return -ENOMEM;
+       }
 
-        for (i = nip = 0; i < nif; i++) {
-                if (!strcmp(ifnames[i], "lo"))
-                        continue;
+       for (i = nip = 0; i < nif; i++) {
+               if (!strcmp(ifnames[i], "lo"))
+                       continue;
 
                rc = lnet_ipif_query(ifnames[i], &up,
-                                       &ipaddrs[nip], &netmask);
-                if (rc != 0) {
-                        CWARN("Can't query interface %s: %d\n",
-                              ifnames[i], rc);
-                        continue;
-                }
-
-                if (!up) {
-                        CWARN("Ignoring interface %s: it's down\n",
-                              ifnames[i]);
-                        continue;
-                }
-
-                nip++;
-        }
+                                      &ipaddrs[nip], &netmask);
+               if (rc != 0) {
+                       CWARN("Can't query interface %s: %d\n",
+                             ifnames[i], rc);
+                       continue;
+               }
+
+               if (!up) {
+                       CWARN("Ignoring interface %s: it's down\n",
+                             ifnames[i]);
+                       continue;
+               }
+
+               nip++;
+       }
 
        lnet_ipif_free_enumeration(ifnames, nif);
 
-        if (nip == nif) {
-                *ipaddrsp = ipaddrs;
-        } else {
-                if (nip > 0) {
-                        LIBCFS_ALLOC(ipaddrs2, nip * sizeof(*ipaddrs2));
-                        if (ipaddrs2 == NULL) {
-                                CERROR("Can't allocate ipaddrs[%d]\n", nip);
-                                nip = -ENOMEM;
-                        } else {
+       if (nip == nif) {
+               *ipaddrsp = ipaddrs;
+       } else {
+               if (nip > 0) {
+                       LIBCFS_ALLOC(ipaddrs2, nip * sizeof(*ipaddrs2));
+                       if (ipaddrs2 == NULL) {
+                               CERROR("Can't allocate ipaddrs[%d]\n", nip);
+                               nip = -ENOMEM;
+                       } else {
                                memcpy(ipaddrs2, ipaddrs,
                                        nip * sizeof(*ipaddrs));
-                                *ipaddrsp = ipaddrs2;
-                                rc = nip;
-                        }
-                }
-                lnet_ipaddr_free_enumeration(ipaddrs, nif);
-        }
-        return nip;
+                               *ipaddrsp = ipaddrs2;
+                               rc = nip;
+                       }
+               }
+               lnet_ipaddr_free_enumeration(ipaddrs, nif);
+       }
+       return nip;
 }
 
 int
 lnet_parse_ip2nets (char **networksp, char *ip2nets)
 {
-       __u32     *ipaddrs = NULL;
-        int        nip = lnet_ipaddr_enumerate(&ipaddrs);
-        int        rc;
-
-        if (nip < 0) {
-                LCONSOLE_ERROR_MSG(0x117, "Error %d enumerating local IP "
-                                   "interfaces for ip2nets to match\n", nip);
-                return nip;
-        }
-
-        if (nip == 0) {
-                LCONSOLE_ERROR_MSG(0x118, "No local IP interfaces "
-                                   "for ip2nets to match\n");
-                return -ENOENT;
-        }
-
-        rc = lnet_match_networks(networksp, ip2nets, ipaddrs, nip);
-        lnet_ipaddr_free_enumeration(ipaddrs, nip);
-
-        if (rc < 0) {
-                LCONSOLE_ERROR_MSG(0x119, "Error %d parsing ip2nets\n", rc);
-                return rc;
-        }
-
-        if (rc == 0) {
-                LCONSOLE_ERROR_MSG(0x11a, "ip2nets does not match "
-                                   "any local IP interfaces\n");
-                return -ENOENT;
-        }
-
-        return 0;
+       __u32     *ipaddrs = NULL;
+       int        nip = lnet_ipaddr_enumerate(&ipaddrs);
+       int        rc;
+
+       if (nip < 0) {
+               LCONSOLE_ERROR_MSG(0x117, "Error %d enumerating local IP "
+                                  "interfaces for ip2nets to match\n", nip);
+               return nip;
+       }
+
+       if (nip == 0) {
+               LCONSOLE_ERROR_MSG(0x118, "No local IP interfaces "
+                                  "for ip2nets to match\n");
+               return -ENOENT;
+       }
+
+       rc = lnet_match_networks(networksp, ip2nets, ipaddrs, nip);
+       lnet_ipaddr_free_enumeration(ipaddrs, nip);
+
+       if (rc < 0) {
+               LCONSOLE_ERROR_MSG(0x119, "Error %d parsing ip2nets\n", rc);
+               return rc;
+       }
+
+       if (rc == 0) {
+               LCONSOLE_ERROR_MSG(0x11a, "ip2nets does not match "
+                                  "any local IP interfaces\n");
+               return -ENOENT;
+       }
+
+       return 0;
 }
index 8e95154..8d862fe 100644 (file)
@@ -60,7 +60,7 @@
  * \param handle On successful return, this location will hold a handle for
  * the newly created EQ.
  *
- * \retval 0       On success.
+ * \retval 0      On success.
  * \retval -EINVAL If an parameter is not valid.
  * \retval -ENOMEM If memory for the EQ can't be allocated.
  *
  */
 int
 LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback,
-            lnet_handle_eq_t *handle)
+           lnet_handle_eq_t *handle)
 {
-        lnet_eq_t     *eq;
+       lnet_eq_t     *eq;
 
-        LASSERT (the_lnet.ln_refcount > 0);
+       LASSERT(the_lnet.ln_refcount > 0);
 
-        /* We need count to be a power of 2 so that when eq_{enq,deq}_seq
-         * overflow, they don't skip entries, so the queue has the same
-         * apparent capacity at all times */
+       /* We need count to be a power of 2 so that when eq_{enq,deq}_seq
+        * overflow, they don't skip entries, so the queue has the same
+        * apparent capacity at all times */
 
        if (count)
                count = roundup_pow_of_two(count);
@@ -105,10 +105,10 @@ LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback,
                 * so all them should be earlier than eq_deq_seq */
        }
 
-        eq->eq_deq_seq = 1;
-        eq->eq_enq_seq = 1;
-        eq->eq_size = count;
-        eq->eq_callback = callback;
+       eq->eq_deq_seq = 1;
+       eq->eq_enq_seq = 1;
+       eq->eq_size = count;
+       eq->eq_callback = callback;
 
        eq->eq_refs = cfs_percpt_alloc(lnet_cpt_table(),
                                       sizeof(*eq->eq_refs[0]));
@@ -255,19 +255,19 @@ lnet_eq_dequeue_event(lnet_eq_t *eq, lnet_event_t *ev)
        CDEBUG(D_INFO, "event: %p, sequence: %lu, eq->size: %u\n",
               new_event, eq->eq_deq_seq, eq->eq_size);
 
-        /* ...but did it overwrite an event we've not seen yet? */
-        if (eq->eq_deq_seq == new_event->sequence) {
-                rc = 1;
-        } else {
-                /* don't complain with CERROR: some EQs are sized small
-                 * anyway; if it's important, the caller should complain */
-                CDEBUG(D_NET, "Event Queue Overflow: eq seq %lu ev seq %lu\n",
-                       eq->eq_deq_seq, new_event->sequence);
-                rc = -EOVERFLOW;
-        }
-
-        eq->eq_deq_seq = new_event->sequence + 1;
-        RETURN(rc);
+       /* ...but did it overwrite an event we've not seen yet? */
+       if (eq->eq_deq_seq == new_event->sequence) {
+               rc = 1;
+       } else {
+               /* don't complain with CERROR: some EQs are sized small
+                * anyway; if it's important, the caller should complain */
+               CDEBUG(D_NET, "Event Queue Overflow: eq seq %lu ev seq %lu\n",
+                      eq->eq_deq_seq, new_event->sequence);
+               rc = -EOVERFLOW;
+       }
+
+       eq->eq_deq_seq = new_event->sequence + 1;
+       RETURN(rc);
 }
 
 /**
@@ -279,8 +279,8 @@ lnet_eq_dequeue_event(lnet_eq_t *eq, lnet_event_t *ev)
  * \param event On successful return (1 or -EOVERFLOW), this location will
  * hold the next event in the EQ.
  *
- * \retval 0          No pending event in the EQ.
- * \retval 1          Indicates success.
+ * \retval 0         No pending event in the EQ.
+ * \retval 1         Indicates success.
  * \retval -ENOENT    If \a eventq does not point to a valid EQ.
  * \retval -EOVERFLOW Indicates success (i.e., an event is returned) and that
  * at least one event between this event and the last event obtained from the
@@ -289,10 +289,10 @@ lnet_eq_dequeue_event(lnet_eq_t *eq, lnet_event_t *ev)
 int
 LNetEQGet (lnet_handle_eq_t eventq, lnet_event_t *event)
 {
-        int which;
+       int which;
 
-        return LNetEQPoll(&eventq, 1, 0,
-                         event, &which);
+       return LNetEQPoll(&eventq, 1, 0,
+                        event, &which);
 }
 EXPORT_SYMBOL(LNetEQGet);
 
@@ -306,7 +306,7 @@ EXPORT_SYMBOL(LNetEQGet);
  * \param event On successful return (1 or -EOVERFLOW), this location will
  * hold the next event in the EQ.
  *
- * \retval 1          Indicates success.
+ * \retval 1         Indicates success.
  * \retval -ENOENT    If \a eventq does not point to a valid EQ.
  * \retval -EOVERFLOW Indicates success (i.e., an event is returned) and that
  * at least one event between this event and the last event obtained from the
@@ -315,10 +315,10 @@ EXPORT_SYMBOL(LNetEQGet);
 int
 LNetEQWait (lnet_handle_eq_t eventq, lnet_event_t *event)
 {
-        int which;
+       int which;
 
-        return LNetEQPoll(&eventq, 1, LNET_TIME_FOREVER,
-                         event, &which);
+       return LNetEQPoll(&eventq, 1, LNET_TIME_FOREVER,
+                        event, &which);
 }
 EXPORT_SYMBOL(LNetEQWait);
 
@@ -329,7 +329,7 @@ __must_hold(&the_lnet.ln_eq_wait_lock)
        int             tms = *timeout_ms;
        int             wait;
        wait_queue_t    wl;
-       cfs_time_t      now;
+       cfs_time_t      now;
 
        if (tms == 0)
                return -ENXIO; /* don't want to wait and no new event */
@@ -381,8 +381,8 @@ __must_hold(&the_lnet.ln_eq_wait_lock)
  * hold the next event in the EQs, and \a which will contain the index of the
  * EQ from which the event was taken.
  *
- * \retval 0          No pending event in the EQs after timeout.
- * \retval 1          Indicates success.
+ * \retval 0         No pending event in the EQs after timeout.
+ * \retval 1         Indicates success.
  * \retval -EOVERFLOW Indicates success (i.e., an event is returned) and that
  * at least one event between this event and the last event obtained from the
  * EQ indicated by \a which has been dropped due to limited space in the EQ.
@@ -395,12 +395,12 @@ LNetEQPoll(lnet_handle_eq_t *eventqs, int neq, int timeout_ms,
        int     wait = 1;
        int     rc;
        int     i;
-        ENTRY;
+       ENTRY;
 
-        LASSERT (the_lnet.ln_refcount > 0);
+       LASSERT(the_lnet.ln_refcount > 0);
 
-        if (neq < 1)
-                RETURN(-ENOENT);
+       if (neq < 1)
+               RETURN(-ENOENT);
 
        lnet_eq_wait_lock();
 
@@ -429,7 +429,7 @@ LNetEQPoll(lnet_handle_eq_t *eventqs, int neq, int timeout_ms,
                 * -1 : did nothing and it's sure no new event
                 *  1 : sleep inside and wait until new event
                 *  0 : don't want to wait anymore, but might have new event
-                *      so need to call dequeue again
+                *      so need to call dequeue again
                 */
                wait = lnet_eq_wait_locked(&timeout_ms);
                if (wait < 0) /* no new event */
index c78221c..f1397bf 100644 (file)
 void
 lnet_md_unlink(lnet_libmd_t *md)
 {
-        if ((md->md_flags & LNET_MD_FLAG_ZOMBIE) == 0) {
-                /* first unlink attempt... */
-                lnet_me_t *me = md->md_me;
+       if ((md->md_flags & LNET_MD_FLAG_ZOMBIE) == 0) {
+               /* first unlink attempt... */
+               lnet_me_t *me = md->md_me;
 
-                md->md_flags |= LNET_MD_FLAG_ZOMBIE;
+               md->md_flags |= LNET_MD_FLAG_ZOMBIE;
 
-                /* Disassociate from ME (if any), and unlink it if it was created
-                 * with LNET_UNLINK */
-                if (me != NULL) {
+               /* Disassociate from ME (if any), and unlink it if it was created
+                * with LNET_UNLINK */
+               if (me != NULL) {
                        /* detach MD from portal */
                        lnet_ptl_detach_md(me, md);
-                        if (me->me_unlink == LNET_UNLINK)
-                                lnet_me_unlink(me);
-                }
+                       if (me->me_unlink == LNET_UNLINK)
+                               lnet_me_unlink(me);
+               }
 
-                /* ensure all future handle lookups fail */
+               /* ensure all future handle lookups fail */
                lnet_res_lh_invalidate(&md->md_lh);
-        }
+       }
 
-        if (md->md_refcount != 0) {
-                CDEBUG(D_NET, "Queueing unlink of md %p\n", md);
-                return;
-        }
+       if (md->md_refcount != 0) {
+               CDEBUG(D_NET, "Queueing unlink of md %p\n", md);
+               return;
+       }
 
-        CDEBUG(D_NET, "Unlinking md %p\n", md);
+       CDEBUG(D_NET, "Unlinking md %p\n", md);
 
-        if (md->md_eq != NULL) {
+       if (md->md_eq != NULL) {
                int     cpt = lnet_cpt_of_cookie(md->md_lh.lh_cookie);
 
                LASSERT(*md->md_eq->eq_refs[cpt] > 0);
@@ -87,76 +87,76 @@ lnet_md_unlink(lnet_libmd_t *md)
 static int
 lnet_md_build(lnet_libmd_t *lmd, lnet_md_t *umd, int unlink)
 {
-        int          i;
-        unsigned int niov;
-        int          total_length = 0;
-
-        lmd->md_me = NULL;
-        lmd->md_start = umd->start;
-        lmd->md_offset = 0;
-        lmd->md_max_size = umd->max_size;
-        lmd->md_options = umd->options;
-        lmd->md_user_ptr = umd->user_ptr;
+       int          i;
+       unsigned int niov;
+       int          total_length = 0;
+
+       lmd->md_me = NULL;
+       lmd->md_start = umd->start;
+       lmd->md_offset = 0;
+       lmd->md_max_size = umd->max_size;
+       lmd->md_options = umd->options;
+       lmd->md_user_ptr = umd->user_ptr;
        lmd->md_eq = NULL;
-        lmd->md_threshold = umd->threshold;
-        lmd->md_refcount = 0;
-        lmd->md_flags = (unlink == LNET_UNLINK) ? LNET_MD_FLAG_AUTO_UNLINK : 0;
+       lmd->md_threshold = umd->threshold;
+       lmd->md_refcount = 0;
+       lmd->md_flags = (unlink == LNET_UNLINK) ? LNET_MD_FLAG_AUTO_UNLINK : 0;
 
-        if ((umd->options & LNET_MD_IOVEC) != 0) {
+       if ((umd->options & LNET_MD_IOVEC) != 0) {
 
-                if ((umd->options & LNET_MD_KIOV) != 0) /* Can't specify both */
-                        return -EINVAL;
+               if ((umd->options & LNET_MD_KIOV) != 0) /* Can't specify both */
+                       return -EINVAL;
 
-                lmd->md_niov = niov = umd->length;
-                memcpy(lmd->md_iov.iov, umd->start,
-                       niov * sizeof (lmd->md_iov.iov[0]));
+               lmd->md_niov = niov = umd->length;
+               memcpy(lmd->md_iov.iov, umd->start,
+                      niov * sizeof(lmd->md_iov.iov[0]));
 
-                for (i = 0; i < (int)niov; i++) {
-                        /* We take the base address on trust */
-                        if (lmd->md_iov.iov[i].iov_len <= 0) /* invalid length */
-                                return -EINVAL;
+               for (i = 0; i < (int)niov; i++) {
+                       /* We take the base address on trust */
+                       if (lmd->md_iov.iov[i].iov_len <= 0) /* invalid length */
+                               return -EINVAL;
 
-                        total_length += lmd->md_iov.iov[i].iov_len;
-                }
+                       total_length += lmd->md_iov.iov[i].iov_len;
+               }
 
-                lmd->md_length = total_length;
+               lmd->md_length = total_length;
 
-                if ((umd->options & LNET_MD_MAX_SIZE) != 0 && /* max size used */
-                    (umd->max_size < 0 ||
-                     umd->max_size > total_length)) // illegal max_size
-                        return -EINVAL;
+               if ((umd->options & LNET_MD_MAX_SIZE) != 0 && /* max size used */
+                   (umd->max_size < 0 ||
+                    umd->max_size > total_length)) // illegal max_size
+                       return -EINVAL;
 
-        } else if ((umd->options & LNET_MD_KIOV) != 0) {
-                lmd->md_niov = niov = umd->length;
-                memcpy(lmd->md_iov.kiov, umd->start,
-                       niov * sizeof (lmd->md_iov.kiov[0]));
+       } else if ((umd->options & LNET_MD_KIOV) != 0) {
+               lmd->md_niov = niov = umd->length;
+               memcpy(lmd->md_iov.kiov, umd->start,
+                      niov * sizeof(lmd->md_iov.kiov[0]));
 
-                for (i = 0; i < (int)niov; i++) {
-                        /* We take the page pointer on trust */
-                        if (lmd->md_iov.kiov[i].kiov_offset +
+               for (i = 0; i < (int)niov; i++) {
+                       /* We take the page pointer on trust */
+                       if (lmd->md_iov.kiov[i].kiov_offset +
                            lmd->md_iov.kiov[i].kiov_len > PAGE_SIZE)
-                                return -EINVAL; /* invalid length */
-
-                        total_length += lmd->md_iov.kiov[i].kiov_len;
-                }
-
-                lmd->md_length = total_length;
-
-                if ((umd->options & LNET_MD_MAX_SIZE) != 0 && /* max size used */
-                    (umd->max_size < 0 ||
-                     umd->max_size > total_length)) // illegal max_size
-                        return -EINVAL;
-        } else {   /* contiguous */
-                lmd->md_length = umd->length;
-                lmd->md_niov = niov = 1;
-                lmd->md_iov.iov[0].iov_base = umd->start;
-                lmd->md_iov.iov[0].iov_len = umd->length;
-
-                if ((umd->options & LNET_MD_MAX_SIZE) != 0 && /* max size used */
-                    (umd->max_size < 0 ||
-                     umd->max_size > (int)umd->length)) // illegal max_size
-                        return -EINVAL;
-        }
+                               return -EINVAL; /* invalid length */
+
+                       total_length += lmd->md_iov.kiov[i].kiov_len;
+               }
+
+               lmd->md_length = total_length;
+
+               if ((umd->options & LNET_MD_MAX_SIZE) != 0 && /* max size used */
+                   (umd->max_size < 0 ||
+                    umd->max_size > total_length)) // illegal max_size
+                       return -EINVAL;
+       } else {   /* contiguous */
+               lmd->md_length = umd->length;
+               lmd->md_niov = niov = 1;
+               lmd->md_iov.iov[0].iov_base = umd->start;
+               lmd->md_iov.iov[0].iov_len = umd->length;
+
+               if ((umd->options & LNET_MD_MAX_SIZE) != 0 && /* max size used */
+                   (umd->max_size < 0 ||
+                    umd->max_size > (int)umd->length)) // illegal max_size
+                       return -EINVAL;
+       }
 
        return 0;
 }
@@ -172,7 +172,7 @@ lnet_md_link(lnet_libmd_t *md, lnet_handle_eq_t eq_handle, int cpt)
         * otherwise caller may only lnet_md_free() it.
         */
        /* This implementation doesn't know how to create START events or
-        * disable END events.  Best to LASSERT our caller is compliant so
+        * disable END events.  Best to LASSERT our caller is compliant so
         * we find out quickly...  */
        /*  TODO - reevaluate what should be here in light of
         * the removal of the start and end events
@@ -200,38 +200,38 @@ lnet_md_link(lnet_libmd_t *md, lnet_handle_eq_t eq_handle, int cpt)
 void
 lnet_md_deconstruct(lnet_libmd_t *lmd, lnet_md_t *umd)
 {
-        /* NB this doesn't copy out all the iov entries so when a
-         * discontiguous MD is copied out, the target gets to know the
-         * original iov pointer (in start) and the number of entries it had
-         * and that's all.
-         */
-        umd->start = lmd->md_start;
-        umd->length = ((lmd->md_options & (LNET_MD_IOVEC | LNET_MD_KIOV)) == 0) ?
-                      lmd->md_length : lmd->md_niov;
-        umd->threshold = lmd->md_threshold;
-        umd->max_size = lmd->md_max_size;
-        umd->options = lmd->md_options;
-        umd->user_ptr = lmd->md_user_ptr;
-        lnet_eq2handle(&umd->eq_handle, lmd->md_eq);
+       /* NB this doesn't copy out all the iov entries so when a
+        * discontiguous MD is copied out, the target gets to know the
+        * original iov pointer (in start) and the number of entries it had
+        * and that's all.
+        */
+       umd->start = lmd->md_start;
+       umd->length = ((lmd->md_options & (LNET_MD_IOVEC | LNET_MD_KIOV)) == 0) ?
+                     lmd->md_length : lmd->md_niov;
+       umd->threshold = lmd->md_threshold;
+       umd->max_size = lmd->md_max_size;
+       umd->options = lmd->md_options;
+       umd->user_ptr = lmd->md_user_ptr;
+       lnet_eq2handle(&umd->eq_handle, lmd->md_eq);
 }
 
 static int
 lnet_md_validate(lnet_md_t *umd)
 {
-        if (umd->start == NULL && umd->length != 0) {
-                CERROR("MD start pointer can not be NULL with length %u\n",
-                       umd->length);
-                return -EINVAL;
-        }
-
-        if ((umd->options & (LNET_MD_KIOV | LNET_MD_IOVEC)) != 0 &&
-            umd->length > LNET_MAX_IOV) {
-                CERROR("Invalid option: too many fragments %u, %d max\n",
-                       umd->length, LNET_MAX_IOV);
-                return -EINVAL;
-        }
-
-        return 0;
+       if (umd->start == NULL && umd->length != 0) {
+               CERROR("MD start pointer can not be NULL with length %u\n",
+                      umd->length);
+               return -EINVAL;
+       }
+
+       if ((umd->options & (LNET_MD_KIOV | LNET_MD_IOVEC)) != 0 &&
+           umd->length > LNET_MAX_IOV) {
+               CERROR("Invalid option: too many fragments %u, %d max\n",
+                      umd->length, LNET_MAX_IOV);
+               return -EINVAL;
+       }
+
+       return 0;
 }
 
 /**
@@ -250,7 +250,7 @@ lnet_md_validate(lnet_md_t *umd)
  * \param handle On successful returns, a handle to the newly created MD is
  * saved here. This handle can be used later in LNetMDUnlink().
  *
- * \retval 0       On success.
+ * \retval 0      On success.
  * \retval -EINVAL If \a umd is not valid.
  * \retval -ENOMEM If new MD cannot be allocated.
  * \retval -ENOENT Either \a meh or \a umd.eq_handle does not point to a
@@ -263,26 +263,26 @@ int
 LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd,
             lnet_unlink_t unlink, lnet_handle_md_t *handle)
 {
-       struct list_head        matches = LIST_HEAD_INIT(matches);
-       struct list_head        drops = LIST_HEAD_INIT(drops);
+       struct list_head        matches = LIST_HEAD_INIT(matches);
+       struct list_head        drops = LIST_HEAD_INIT(drops);
        struct lnet_me          *me;
        struct lnet_libmd       *md;
        int                     cpt;
        int                     rc;
 
-        LASSERT (the_lnet.ln_refcount > 0);
+       LASSERT(the_lnet.ln_refcount > 0);
 
-        if (lnet_md_validate(&umd) != 0)
-                return -EINVAL;
+       if (lnet_md_validate(&umd) != 0)
+               return -EINVAL;
 
-        if ((umd.options & (LNET_MD_OP_GET | LNET_MD_OP_PUT)) == 0) {
-                CERROR("Invalid option: no MD_OP set\n");
-                return -EINVAL;
-        }
+       if ((umd.options & (LNET_MD_OP_GET | LNET_MD_OP_PUT)) == 0) {
+               CERROR("Invalid option: no MD_OP set\n");
+               return -EINVAL;
+       }
 
-        md = lnet_md_alloc(&umd);
-        if (md == NULL)
-                return -ENOMEM;
+       md = lnet_md_alloc(&umd);
+       if (md == NULL)
+               return -ENOMEM;
 
        rc = lnet_md_build(md, &umd, unlink);
        if (rc != 0)
@@ -333,7 +333,7 @@ EXPORT_SYMBOL(LNetMDAttach);
  * saved here. This handle can be used later in LNetMDUnlink(), LNetPut(),
  * and LNetGet() operations.
  *
- * \retval 0       On success.
+ * \retval 0      On success.
  * \retval -EINVAL If \a umd is not valid.
  * \retval -ENOMEM If new MD cannot be allocated.
  * \retval -ENOENT \a umd.eq_handle does not point to a valid EQ. Note that
@@ -347,19 +347,19 @@ LNetMDBind(lnet_md_t umd, lnet_unlink_t unlink, lnet_handle_md_t *handle)
        int             cpt;
        int             rc;
 
-        LASSERT (the_lnet.ln_refcount > 0);
+       LASSERT(the_lnet.ln_refcount > 0);
 
-        if (lnet_md_validate(&umd) != 0)
-                return -EINVAL;
+       if (lnet_md_validate(&umd) != 0)
+               return -EINVAL;
 
-        if ((umd.options & (LNET_MD_OP_GET | LNET_MD_OP_PUT)) != 0) {
-                CERROR("Invalid option: GET|PUT illegal on active MDs\n");
-                return -EINVAL;
-        }
+       if ((umd.options & (LNET_MD_OP_GET | LNET_MD_OP_PUT)) != 0) {
+               CERROR("Invalid option: GET|PUT illegal on active MDs\n");
+               return -EINVAL;
+       }
 
-        md = lnet_md_alloc(&umd);
-        if (md == NULL)
-                return -ENOMEM;
+       md = lnet_md_alloc(&umd);
+       if (md == NULL)
+               return -ENOMEM;
 
        rc = lnet_md_build(md, &umd, unlink);
        if (rc != 0)
@@ -412,7 +412,7 @@ EXPORT_SYMBOL(LNetMDBind);
  *
  * \param mdh A handle for the MD to be unlinked.
  *
- * \retval 0       On success.
+ * \retval 0      On success.
  * \retval -ENOENT If \a mdh does not point to a valid MD object.
  */
 int
@@ -430,8 +430,8 @@ LNetMDUnlink (lnet_handle_md_t mdh)
        md = lnet_handle2md(&mdh);
        if (md == NULL) {
                lnet_res_unlock(cpt);
-                return -ENOENT;
-        }
+               return -ENOENT;
+       }
 
        md->md_flags |= LNET_MD_FLAG_ABORTED;
        /* If the MD is busy, lnet_md_unlink just marks it for deletion, and
@@ -442,7 +442,7 @@ LNetMDUnlink (lnet_handle_md_t mdh)
                lnet_eq_enqueue_event(md->md_eq, &ev);
        }
 
-        lnet_md_unlink(md);
+       lnet_md_unlink(md);
 
        lnet_res_unlock(cpt);
        return 0;
index 9f39a87..856ff4b 100644 (file)
  * object is saved here. This handle can be used later in LNetMEInsert(),
  * LNetMEUnlink(), or LNetMDAttach() functions.
  *
- * \retval 0       On success.
+ * \retval 0      On success.
  * \retval -EINVAL If \a portal is invalid.
  * \retval -ENOMEM If new ME object cannot be allocated.
  */
 int
 LNetMEAttach(unsigned int portal,
-             lnet_process_id_t match_id,
-             __u64 match_bits, __u64 ignore_bits,
-             lnet_unlink_t unlink, lnet_ins_pos_t pos,
-             lnet_handle_me_t *handle)
+            lnet_process_id_t match_id,
+            __u64 match_bits, __u64 ignore_bits,
+            lnet_unlink_t unlink, lnet_ins_pos_t pos,
+            lnet_handle_me_t *handle)
 {
        struct lnet_match_table *mtable;
        struct lnet_me          *me;
@@ -99,12 +99,12 @@ LNetMEAttach(unsigned int portal,
 
        lnet_res_lock(mtable->mt_cpt);
 
-        me->me_portal = portal;
-        me->me_match_id = match_id;
-        me->me_match_bits = match_bits;
-        me->me_ignore_bits = ignore_bits;
-        me->me_unlink = unlink;
-        me->me_md = NULL;
+       me->me_portal = portal;
+       me->me_match_id = match_id;
+       me->me_match_bits = match_bits;
+       me->me_ignore_bits = ignore_bits;
+       me->me_unlink = unlink;
+       me->me_md = NULL;
 
        lnet_res_lh_initialize(the_lnet.ln_me_containers[mtable->mt_cpt],
                               &me->me_lh);
@@ -139,16 +139,16 @@ EXPORT_SYMBOL(LNetMEAttach);
  * \param match_id,match_bits,ignore_bits,unlink,pos,handle See the discussion
  * for LNetMEAttach().
  *
- * \retval 0       On success.
+ * \retval 0      On success.
  * \retval -ENOMEM If new ME object cannot be allocated.
  * \retval -ENOENT If \a current_meh does not point to a valid match entry.
  */
 int
 LNetMEInsert(lnet_handle_me_t current_meh,
-             lnet_process_id_t match_id,
-             __u64 match_bits, __u64 ignore_bits,
-             lnet_unlink_t unlink, lnet_ins_pos_t pos,
-             lnet_handle_me_t *handle)
+            lnet_process_id_t match_id,
+            __u64 match_bits, __u64 ignore_bits,
+            lnet_unlink_t unlink, lnet_ins_pos_t pos,
+            lnet_handle_me_t *handle)
 {
        struct lnet_me          *current_me;
        struct lnet_me          *new_me;
@@ -184,15 +184,15 @@ LNetMEInsert(lnet_handle_me_t current_meh,
                lnet_me_free(new_me);
                lnet_res_unlock(cpt);
                return -EPERM;
-        }
+       }
 
        new_me->me_pos = current_me->me_pos;
-        new_me->me_portal = current_me->me_portal;
-        new_me->me_match_id = match_id;
-        new_me->me_match_bits = match_bits;
-        new_me->me_ignore_bits = ignore_bits;
-        new_me->me_unlink = unlink;
-        new_me->me_md = NULL;
+       new_me->me_portal = current_me->me_portal;
+       new_me->me_match_id = match_id;
+       new_me->me_match_bits = match_bits;
+       new_me->me_ignore_bits = ignore_bits;
+       new_me->me_unlink = unlink;
+       new_me->me_md = NULL;
 
        lnet_res_lh_initialize(the_lnet.ln_me_containers[cpt], &new_me->me_lh);
 
@@ -219,7 +219,7 @@ EXPORT_SYMBOL(LNetMEInsert);
  *
  * \param meh A handle for the ME to be unlinked.
  *
- * \retval 0       On success.
+ * \retval 0      On success.
  * \retval -ENOENT If \a meh does not point to a valid ME.
  * \see LNetMDUnlink() for the discussion on delivering unlink event.
  */
@@ -239,8 +239,8 @@ LNetMEUnlink(lnet_handle_me_t meh)
        me = lnet_handle2me(&meh);
        if (me == NULL) {
                lnet_res_unlock(cpt);
-                return -ENOENT;
-        }
+               return -ENOENT;
+       }
 
        md = me->me_md;
        if (md != NULL) {
@@ -281,15 +281,15 @@ static void
 lib_me_dump(lnet_me_t *me)
 {
        CWARN("Match Entry %p (%#llx)\n", me,
-              me->me_lh.lh_cookie);
+             me->me_lh.lh_cookie);
 
-        CWARN("\tMatch/Ignore\t= %016lx / %016lx\n",
-              me->me_match_bits, me->me_ignore_bits);
+       CWARN("\tMatch/Ignore\t= %016lx / %016lx\n",
+             me->me_match_bits, me->me_ignore_bits);
 
-        CWARN("\tMD\t= %p\n", me->md);
-        CWARN("\tprev\t= %p\n",
+       CWARN("\tMD\t= %p\n", me->md);
+       CWARN("\tprev\t= %p\n",
              list_entry(me->me_list.prev, lnet_me_t, me_list));
-        CWARN("\tnext\t= %p\n",
+       CWARN("\tnext\t= %p\n",
              list_entry(me->me_list.next, lnet_me_t, me_list));
 }
 #endif
index cbbc888..cf8c570 100644 (file)
@@ -57,14 +57,14 @@ lnet_fail_nid(lnet_nid_t nid, unsigned int threshold)
        struct list_head  cull;
 
        /* NB: use lnet_net_lock(0) to serialize operations on test peers */
-        if (threshold != 0) {
-                /* Adding a new entry */
-                LIBCFS_ALLOC(tp, sizeof(*tp));
-                if (tp == NULL)
-                        return -ENOMEM;
+       if (threshold != 0) {
+               /* Adding a new entry */
+               LIBCFS_ALLOC(tp, sizeof(*tp));
+               if (tp == NULL)
+                       return -ENOMEM;
 
-                tp->tp_nid = nid;
-                tp->tp_threshold = threshold;
+               tp->tp_nid = nid;
+               tp->tp_threshold = threshold;
 
                lnet_net_lock(0);
                list_add_tail(&tp->tp_list, &the_lnet.ln_test_peers);
@@ -160,13 +160,13 @@ fail_peer (lnet_nid_t nid, int outgoing)
 unsigned int
 lnet_iov_nob(unsigned int niov, struct kvec *iov)
 {
-        unsigned int nob = 0;
+       unsigned int nob = 0;
 
        LASSERT(niov == 0 || iov != NULL);
-        while (niov-- > 0)
-                nob += (iov++)->iov_len;
+       while (niov-- > 0)
+               nob += (iov++)->iov_len;
 
-        return (nob);
+       return (nob);
 }
 EXPORT_SYMBOL(lnet_iov_nob);
 
@@ -175,57 +175,57 @@ lnet_copy_iov2iov(unsigned int ndiov, struct kvec *diov, unsigned int doffset,
                  unsigned int nsiov, struct kvec *siov, unsigned int soffset,
                  unsigned int nob)
 {
-        /* NB diov, siov are READ-ONLY */
-        unsigned int  this_nob;
-
-        if (nob == 0)
-                return;
-
-        /* skip complete frags before 'doffset' */
-        LASSERT (ndiov > 0);
-        while (doffset >= diov->iov_len) {
-                doffset -= diov->iov_len;
-                diov++;
-                ndiov--;
-                LASSERT (ndiov > 0);
-        }
-
-        /* skip complete frags before 'soffset' */
-        LASSERT (nsiov > 0);
-        while (soffset >= siov->iov_len) {
-                soffset -= siov->iov_len;
-                siov++;
-                nsiov--;
-                LASSERT (nsiov > 0);
-        }
-
-        do {
-                LASSERT (ndiov > 0);
-                LASSERT (nsiov > 0);
-                this_nob = MIN(diov->iov_len - doffset,
-                               siov->iov_len - soffset);
-                this_nob = MIN(this_nob, nob);
-
-                memcpy ((char *)diov->iov_base + doffset,
-                        (char *)siov->iov_base + soffset, this_nob);
-                nob -= this_nob;
-
-                if (diov->iov_len > doffset + this_nob) {
-                        doffset += this_nob;
-                } else {
-                        diov++;
-                        ndiov--;
-                        doffset = 0;
-                }
-
-                if (siov->iov_len > soffset + this_nob) {
-                        soffset += this_nob;
-                } else {
-                        siov++;
-                        nsiov--;
-                        soffset = 0;
-                }
-        } while (nob > 0);
+       /* NB diov, siov are READ-ONLY */
+       unsigned int  this_nob;
+
+       if (nob == 0)
+               return;
+
+       /* skip complete frags before 'doffset' */
+       LASSERT(ndiov > 0);
+       while (doffset >= diov->iov_len) {
+               doffset -= diov->iov_len;
+               diov++;
+               ndiov--;
+               LASSERT(ndiov > 0);
+       }
+
+       /* skip complete frags before 'soffset' */
+       LASSERT(nsiov > 0);
+       while (soffset >= siov->iov_len) {
+               soffset -= siov->iov_len;
+               siov++;
+               nsiov--;
+               LASSERT(nsiov > 0);
+       }
+
+       do {
+               LASSERT(ndiov > 0);
+               LASSERT(nsiov > 0);
+               this_nob = MIN(diov->iov_len - doffset,
+                              siov->iov_len - soffset);
+               this_nob = MIN(this_nob, nob);
+
+               memcpy((char *)diov->iov_base + doffset,
+                      (char *)siov->iov_base + soffset, this_nob);
+               nob -= this_nob;
+
+               if (diov->iov_len > doffset + this_nob) {
+                       doffset += this_nob;
+               } else {
+                       diov++;
+                       ndiov--;
+                       doffset = 0;
+               }
+
+               if (siov->iov_len > soffset + this_nob) {
+                       soffset += this_nob;
+               } else {
+                       siov++;
+                       nsiov--;
+                       soffset = 0;
+               }
+       } while (nob > 0);
 }
 EXPORT_SYMBOL(lnet_copy_iov2iov);
 
@@ -234,45 +234,45 @@ lnet_extract_iov(int dst_niov, struct kvec *dst,
                 int src_niov, struct kvec *src,
                 unsigned int offset, unsigned int len)
 {
-        /* Initialise 'dst' to the subset of 'src' starting at 'offset',
-         * for exactly 'len' bytes, and return the number of entries.
-         * NB not destructive to 'src' */
-        unsigned int    frag_len;
-        unsigned int    niov;
-
-        if (len == 0)                           /* no data => */
-                return (0);                     /* no frags */
-
-        LASSERT (src_niov > 0);
-        while (offset >= src->iov_len) {      /* skip initial frags */
-                offset -= src->iov_len;
-                src_niov--;
-                src++;
-                LASSERT (src_niov > 0);
-        }
-
-        niov = 1;
-        for (;;) {
-                LASSERT (src_niov > 0);
-                LASSERT ((int)niov <= dst_niov);
-
-                frag_len = src->iov_len - offset;
-                dst->iov_base = ((char *)src->iov_base) + offset;
-
-                if (len <= frag_len) {
-                        dst->iov_len = len;
-                        return (niov);
-                }
-
-                dst->iov_len = frag_len;
-
-                len -= frag_len;
-                dst++;
-                src++;
-                niov++;
-                src_niov--;
-                offset = 0;
-        }
+       /* Initialise 'dst' to the subset of 'src' starting at 'offset',
+        * for exactly 'len' bytes, and return the number of entries.
+        * NB not destructive to 'src' */
+       unsigned int    frag_len;
+       unsigned int    niov;
+
+       if (len == 0)                           /* no data => */
+               return (0);                     /* no frags */
+
+       LASSERT(src_niov > 0);
+       while (offset >= src->iov_len) {      /* skip initial frags */
+               offset -= src->iov_len;
+               src_niov--;
+               src++;
+               LASSERT(src_niov > 0);
+       }
+
+       niov = 1;
+       for (;;) {
+               LASSERT(src_niov > 0);
+               LASSERT((int)niov <= dst_niov);
+
+               frag_len = src->iov_len - offset;
+               dst->iov_base = ((char *)src->iov_base) + offset;
+
+               if (len <= frag_len) {
+                       dst->iov_len = len;
+                       return (niov);
+               }
+
+               dst->iov_len = frag_len;
+
+               len -= frag_len;
+               dst++;
+               src++;
+               niov++;
+               src_niov--;
+               offset = 0;
+       }
 }
 EXPORT_SYMBOL(lnet_extract_iov);
 
@@ -280,13 +280,13 @@ EXPORT_SYMBOL(lnet_extract_iov);
 unsigned int
 lnet_kiov_nob(unsigned int niov, lnet_kiov_t *kiov)
 {
-        unsigned int  nob = 0;
+       unsigned int  nob = 0;
 
        LASSERT(niov == 0 || kiov != NULL);
-        while (niov-- > 0)
-                nob += (kiov++)->kiov_len;
+       while (niov-- > 0)
+               nob += (kiov++)->kiov_len;
 
-        return (nob);
+       return (nob);
 }
 EXPORT_SYMBOL(lnet_kiov_nob);
 
@@ -296,9 +296,9 @@ lnet_copy_kiov2kiov(unsigned int ndiov, lnet_kiov_t *diov, unsigned int doffset,
                    unsigned int nob)
 {
        /* NB diov, siov are READ-ONLY */
-       unsigned int    this_nob;
-       char           *daddr = NULL;
-       char           *saddr = NULL;
+       unsigned int    this_nob;
+       char           *daddr = NULL;
+       char           *saddr = NULL;
 
        if (nob == 0)
                return;
@@ -306,27 +306,27 @@ lnet_copy_kiov2kiov(unsigned int ndiov, lnet_kiov_t *diov, unsigned int doffset,
        LASSERT (!in_interrupt ());
 
        LASSERT (ndiov > 0);
-        while (doffset >= diov->kiov_len) {
-                doffset -= diov->kiov_len;
-                diov++;
-                ndiov--;
-                LASSERT (ndiov > 0);
-        }
-
-        LASSERT (nsiov > 0);
-        while (soffset >= siov->kiov_len) {
-                soffset -= siov->kiov_len;
-                siov++;
-                nsiov--;
-                LASSERT (nsiov > 0);
-        }
-
-        do {
-                LASSERT (ndiov > 0);
-                LASSERT (nsiov > 0);
-                this_nob = MIN(diov->kiov_len - doffset,
-                               siov->kiov_len - soffset);
-                this_nob = MIN(this_nob, nob);
+       while (doffset >= diov->kiov_len) {
+               doffset -= diov->kiov_len;
+               diov++;
+               ndiov--;
+               LASSERT(ndiov > 0);
+       }
+
+       LASSERT(nsiov > 0);
+       while (soffset >= siov->kiov_len) {
+               soffset -= siov->kiov_len;
+               siov++;
+               nsiov--;
+               LASSERT(nsiov > 0);
+       }
+
+       do {
+               LASSERT(ndiov > 0);
+               LASSERT(nsiov > 0);
+               this_nob = MIN(diov->kiov_len - doffset,
+                              siov->kiov_len - soffset);
+               this_nob = MIN(this_nob, nob);
 
                if (daddr == NULL)
                        daddr = ((char *)kmap(diov->kiov_page)) +
@@ -374,12 +374,12 @@ EXPORT_SYMBOL(lnet_copy_kiov2kiov);
 
 void
 lnet_copy_kiov2iov (unsigned int niov, struct kvec *iov, unsigned int iovoffset,
-                    unsigned int nkiov, lnet_kiov_t *kiov, unsigned int kiovoffset,
-                    unsigned int nob)
+                   unsigned int nkiov, lnet_kiov_t *kiov, unsigned int kiovoffset,
+                   unsigned int nob)
 {
        /* NB iov, kiov are READ-ONLY */
-       unsigned int    this_nob;
-       char           *addr = NULL;
+       unsigned int    this_nob;
+       char           *addr = NULL;
 
        if (nob == 0)
                return;
@@ -387,47 +387,47 @@ lnet_copy_kiov2iov (unsigned int niov, struct kvec *iov, unsigned int iovoffset,
        LASSERT (!in_interrupt ());
 
        LASSERT (niov > 0);
-        while (iovoffset >= iov->iov_len) {
-                iovoffset -= iov->iov_len;
-                iov++;
-                niov--;
-                LASSERT (niov > 0);
-        }
-
-        LASSERT (nkiov > 0);
-        while (kiovoffset >= kiov->kiov_len) {
-                kiovoffset -= kiov->kiov_len;
-                kiov++;
-                nkiov--;
-                LASSERT (nkiov > 0);
-        }
-
-        do {
-                LASSERT (niov > 0);
-                LASSERT (nkiov > 0);
-                this_nob = MIN(iov->iov_len - iovoffset,
-                               kiov->kiov_len - kiovoffset);
-                this_nob = MIN(this_nob, nob);
-
-                if (addr == NULL)
+       while (iovoffset >= iov->iov_len) {
+               iovoffset -= iov->iov_len;
+               iov++;
+               niov--;
+               LASSERT(niov > 0);
+       }
+
+       LASSERT(nkiov > 0);
+       while (kiovoffset >= kiov->kiov_len) {
+               kiovoffset -= kiov->kiov_len;
+               kiov++;
+               nkiov--;
+               LASSERT(nkiov > 0);
+       }
+
+       do {
+               LASSERT(niov > 0);
+               LASSERT(nkiov > 0);
+               this_nob = MIN(iov->iov_len - iovoffset,
+                              kiov->kiov_len - kiovoffset);
+               this_nob = MIN(this_nob, nob);
+
+               if (addr == NULL)
                        addr = ((char *)kmap(kiov->kiov_page)) +
-                                kiov->kiov_offset + kiovoffset;
-
-                memcpy ((char *)iov->iov_base + iovoffset, addr, this_nob);
-                nob -= this_nob;
-
-                if (iov->iov_len > iovoffset + this_nob) {
-                        iovoffset += this_nob;
-                } else {
-                        iov++;
-                        niov--;
-                        iovoffset = 0;
-                }
-
-                if (kiov->kiov_len > kiovoffset + this_nob) {
-                        addr += this_nob;
-                        kiovoffset += this_nob;
-                } else {
+                               kiov->kiov_offset + kiovoffset;
+
+               memcpy((char *)iov->iov_base + iovoffset, addr, this_nob);
+               nob -= this_nob;
+
+               if (iov->iov_len > iovoffset + this_nob) {
+                       iovoffset += this_nob;
+               } else {
+                       iov++;
+                       niov--;
+                       iovoffset = 0;
+               }
+
+               if (kiov->kiov_len > kiovoffset + this_nob) {
+                       addr += this_nob;
+                       kiovoffset += this_nob;
+               } else {
                        kunmap(kiov->kiov_page);
                        addr = NULL;
                        kiov++;
@@ -448,8 +448,8 @@ lnet_copy_iov2kiov(unsigned int nkiov, lnet_kiov_t *kiov, unsigned int kiovoffse
                   unsigned int nob)
 {
        /* NB kiov, iov are READ-ONLY */
-       unsigned int    this_nob;
-       char           *addr = NULL;
+       unsigned int    this_nob;
+       char           *addr = NULL;
 
        if (nob == 0)
                return;
@@ -457,29 +457,29 @@ lnet_copy_iov2kiov(unsigned int nkiov, lnet_kiov_t *kiov, unsigned int kiovoffse
        LASSERT (!in_interrupt ());
 
        LASSERT (nkiov > 0);
-        while (kiovoffset >= kiov->kiov_len) {
-                kiovoffset -= kiov->kiov_len;
-                kiov++;
-                nkiov--;
-                LASSERT (nkiov > 0);
-        }
-
-        LASSERT (niov > 0);
-        while (iovoffset >= iov->iov_len) {
-                iovoffset -= iov->iov_len;
-                iov++;
-                niov--;
-                LASSERT (niov > 0);
-        }
-
-        do {
-                LASSERT (nkiov > 0);
-                LASSERT (niov > 0);
-                this_nob = MIN(kiov->kiov_len - kiovoffset,
-                               iov->iov_len - iovoffset);
-                this_nob = MIN(this_nob, nob);
-
-                if (addr == NULL)
+       while (kiovoffset >= kiov->kiov_len) {
+               kiovoffset -= kiov->kiov_len;
+               kiov++;
+               nkiov--;
+               LASSERT(nkiov > 0);
+       }
+
+       LASSERT(niov > 0);
+       while (iovoffset >= iov->iov_len) {
+               iovoffset -= iov->iov_len;
+               iov++;
+               niov--;
+               LASSERT(niov > 0);
+       }
+
+       do {
+               LASSERT(nkiov > 0);
+               LASSERT(niov > 0);
+               this_nob = MIN(kiov->kiov_len - kiovoffset,
+                              iov->iov_len - iovoffset);
+               this_nob = MIN(this_nob, nob);
+
+               if (addr == NULL)
                        addr = ((char *)kmap(kiov->kiov_page)) +
                                kiov->kiov_offset + kiovoffset;
 
@@ -516,31 +516,31 @@ lnet_extract_kiov(int dst_niov, lnet_kiov_t *dst,
                  int src_niov, lnet_kiov_t *src,
                  unsigned int offset, unsigned int len)
 {
-        /* Initialise 'dst' to the subset of 'src' starting at 'offset',
-         * for exactly 'len' bytes, and return the number of entries.
-         * NB not destructive to 'src' */
-        unsigned int    frag_len;
-        unsigned int    niov;
-
-        if (len == 0)                           /* no data => */
-                return (0);                     /* no frags */
-
-        LASSERT (src_niov > 0);
-        while (offset >= src->kiov_len) {      /* skip initial frags */
-                offset -= src->kiov_len;
-                src_niov--;
-                src++;
-                LASSERT (src_niov > 0);
-        }
-
-        niov = 1;
-        for (;;) {
-                LASSERT (src_niov > 0);
-                LASSERT ((int)niov <= dst_niov);
-
-                frag_len = src->kiov_len - offset;
-                dst->kiov_page = src->kiov_page;
-                dst->kiov_offset = src->kiov_offset + offset;
+       /* Initialise 'dst' to the subset of 'src' starting at 'offset',
+        * for exactly 'len' bytes, and return the number of entries.
+        * NB not destructive to 'src' */
+       unsigned int    frag_len;
+       unsigned int    niov;
+
+       if (len == 0)                           /* no data => */
+               return (0);                     /* no frags */
+
+       LASSERT(src_niov > 0);
+       while (offset >= src->kiov_len) {      /* skip initial frags */
+               offset -= src->kiov_len;
+               src_niov--;
+               src++;
+               LASSERT(src_niov > 0);
+       }
+
+       niov = 1;
+       for (;;) {
+               LASSERT(src_niov > 0);
+               LASSERT((int)niov <= dst_niov);
+
+               frag_len = src->kiov_len - offset;
+               dst->kiov_page = src->kiov_page;
+               dst->kiov_offset = src->kiov_offset + offset;
 
                if (len <= frag_len) {
                        dst->kiov_len = len;
@@ -551,99 +551,99 @@ lnet_extract_kiov(int dst_niov, lnet_kiov_t *dst,
                dst->kiov_len = frag_len;
                LASSERT(dst->kiov_offset + dst->kiov_len <= PAGE_SIZE);
 
-                len -= frag_len;
-                dst++;
-                src++;
-                niov++;
-                src_niov--;
-                offset = 0;
-        }
+               len -= frag_len;
+               dst++;
+               src++;
+               niov++;
+               src_niov--;
+               offset = 0;
+       }
 }
 EXPORT_SYMBOL(lnet_extract_kiov);
 
 void
 lnet_ni_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed,
-             unsigned int offset, unsigned int mlen, unsigned int rlen)
+            unsigned int offset, unsigned int mlen, unsigned int rlen)
 {
        unsigned int  niov = 0;
        struct kvec *iov = NULL;
        lnet_kiov_t  *kiov = NULL;
-       int           rc;
+       int           rc;
 
        LASSERT (!in_interrupt ());
        LASSERT (mlen == 0 || msg != NULL);
 
-        if (msg != NULL) {
-                LASSERT(msg->msg_receiving);
-                LASSERT(!msg->msg_sending);
-                LASSERT(rlen == msg->msg_len);
-                LASSERT(mlen <= msg->msg_len);
+       if (msg != NULL) {
+               LASSERT(msg->msg_receiving);
+               LASSERT(!msg->msg_sending);
+               LASSERT(rlen == msg->msg_len);
+               LASSERT(mlen <= msg->msg_len);
                LASSERT(msg->msg_offset == offset);
                LASSERT(msg->msg_wanted == mlen);
 
-                msg->msg_receiving = 0;
+               msg->msg_receiving = 0;
 
-                if (mlen != 0) {
-                        niov = msg->msg_niov;
-                        iov  = msg->msg_iov;
-                        kiov = msg->msg_kiov;
+               if (mlen != 0) {
+                       niov = msg->msg_niov;
+                       iov  = msg->msg_iov;
+                       kiov = msg->msg_kiov;
 
-                        LASSERT (niov > 0);
-                        LASSERT ((iov == NULL) != (kiov == NULL));
-                }
-        }
+                       LASSERT(niov > 0);
+                       LASSERT((iov == NULL) != (kiov == NULL));
+               }
+       }
 
-        rc = (ni->ni_lnd->lnd_recv)(ni, private, msg, delayed,
-                                    niov, iov, kiov, offset, mlen, rlen);
-        if (rc < 0)
-                lnet_finalize(ni, msg, rc);
+       rc = (ni->ni_lnd->lnd_recv)(ni, private, msg, delayed,
+                                   niov, iov, kiov, offset, mlen, rlen);
+       if (rc < 0)
+               lnet_finalize(ni, msg, rc);
 }
 
 static void
 lnet_setpayloadbuffer(lnet_msg_t *msg)
 {
-        lnet_libmd_t *md = msg->msg_md;
-
-        LASSERT (msg->msg_len > 0);
-        LASSERT (!msg->msg_routing);
-        LASSERT (md != NULL);
-        LASSERT (msg->msg_niov == 0);
-        LASSERT (msg->msg_iov == NULL);
-        LASSERT (msg->msg_kiov == NULL);
-
-        msg->msg_niov = md->md_niov;
-        if ((md->md_options & LNET_MD_KIOV) != 0)
-                msg->msg_kiov = md->md_iov.kiov;
-        else
-                msg->msg_iov = md->md_iov.iov;
+       lnet_libmd_t *md = msg->msg_md;
+
+       LASSERT(msg->msg_len > 0);
+       LASSERT(!msg->msg_routing);
+       LASSERT(md != NULL);
+       LASSERT(msg->msg_niov == 0);
+       LASSERT(msg->msg_iov == NULL);
+       LASSERT(msg->msg_kiov == NULL);
+
+       msg->msg_niov = md->md_niov;
+       if ((md->md_options & LNET_MD_KIOV) != 0)
+               msg->msg_kiov = md->md_iov.kiov;
+       else
+               msg->msg_iov = md->md_iov.iov;
 }
 
 void
 lnet_prep_send(lnet_msg_t *msg, int type, lnet_process_id_t target,
               unsigned int offset, unsigned int len)
 {
-        msg->msg_type = type;
-        msg->msg_target = target;
-        msg->msg_len = len;
-        msg->msg_offset = offset;
-
-        if (len != 0)
-                lnet_setpayloadbuffer(msg);
-
-        memset (&msg->msg_hdr, 0, sizeof (msg->msg_hdr));
-        msg->msg_hdr.type           = cpu_to_le32(type);
-        msg->msg_hdr.dest_nid       = cpu_to_le64(target.nid);
-        msg->msg_hdr.dest_pid       = cpu_to_le32(target.pid);
-        /* src_nid will be set later */
-        msg->msg_hdr.src_pid        = cpu_to_le32(the_lnet.ln_pid);
-        msg->msg_hdr.payload_length = cpu_to_le32(len);
+       msg->msg_type = type;
+       msg->msg_target = target;
+       msg->msg_len = len;
+       msg->msg_offset = offset;
+
+       if (len != 0)
+               lnet_setpayloadbuffer(msg);
+
+       memset(&msg->msg_hdr, 0, sizeof(msg->msg_hdr));
+       msg->msg_hdr.type           = cpu_to_le32(type);
+       msg->msg_hdr.dest_nid       = cpu_to_le64(target.nid);
+       msg->msg_hdr.dest_pid       = cpu_to_le32(target.pid);
+       /* src_nid will be set later */
+       msg->msg_hdr.src_pid        = cpu_to_le32(the_lnet.ln_pid);
+       msg->msg_hdr.payload_length = cpu_to_le32(len);
 }
 
 static void
 lnet_ni_send(lnet_ni_t *ni, lnet_msg_t *msg)
 {
        void   *priv = msg->msg_private;
-       int     rc;
+       int     rc;
 
        LASSERT (!in_interrupt ());
        LASSERT (LNET_NETTYP(LNET_NIDNET(ni->ni_nid)) == LOLND ||
@@ -701,31 +701,31 @@ lnet_ni_query_locked(lnet_ni_t *ni, lnet_peer_t *lp)
 static inline int
 lnet_peer_is_alive (lnet_peer_t *lp, cfs_time_t now)
 {
-        int        alive;
-        cfs_time_t deadline;
-
-        LASSERT (lnet_peer_aliveness_enabled(lp));
-
-        /* Trust lnet_notify() if it has more recent aliveness news, but
-         * ignore the initial assumed death (see lnet_peers_start_down()).
-         */
-        if (!lp->lp_alive && lp->lp_alive_count > 0 &&
-            cfs_time_aftereq(lp->lp_timestamp, lp->lp_last_alive))
-                return 0;
-
-        deadline = cfs_time_add(lp->lp_last_alive,
-                                cfs_time_seconds(lp->lp_ni->ni_peertimeout));
-        alive = cfs_time_after(deadline, now);
-
-        /* Update obsolete lp_alive except for routers assumed to be dead
-         * initially, because router checker would update aliveness in this
-         * case, and moreover lp_last_alive at peer creation is assumed.
-         */
-        if (alive && !lp->lp_alive &&
-            !(lnet_isrouter(lp) && lp->lp_alive_count == 0))
-                lnet_notify_locked(lp, 0, 1, lp->lp_last_alive);
-
-        return alive;
+       int        alive;
+       cfs_time_t deadline;
+
+       LASSERT(lnet_peer_aliveness_enabled(lp));
+
+       /* Trust lnet_notify() if it has more recent aliveness news, but
+        * ignore the initial assumed death (see lnet_peers_start_down()).
+        */
+       if (!lp->lp_alive && lp->lp_alive_count > 0 &&
+           cfs_time_aftereq(lp->lp_timestamp, lp->lp_last_alive))
+               return 0;
+
+       deadline = cfs_time_add(lp->lp_last_alive,
+                               cfs_time_seconds(lp->lp_ni->ni_peertimeout));
+       alive = cfs_time_after(deadline, now);
+
+       /* Update obsolete lp_alive except for routers assumed to be dead
+        * initially, because router checker would update aliveness in this
+        * case, and moreover lp_last_alive at peer creation is assumed.
+        */
+       if (alive && !lp->lp_alive &&
+           !(lnet_isrouter(lp) && lp->lp_alive_count == 0))
+               lnet_notify_locked(lp, 0, 1, lp->lp_last_alive);
+
+       return alive;
 }
 
 
@@ -734,43 +734,43 @@ lnet_peer_is_alive (lnet_peer_t *lp, cfs_time_t now)
 static int
 lnet_peer_alive_locked (lnet_peer_t *lp)
 {
-        cfs_time_t now = cfs_time_current();
-
-        if (!lnet_peer_aliveness_enabled(lp))
-                return -ENODEV;
-
-        if (lnet_peer_is_alive(lp, now))
-                return 1;
-
-        /* Peer appears dead, but we should avoid frequent NI queries (at
-         * most once per lnet_queryinterval seconds). */
-        if (lp->lp_last_query != 0) {
-                static const int lnet_queryinterval = 1;
-
-                cfs_time_t next_query =
-                           cfs_time_add(lp->lp_last_query,
-                                        cfs_time_seconds(lnet_queryinterval));
-
-                if (cfs_time_before(now, next_query)) {
-                        if (lp->lp_alive)
-                                CWARN("Unexpected aliveness of peer %s: "
-                                      "%d < %d (%d/%d)\n",
-                                      libcfs_nid2str(lp->lp_nid),
-                                      (int)now, (int)next_query,
-                                      lnet_queryinterval,
-                                      lp->lp_ni->ni_peertimeout);
-                        return 0;
-                }
-        }
-
-        /* query NI for latest aliveness news */
+       cfs_time_t now = cfs_time_current();
+
+       if (!lnet_peer_aliveness_enabled(lp))
+               return -ENODEV;
+
+       if (lnet_peer_is_alive(lp, now))
+               return 1;
+
+       /* Peer appears dead, but we should avoid frequent NI queries (at
+        * most once per lnet_queryinterval seconds). */
+       if (lp->lp_last_query != 0) {
+               static const int lnet_queryinterval = 1;
+
+               cfs_time_t next_query =
+                          cfs_time_add(lp->lp_last_query,
+                                       cfs_time_seconds(lnet_queryinterval));
+
+               if (cfs_time_before(now, next_query)) {
+                       if (lp->lp_alive)
+                               CWARN("Unexpected aliveness of peer %s: "
+                                     "%d < %d (%d/%d)\n",
+                                     libcfs_nid2str(lp->lp_nid),
+                                     (int)now, (int)next_query,
+                                     lnet_queryinterval,
+                                     lp->lp_ni->ni_peertimeout);
+                       return 0;
+               }
+       }
+
+       /* query NI for latest aliveness news */
        lnet_ni_query_locked(lp->lp_ni, lp);
 
-        if (lnet_peer_is_alive(lp, now))
-                return 1;
+       if (lnet_peer_is_alive(lp, now))
+               return 1;
 
-        lnet_notify_locked(lp, 0, 0, lp->lp_last_alive);
-        return 0;
+       lnet_notify_locked(lp, 0, 0, lp->lp_last_alive);
+       return 0;
 }
 
 /**
@@ -898,16 +898,16 @@ lnet_post_routed_recv_locked (lnet_msg_t *msg, int do_recv)
         * sets do_recv FALSE and I don't do the unlock/send/lock bit.
         * I return LNET_CREDIT_WAIT if msg blocked and LNET_CREDIT_OK if
         * received or OK to receive */
-        lnet_peer_t         *lp = msg->msg_rxpeer;
-        lnet_rtrbufpool_t   *rbp;
-        lnet_rtrbuf_t       *rb;
-
-        LASSERT (msg->msg_iov == NULL);
-        LASSERT (msg->msg_kiov == NULL);
-        LASSERT (msg->msg_niov == 0);
-        LASSERT (msg->msg_routing);
-        LASSERT (msg->msg_receiving);
-        LASSERT (!msg->msg_sending);
+       lnet_peer_t         *lp = msg->msg_rxpeer;
+       lnet_rtrbufpool_t   *rbp;
+       lnet_rtrbuf_t       *rb;
+
+       LASSERT(msg->msg_iov == NULL);
+       LASSERT(msg->msg_kiov == NULL);
+       LASSERT(msg->msg_niov == 0);
+       LASSERT(msg->msg_routing);
+       LASSERT(msg->msg_receiving);
+       LASSERT(!msg->msg_sending);
 
        /* non-lnet_parse callers only receive delayed messages */
        LASSERT(!do_recv || msg->msg_rx_delayed);
@@ -916,10 +916,10 @@ lnet_post_routed_recv_locked (lnet_msg_t *msg, int do_recv)
                LASSERT((lp->lp_rtrcredits < 0) ==
                        !list_empty(&lp->lp_rtrq));
 
-                msg->msg_peerrtrcredit = 1;
-                lp->lp_rtrcredits--;
-                if (lp->lp_rtrcredits < lp->lp_minrtrcredits)
-                        lp->lp_minrtrcredits = lp->lp_rtrcredits;
+               msg->msg_peerrtrcredit = 1;
+               lp->lp_rtrcredits--;
+               if (lp->lp_rtrcredits < lp->lp_minrtrcredits)
+                       lp->lp_minrtrcredits = lp->lp_rtrcredits;
 
                if (lp->lp_rtrcredits < 0) {
                        /* must have checked eager_recv before here */
@@ -951,10 +951,10 @@ lnet_post_routed_recv_locked (lnet_msg_t *msg, int do_recv)
        rb = list_entry(rbp->rbp_bufs.next, lnet_rtrbuf_t, rb_list);
        list_del(&rb->rb_list);
 
-        msg->msg_niov = rbp->rbp_npages;
-        msg->msg_kiov = &rb->rb_kiov[0];
+       msg->msg_niov = rbp->rbp_npages;
+       msg->msg_kiov = &rb->rb_kiov[0];
 
-        if (do_recv) {
+       if (do_recv) {
                int cpt = msg->msg_rx_cpt;
 
                lnet_net_unlock(cpt);
@@ -990,37 +990,37 @@ lnet_return_tx_credits_locked(lnet_msg_t *msg)
                        LASSERT(msg2->msg_txpeer->lp_ni == ni);
                        LASSERT(msg2->msg_tx_delayed);
 
-                        (void) lnet_post_send_locked(msg2, 1);
-                }
-        }
+                       (void) lnet_post_send_locked(msg2, 1);
+               }
+       }
 
-        if (msg->msg_peertxcredit) {
-                /* give back peer txcredits */
-                msg->msg_peertxcredit = 0;
+       if (msg->msg_peertxcredit) {
+               /* give back peer txcredits */
+               msg->msg_peertxcredit = 0;
 
-                LASSERT((txpeer->lp_txcredits < 0) ==
+               LASSERT((txpeer->lp_txcredits < 0) ==
                        !list_empty(&txpeer->lp_txq));
 
-                txpeer->lp_txqnob -= msg->msg_len + sizeof(lnet_hdr_t);
-                LASSERT (txpeer->lp_txqnob >= 0);
+               txpeer->lp_txqnob -= msg->msg_len + sizeof(lnet_hdr_t);
+               LASSERT(txpeer->lp_txqnob >= 0);
 
-                txpeer->lp_txcredits++;
-                if (txpeer->lp_txcredits <= 0) {
+               txpeer->lp_txcredits++;
+               if (txpeer->lp_txcredits <= 0) {
                        msg2 = list_entry(txpeer->lp_txq.next,
-                                              lnet_msg_t, msg_list);
+                                             lnet_msg_t, msg_list);
                        list_del(&msg2->msg_list);
 
                        LASSERT(msg2->msg_txpeer == txpeer);
                        LASSERT(msg2->msg_tx_delayed);
 
-                        (void) lnet_post_send_locked(msg2, 1);
-                }
-        }
+                       (void) lnet_post_send_locked(msg2, 1);
+               }
+       }
 
-        if (txpeer != NULL) {
-                msg->msg_txpeer = NULL;
-                lnet_peer_decref_locked(txpeer);
-        }
+       if (txpeer != NULL) {
+               msg->msg_txpeer = NULL;
+               lnet_peer_decref_locked(txpeer);
+       }
 }
 
 void
@@ -1068,7 +1068,7 @@ lnet_return_rx_credits_locked(lnet_msg_t *msg)
 
        if (msg->msg_rtrcredit) {
                /* give back global router credits */
-               lnet_rtrbuf_t     *rb;
+               lnet_rtrbuf_t     *rb;
                lnet_rtrbufpool_t *rbp;
 
                /* NB If a msg ever blocks for a buffer in rbp_msgs, it stays
@@ -1250,12 +1250,12 @@ lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid)
         * but we might want to use pre-determined router for ACK/REPLY
         * in the future */
        /* NB: ni != NULL == interface pre-determined (ACK/REPLY) */
-        LASSERT (msg->msg_txpeer == NULL);
-        LASSERT (!msg->msg_sending);
-        LASSERT (!msg->msg_target_is_router);
-        LASSERT (!msg->msg_receiving);
+       LASSERT(msg->msg_txpeer == NULL);
+       LASSERT(!msg->msg_sending);
+       LASSERT(!msg->msg_target_is_router);
+       LASSERT(!msg->msg_receiving);
 
-        msg->msg_sending = 1;
+       msg->msg_sending = 1;
 
        LASSERT(!msg->msg_tx_committed);
        cpt = lnet_cpt_of_nid(rtr_nid == LNET_NID_ANY ? dst_nid : rtr_nid);
@@ -1273,22 +1273,22 @@ lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid)
                src_ni = lnet_nid2ni_locked(src_nid, cpt);
                if (src_ni == NULL) {
                        lnet_net_unlock(cpt);
-                        LCONSOLE_WARN("Can't send to %s: src %s is not a "
-                                      "local nid\n", libcfs_nid2str(dst_nid),
-                                      libcfs_nid2str(src_nid));
-                        return -EINVAL;
-                }
-                LASSERT (!msg->msg_routing);
-        }
-
-        /* Is this for someone on a local network? */
+                       LCONSOLE_WARN("Can't send to %s: src %s is not a "
+                                     "local nid\n", libcfs_nid2str(dst_nid),
+                                     libcfs_nid2str(src_nid));
+                       return -EINVAL;
+               }
+               LASSERT(!msg->msg_routing);
+       }
+
+       /* Is this for someone on a local network? */
        local_ni = lnet_net2ni_locked(LNET_NIDNET(dst_nid), cpt);
 
-        if (local_ni != NULL) {
-                if (src_ni == NULL) {
-                        src_ni = local_ni;
-                        src_nid = src_ni->ni_nid;
-                } else if (src_ni == local_ni) {
+       if (local_ni != NULL) {
+               if (src_ni == NULL) {
+                       src_ni = local_ni;
+                       src_nid = src_ni->ni_nid;
+               } else if (src_ni == local_ni) {
                        lnet_ni_decref_locked(local_ni, cpt);
                } else {
                        lnet_ni_decref_locked(local_ni, cpt);
@@ -1322,13 +1322,13 @@ lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid)
                lnet_ni_decref_locked(src_ni, cpt);
                if (rc != 0) {
                        lnet_net_unlock(cpt);
-                        LCONSOLE_WARN("Error %d finding peer %s\n", rc,
-                                      libcfs_nid2str(dst_nid));
-                        /* ENOMEM or shutting down */
-                        return rc;
-                }
-                LASSERT (lp->lp_ni == src_ni);
-        } else {
+                       LCONSOLE_WARN("Error %d finding peer %s\n", rc,
+                                     libcfs_nid2str(dst_nid));
+                       /* ENOMEM or shutting down */
+                       return rc;
+               }
+               LASSERT(lp->lp_ni == src_ni);
+       } else {
                /* sending to a remote network */
                lp = lnet_find_route_locked(src_ni, dst_nid, rtr_nid);
                if (lp == NULL) {
@@ -1336,12 +1336,12 @@ lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid)
                                lnet_ni_decref_locked(src_ni, cpt);
                        lnet_net_unlock(cpt);
 
-                        LCONSOLE_WARN("No route to %s via %s "
-                                      "(all routers down)\n",
-                                      libcfs_id2str(msg->msg_target),
-                                      libcfs_nid2str(src_nid));
-                        return -EHOSTUNREACH;
-                }
+                       LCONSOLE_WARN("No route to %s via %s "
+                                     "(all routers down)\n",
+                                     libcfs_id2str(msg->msg_target),
+                                     libcfs_nid2str(src_nid));
+                       return -EHOSTUNREACH;
+               }
 
                /* rtr_nid is LNET_NID_ANY or NID of pre-determined router,
                 * it's possible that rtr_nid isn't LNET_NID_ANY and lp isn't
@@ -1360,15 +1360,15 @@ lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid)
                        }
                }
 
-                CDEBUG(D_NET, "Best route to %s via %s for %s %d\n",
-                       libcfs_nid2str(dst_nid), libcfs_nid2str(lp->lp_nid),
-                       lnet_msgtyp2str(msg->msg_type), msg->msg_len);
+               CDEBUG(D_NET, "Best route to %s via %s for %s %d\n",
+                      libcfs_nid2str(dst_nid), libcfs_nid2str(lp->lp_nid),
+                      lnet_msgtyp2str(msg->msg_type), msg->msg_len);
 
-                if (src_ni == NULL) {
-                        src_ni = lp->lp_ni;
-                        src_nid = src_ni->ni_nid;
-                } else {
-                        LASSERT (src_ni == lp->lp_ni);
+               if (src_ni == NULL) {
+                       src_ni = lp->lp_ni;
+                       src_nid = src_ni->ni_nid;
+               } else {
+                       LASSERT(src_ni == lp->lp_ni);
                        lnet_ni_decref_locked(src_ni, cpt);
                }
 
@@ -1377,32 +1377,32 @@ lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid)
                LASSERT(src_nid != LNET_NID_ANY);
                lnet_msg_commit(msg, cpt);
 
-                if (!msg->msg_routing) {
-                        /* I'm the source and now I know which NI to send on */
-                        msg->msg_hdr.src_nid = cpu_to_le64(src_nid);
-                }
+               if (!msg->msg_routing) {
+                       /* I'm the source and now I know which NI to send on */
+                       msg->msg_hdr.src_nid = cpu_to_le64(src_nid);
+               }
 
-                msg->msg_target_is_router = 1;
-                msg->msg_target.nid = lp->lp_nid;
+               msg->msg_target_is_router = 1;
+               msg->msg_target.nid = lp->lp_nid;
                msg->msg_target.pid = LNET_PID_LUSTRE;
-        }
+       }
 
-        /* 'lp' is our best choice of peer */
+       /* 'lp' is our best choice of peer */
 
-        LASSERT (!msg->msg_peertxcredit);
-        LASSERT (!msg->msg_txcredit);
-        LASSERT (msg->msg_txpeer == NULL);
+       LASSERT(!msg->msg_peertxcredit);
+       LASSERT(!msg->msg_txcredit);
+       LASSERT(msg->msg_txpeer == NULL);
 
-        msg->msg_txpeer = lp;                   /* msg takes my ref on lp */
+       msg->msg_txpeer = lp;                   /* msg takes my ref on lp */
 
-        rc = lnet_post_send_locked(msg, 0);
+       rc = lnet_post_send_locked(msg, 0);
        lnet_net_unlock(cpt);
 
        if (rc < 0)
                return rc;
 
        if (rc == LNET_CREDIT_OK)
-                lnet_ni_send(src_ni, msg);
+               lnet_ni_send(src_ni, msg);
 
        return 0; /* rc == LNET_CREDIT_OK or LNET_CREDIT_WAIT */
 }
@@ -1428,7 +1428,7 @@ lnet_recv_put(lnet_ni_t *ni, lnet_msg_t *msg)
 
        lnet_build_msg_event(msg, LNET_EVENT_PUT);
 
-       /* Must I ACK?  If so I'll grab the ack_wmd out of the header and put
+       /* Must I ACK?  If so I'll grab the ack_wmd out of the header and put
         * it back into the ACK during lnet_finalize() */
        msg->msg_ack = (!lnet_is_wire_handle_none(&hdr->msg.put.ack_wmd) &&
                        (msg->msg_md->md_options & LNET_MD_ACK_DISABLE) == 0);
@@ -1463,15 +1463,15 @@ lnet_parse_put(lnet_ni_t *ni, lnet_msg_t *msg)
 
  again:
        rc = lnet_ptl_match_md(&info, msg);
-        switch (rc) {
-        default:
-                LBUG();
+       switch (rc) {
+       default:
+               LBUG();
 
-        case LNET_MATCHMD_OK:
+       case LNET_MATCHMD_OK:
                lnet_recv_put(ni, msg);
-                return 0;
+               return 0;
 
-        case LNET_MATCHMD_NONE:
+       case LNET_MATCHMD_NONE:
                if (ready_delay)
                        /* no eager_recv or has already called it, should
                         * have been attached on delayed list */
@@ -1534,17 +1534,17 @@ lnet_parse_get(lnet_ni_t *ni, lnet_msg_t *msg, int rdma_get)
        lnet_prep_send(msg, LNET_MSG_REPLY, info.mi_id,
                       msg->msg_offset, msg->msg_wanted);
 
-        msg->msg_hdr.msg.reply.dst_wmd = reply_wmd;
+       msg->msg_hdr.msg.reply.dst_wmd = reply_wmd;
 
-        if (rdma_get) {
-                /* The LND completes the REPLY from her recv procedure */
-                lnet_ni_recv(ni, msg->msg_private, msg, 0,
-                             msg->msg_offset, msg->msg_len, msg->msg_len);
-                return 0;
-        }
+       if (rdma_get) {
+               /* The LND completes the REPLY from her recv procedure */
+               lnet_ni_recv(ni, msg->msg_private, msg, 0,
+                            msg->msg_offset, msg->msg_len, msg->msg_len);
+               return 0;
+       }
 
-        lnet_ni_recv(ni, msg->msg_private, NULL, 0, 0, 0, 0);
-        msg->msg_receiving = 0;
+       lnet_ni_recv(ni, msg->msg_private, NULL, 0, 0, 0, 0);
+       msg->msg_receiving = 0;
 
        rc = lnet_send(ni->ni_nid, msg, LNET_NID_ANY);
        if (rc < 0) {
@@ -1562,56 +1562,56 @@ lnet_parse_get(lnet_ni_t *ni, lnet_msg_t *msg, int rdma_get)
 static int
 lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg)
 {
-        void             *private = msg->msg_private;
-        lnet_hdr_t       *hdr = &msg->msg_hdr;
-        lnet_process_id_t src = {0};
-        lnet_libmd_t     *md;
-        int               rlength;
-        int               mlength;
+       void             *private = msg->msg_private;
+       lnet_hdr_t       *hdr = &msg->msg_hdr;
+       lnet_process_id_t src = {0};
+       lnet_libmd_t     *md;
+       int               rlength;
+       int               mlength;
        int                     cpt;
 
        cpt = lnet_cpt_of_cookie(hdr->msg.reply.dst_wmd.wh_object_cookie);
        lnet_res_lock(cpt);
 
-        src.nid = hdr->src_nid;
-        src.pid = hdr->src_pid;
+       src.nid = hdr->src_nid;
+       src.pid = hdr->src_pid;
 
-        /* NB handles only looked up by creator (no flips) */
-        md = lnet_wire_handle2md(&hdr->msg.reply.dst_wmd);
-        if (md == NULL || md->md_threshold == 0 || md->md_me != NULL) {
-                CNETERR("%s: Dropping REPLY from %s for %s "
+       /* NB handles only looked up by creator (no flips) */
+       md = lnet_wire_handle2md(&hdr->msg.reply.dst_wmd);
+       if (md == NULL || md->md_threshold == 0 || md->md_me != NULL) {
+               CNETERR("%s: Dropping REPLY from %s for %s "
                        "MD %#llx.%#llx\n",
-                        libcfs_nid2str(ni->ni_nid), libcfs_id2str(src),
-                        (md == NULL) ? "invalid" : "inactive",
-                        hdr->msg.reply.dst_wmd.wh_interface_cookie,
-                        hdr->msg.reply.dst_wmd.wh_object_cookie);
-                if (md != NULL && md->md_me != NULL)
-                        CERROR("REPLY MD also attached to portal %d\n",
-                               md->md_me->me_portal);
+                       libcfs_nid2str(ni->ni_nid), libcfs_id2str(src),
+                       (md == NULL) ? "invalid" : "inactive",
+                       hdr->msg.reply.dst_wmd.wh_interface_cookie,
+                       hdr->msg.reply.dst_wmd.wh_object_cookie);
+               if (md != NULL && md->md_me != NULL)
+                       CERROR("REPLY MD also attached to portal %d\n",
+                              md->md_me->me_portal);
 
                lnet_res_unlock(cpt);
                return -ENOENT; /* -ve: OK but no match */
-        }
+       }
 
-        LASSERT (md->md_offset == 0);
+       LASSERT(md->md_offset == 0);
 
-        rlength = hdr->payload_length;
-        mlength = MIN(rlength, (int)md->md_length);
+       rlength = hdr->payload_length;
+       mlength = MIN(rlength, (int)md->md_length);
 
-        if (mlength < rlength &&
-            (md->md_options & LNET_MD_TRUNCATE) == 0) {
-                CNETERR("%s: Dropping REPLY from %s length %d "
+       if (mlength < rlength &&
+           (md->md_options & LNET_MD_TRUNCATE) == 0) {
+               CNETERR("%s: Dropping REPLY from %s length %d "
                        "for MD %#llx would overflow (%d)\n",
-                        libcfs_nid2str(ni->ni_nid), libcfs_id2str(src),
-                        rlength, hdr->msg.reply.dst_wmd.wh_object_cookie,
-                        mlength);
+                       libcfs_nid2str(ni->ni_nid), libcfs_id2str(src),
+                       rlength, hdr->msg.reply.dst_wmd.wh_object_cookie,
+                       mlength);
                lnet_res_unlock(cpt);
                return -ENOENT; /* -ve: OK but no match */
-        }
+       }
 
        CDEBUG(D_NET, "%s: Reply from %s of length %d/%d into md %#llx\n",
               libcfs_nid2str(ni->ni_nid), libcfs_id2str(src),
-               mlength, rlength, hdr->msg.reply.dst_wmd.wh_object_cookie);
+              mlength, rlength, hdr->msg.reply.dst_wmd.wh_object_cookie);
 
        lnet_msg_attach_md(msg, md, 0, mlength);
 
@@ -1629,42 +1629,42 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg)
 static int
 lnet_parse_ack(lnet_ni_t *ni, lnet_msg_t *msg)
 {
-        lnet_hdr_t       *hdr = &msg->msg_hdr;
-        lnet_process_id_t src = {0};
-        lnet_libmd_t     *md;
+       lnet_hdr_t       *hdr = &msg->msg_hdr;
+       lnet_process_id_t src = {0};
+       lnet_libmd_t     *md;
        int                     cpt;
 
-        src.nid = hdr->src_nid;
-        src.pid = hdr->src_pid;
+       src.nid = hdr->src_nid;
+       src.pid = hdr->src_pid;
 
-        /* Convert ack fields to host byte order */
-        hdr->msg.ack.match_bits = le64_to_cpu(hdr->msg.ack.match_bits);
-        hdr->msg.ack.mlength = le32_to_cpu(hdr->msg.ack.mlength);
+       /* Convert ack fields to host byte order */
+       hdr->msg.ack.match_bits = le64_to_cpu(hdr->msg.ack.match_bits);
+       hdr->msg.ack.mlength = le32_to_cpu(hdr->msg.ack.mlength);
 
        cpt = lnet_cpt_of_cookie(hdr->msg.ack.dst_wmd.wh_object_cookie);
        lnet_res_lock(cpt);
 
-        /* NB handles only looked up by creator (no flips) */
-        md = lnet_wire_handle2md(&hdr->msg.ack.dst_wmd);
-        if (md == NULL || md->md_threshold == 0 || md->md_me != NULL) {
-                /* Don't moan; this is expected */
-                CDEBUG(D_NET,
+       /* NB handles only looked up by creator (no flips) */
+       md = lnet_wire_handle2md(&hdr->msg.ack.dst_wmd);
+       if (md == NULL || md->md_threshold == 0 || md->md_me != NULL) {
+               /* Don't moan; this is expected */
+               CDEBUG(D_NET,
                       "%s: Dropping ACK from %s to %s MD %#llx.%#llx\n",
-                       libcfs_nid2str(ni->ni_nid), libcfs_id2str(src),
-                       (md == NULL) ? "invalid" : "inactive",
-                       hdr->msg.ack.dst_wmd.wh_interface_cookie,
-                       hdr->msg.ack.dst_wmd.wh_object_cookie);
-                if (md != NULL && md->md_me != NULL)
-                        CERROR("Source MD also attached to portal %d\n",
-                               md->md_me->me_portal);
+                      libcfs_nid2str(ni->ni_nid), libcfs_id2str(src),
+                      (md == NULL) ? "invalid" : "inactive",
+                      hdr->msg.ack.dst_wmd.wh_interface_cookie,
+                      hdr->msg.ack.dst_wmd.wh_object_cookie);
+               if (md != NULL && md->md_me != NULL)
+                       CERROR("Source MD also attached to portal %d\n",
+                              md->md_me->me_portal);
 
                lnet_res_unlock(cpt);
-               return -ENOENT;                  /* -ve! */
-        }
+               return -ENOENT;                  /* -ve! */
+       }
 
        CDEBUG(D_NET, "%s: ACK from %s into md %#llx\n",
               libcfs_nid2str(ni->ni_nid), libcfs_id2str(src),
-               hdr->msg.ack.dst_wmd.wh_object_cookie);
+              hdr->msg.ack.dst_wmd.wh_object_cookie);
 
        lnet_msg_attach_md(msg, md, 0, 0);
 
@@ -1735,81 +1735,81 @@ lnet_parse_local(lnet_ni_t *ni, lnet_msg_t *msg)
 char *
 lnet_msgtyp2str (int type)
 {
-        switch (type) {
-        case LNET_MSG_ACK:
-                return ("ACK");
-        case LNET_MSG_PUT:
-                return ("PUT");
-        case LNET_MSG_GET:
-                return ("GET");
-        case LNET_MSG_REPLY:
-                return ("REPLY");
-        case LNET_MSG_HELLO:
-                return ("HELLO");
-        default:
-                return ("<UNKNOWN>");
-        }
+       switch (type) {
+       case LNET_MSG_ACK:
+               return ("ACK");
+       case LNET_MSG_PUT:
+               return ("PUT");
+       case LNET_MSG_GET:
+               return ("GET");
+       case LNET_MSG_REPLY:
+               return ("REPLY");
+       case LNET_MSG_HELLO:
+               return ("HELLO");
+       default:
+               return ("<UNKNOWN>");
+       }
 }
 
 void
 lnet_print_hdr(lnet_hdr_t * hdr)
 {
-        lnet_process_id_t src = {0};
-        lnet_process_id_t dst = {0};
-        char *type_str = lnet_msgtyp2str (hdr->type);
+       lnet_process_id_t src = {0};
+       lnet_process_id_t dst = {0};
+       char *type_str = lnet_msgtyp2str(hdr->type);
 
-        src.nid = hdr->src_nid;
-        src.pid = hdr->src_pid;
+       src.nid = hdr->src_nid;
+       src.pid = hdr->src_pid;
 
-        dst.nid = hdr->dest_nid;
-        dst.pid = hdr->dest_pid;
+       dst.nid = hdr->dest_nid;
+       dst.pid = hdr->dest_pid;
 
-        CWARN("P3 Header at %p of type %s\n", hdr, type_str);
-        CWARN("    From %s\n", libcfs_id2str(src));
-        CWARN("    To   %s\n", libcfs_id2str(dst));
+       CWARN("P3 Header at %p of type %s\n", hdr, type_str);
+       CWARN("    From %s\n", libcfs_id2str(src));
+       CWARN("    To   %s\n", libcfs_id2str(dst));
 
-        switch (hdr->type) {
-        default:
-                break;
+       switch (hdr->type) {
+       default:
+               break;
 
-        case LNET_MSG_PUT:
+       case LNET_MSG_PUT:
                CWARN("    Ptl index %d, ack md %#llx.%#llx, "
                      "match bits %llu\n",
-                      hdr->msg.put.ptl_index,
-                      hdr->msg.put.ack_wmd.wh_interface_cookie,
-                      hdr->msg.put.ack_wmd.wh_object_cookie,
-                      hdr->msg.put.match_bits);
+                     hdr->msg.put.ptl_index,
+                     hdr->msg.put.ack_wmd.wh_interface_cookie,
+                     hdr->msg.put.ack_wmd.wh_object_cookie,
+                     hdr->msg.put.match_bits);
                CWARN("    Length %d, offset %d, hdr data %#llx\n",
-                      hdr->payload_length, hdr->msg.put.offset,
-                      hdr->msg.put.hdr_data);
-                break;
+                     hdr->payload_length, hdr->msg.put.offset,
+                     hdr->msg.put.hdr_data);
+               break;
 
-        case LNET_MSG_GET:
+       case LNET_MSG_GET:
                CWARN("    Ptl index %d, return md %#llx.%#llx, "
                      "match bits %llu\n", hdr->msg.get.ptl_index,
-                      hdr->msg.get.return_wmd.wh_interface_cookie,
-                      hdr->msg.get.return_wmd.wh_object_cookie,
-                      hdr->msg.get.match_bits);
-                CWARN("    Length %d, src offset %d\n",
-                      hdr->msg.get.sink_length,
-                      hdr->msg.get.src_offset);
-                break;
-
-        case LNET_MSG_ACK:
+                     hdr->msg.get.return_wmd.wh_interface_cookie,
+                     hdr->msg.get.return_wmd.wh_object_cookie,
+                     hdr->msg.get.match_bits);
+               CWARN("    Length %d, src offset %d\n",
+                     hdr->msg.get.sink_length,
+                     hdr->msg.get.src_offset);
+               break;
+
+       case LNET_MSG_ACK:
                CWARN("    dst md %#llx.%#llx, "
-                      "manipulated length %d\n",
-                      hdr->msg.ack.dst_wmd.wh_interface_cookie,
-                      hdr->msg.ack.dst_wmd.wh_object_cookie,
-                      hdr->msg.ack.mlength);
-                break;
+                     "manipulated length %d\n",
+                     hdr->msg.ack.dst_wmd.wh_interface_cookie,
+                     hdr->msg.ack.dst_wmd.wh_object_cookie,
+                     hdr->msg.ack.mlength);
+               break;
 
-        case LNET_MSG_REPLY:
+       case LNET_MSG_REPLY:
                CWARN("    dst md %#llx.%#llx, "
-                      "length %d\n",
-                      hdr->msg.reply.dst_wmd.wh_interface_cookie,
-                      hdr->msg.reply.dst_wmd.wh_object_cookie,
-                      hdr->payload_length);
-        }
+                     "length %d\n",
+                     hdr->msg.reply.dst_wmd.wh_interface_cookie,
+                     hdr->msg.reply.dst_wmd.wh_object_cookie,
+                     hdr->payload_length);
+       }
 
 }
 
@@ -1824,8 +1824,8 @@ lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid,
        lnet_pid_t     dest_pid;
        lnet_nid_t     dest_nid;
        lnet_nid_t     src_nid;
-       __u32          payload_length;
-       __u32          type;
+       __u32          payload_length;
+       __u32          type;
 
        LASSERT (!in_interrupt ());
 
@@ -2162,7 +2162,7 @@ lnet_recv_delayed_msg_list(struct list_head *head)
  * header. This data is written to an event queue entry at the target if an
  * EQ is present on the matching MD.
  *
- * \retval  0      Success, and only in this case events will be generated
+ * \retval  0     Success, and only in this case events will be generated
  * and logged to EQ (if it exists).
  * \retval -EIO    Simulated failure.
  * \retval -ENOMEM Memory allocation failure.
@@ -2172,9 +2172,9 @@ lnet_recv_delayed_msg_list(struct list_head *head)
  */
 int
 LNetPut(lnet_nid_t self, lnet_handle_md_t mdh, lnet_ack_req_t ack,
-        lnet_process_id_t target, unsigned int portal,
-        __u64 match_bits, unsigned int offset,
-        __u64 hdr_data)
+       lnet_process_id_t target, unsigned int portal,
+       __u64 match_bits, unsigned int offset,
+       __u64 hdr_data)
 {
        struct lnet_msg         *msg;
        struct lnet_libmd       *md;
@@ -2185,30 +2185,30 @@ LNetPut(lnet_nid_t self, lnet_handle_md_t mdh, lnet_ack_req_t ack,
 
        if (!list_empty(&the_lnet.ln_test_peers) &&     /* normally we don't */
            fail_peer(target.nid, 1)) {                 /* shall we now? */
-                CERROR("Dropping PUT to %s: simulated failure\n",
-                       libcfs_id2str(target));
-                return -EIO;
-        }
-
-        msg = lnet_msg_alloc();
-        if (msg == NULL) {
-                CERROR("Dropping PUT to %s: ENOMEM on lnet_msg_t\n",
-                       libcfs_id2str(target));
-                return -ENOMEM;
-        }
+               CERROR("Dropping PUT to %s: simulated failure\n",
+                      libcfs_id2str(target));
+               return -EIO;
+       }
+
+       msg = lnet_msg_alloc();
+       if (msg == NULL) {
+               CERROR("Dropping PUT to %s: ENOMEM on lnet_msg_t\n",
+                      libcfs_id2str(target));
+               return -ENOMEM;
+       }
        msg->msg_vmflush = !!memory_pressure_get();
 
        cpt = lnet_cpt_of_cookie(mdh.cookie);
        lnet_res_lock(cpt);
 
-        md = lnet_handle2md(&mdh);
-        if (md == NULL || md->md_threshold == 0 || md->md_me != NULL) {
+       md = lnet_handle2md(&mdh);
+       if (md == NULL || md->md_threshold == 0 || md->md_me != NULL) {
                CERROR("Dropping PUT (%llu:%d:%s): MD (%d) invalid\n",
-                       match_bits, portal, libcfs_id2str(target),
-                       md == NULL ? -1 : md->md_threshold);
-                if (md != NULL && md->md_me != NULL)
-                        CERROR("Source MD also attached to portal %d\n",
-                               md->md_me->me_portal);
+                      match_bits, portal, libcfs_id2str(target),
+                      md == NULL ? -1 : md->md_threshold);
+               if (md != NULL && md->md_me != NULL)
+                       CERROR("Source MD also attached to portal %d\n",
+                              md->md_me->me_portal);
                lnet_res_unlock(cpt);
 
                lnet_msg_free(msg);
@@ -2219,51 +2219,51 @@ LNetPut(lnet_nid_t self, lnet_handle_md_t mdh, lnet_ack_req_t ack,
 
        lnet_msg_attach_md(msg, md, 0, 0);
 
-        lnet_prep_send(msg, LNET_MSG_PUT, target, 0, md->md_length);
+       lnet_prep_send(msg, LNET_MSG_PUT, target, 0, md->md_length);
 
-        msg->msg_hdr.msg.put.match_bits = cpu_to_le64(match_bits);
-        msg->msg_hdr.msg.put.ptl_index = cpu_to_le32(portal);
-        msg->msg_hdr.msg.put.offset = cpu_to_le32(offset);
-        msg->msg_hdr.msg.put.hdr_data = hdr_data;
+       msg->msg_hdr.msg.put.match_bits = cpu_to_le64(match_bits);
+       msg->msg_hdr.msg.put.ptl_index = cpu_to_le32(portal);
+       msg->msg_hdr.msg.put.offset = cpu_to_le32(offset);
+       msg->msg_hdr.msg.put.hdr_data = hdr_data;
 
-        /* NB handles only looked up by creator (no flips) */
-        if (ack == LNET_ACK_REQ) {
+       /* NB handles only looked up by creator (no flips) */
+       if (ack == LNET_ACK_REQ) {
                msg->msg_hdr.msg.put.ack_wmd.wh_interface_cookie =
-                        the_lnet.ln_interface_cookie;
+                       the_lnet.ln_interface_cookie;
                msg->msg_hdr.msg.put.ack_wmd.wh_object_cookie =
-                        md->md_lh.lh_cookie;
-        } else {
+                       md->md_lh.lh_cookie;
+       } else {
                msg->msg_hdr.msg.put.ack_wmd.wh_interface_cookie =
-                        LNET_WIRE_HANDLE_COOKIE_NONE;
+                       LNET_WIRE_HANDLE_COOKIE_NONE;
                msg->msg_hdr.msg.put.ack_wmd.wh_object_cookie =
-                        LNET_WIRE_HANDLE_COOKIE_NONE;
-        }
+                       LNET_WIRE_HANDLE_COOKIE_NONE;
+       }
 
        lnet_res_unlock(cpt);
 
        lnet_build_msg_event(msg, LNET_EVENT_SEND);
 
        rc = lnet_send(self, msg, LNET_NID_ANY);
-        if (rc != 0) {
-                CNETERR( "Error sending PUT to %s: %d\n",
-                       libcfs_id2str(target), rc);
-                lnet_finalize (NULL, msg, rc);
-        }
-
-        /* completion will be signalled by an event */
-        return 0;
+       if (rc != 0) {
+               CNETERR("Error sending PUT to %s: %d\n",
+                       libcfs_id2str(target), rc);
+               lnet_finalize(NULL, msg, rc);
+       }
+
+       /* completion will be signalled by an event */
+       return 0;
 }
 EXPORT_SYMBOL(LNetPut);
 
 lnet_msg_t *
 lnet_create_reply_msg (lnet_ni_t *ni, lnet_msg_t *getmsg)
 {
-        /* The LND can DMA direct to the GET md (i.e. no REPLY msg).  This
-         * returns a msg for the LND to pass to lnet_finalize() when the sink
-         * data has been received.
-         *
-         * CAVEAT EMPTOR: 'getmsg' is the original GET, which is freed when
-         * lnet_finalize() is called on it, so the LND must call this first */
+       /* The LND can DMA direct to the GET md (i.e. no REPLY msg).  This
+        * returns a msg for the LND to pass to lnet_finalize() when the sink
+        * data has been received.
+        *
+        * CAVEAT EMPTOR: 'getmsg' is the original GET, which is freed when
+        * lnet_finalize() is called on it, so the LND must call this first */
 
        struct lnet_msg         *msg = lnet_msg_alloc();
        struct lnet_libmd       *getmd = getmsg->msg_md;
@@ -2284,10 +2284,10 @@ lnet_create_reply_msg (lnet_ni_t *ni, lnet_msg_t *getmsg)
 
        LASSERT(getmd->md_refcount > 0);
 
-        if (getmd->md_threshold == 0) {
-                CERROR ("%s: Dropping REPLY from %s for inactive MD %p\n",
+       if (getmd->md_threshold == 0) {
+               CERROR("%s: Dropping REPLY from %s for inactive MD %p\n",
                        libcfs_nid2str(ni->ni_nid), libcfs_id2str(peer_id),
-                        getmd);
+                       getmd);
                lnet_res_unlock(cpt);
                goto drop;
        }
@@ -2335,17 +2335,17 @@ EXPORT_SYMBOL(lnet_create_reply_msg);
 void
 lnet_set_reply_msg_len(lnet_ni_t *ni, lnet_msg_t *reply, unsigned int len)
 {
-        /* Set the REPLY length, now the RDMA that elides the REPLY message has
-         * completed and I know it. */
-        LASSERT (reply != NULL);
-        LASSERT (reply->msg_type == LNET_MSG_GET);
-        LASSERT (reply->msg_ev.type == LNET_EVENT_REPLY);
+       /* Set the REPLY length, now the RDMA that elides the REPLY message has
+        * completed and I know it. */
+       LASSERT(reply != NULL);
+       LASSERT(reply->msg_type == LNET_MSG_GET);
+       LASSERT(reply->msg_ev.type == LNET_EVENT_REPLY);
 
-        /* NB I trusted my peer to RDMA.  If she tells me she's written beyond
-         * the end of my buffer, I might as well be dead. */
-        LASSERT (len <= reply->msg_ev.mlength);
+       /* NB I trusted my peer to RDMA.  If she tells me she's written beyond
+        * the end of my buffer, I might as well be dead. */
+       LASSERT(len <= reply->msg_ev.mlength);
 
-        reply->msg_ev.mlength = len;
+       reply->msg_ev.mlength = len;
 }
 EXPORT_SYMBOL(lnet_set_reply_msg_len);
 
@@ -2363,7 +2363,7 @@ EXPORT_SYMBOL(lnet_set_reply_msg_len);
  * \param mdh A handle for the MD that describes the memory into which the
  * requested data will be received. The MD must be "free floating" (See LNetMDBind()).
  *
- * \retval  0      Success, and only in this case events will be generated
+ * \retval  0     Success, and only in this case events will be generated
  * and logged to EQ (if it exists) of the MD.
  * \retval -EIO    Simulated failure.
  * \retval -ENOMEM Memory allocation failure.
@@ -2379,53 +2379,53 @@ LNetGet(lnet_nid_t self, lnet_handle_md_t mdh,
        int                     cpt;
        int                     rc;
 
-        LASSERT (the_lnet.ln_refcount > 0);
+       LASSERT(the_lnet.ln_refcount > 0);
 
        if (!list_empty(&the_lnet.ln_test_peers) &&     /* normally we don't */
            fail_peer(target.nid, 1))                   /* shall we now? */
-        {
-                CERROR("Dropping GET to %s: simulated failure\n",
-                       libcfs_id2str(target));
-                return -EIO;
-        }
-
-        msg = lnet_msg_alloc();
-        if (msg == NULL) {
-                CERROR("Dropping GET to %s: ENOMEM on lnet_msg_t\n",
-                       libcfs_id2str(target));
-