Whamcloud - gitweb
LU-9120 lnet: add health value per ni
[fs/lustre-release.git] / lnet / include / lnet / lib-types.h
index cd875a6..7528c3c 100644 (file)
 #include <uapi/linux/lnet/lnetctl.h>
 
 /* Max payload size */
-#ifndef CONFIG_LNET_MAX_PAYLOAD
-# error "CONFIG_LNET_MAX_PAYLOAD must be defined in config.h"
-#endif
+#define LNET_MAX_PAYLOAD       LNET_MTU
 
-#define LNET_MAX_PAYLOAD       CONFIG_LNET_MAX_PAYLOAD
-#if (LNET_MAX_PAYLOAD < LNET_MTU)
-# error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb"
-#elif (LNET_MAX_PAYLOAD > (PAGE_SIZE * LNET_MAX_IOV))
-# error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb"
-#endif
+#define LNET_MAX_IOV           (LNET_MAX_PAYLOAD >> PAGE_SHIFT)
+
+/*
+ * This is the maximum health value.
+ * All local and peer NIs created have their health default to this value.
+ */
+#define LNET_MAX_HEALTH_VALUE 1000
 
 /* forward refs */
 struct lnet_libmd;
@@ -258,7 +257,7 @@ struct lnet_lnd {
        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);
+       void (*lnd_query)(struct lnet_ni *ni, lnet_nid_t peer, time64_t *when);
 
        /* accept a new connection */
        int (*lnd_accept)(struct lnet_ni *ni, struct socket *sock);
@@ -390,7 +389,7 @@ struct lnet_ni {
        int                     **ni_refs;
 
        /* when I was last alive */
-       long                    ni_last_alive;
+       time64_t                ni_last_alive;
 
        /* pointer to parent network */
        struct lnet_net         *ni_net;
@@ -417,6 +416,15 @@ struct lnet_ni {
        __u32                   ni_seq;
 
        /*
+        * health value
+        *      initialized to LNET_MAX_HEALTH_VALUE
+        * Value is decremented every time we fail to send a message over
+        * this NI because of a NI specific failure.
+        * Value is incremented if we successfully send a message.
+        */
+       atomic_t                ni_healthv;
+
+       /*
         * equivalent interfaces to use
         * This is an array because socklnd bonding can still be configured
         */
@@ -498,15 +506,15 @@ struct lnet_peer_ni {
        /* # times router went dead<->alive. Protected with lpni_lock */
        int                     lpni_alive_count;
        /* time of last aliveness news */
-       cfs_time_t              lpni_timestamp;
+       time64_t                lpni_timestamp;
        /* time of last ping attempt */
-       cfs_time_t              lpni_ping_timestamp;
+       time64_t                lpni_ping_timestamp;
        /* != 0 if ping reply expected */
-       cfs_time_t              lpni_ping_deadline;
+       time64_t                lpni_ping_deadline;
        /* when I was last alive */
-       cfs_time_t              lpni_last_alive;
+       time64_t                lpni_last_alive;
        /* when lpni_ni was queried last time */
-       cfs_time_t              lpni_last_query;
+       time64_t                lpni_last_query;
        /* network peer is on */
        struct lnet_net         *lpni_net;
        /* peer's NID */