4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2012, 2014, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lnet/include/lnet/lib-lnet.h
38 * Top level include for library side routines
41 #ifndef __LNET_LIB_LNET_H__
42 #define __LNET_LIB_LNET_H__
44 #include <libcfs/libcfs.h>
45 #include <lnet/types.h>
46 #include <lnet/lnet.h>
47 #include <lnet/lib-types.h>
48 #include <lnet/lib-dlc.h>
50 extern lnet_t the_lnet; /* THE network */
52 #if (BITS_PER_LONG == 32)
53 /* 2 CPTs, allowing more CPTs might make us under memory pressure */
54 # define LNET_CPT_MAX_BITS 1
56 #else /* 64-bit system */
58 * 256 CPTs for thousands of CPUs, allowing more CPTs might make us
59 * under risk of consuming all lh_cookie.
61 # define LNET_CPT_MAX_BITS 8
62 #endif /* BITS_PER_LONG == 32 */
64 /* max allowed CPT number */
65 #define LNET_CPT_MAX (1 << LNET_CPT_MAX_BITS)
67 #define LNET_CPT_NUMBER (the_lnet.ln_cpt_number)
68 #define LNET_CPT_BITS (the_lnet.ln_cpt_bits)
69 #define LNET_CPT_MASK ((1ULL << LNET_CPT_BITS) - 1)
72 #define LNET_LOCK_EX CFS_PERCPT_LOCK_EX
74 static inline int lnet_is_route_alive(lnet_route_t *route)
76 if (!route->lr_gateway->lp_alive)
77 return 0; /* gateway is down */
78 if ((route->lr_gateway->lp_ping_feats &
79 LNET_PING_FEAT_NI_STATUS) == 0)
80 return 1; /* no NI status, assume it's alive */
81 /* has NI status, check # down NIs */
82 return route->lr_downis == 0;
85 static inline int lnet_is_wire_handle_none (lnet_handle_wire_t *wh)
87 return (wh->wh_interface_cookie == LNET_WIRE_HANDLE_COOKIE_NONE &&
88 wh->wh_object_cookie == LNET_WIRE_HANDLE_COOKIE_NONE);
91 static inline int lnet_md_exhausted (lnet_libmd_t *md)
93 return (md->md_threshold == 0 ||
94 ((md->md_options & LNET_MD_MAX_SIZE) != 0 &&
95 md->md_offset + md->md_max_size > md->md_length));
98 static inline int lnet_md_unlinkable (lnet_libmd_t *md)
100 /* Should unlink md when its refcount is 0 and either:
101 * - md has been flagged for deletion (by auto unlink or LNetM[DE]Unlink,
102 * in the latter case md may not be exhausted).
103 * - auto unlink is on and md is exhausted.
105 if (md->md_refcount != 0)
108 if ((md->md_flags & LNET_MD_FLAG_ZOMBIE) != 0)
111 return ((md->md_flags & LNET_MD_FLAG_AUTO_UNLINK) != 0 &&
112 lnet_md_exhausted(md));
115 #define lnet_cpt_table() (the_lnet.ln_cpt_table)
116 #define lnet_cpt_current() cfs_cpt_current(the_lnet.ln_cpt_table, 1)
119 lnet_cpt_of_cookie(__u64 cookie)
121 unsigned int cpt = (cookie >> LNET_COOKIE_TYPE_BITS) & LNET_CPT_MASK;
123 /* LNET_CPT_NUMBER doesn't have to be power2, which means we can
124 * get illegal cpt from it's invalid cookie */
125 return cpt < LNET_CPT_NUMBER ? cpt : cpt % LNET_CPT_NUMBER;
129 lnet_res_lock(int cpt)
131 cfs_percpt_lock(the_lnet.ln_res_lock, cpt);
135 lnet_res_unlock(int cpt)
137 cfs_percpt_unlock(the_lnet.ln_res_lock, cpt);
141 lnet_res_lock_current(void)
143 int cpt = lnet_cpt_current();
150 lnet_net_lock(int cpt)
152 cfs_percpt_lock(the_lnet.ln_net_lock, cpt);
156 lnet_net_unlock(int cpt)
158 cfs_percpt_unlock(the_lnet.ln_net_lock, cpt);
162 lnet_net_lock_current(void)
164 int cpt = lnet_cpt_current();
170 #define LNET_LOCK() lnet_net_lock(LNET_LOCK_EX)
171 #define LNET_UNLOCK() lnet_net_unlock(LNET_LOCK_EX)
173 #define lnet_ptl_lock(ptl) spin_lock(&(ptl)->ptl_lock)
174 #define lnet_ptl_unlock(ptl) spin_unlock(&(ptl)->ptl_lock)
175 #define lnet_eq_wait_lock() spin_lock(&the_lnet.ln_eq_wait_lock)
176 #define lnet_eq_wait_unlock() spin_unlock(&the_lnet.ln_eq_wait_lock)
177 #define lnet_ni_lock(ni) spin_lock(&(ni)->ni_lock)
178 #define lnet_ni_unlock(ni) spin_unlock(&(ni)->ni_lock)
179 #define LNET_MUTEX_LOCK(m) mutex_lock(m)
180 #define LNET_MUTEX_UNLOCK(m) mutex_unlock(m)
182 #define MAX_PORTALS 64
184 static inline lnet_eq_t *
189 LIBCFS_ALLOC(eq, sizeof(*eq));
194 lnet_eq_free(lnet_eq_t *eq)
196 LIBCFS_FREE(eq, sizeof(*eq));
199 static inline lnet_libmd_t *
200 lnet_md_alloc (lnet_md_t *umd)
206 if ((umd->options & LNET_MD_KIOV) != 0) {
208 size = offsetof(lnet_libmd_t, md_iov.kiov[niov]);
210 niov = ((umd->options & LNET_MD_IOVEC) != 0) ?
212 size = offsetof(lnet_libmd_t, md_iov.iov[niov]);
215 LIBCFS_ALLOC(md, size);
218 /* Set here in case of early free */
219 md->md_options = umd->options;
221 INIT_LIST_HEAD(&md->md_list);
228 lnet_md_free(lnet_libmd_t *md)
232 if ((md->md_options & LNET_MD_KIOV) != 0)
233 size = offsetof(lnet_libmd_t, md_iov.kiov[md->md_niov]);
235 size = offsetof(lnet_libmd_t, md_iov.iov[md->md_niov]);
237 LIBCFS_FREE(md, size);
240 static inline lnet_me_t *
245 LIBCFS_ALLOC(me, sizeof(*me));
250 lnet_me_free(lnet_me_t *me)
252 LIBCFS_FREE(me, sizeof(*me));
255 static inline lnet_msg_t *
260 LIBCFS_ALLOC(msg, sizeof(*msg));
262 /* no need to zero, LIBCFS_ALLOC does for us */
267 lnet_msg_free(lnet_msg_t *msg)
269 LASSERT(!msg->msg_onactivelist);
270 LIBCFS_FREE(msg, sizeof(*msg));
273 lnet_libhandle_t *lnet_res_lh_lookup(struct lnet_res_container *rec,
275 void lnet_res_lh_initialize(struct lnet_res_container *rec,
276 lnet_libhandle_t *lh);
278 lnet_res_lh_invalidate(lnet_libhandle_t *lh)
280 /* ALWAYS called with resource lock held */
281 /* NB: cookie is still useful, don't reset it */
282 list_del(&lh->lh_hash_chain);
286 lnet_eq2handle (lnet_handle_eq_t *handle, lnet_eq_t *eq)
289 LNetInvalidateHandle(handle);
293 handle->cookie = eq->eq_lh.lh_cookie;
296 static inline lnet_eq_t *
297 lnet_handle2eq(lnet_handle_eq_t *handle)
299 /* ALWAYS called with resource lock held */
300 lnet_libhandle_t *lh;
302 lh = lnet_res_lh_lookup(&the_lnet.ln_eq_container, handle->cookie);
306 return lh_entry(lh, lnet_eq_t, eq_lh);
310 lnet_md2handle (lnet_handle_md_t *handle, lnet_libmd_t *md)
312 handle->cookie = md->md_lh.lh_cookie;
315 static inline lnet_libmd_t *
316 lnet_handle2md(lnet_handle_md_t *handle)
318 /* ALWAYS called with resource lock held */
319 lnet_libhandle_t *lh;
322 cpt = lnet_cpt_of_cookie(handle->cookie);
323 lh = lnet_res_lh_lookup(the_lnet.ln_md_containers[cpt],
328 return lh_entry(lh, lnet_libmd_t, md_lh);
331 static inline lnet_libmd_t *
332 lnet_wire_handle2md(lnet_handle_wire_t *wh)
334 /* ALWAYS called with resource lock held */
335 lnet_libhandle_t *lh;
338 if (wh->wh_interface_cookie != the_lnet.ln_interface_cookie)
341 cpt = lnet_cpt_of_cookie(wh->wh_object_cookie);
342 lh = lnet_res_lh_lookup(the_lnet.ln_md_containers[cpt],
343 wh->wh_object_cookie);
347 return lh_entry(lh, lnet_libmd_t, md_lh);
351 lnet_me2handle (lnet_handle_me_t *handle, lnet_me_t *me)
353 handle->cookie = me->me_lh.lh_cookie;
356 static inline lnet_me_t *
357 lnet_handle2me(lnet_handle_me_t *handle)
359 /* ALWAYS called with resource lock held */
360 lnet_libhandle_t *lh;
363 cpt = lnet_cpt_of_cookie(handle->cookie);
364 lh = lnet_res_lh_lookup(the_lnet.ln_me_containers[cpt],
369 return lh_entry(lh, lnet_me_t, me_lh);
373 lnet_peer_addref_locked(lnet_peer_t *lp)
375 LASSERT (lp->lp_refcount > 0);
379 extern void lnet_destroy_peer_locked(lnet_peer_t *lp);
382 lnet_peer_decref_locked(lnet_peer_t *lp)
384 LASSERT (lp->lp_refcount > 0);
386 if (lp->lp_refcount == 0)
387 lnet_destroy_peer_locked(lp);
391 lnet_isrouter(lnet_peer_t *lp)
393 return lp->lp_rtr_refcount != 0;
397 lnet_ni_addref_locked(lnet_ni_t *ni, int cpt)
399 LASSERT(cpt >= 0 && cpt < LNET_CPT_NUMBER);
400 LASSERT(*ni->ni_refs[cpt] >= 0);
402 (*ni->ni_refs[cpt])++;
406 lnet_ni_addref(lnet_ni_t *ni)
409 lnet_ni_addref_locked(ni, 0);
414 lnet_ni_decref_locked(lnet_ni_t *ni, int cpt)
416 LASSERT(cpt >= 0 && cpt < LNET_CPT_NUMBER);
417 LASSERT(*ni->ni_refs[cpt] > 0);
419 (*ni->ni_refs[cpt])--;
423 lnet_ni_decref(lnet_ni_t *ni)
426 lnet_ni_decref_locked(ni, 0);
430 void lnet_ni_free(lnet_ni_t *ni);
432 lnet_ni_alloc(__u32 net, struct cfs_expr_list *el, struct list_head *nilist);
435 lnet_nid2peerhash(lnet_nid_t nid)
437 return hash_long(nid, LNET_PEER_HASH_BITS);
440 static inline struct list_head *
441 lnet_net2rnethash(__u32 net)
443 return &the_lnet.ln_remote_nets_hash[(LNET_NETNUM(net) +
445 ((1U << the_lnet.ln_remote_nets_hbits) - 1)];
448 extern lnd_t the_lolnd;
449 extern int avoid_asym_router_failure;
451 extern int lnet_cpt_of_nid_locked(lnet_nid_t nid);
452 extern int lnet_cpt_of_nid(lnet_nid_t nid);
453 extern lnet_ni_t *lnet_nid2ni_locked(lnet_nid_t nid, int cpt);
454 extern lnet_ni_t *lnet_net2ni_locked(__u32 net, int cpt);
455 extern lnet_ni_t *lnet_net2ni(__u32 net);
458 void lnet_fini(void);
460 extern int portal_rotor;
462 int lnet_notify(lnet_ni_t *ni, lnet_nid_t peer, int alive, cfs_time_t when);
463 void lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, cfs_time_t when);
464 int lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway_nid,
465 unsigned int priority);
466 int lnet_check_routes(void);
467 int lnet_del_route(__u32 net, lnet_nid_t gw_nid);
468 void lnet_destroy_routes(void);
469 int lnet_get_route(int idx, __u32 *net, __u32 *hops,
470 lnet_nid_t *gateway, __u32 *alive, __u32 *priority);
471 int lnet_get_net_config(int idx,
475 int *peer_tx_credits,
478 struct lnet_ioctl_net_config *net_config);
479 int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg);
481 void lnet_proc_init(void);
482 void lnet_proc_fini(void);
483 int lnet_rtrpools_alloc(int im_a_router);
484 void lnet_destroy_rtrbuf(lnet_rtrbuf_t *rb, int npages);
485 int lnet_rtrpools_adjust(int tiny, int small, int large);
486 int lnet_rtrpools_enable(void);
487 void lnet_rtrpools_disable(void);
488 void lnet_rtrpools_free(int keep_pools);
489 lnet_remotenet_t *lnet_find_net_locked (__u32 net);
490 int lnet_dyn_add_ni(lnet_pid_t requested_pid, char *nets,
491 __s32 peer_timeout, __s32 peer_cr, __s32 peer_buf_cr,
493 int lnet_dyn_del_ni(__u32 net);
495 int lnet_islocalnid(lnet_nid_t nid);
496 int lnet_islocalnet(__u32 net);
498 void lnet_msg_attach_md(lnet_msg_t *msg, lnet_libmd_t *md,
499 unsigned int offset, unsigned int mlen);
500 void lnet_msg_detach_md(lnet_msg_t *msg, int status);
501 void lnet_build_unlink_event(lnet_libmd_t *md, lnet_event_t *ev);
502 void lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type);
503 void lnet_msg_commit(lnet_msg_t *msg, int cpt);
504 void lnet_msg_decommit(lnet_msg_t *msg, int cpt, int status);
506 void lnet_eq_enqueue_event(lnet_eq_t *eq, lnet_event_t *ev);
507 void lnet_prep_send(lnet_msg_t *msg, int type, lnet_process_id_t target,
508 unsigned int offset, unsigned int len);
509 int lnet_send(lnet_nid_t nid, lnet_msg_t *msg, lnet_nid_t rtr_nid);
510 void lnet_return_tx_credits_locked(lnet_msg_t *msg);
511 void lnet_return_rx_credits_locked(lnet_msg_t *msg);
512 void lnet_schedule_blocked_locked(lnet_rtrbufpool_t *rbp);
513 void lnet_drop_routed_msgs_locked(struct list_head *list, int cpt);
515 /* portals functions */
516 /* portals attributes */
518 lnet_ptl_is_lazy(lnet_portal_t *ptl)
520 return !!(ptl->ptl_options & LNET_PTL_LAZY);
524 lnet_ptl_is_unique(lnet_portal_t *ptl)
526 return !!(ptl->ptl_options & LNET_PTL_MATCH_UNIQUE);
530 lnet_ptl_is_wildcard(lnet_portal_t *ptl)
532 return !!(ptl->ptl_options & LNET_PTL_MATCH_WILDCARD);
536 lnet_ptl_setopt(lnet_portal_t *ptl, int opt)
538 ptl->ptl_options |= opt;
542 lnet_ptl_unsetopt(lnet_portal_t *ptl, int opt)
544 ptl->ptl_options &= ~opt;
547 /* match-table functions */
548 struct list_head *lnet_mt_match_head(struct lnet_match_table *mtable,
549 lnet_process_id_t id, __u64 mbits);
550 struct lnet_match_table *lnet_mt_of_attach(unsigned int index,
551 lnet_process_id_t id, __u64 mbits,
554 int lnet_mt_match_md(struct lnet_match_table *mtable,
555 struct lnet_match_info *info, struct lnet_msg *msg);
557 /* portals match/attach functions */
558 void lnet_ptl_attach_md(lnet_me_t *me, lnet_libmd_t *md,
559 struct list_head *matches, struct list_head *drops);
560 void lnet_ptl_detach_md(lnet_me_t *me, lnet_libmd_t *md);
561 int lnet_ptl_match_md(struct lnet_match_info *info, struct lnet_msg *msg);
563 /* initialized and finalize portals */
564 int lnet_portals_create(void);
565 void lnet_portals_destroy(void);
567 /* message functions */
568 int lnet_parse (lnet_ni_t *ni, lnet_hdr_t *hdr,
569 lnet_nid_t fromnid, void *private, int rdma_req);
570 int lnet_parse_local(lnet_ni_t *ni, lnet_msg_t *msg);
571 int lnet_parse_forward_locked(lnet_ni_t *ni, lnet_msg_t *msg);
573 void lnet_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed,
574 unsigned int offset, unsigned int mlen, unsigned int rlen);
575 void lnet_ni_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg,
576 int delayed, unsigned int offset,
577 unsigned int mlen, unsigned int rlen);
579 lnet_msg_t *lnet_create_reply_msg (lnet_ni_t *ni, lnet_msg_t *get_msg);
580 void lnet_set_reply_msg_len(lnet_ni_t *ni, lnet_msg_t *msg, unsigned int len);
582 void lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int rc);
584 void lnet_drop_message(lnet_ni_t *ni, int cpt, void *private,
586 void lnet_drop_delayed_msg_list(struct list_head *head, char *reason);
587 void lnet_recv_delayed_msg_list(struct list_head *head);
589 int lnet_msg_container_setup(struct lnet_msg_container *container, int cpt);
590 void lnet_msg_container_cleanup(struct lnet_msg_container *container);
591 void lnet_msg_containers_destroy(void);
592 int lnet_msg_containers_create(void);
594 char *lnet_msgtyp2str (int type);
595 void lnet_print_hdr (lnet_hdr_t * hdr);
596 int lnet_fail_nid(lnet_nid_t nid, unsigned int threshold);
598 /** \addtogroup lnet_fault_simulation @{ */
600 int lnet_fault_ctl(int cmd, struct libcfs_ioctl_data *data);
601 int lnet_fault_init(void);
602 void lnet_fault_fini(void);
604 bool lnet_drop_rule_match(lnet_hdr_t *hdr);
606 int lnet_delay_rule_add(struct lnet_fault_attr *attr);
607 int lnet_delay_rule_del(lnet_nid_t src, lnet_nid_t dst, bool shutdown);
608 int lnet_delay_rule_list(int pos, struct lnet_fault_attr *attr,
609 struct lnet_fault_stat *stat);
610 void lnet_delay_rule_reset(void);
611 void lnet_delay_rule_check(void);
612 bool lnet_delay_rule_match_locked(lnet_hdr_t *hdr, struct lnet_msg *msg);
614 /** @} lnet_fault_simulation */
616 void lnet_counters_get(lnet_counters_t *counters);
617 void lnet_counters_reset(void);
619 unsigned int lnet_iov_nob (unsigned int niov, struct iovec *iov);
620 int lnet_extract_iov (int dst_niov, struct iovec *dst,
621 int src_niov, struct iovec *src,
622 unsigned int offset, unsigned int len);
624 unsigned int lnet_kiov_nob (unsigned int niov, lnet_kiov_t *iov);
625 int lnet_extract_kiov (int dst_niov, lnet_kiov_t *dst,
626 int src_niov, lnet_kiov_t *src,
627 unsigned int offset, unsigned int len);
629 void lnet_copy_iov2iov (unsigned int ndiov, struct iovec *diov,
630 unsigned int doffset,
631 unsigned int nsiov, struct iovec *siov,
632 unsigned int soffset, unsigned int nob);
633 void lnet_copy_kiov2iov (unsigned int niov, struct iovec *iov,
634 unsigned int iovoffset,
635 unsigned int nkiov, lnet_kiov_t *kiov,
636 unsigned int kiovoffset, unsigned int nob);
637 void lnet_copy_iov2kiov (unsigned int nkiov, lnet_kiov_t *kiov,
638 unsigned int kiovoffset,
639 unsigned int niov, struct iovec *iov,
640 unsigned int iovoffset, unsigned int nob);
641 void lnet_copy_kiov2kiov (unsigned int ndkiov, lnet_kiov_t *dkiov,
642 unsigned int doffset,
643 unsigned int nskiov, lnet_kiov_t *skiov,
644 unsigned int soffset, unsigned int nob);
647 lnet_copy_iov2flat(int dlen, __user void *dest, unsigned int doffset,
648 unsigned int nsiov, struct iovec *siov, unsigned int soffset,
651 struct iovec diov = {/*.iov_base = */ dest, /*.iov_len = */ dlen};
653 lnet_copy_iov2iov(1, &diov, doffset,
654 nsiov, siov, soffset, nob);
658 lnet_copy_kiov2flat(int dlen, void __user *dest, unsigned int doffset,
659 unsigned int nsiov, lnet_kiov_t *skiov,
660 unsigned int soffset, unsigned int nob)
662 struct iovec diov = {/* .iov_base = */ dest, /* .iov_len = */ dlen};
664 lnet_copy_kiov2iov(1, &diov, doffset,
665 nsiov, skiov, soffset, nob);
669 lnet_copy_flat2iov(unsigned int ndiov, struct iovec *diov, unsigned int doffset,
670 int slen, void __user *src, unsigned int soffset,
673 struct iovec siov = {/*.iov_base = */ src, /*.iov_len = */slen};
674 lnet_copy_iov2iov(ndiov, diov, doffset,
675 1, &siov, soffset, nob);
679 lnet_copy_flat2kiov(unsigned int ndiov, lnet_kiov_t *dkiov,
680 unsigned int doffset, int slen, void __user *src,
681 unsigned int soffset, unsigned int nob)
683 struct iovec siov = {/* .iov_base = */ src, /* .iov_len = */ slen};
684 lnet_copy_iov2kiov(ndiov, dkiov, doffset,
685 1, &siov, soffset, nob);
688 void lnet_me_unlink(lnet_me_t *me);
690 void lnet_md_unlink(lnet_libmd_t *md);
691 void lnet_md_deconstruct(lnet_libmd_t *lmd, lnet_md_t *umd);
693 void lnet_register_lnd(lnd_t *lnd);
694 void lnet_unregister_lnd(lnd_t *lnd);
695 int lnet_set_ip_niaddr (lnet_ni_t *ni);
697 int lnet_connect(cfs_socket_t **sockp, lnet_nid_t peer_nid,
698 __u32 local_ip, __u32 peer_ip, int peer_port);
699 void lnet_connect_console_error(int rc, lnet_nid_t peer_nid,
700 __u32 peer_ip, int port);
701 int lnet_count_acceptor_nis(void);
702 int lnet_acceptor_timeout(void);
703 int lnet_acceptor_port(void);
704 int lnet_acceptor_start(void);
705 void lnet_acceptor_stop(void);
707 int lnet_peers_start_down(void);
708 int lnet_peer_buffer_credits(lnet_ni_t *ni);
710 int lnet_router_checker_start(void);
711 void lnet_router_checker_stop(void);
712 void lnet_router_ni_update_locked(lnet_peer_t *gw, __u32 net);
713 void lnet_swap_pinginfo(lnet_ping_info_t *info);
715 int lnet_parse_ip2nets(char **networksp, char *ip2nets);
716 int lnet_parse_routes(char *route_str, int *im_a_router);
717 int lnet_parse_networks(struct list_head *nilist, char *networks);
718 int lnet_net_unique(__u32 net, struct list_head *nilist);
720 int lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt);
721 lnet_peer_t *lnet_find_peer_locked(struct lnet_peer_table *ptable,
723 void lnet_peer_tables_cleanup(lnet_ni_t *ni);
724 void lnet_peer_tables_destroy(void);
725 int lnet_peer_tables_create(void);
726 void lnet_debug_peer(lnet_nid_t nid);
727 int lnet_get_peer_info(__u32 peer_index, __u64 *nid,
728 char alivness[LNET_MAX_STR_LEN],
729 __u32 *cpt_iter, __u32 *refcount,
730 __u32 *ni_peer_tx_credits, __u32 *peer_tx_credits,
731 __u32 *peer_rtr_credits, __u32 *peer_min_rtr_credtis,
732 __u32 *peer_tx_qnob);
735 lnet_peer_set_alive(lnet_peer_t *lp)
737 lp->lp_last_alive = lp->lp_last_query = cfs_time_current();
739 lnet_notify_locked(lp, 0, 1, lp->lp_last_alive);