* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2013, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#ifndef __LNET_LIB_LNET_H__
#define __LNET_LIB_LNET_H__
-#include <lnet/linux/lib-lnet.h>
+#define LNET_ROUTER
#include <libcfs/libcfs.h>
#include <lnet/types.h>
return lp->lp_rtr_refcount != 0;
}
+/* check if it's a router checker ping */
+static inline int
+lnet_msg_is_rc_ping(struct lnet_msg *msg)
+{
+ lnet_hdr_t *hdr = &msg->msg_hdr;
+
+ return msg->msg_type == LNET_MSG_GET &&
+ hdr->msg.get.ptl_index == cpu_to_le32(LNET_RESERVED_PORTAL) &&
+ hdr->msg.get.match_bits ==
+ cpu_to_le64(LNET_PROTO_PING_MATCHBITS);
+}
+
+/* peer aliveness is enabled in a network where lnet_ni_t::ni_peertimeout has
+ * been set to a positive value, it's only valid for router peers or peers on
+ * routers.
+ */
+static inline int
+lnet_peer_aliveness_enabled(struct lnet_peer *lp)
+{
+ if (lp->lp_ni->ni_peertimeout <= 0)
+ return 0;
+
+ return the_lnet.ln_routing || lnet_isrouter(lp);
+}
+
static inline void
lnet_ni_addref_locked(lnet_ni_t *ni, int cpt)
{
}
extern lnd_t the_lolnd;
+extern int avoid_asym_router_failure;
#ifndef __KERNEL__
/* unconditional registration */
int lnet_router_checker_start(void);
void lnet_router_checker_stop(void);
+void lnet_router_ni_update_locked(lnet_peer_t *gw, __u32 net);
void lnet_swap_pinginfo(lnet_ping_info_t *info);
int lnet_parse_ip2nets(char **networksp, char *ip2nets);
__u32 *peer_rtr_credits, __u32 *peer_min_rtr_credtis,
__u32 *peer_tx_qnob);
+static inline void
+lnet_peer_set_alive(lnet_peer_t *lp)
+{
+ lp->lp_last_alive = lp->lp_last_query = cfs_time_current();
+ if (!lp->lp_alive)
+ lnet_notify_locked(lp, 0, 1, lp->lp_last_alive);
+}
+
#ifndef __KERNEL__
static inline int
lnet_parse_int_tunable(int *value, char *name)