Whamcloud - gitweb
LU-13265 lnet: Modify push MD to have single threshold
[fs/lustre-release.git] / lnet / include / lnet / lib-lnet.h
index 059a5b4..602bf46 100644 (file)
@@ -273,28 +273,6 @@ lnet_md_free(struct lnet_libmd *md)
        }
 }
 
-static inline struct lnet_me *
-lnet_me_alloc (void)
-{
-       struct lnet_me *me;
-
-       me = kmem_cache_alloc(lnet_mes_cachep, GFP_NOFS | __GFP_ZERO);
-
-       if (me)
-               CDEBUG(D_MALLOC, "slab-alloced 'me' at %p.\n", me);
-       else
-               CDEBUG(D_MALLOC, "failed to allocate 'me'\n");
-
-       return me;
-}
-
-static inline void
-lnet_me_free(struct lnet_me *me)
-{
-       CDEBUG(D_MALLOC, "slab-freed 'me' at %p.\n", me);
-       kmem_cache_free(lnet_mes_cachep, me);
-}
-
 struct lnet_libhandle *lnet_res_lh_lookup(struct lnet_res_container *rec,
                                     __u64 cookie);
 void lnet_res_lh_initialize(struct lnet_res_container *rec,
@@ -308,30 +286,6 @@ lnet_res_lh_invalidate(struct lnet_libhandle *lh)
 }
 
 static inline void
-lnet_eq2handle(struct lnet_handle_eq *handle, struct lnet_eq *eq)
-{
-       if (eq == NULL) {
-               LNetInvalidateEQHandle(handle);
-               return;
-       }
-
-       handle->cookie = eq->eq_lh.lh_cookie;
-}
-
-static inline struct lnet_eq *
-lnet_handle2eq(struct lnet_handle_eq *handle)
-{
-       /* ALWAYS called with resource lock held */
-       struct lnet_libhandle *lh;
-
-       lh = lnet_res_lh_lookup(&the_lnet.ln_eq_container, handle->cookie);
-       if (lh == NULL)
-               return NULL;
-
-       return lh_entry(lh, struct lnet_eq, eq_lh);
-}
-
-static inline void
 lnet_md2handle(struct lnet_handle_md *handle, struct lnet_libmd *md)
 {
        handle->cookie = md->md_lh.lh_cookie;
@@ -617,7 +571,7 @@ void lnet_prep_send(struct lnet_msg *msg, int type,
                    unsigned int len);
 int lnet_send(lnet_nid_t nid, struct lnet_msg *msg, lnet_nid_t rtr_nid);
 int lnet_send_ping(lnet_nid_t dest_nid, struct lnet_handle_md *mdh, int nnis,
-                  void *user_ptr, struct lnet_handle_eq eqh, bool recovery);
+                  void *user_ptr, struct lnet_eq *eq, bool recovery);
 void lnet_return_tx_credits_locked(struct lnet_msg *msg);
 void lnet_return_rx_credits_locked(struct lnet_msg *msg);
 void lnet_schedule_blocked_locked(struct lnet_rtrbufpool *rbp);
@@ -887,6 +841,8 @@ static inline int lnet_push_target_resize_needed(void)
 }
 
 int lnet_push_target_resize(void);
+int lnet_push_target_post(struct lnet_ping_buffer *pbuf,
+                         struct lnet_handle_md *mdh);
 void lnet_peer_push_event(struct lnet_event *ev);
 
 int lnet_parse_ip2nets(char **networksp, char *ip2nets);
@@ -1013,9 +969,37 @@ lnet_is_peer_ni_alive(struct lnet_peer_ni *lpni)
 }
 
 static inline void
-lnet_set_healthv(atomic_t *healthv, int value)
+lnet_update_peer_net_healthv(struct lnet_peer_ni *lpni)
+{
+       struct lnet_peer_net *lpn;
+       int best_healthv = 0;
+
+       lpn = lpni->lpni_peer_net;
+
+       list_for_each_entry(lpni, &lpn->lpn_peer_nis, lpni_peer_nis) {
+               int lpni_healthv = atomic_read(&lpni->lpni_healthv);
+               if (best_healthv < lpni_healthv)
+                       best_healthv = lpni_healthv;
+       }
+
+       lpn->lpn_healthv = best_healthv;
+}
+
+static inline void
+lnet_set_lpni_healthv_locked(struct lnet_peer_ni *lpni, int value)
+{
+       if (atomic_read(&lpni->lpni_healthv) == value)
+               return;
+       atomic_set(&lpni->lpni_healthv, value);
+       lnet_update_peer_net_healthv(lpni);
+}
+
+static inline void
+lnet_inc_lpni_healthv_locked(struct lnet_peer_ni *lpni)
 {
-       atomic_set(healthv, value);
+       /* only adjust the net health if the lpni health value changed */
+       if (atomic_add_unless(&lpni->lpni_healthv, 1, LNET_MAX_HEALTH_VALUE))
+               lnet_update_peer_net_healthv(lpni);
 }
 
 static inline void