-int lnet_get_peer_info(__u32 peer_index, __u64 *nid,
- char alivness[LNET_MAX_STR_LEN],
- __u32 *cpt_iter, __u32 *refcount,
- __u32 *ni_peer_tx_credits, __u32 *peer_tx_credits,
- __u32 *peer_rtr_credits, __u32 *peer_min_rtr_credtis,
- __u32 *peer_tx_qnob);
+struct lnet_peer_net *lnet_peer_get_net_locked(struct lnet_peer *peer,
+ __u32 net_id);
+bool lnet_peer_is_ni_pref_locked(struct lnet_peer_ni *lpni,
+ struct lnet_ni *ni);
+int lnet_add_peer_ni_to_peer(lnet_nid_t key_nid, lnet_nid_t nid, bool mr);
+int lnet_del_peer_ni_from_peer(lnet_nid_t key_nid, lnet_nid_t nid);
+int lnet_get_peer_info(__u32 idx, lnet_nid_t *primary_nid, lnet_nid_t *nid,
+ bool *mr, struct lnet_peer_ni_credit_info *peer_ni_info,
+ struct lnet_ioctl_element_stats *peer_ni_stats);
+int lnet_get_peer_ni_info(__u32 peer_index, __u64 *nid,
+ char alivness[LNET_MAX_STR_LEN],
+ __u32 *cpt_iter, __u32 *refcount,
+ __u32 *ni_peer_tx_credits, __u32 *peer_tx_credits,
+ __u32 *peer_rtr_credits, __u32 *peer_min_rtr_credtis,
+ __u32 *peer_tx_qnob);
+
+
+static inline __u32
+lnet_get_num_peer_nis(struct lnet_peer *peer)
+{
+ struct lnet_peer_net *lpn;
+ struct lnet_peer_ni *lpni;
+ __u32 count = 0;
+
+ list_for_each_entry(lpn, &peer->lp_peer_nets, lpn_on_peer_list)
+ list_for_each_entry(lpni, &lpn->lpn_peer_nis,
+ lpni_on_peer_net_list)
+ count++;
+
+ return count;
+}
+
+static inline bool
+lnet_is_peer_ni_healthy_locked(struct lnet_peer_ni *lpni)
+{
+ return lpni->lpni_healthy;
+}
+
+static inline void
+lnet_set_peer_ni_health_locked(struct lnet_peer_ni *lpni, bool health)
+{
+ lpni->lpni_healthy = health;
+}
+
+static inline bool
+lnet_is_peer_net_healthy_locked(struct lnet_peer_net *peer_net)
+{
+ struct lnet_peer_ni *lpni;
+
+ list_for_each_entry(lpni, &peer_net->lpn_peer_nis,
+ lpni_on_peer_net_list) {
+ if (lnet_is_peer_ni_healthy_locked(lpni))
+ return true;
+ }
+
+ return false;
+}
+
+static inline bool
+lnet_is_peer_healthy_locked(struct lnet_peer *peer)
+{
+ struct lnet_peer_net *peer_net;
+
+ list_for_each_entry(peer_net, &peer->lp_peer_nets, lpn_on_peer_list) {
+ if (lnet_is_peer_net_healthy_locked(peer_net))
+ return true;
+ }
+
+ return false;
+}