init_waitqueue_head(&lp->lp_dc_waitq);
spin_lock_init(&lp->lp_lock);
lp->lp_primary_nid = nid;
+ if (lnet_peers_start_down())
+ lp->lp_alive = false;
+ else
+ lp->lp_alive = true;
/*
* all peers created on a router should have health on
/* decrement the ref count on the peer table */
ptable = the_lnet.ln_peer_tables[lpni->lpni_cpt];
- LASSERT(ptable->pt_number > 0);
- ptable->pt_number--;
/*
* The peer_ni can no longer be found with a lookup. But there
"Waiting for %d zombies on peer table\n",
ptable->pt_zombies);
}
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(cfs_time_seconds(1) >> 1);
+ schedule_timeout_uninterruptible(cfs_time_seconds(1) >> 1);
spin_lock(&ptable->pt_zombie_lock);
}
spin_unlock(&ptable->pt_zombie_lock);
struct list_head *peers;
struct lnet_peer_ni *lp;
- LASSERT(the_lnet.ln_state == LNET_STATE_RUNNING);
+ if (the_lnet.ln_state != LNET_STATE_RUNNING)
+ return NULL;
peers = &ptable->pt_hash[lnet_nid2peerhash(nid)];
list_for_each_entry(lp, peers, lpni_hashlist) {
bool
lnet_is_discovery_disabled_locked(struct lnet_peer *lp)
+__must_hold(&lp->lp_lock)
{
if (lnet_peer_discovery_disabled)
return true;
ptable = the_lnet.ln_peer_tables[lpni->lpni_cpt];
list_add_tail(&lpni->lpni_hashlist, &ptable->pt_hash[hash]);
ptable->pt_version++;
- ptable->pt_number++;
/* This is the 1st refcount on lpni. */
atomic_inc(&lpni->lpni_refcount);
}
struct lnet_peer *lp;
struct lnet_peer_net *lpn;
struct lnet_peer_ni *lpni;
- /*
- * Assume peer is Multi-Rail capable and let discovery find out
- * otherwise.
- */
- unsigned flags = LNET_PEER_MULTI_RAIL;
+ unsigned flags = 0;
int rc = 0;
if (nid == LNET_NID_ANY) {
{
struct lnet_msg *msg, *tmp;
int rc = 0;
- struct list_head pending_msgs;
-
- INIT_LIST_HEAD(&pending_msgs);
+ LIST_HEAD(pending_msgs);
CDEBUG(D_NET, "Discovery complete. Dequeue peer %s\n",
libcfs_nid2str(lp->lp_primary_nid));
/*
- * Only enable the multi-rail feature on the peer if both sides of
- * the connection have discovery on
- */
- if (pbuf->pb_info.pi_features & LNET_PING_FEAT_MULTI_RAIL) {
- CDEBUG(D_NET, "Peer %s has Multi-Rail feature enabled\n",
- libcfs_nid2str(lp->lp_primary_nid));
- lp->lp_state |= LNET_PEER_MULTI_RAIL;
- } else {
- CDEBUG(D_NET, "Peer %s has Multi-Rail feature disabled\n",
- libcfs_nid2str(lp->lp_primary_nid));
- lp->lp_state &= ~LNET_PEER_MULTI_RAIL;
- }
-
- /*
* The peer may have discovery disabled at its end. Set
* NO_DISCOVERY as appropriate.
*/
*/
if (pbuf->pb_info.pi_features & LNET_PING_FEAT_MULTI_RAIL) {
if (lp->lp_state & LNET_PEER_MULTI_RAIL) {
- /* Everything's fine */
+ CDEBUG(D_NET, "peer %s(%p) is MR\n",
+ libcfs_nid2str(lp->lp_primary_nid), lp);
} else if (lp->lp_state & LNET_PEER_CONFIGURED) {
CWARN("Reply says %s is Multi-Rail, DLC says not\n",
libcfs_nid2str(lp->lp_primary_nid));
+ } else if (lnet_peer_discovery_disabled) {
+ CDEBUG(D_NET,
+ "peer %s(%p) not MR: DD disabled locally\n",
+ libcfs_nid2str(lp->lp_primary_nid), lp);
+ } else if (lp->lp_state & LNET_PEER_NO_DISCOVERY) {
+ CDEBUG(D_NET,
+ "peer %s(%p) not MR: DD disabled remotely\n",
+ libcfs_nid2str(lp->lp_primary_nid), lp);
} else {
- /*
- * if discovery is disabled then we don't want to
- * update the state of the peer. All we'll do is
- * update the peer_nis which were reported back in
- * the initial ping
- */
-
- if (!lnet_is_discovery_disabled_locked(lp)) {
- lp->lp_state |= LNET_PEER_MULTI_RAIL;
- lnet_peer_clr_non_mr_pref_nids(lp);
- }
+ CDEBUG(D_NET, "peer %s(%p) is MR capable\n",
+ libcfs_nid2str(lp->lp_primary_nid), lp);
+ lp->lp_state |= LNET_PEER_MULTI_RAIL;
+ lnet_peer_clr_non_mr_pref_nids(lp);
}
} else if (lp->lp_state & LNET_PEER_MULTI_RAIL) {
if (lp->lp_state & LNET_PEER_CONFIGURED) {
lp->lp_state &= ~LNET_PEER_ROUTER_ENABLED;
spin_unlock(&lp->lp_lock);
- nnis = MAX(lp->lp_nnis, pbuf->pb_info.pi_nnis);
+ nnis = max_t(int, lp->lp_nnis, pbuf->pb_info.pi_nnis);
LIBCFS_ALLOC(curnis, nnis * sizeof(*curnis));
LIBCFS_ALLOC(addnis, nnis * sizeof(*addnis));
LIBCFS_ALLOC(delnis, nnis * sizeof(*delnis));
pnid = lnet_peer_select_nid(lp);
lnet_net_unlock(cpt);
- nnis = MAX(lp->lp_data_nnis, LNET_INTERFACES_MIN);
+ nnis = max(lp->lp_data_nnis, LNET_INTERFACES_MIN);
rc = lnet_send_ping(pnid, &lp->lp_ping_mdh, nnis, lp,
the_lnet.ln_dc_eqh, false);
static void lnet_resend_msgs(void)
{
struct lnet_msg *msg, *tmp;
- struct list_head resend;
+ LIST_HEAD(resend);
int rc;
- INIT_LIST_HEAD(&resend);
-
spin_lock(&the_lnet.ln_msg_resend_lock);
list_splice(&the_lnet.ln_msg_resend, &resend);
spin_unlock(&the_lnet.ln_msg_resend_lock);
/* Queue cleanup 2: wait for the expired queue to clear. */
while (!list_empty(&the_lnet.ln_dc_expired))
- schedule_timeout(cfs_time_seconds(1));
+ schedule_timeout_uninterruptible(cfs_time_seconds(1));
/* Queue cleanup 3: clear the request queue. */
lnet_net_lock(LNET_LOCK_EX);