char *iface);
static inline int
-lnet_nid2peerhash(lnet_nid_t nid)
+lnet_nid2peerhash(struct lnet_nid *nid)
{
- return hash_long(nid, LNET_PEER_HASH_BITS);
+ u32 h = 0;
+ int i;
+
+ for (i = 0; i < 4; i++)
+ h = hash_32(nid->nid_addr[i]^h, 32);
+ return hash_32(LNET_NID_NET(nid) ^ h, LNET_PEER_HASH_BITS);
}
static inline struct list_head *
extern int avoid_asym_router_failure;
extern unsigned int lnet_nid_cpt_hash(lnet_nid_t nid, unsigned int number);
-extern int lnet_cpt_of_nid_locked(lnet_nid_t nid, struct lnet_ni *ni);
+extern int lnet_cpt_of_nid_locked(struct lnet_nid *nid, struct lnet_ni *ni);
extern int lnet_cpt_of_nid(lnet_nid_t nid, struct lnet_ni *ni);
extern struct lnet_ni *lnet_nid2ni_locked(lnet_nid_t nid, int cpt);
extern struct lnet_ni *lnet_nid2ni_addref(lnet_nid_t nid);
static inline bool
lnet_peer_ni_is_primary(struct lnet_peer_ni *lpni)
{
- return lpni->lpni_nid == lpni->lpni_peer_net->lpn_peer->lp_primary_nid;
+ return lnet_nid_to_nid4(&lpni->lpni_nid) ==
+ lpni->lpni_peer_net->lpn_peer->lp_primary_nid;
}
bool lnet_peer_is_uptodate(struct lnet_peer *lp);
/* network peer is on */
struct lnet_net *lpni_net;
/* peer's NID */
- lnet_nid_t lpni_nid;
+ struct lnet_nid lpni_nid;
/* # refs */
struct kref lpni_kref;
/* health value for the peer */
}
int
-lnet_cpt_of_nid_locked(lnet_nid_t nid, struct lnet_ni *ni)
+lnet_cpt_of_nid_locked(struct lnet_nid *nid, struct lnet_ni *ni)
{
struct lnet_net *net;
+ /* FIXME handle long-addr nid */
+ lnet_nid_t nid4 = lnet_nid_to_nid4(nid);
/* must called with hold of lnet_net_lock */
if (LNET_CPT_NUMBER == 1)
*/
if (ni != NULL) {
if (ni->ni_cpts != NULL)
- return ni->ni_cpts[lnet_nid_cpt_hash(nid,
+ return ni->ni_cpts[lnet_nid_cpt_hash(nid4,
ni->ni_ncpts)];
else
- return lnet_nid_cpt_hash(nid, LNET_CPT_NUMBER);
+ return lnet_nid_cpt_hash(nid4, LNET_CPT_NUMBER);
}
/* no NI provided so look at the net */
- net = lnet_get_net_locked(LNET_NIDNET(nid));
+ net = lnet_get_net_locked(LNET_NID_NET(nid));
if (net != NULL && net->net_cpts != NULL) {
- return net->net_cpts[lnet_nid_cpt_hash(nid, net->net_ncpts)];
+ return net->net_cpts[lnet_nid_cpt_hash(nid4, net->net_ncpts)];
}
- return lnet_nid_cpt_hash(nid, LNET_CPT_NUMBER);
+ return lnet_nid_cpt_hash(nid4, LNET_CPT_NUMBER);
}
int
-lnet_cpt_of_nid(lnet_nid_t nid, struct lnet_ni *ni)
+lnet_cpt_of_nid(lnet_nid_t nid4, struct lnet_ni *ni)
{
int cpt;
int cpt2;
+ struct lnet_nid nid;
if (LNET_CPT_NUMBER == 1)
return 0; /* the only one */
+ lnet_nid4_to_nid(nid4, &nid);
cpt = lnet_net_lock_current();
- cpt2 = lnet_cpt_of_nid_locked(nid, ni);
+ cpt2 = lnet_cpt_of_nid_locked(&nid, ni);
lnet_net_unlock(cpt);
}
struct lnet_ni *
-lnet_nid2ni_locked(lnet_nid_t nid4, int cpt)
+lnet_nid_to_ni_locked(struct lnet_nid *nid, int cpt)
{
- struct lnet_net *net;
+ struct lnet_net *net;
struct lnet_ni *ni;
- struct lnet_nid nid;
LASSERT(cpt != LNET_LOCK_EX);
- lnet_nid4_to_nid(nid4, &nid);
list_for_each_entry(net, &the_lnet.ln_nets, net_list) {
list_for_each_entry(ni, &net->net_ni_list, ni_netlist) {
- if (nid_same(&ni->ni_nid, &nid))
+ if (nid_same(&ni->ni_nid, nid))
return ni;
}
}
return NULL;
}
+struct lnet_ni *
+lnet_nid2ni_locked(lnet_nid_t nid4, int cpt)
+{
+ struct lnet_nid nid;
+
+ lnet_nid4_to_nid(nid4, &nid);
+ return lnet_nid_to_ni_locked(&nid, cpt);
+}
+
struct lnet_ni *
-lnet_nid2ni_addref(lnet_nid_t nid)
+lnet_nid2ni_addref(lnet_nid_t nid4)
{
struct lnet_ni *ni;
+ struct lnet_nid nid;
+
+ lnet_nid4_to_nid(nid4, &nid);
lnet_net_lock(0);
- ni = lnet_nid2ni_locked(nid, 0);
+ ni = lnet_nid_to_ni_locked(&nid, 0);
if (ni)
lnet_ni_addref_locked(ni, 0);
lnet_net_unlock(0);
}
EXPORT_SYMBOL(lnet_nid2ni_addref);
+struct lnet_ni *
+lnet_nid_to_ni_addref(struct lnet_nid *nid)
+{
+ struct lnet_ni *ni;
+
+ lnet_net_lock(0);
+ ni = lnet_nid_to_ni_locked(nid, 0);
+ if (ni)
+ lnet_ni_addref_locked(ni, 0);
+ lnet_net_unlock(0);
+
+ return ni;
+}
+EXPORT_SYMBOL(lnet_nid_to_ni_addref);
+
int
lnet_islocalnid(lnet_nid_t nid)
{
lnet_net_lock(LNET_LOCK_EX);
list_for_each_entry(lpni, &the_lnet.ln_mt_peerNIRecovq, lpni_recovery) {
- list->rlst_nid_array[i] = lpni->lpni_nid;
+ list->rlst_nid_array[i] = lnet_nid_to_nid4(&lpni->lpni_nid);
i++;
if (i >= LNET_MAX_SHOW_NUM_NID)
break;
p = NULL;
while ((p = lnet_get_next_peer_ni_locked(lp, NULL, p)) != NULL) {
buf[i].pid = id.pid;
- buf[i].nid = p->lpni_nid;
+ buf[i].nid = lnet_nid_to_nid4(&p->lpni_nid);
if (++i >= n_ids)
break;
}
if (rc != 0) {
CERROR("recv from %s / send to %s aborted: "
"eager_recv failed %d\n",
- libcfs_nid2str(msg->msg_rxpeer->lpni_nid),
+ libcfs_nidstr(&msg->msg_rxpeer->lpni_nid),
libcfs_id2str(msg->msg_target), rc);
LASSERT(rc < 0); /* required by my callers */
}
/* can't get here if we're sending to the loopback interface */
if (the_lnet.ln_loni)
- LASSERT(lp->lpni_nid !=
- lnet_nid_to_nid4(&the_lnet.ln_loni->ni_nid));
+ LASSERT(!nid_same(&lp->lpni_nid, &the_lnet.ln_loni->ni_nid));
/* NB 'lp' is always the next hop */
if ((msg->msg_target.pid & LNET_PID_USERFLAG) == 0 &&
if (best_lpni)
CDEBUG(D_NET, "n:[%s, %s] h:[%d, %d] p:[%d, %d] c:[%d, %d] s:[%d, %d]\n",
- libcfs_nid2str(lpni->lpni_nid),
- libcfs_nid2str(best_lpni->lpni_nid),
+ libcfs_nidstr(&lpni->lpni_nid),
+ libcfs_nidstr(&best_lpni->lpni_nid),
lpni_healthv, best_lpni_healthv,
lpni_sel_prio, best_sel_prio,
lpni->lpni_txcredits, best_lpni_credits,
}
CDEBUG(D_NET, "sd_best_lpni = %s\n",
- libcfs_nid2str(best_lpni->lpni_nid));
+ libcfs_nidstr(&best_lpni->lpni_nid));
return best_lpni;
}
best_ni->ni_seq, best_ni->ni_net->net_seq,
atomic_read(&best_ni->ni_tx_credits),
best_ni->ni_sel_priority,
- libcfs_nid2str(best_lpni->lpni_nid),
+ libcfs_nidstr(&best_lpni->lpni_nid),
best_lpni->lpni_seq, best_lpni->lpni_peer_net->lpn_seq,
best_lpni->lpni_txcredits,
best_lpni->lpni_sel_priority);
* the configuration has changed. We don't have a hold on the best_ni
* yet, and it may have vanished.
*/
- cpt2 = lnet_cpt_of_nid_locked(best_lpni->lpni_nid, best_ni);
+ cpt2 = lnet_cpt_of_nid_locked(&best_lpni->lpni_nid, best_ni);
if (sd->sd_cpt != cpt2) {
__u32 seq = lnet_get_dlc_seq_locked();
lnet_net_unlock(sd->sd_cpt);
* what was originally set in the target or it will be the NID of
* a router if this message should be routed
*/
- msg->msg_target.nid = msg->msg_txpeer->lpni_nid;
+ /* FIXME handle large-addr nids */
+ msg->msg_target.nid = lnet_nid_to_nid4(&msg->msg_txpeer->lpni_nid);
/*
* lnet_msg_commit assigns the correct cpt to the message, which
* lnet_select_pathway() function and is never changed.
* It's safe to use it here.
*/
- msg->msg_hdr.dest_nid = cpu_to_le64(final_dst_lpni->lpni_nid);
+ /* FIXME handle large-addr nid */
+ msg->msg_hdr.dest_nid =
+ cpu_to_le64(lnet_nid_to_nid4(&final_dst_lpni->lpni_nid));
} else {
/*
* if we're not routing set the dest_nid to the best peer
* ni NID that we picked earlier in the algorithm.
*/
- msg->msg_hdr.dest_nid = cpu_to_le64(msg->msg_txpeer->lpni_nid);
+ msg->msg_hdr.dest_nid =
+ cpu_to_le64(lnet_nid_to_nid4(&msg->msg_txpeer->lpni_nid));
}
/*
if (msg->msg_md) {
rspt = msg->msg_md->md_rspt_ptr;
if (rspt) {
- rspt->rspt_next_hop_nid = msg->msg_txpeer->lpni_nid;
+ rspt->rspt_next_hop_nid =
+ lnet_nid_to_nid4(&msg->msg_txpeer->lpni_nid);
CDEBUG(D_NET, "rspt_next_hop_nid = %s\n",
libcfs_nid2str(rspt->rspt_next_hop_nid));
}
libcfs_nid2str(sd->sd_src_nid),
libcfs_nid2str(msg->msg_hdr.dest_nid),
libcfs_nid2str(sd->sd_dst_nid),
- libcfs_nid2str(msg->msg_txpeer->lpni_nid),
+ libcfs_nidstr(&msg->msg_txpeer->lpni_nid),
libcfs_nid2str(sd->sd_rtr_nid),
lnet_msgtyp2str(msg->msg_type), msg->msg_retry_count);
!lnet_msg_is_response(msg) && lpni->lpni_pref_nnids == 0) {
CDEBUG(D_NET, "Setting preferred local NID %s on NMR peer %s\n",
libcfs_nidstr(&lni->ni_nid),
- libcfs_nid2str(lpni->lpni_nid));
+ libcfs_nidstr(&lpni->lpni_nid));
lnet_peer_ni_set_non_mr_pref_nid(
lpni, lnet_nid_to_nid4(&lni->ni_nid));
}
}
if (sd->sd_best_lpni &&
- sd->sd_best_lpni->lpni_nid ==
- lnet_nid_to_nid4(&the_lnet.ln_loni->ni_nid))
+ nid_same(&sd->sd_best_lpni->lpni_nid,
+ &the_lnet.ln_loni->ni_nid))
return lnet_handle_lo_send(sd);
else if (sd->sd_best_lpni)
return lnet_handle_send(sd);
return rc;
}
- new_lpni = lnet_find_peer_ni_locked(lpni->lpni_nid);
+ new_lpni = lnet_find_peer_ni_locked(lnet_nid_to_nid4(&lpni->lpni_nid));
if (!new_lpni) {
lnet_peer_ni_decref_locked(lpni);
return -ENOENT;
/* If there is no best_ni we don't have a route */
if (!best_ni) {
CERROR("no path to %s from net %s\n",
- libcfs_nid2str(best_lpni->lpni_nid),
+ libcfs_nidstr(&best_lpni->lpni_nid),
libcfs_net2str(best_lpni->lpni_net->net_id));
return -EHOSTUNREACH;
}
* network
*/
if (sd->sd_best_lpni &&
- sd->sd_best_lpni->lpni_nid ==
- lnet_nid_to_nid4(&the_lnet.ln_loni->ni_nid)) {
+ nid_same(&sd->sd_best_lpni->lpni_nid,
+ &the_lnet.ln_loni->ni_nid)) {
/*
* in case we initially started with a routed
* destination, let's reset to local
LIBCFS_ALLOC(ev_info, sizeof(*ev_info));
if (!ev_info) {
CERROR("out of memory. Can't recover %s\n",
- libcfs_nid2str(lpni->lpni_nid));
+ libcfs_nidstr(&lpni->lpni_nid));
spin_lock(&lpni->lpni_lock);
lpni->lpni_state &= ~LNET_PEER_NI_RECOVERY_PENDING;
spin_unlock(&lpni->lpni_lock);
/* look at the comments in lnet_recover_local_nis() */
mdh = lpni->lpni_recovery_ping_mdh;
LNetInvalidateMDHandle(&lpni->lpni_recovery_ping_mdh);
- nid = lpni->lpni_nid;
+ /* FIXME handle large-addr nid */
+ nid = lnet_nid_to_nid4(&lpni->lpni_nid);
lnet_net_lock(0);
list_del_init(&lpni->lpni_recovery);
lnet_peer_ni_decref_locked(lpni);
CDEBUG(D_NET, "health check: %s->%s: %s: %s\n",
libcfs_nidstr(&ni->ni_nid),
- (lo) ? "self" : libcfs_nid2str(lpni->lpni_nid),
+ (lo) ? "self" : libcfs_nidstr(&lpni->lpni_nid),
lnet_msgtyp2str(msg->msg_type),
lnet_health_error2str(hstatus));
ni = msg->msg_txni;
CDEBUG(D_NET, "TRACE: msg %p %s -> %s : %s\n", msg,
libcfs_nidstr(&ni->ni_nid),
- libcfs_nid2str(msg->msg_txpeer->lpni_nid),
+ libcfs_nidstr(&msg->msg_txpeer->lpni_nid),
lnet_msgtyp2str(msg->msg_type));
lnet_ni_send(ni, msg);
continue;
list_for_each_entry_safe(lpni, tmp, &the_lnet.ln_remote_peer_ni_list,
lpni_on_remote_peer_ni_list) {
- if (LNET_NIDNET(lpni->lpni_nid) == net->net_id) {
+ if (LNET_NID_NET(&lpni->lpni_nid) == net->net_id) {
lpni->lpni_net = net;
spin_lock(&lpni->lpni_lock);
else
lpni->lpni_ns_status = LNET_NI_STATUS_UP;
lpni->lpni_ping_feats = LNET_PING_FEAT_INVAL;
- lpni->lpni_nid = nid;
+ lnet_nid4_to_nid(nid, &lpni->lpni_nid);
lpni->lpni_cpt = cpt;
atomic_set(&lpni->lpni_healthv, LNET_MAX_HEALTH_VALUE);
&the_lnet.ln_remote_peer_ni_list);
}
- CDEBUG(D_NET, "%p nid %s\n", lpni, libcfs_nid2str(lpni->lpni_nid));
+ CDEBUG(D_NET, "%p nid %s\n", lpni, libcfs_nidstr(&lpni->lpni_nid));
return lpni;
}
}
CDEBUG(D_NET, "peer %s NID %s\n",
libcfs_nid2str(lp->lp_primary_nid),
- libcfs_nid2str(lpni->lpni_nid));
+ libcfs_nidstr(&lpni->lpni_nid));
}
/* called with lnet_net_lock LNET_LOCK_EX held */
/* don't remove a peer_ni if it's also a gateway */
if (lnet_isrouter(lpni) && !force) {
CERROR("Peer NI %s is a gateway. Can not delete it\n",
- libcfs_nid2str(lpni->lpni_nid));
+ libcfs_nidstr(&lpni->lpni_nid));
return -EBUSY;
}
/* assign the next peer_ni to be the primary */
lpni2 = lnet_get_next_peer_ni_locked(lp, NULL, lpni);
LASSERT(lpni2);
- lp->lp_primary_nid = lpni2->lpni_nid;
+ lp->lp_primary_nid = lnet_nid_to_nid4(&lpni2->lpni_nid);
}
rc = lnet_peer_ni_del_locked(lpni, force);
continue;
peer = lpni->lpni_peer_net->lpn_peer;
- if (peer->lp_primary_nid != lpni->lpni_nid) {
+ if (peer->lp_primary_nid !=
+ lnet_nid_to_nid4(&lpni->lpni_nid)) {
lnet_peer_ni_del_locked(lpni, false);
continue;
}
}
static struct lnet_peer_ni *
-lnet_get_peer_ni_locked(struct lnet_peer_table *ptable, lnet_nid_t nid)
+lnet_get_peer_ni_locked(struct lnet_peer_table *ptable, struct lnet_nid *nid)
{
struct list_head *peers;
struct lnet_peer_ni *lp;
peers = &ptable->pt_hash[lnet_nid2peerhash(nid)];
list_for_each_entry(lp, peers, lpni_hashlist) {
- if (lp->lpni_nid == nid) {
+ if (nid_same(&lp->lpni_nid, nid)) {
lnet_peer_ni_addref_locked(lp);
return lp;
}
}
struct lnet_peer_ni *
-lnet_find_peer_ni_locked(lnet_nid_t nid)
+lnet_find_peer_ni_locked(lnet_nid_t nid4)
{
struct lnet_peer_ni *lpni;
struct lnet_peer_table *ptable;
int cpt;
+ struct lnet_nid nid;
- cpt = lnet_nid_cpt_hash(nid, LNET_CPT_NUMBER);
+ lnet_nid4_to_nid(nid4, &nid);
+
+ cpt = lnet_nid_cpt_hash(nid4, LNET_CPT_NUMBER);
ptable = the_lnet.ln_peer_tables[cpt];
- lpni = lnet_get_peer_ni_locked(ptable, nid);
+ lpni = lnet_get_peer_ni_locked(ptable, &nid);
return lpni;
}
return NULL;
list_for_each_entry(lpni, &lpn->lpn_peer_nis, lpni_peer_nis) {
- if (lpni->lpni_nid == nid)
+ if (lnet_nid_to_nid4(&lpni->lpni_nid) == nid)
return lpni;
}
struct lnet_nid_list *ne;
CDEBUG(D_NET, "%s: rtr pref emtpy: %d\n",
- libcfs_nid2str(lpni->lpni_nid),
+ libcfs_nidstr(&lpni->lpni_nid),
list_empty(&lpni->lpni_rtr_pref_nids));
if (list_empty(&lpni->lpni_rtr_pref_nids))
spin_unlock(&lpni->lpni_lock);
CDEBUG(D_NET, "peer %s nid %s: %d\n",
- libcfs_nid2str(lpni->lpni_nid), libcfs_nid2str(nid), rc);
+ libcfs_nidstr(&lpni->lpni_nid), libcfs_nid2str(nid), rc);
return rc;
}
spin_unlock(&lpni->lpni_lock);
CDEBUG(D_NET, "peer %s: %d\n",
- libcfs_nid2str(lpni->lpni_nid), rc);
+ libcfs_nidstr(&lpni->lpni_nid), rc);
return rc;
}
lnet_net_lock(LNET_LOCK_EX);
/* Add peer_ni to global peer table hash, if necessary. */
if (list_empty(&lpni->lpni_hashlist)) {
- int hash = lnet_nid2peerhash(lpni->lpni_nid);
+ int hash = lnet_nid2peerhash(&lpni->lpni_nid);
ptable = the_lnet.ln_peer_tables[lpni->lpni_cpt];
list_add_tail(&lpni->lpni_hashlist, &ptable->pt_hash[hash]);
/* Add peer_ni to peer_net */
lpni->lpni_peer_net = lpn;
- if (lp->lp_primary_nid == lpni->lpni_nid)
+ if (lp->lp_primary_nid == lnet_nid_to_nid4(&lpni->lpni_nid))
list_add(&lpni->lpni_peer_nis, &lpn->lpn_peer_nis);
else
list_add_tail(&lpni->lpni_peer_nis, &lpn->lpn_peer_nis);
if (!lpn->lpn_peer) {
new_lpn = true;
lpn->lpn_peer = lp;
- if (lp->lp_primary_nid == lpni->lpni_nid)
+ if (lp->lp_primary_nid == lnet_nid_to_nid4(&lpni->lpni_nid))
list_add(&lpn->lpn_peer_nets, &lp->lp_peer_nets);
else
list_add_tail(&lpn->lpn_peer_nets, &lp->lp_peer_nets);
rc = lnet_udsp_apply_policies_on_lpni(lpni);
if (rc)
CERROR("Failed to apply UDSPs on lpni %s\n",
- libcfs_nid2str(lpni->lpni_nid));
+ libcfs_nidstr(&lpni->lpni_nid));
CDEBUG(D_NET, "peer %s NID %s flags %#x\n",
libcfs_nid2str(lp->lp_primary_nid),
- libcfs_nid2str(lpni->lpni_nid), flags);
+ libcfs_nidstr(&lpni->lpni_nid), flags);
lnet_peer_ni_decref_locked(lpni);
lnet_net_unlock(LNET_LOCK_EX);
struct lnet_peer_table *ptable;
struct lnet_peer_net *lpn;
- CDEBUG(D_NET, "%p nid %s\n", lpni, libcfs_nid2str(lpni->lpni_nid));
+ CDEBUG(D_NET, "%p nid %s\n", lpni, libcfs_nidstr(&lpni->lpni_nid));
LASSERT(kref_read(&lpni->lpni_kref) == 0);
LASSERT(list_empty(&lpni->lpni_txq));
CDEBUG(D_NET, "peer %s NID %s: %d. %s\n",
(lp ? libcfs_nid2str(lp->lp_primary_nid) : "(none)"),
- libcfs_nid2str(lpni->lpni_nid), rc,
+ libcfs_nidstr(&lpni->lpni_nid), rc,
(!block) ? "pending discovery" : "discovery complete");
return rc;
/* Construct the list of NIDs present in peer. */
lpni = NULL;
while ((lpni = lnet_get_next_peer_ni_locked(lp, NULL, lpni)) != NULL)
- curnis[ncurnis++] = lpni->lpni_nid;
+ curnis[ncurnis++] = lnet_nid_to_nid4(&lpni->lpni_nid);
/*
* Check for NIDs in pbuf not present in curnis[].
aliveness = (lnet_is_peer_ni_alive(lp)) ? "up" : "down";
CDEBUG(D_WARNING, "%-24s %4d %5s %5d %5d %5d %5d %5d %ld\n",
- libcfs_nid2str(lp->lpni_nid), kref_read(&lp->lpni_kref),
+ libcfs_nidstr(&lp->lpni_nid), kref_read(&lp->lpni_kref),
aliveness, lp->lpni_net->net_tunables.lct_peer_tx_credits,
lp->lpni_rtrcredits, lp->lpni_minrtrcredits,
lp->lpni_txcredits, lp->lpni_mintxcredits, lp->lpni_txqnob);
struct list_head *peers = &peer_table->pt_hash[j];
list_for_each_entry(lp, peers, lpni_hashlist) {
+ if (!nid_is_nid4(&lp->lpni_nid))
+ continue;
if (peer_index-- > 0)
continue;
snprintf(aliveness, LNET_MAX_STR_LEN,
lnet_is_peer_ni_alive(lp) ? "up" : "down");
- *nid = lp->lpni_nid;
+ *nid = lnet_nid_to_nid4(&lp->lpni_nid);
*refcount = kref_read(&lp->lpni_kref);
*ni_peer_tx_credits =
lp->lpni_net->net_tunables.lct_peer_tx_credits;
lpni = NULL;
rc = -EFAULT;
while ((lpni = lnet_get_next_peer_ni_locked(lp, NULL, lpni)) != NULL) {
- nid = lpni->lpni_nid;
+ if (!nid_is_nid4(&lpni->lpni_nid))
+ continue;
+ nid = lnet_nid_to_nid4(&lpni->lpni_nid);
if (copy_to_user(bulk, &nid, sizeof(nid)))
goto out_free_hstats;
bulk += sizeof(nid);
if (!lpni->lpni_last_alive) {
CDEBUG(D_NET,
"lpni %s(%p) not eligible for recovery last alive %lld\n",
- libcfs_nid2str(lpni->lpni_nid), lpni,
+ libcfs_nidstr(&lpni->lpni_nid), lpni,
lpni->lpni_last_alive);
return;
}
if (lnet_recovery_limit &&
now > lpni->lpni_last_alive + lnet_recovery_limit) {
CDEBUG(D_NET, "lpni %s aged out last alive %lld\n",
- libcfs_nid2str(lpni->lpni_nid),
+ libcfs_nidstr(&lpni->lpni_nid),
lpni->lpni_last_alive);
/* Reset the ping count so that if this peer NI is added back to
* the recovery queue we will send the first ping right away.
lnet_peer_ni_set_next_ping(lpni, now);
CDEBUG(D_NET, "%s added to recovery queue. ping count: %u next ping: %lld last alive: %lld health: %d\n",
- libcfs_nid2str(lpni->lpni_nid),
+ libcfs_nidstr(&lpni->lpni_nid),
lpni->lpni_ping_count,
lpni->lpni_next_ping,
lpni->lpni_last_alive,
/* discover the router */
CDEBUG(D_NET, "discover %s, cpt = %d\n",
- libcfs_nid2str(lpni->lpni_nid), cpt);
+ libcfs_nidstr(&lpni->lpni_nid), cpt);
rc = lnet_discover_peer_locked(lpni, cpt, false);
/* drop ref taken above */
*/
if (lnet_is_discovery_disabled(lp)) {
list_for_each_entry(route, &lp->lp_routes, lr_gwlist) {
- if (route->lr_nid == lpni->lpni_nid)
+ if (route->lr_nid ==
+ lnet_nid_to_nid4(&lpni->lpni_nid))
lnet_set_route_aliveness(route, alive);
}
}
lnet_net_unlock(0);
if (ni != NULL && !alive)
- lnet_notify_peer_down(ni, lpni->lpni_nid);
+ lnet_notify_peer_down(ni, lnet_nid_to_nid4(&lpni->lpni_nid));
cpt = lpni->lpni_cpt;
lnet_net_lock(cpt);
}
if (peer != NULL) {
- lnet_nid_t nid = peer->lpni_nid;
+ struct lnet_nid nid = peer->lpni_nid;
int nrefs = kref_read(&peer->lpni_kref);
time64_t lastalive = -1;
char *aliveness = "NA";
s += scnprintf(s, tmpstr + tmpsiz - s,
"%-24s %4d %5s %5lld %5d %5d %5d %5d %5d %d\n",
- libcfs_nid2str(nid), nrefs, aliveness,
+ libcfs_nidstr(&nid), nrefs, aliveness,
lastalive, maxcr, rtrcr, minrtrcr, txcr,
mintxcr, txqnob);
LASSERT(tmpstr + tmpsiz - s > 0);
lpni)) != NULL) {
if (!lnet_get_net_locked(lpni->lpni_peer_net->lpn_net_id))
continue;
- gw_nid = lpni->lpni_nid;
+ gw_nid = lnet_nid_to_nid4(&lpni->lpni_nid);
rc = cfs_match_nid_net(gw_nid,
rte_action->ud_net_id.udn_net_type,
&rte_action->ud_net_id.udn_net_num_range,
if (!cleared || revert) {
CDEBUG(D_NET, "%spref rtr nids from lpni %s\n",
(revert) ? "revert " : "clear ",
- libcfs_nid2str(lpni->lpni_nid));
+ libcfs_nidstr(&lpni->lpni_nid));
lnet_peer_clr_pref_rtrs(lpni);
cleared = true;
if (revert) {
}
CDEBUG(D_NET, "add gw nid %s as preferred for peer %s\n",
libcfs_nid2str(gw_nid),
- libcfs_nid2str(lpni->lpni_nid));
+ libcfs_nidstr(&lpni->lpni_nid));
/* match. Add to pref NIDs */
rc = lnet_peer_add_pref_rtr(lpni, gw_nid);
lnet_net_lock(LNET_LOCK_EX);
if (rc && rc != -EEXIST) {
CERROR("Failed to add %s to %s pref rtr list\n",
libcfs_nid2str(gw_nid),
- libcfs_nid2str(lpni->lpni_nid));
+ libcfs_nidstr(&lpni->lpni_nid));
return rc;
}
}
lnet_peer_clr_pref_nids(lpni);
CDEBUG(D_NET, "%spref nids from lpni %s\n",
(revert) ? "revert " : "clear ",
- libcfs_nid2str(lpni->lpni_nid));
+ libcfs_nidstr(&lpni->lpni_nid));
cleared = true;
if (revert) {
lnet_net_lock(LNET_LOCK_EX);
}
CDEBUG(D_NET, "add nid %s as preferred for peer %s\n",
libcfs_nidstr(&ni->ni_nid),
- libcfs_nid2str(lpni->lpni_nid));
+ libcfs_nidstr(&lpni->lpni_nid));
/* match. Add to pref NIDs */
rc = lnet_peer_add_pref_nid(
lpni, lnet_nid_to_nid4(&ni->ni_nid));
if (rc && rc != -EEXIST) {
CERROR("Failed to add %s to %s pref nid list\n",
libcfs_nidstr(&ni->ni_nid),
- libcfs_nid2str(lpni->lpni_nid));
+ libcfs_nidstr(&lpni->lpni_nid));
return rc;
}
}
bool local = udi->udi_local;
enum lnet_udsp_action_type type = udi->udi_type;
- rc = cfs_match_nid_net(lpni->lpni_nid,
+ rc = cfs_match_nid_net(lnet_nid_to_nid4(&lpni->lpni_nid),
lp_match->ud_net_id.udn_net_type,
&lp_match->ud_net_id.udn_net_num_range,
&lp_match->ud_addr_range);
&lpn->lpn_peer_nis,
lpni_peer_nis) {
CDEBUG(D_NET, "udsp examining lpni %s\n",
- libcfs_nid2str(lpni->lpni_nid));
+ libcfs_nidstr(&lpni->lpni_nid));
udi->udi_lpni = lpni;
rc = lnet_udsp_apply_rule_on_lpni(udi);
if (rc)
info->cud_nid_priority = lpni->lpni_sel_priority;
CDEBUG(D_NET, "lpni %s has %d pref nids\n",
- libcfs_nid2str(lpni->lpni_nid),
+ libcfs_nidstr(&lpni->lpni_nid),
lpni->lpni_pref_nnids);
if (lpni->lpni_pref_nnids == 1) {
info->cud_pref_nid[0] = lpni->lpni_pref.nid;