lpni = NULL;
seq = lnet_get_dlc_seq_locked();
- rc = lnet_find_or_create_peer_locked(dst_nid, cpt, &peer);
- if (rc != 0) {
+ peer = lnet_find_or_create_peer_locked(dst_nid, cpt);
+ if (IS_ERR(peer)) {
lnet_net_unlock(cpt);
- return rc;
+ return PTR_ERR(peer);
}
/* If peer is not healthy then can not send anything to it */
}
}
/*
- * Now that we selected the NI to use increment its sequence
- * number so the Round Robin algorithm will detect that it has
- * been used and pick the next NI.
- */
- best_ni->ni_seq++;
-
- /*
* if the peer is not MR capable, then we should always send to it
* using the first NI in the NET we determined.
*/
return -EINVAL;
}
+ /*
+ * Now that we selected the NI to use increment its sequence
+ * number so the Round Robin algorithm will detect that it has
+ * been used and pick the next NI.
+ */
+ best_ni->ni_seq++;
+
if (routing)
goto send;
}
CDEBUG(D_NET, "Best route to %s via %s for %s %d\n",
- libcfs_nid2str(lpni->lpni_nid),
+ libcfs_nid2str(dst_nid),
libcfs_nid2str(best_gw->lpni_nid),
lnet_msgtyp2str(msg->msg_type), msg->msg_len);
lnet_pid_t dest_pid;
lnet_nid_t dest_nid;
lnet_nid_t src_nid;
- __u32 payload_length;
- __u32 type;
+ struct lnet_peer_ni *lpni;
+ __u32 payload_length;
+ __u32 type;
LASSERT (!in_interrupt ());
msg->msg_initiator = lnet_peer_primary_nid(src_nid);
lnet_net_lock(cpt);
- rc = lnet_nid2peerni_locked(&msg->msg_rxpeer, from_nid, cpt);
- if (rc != 0) {
+ lpni = lnet_nid2peerni_locked(from_nid, cpt);
+ if (IS_ERR(lpni)) {
lnet_net_unlock(cpt);
CERROR("%s, src %s: Dropping %s "
- "(error %d looking up sender)\n",
+ "(error %ld looking up sender)\n",
libcfs_nid2str(from_nid), libcfs_nid2str(src_nid),
- lnet_msgtyp2str(type), rc);
+ lnet_msgtyp2str(type), PTR_ERR(lpni));
lnet_msg_free(msg);
if (rc == -ESHUTDOWN)
/* We are shutting down. Don't do anything more */
return 0;
goto drop;
}
+ msg->msg_rxpeer = lpni;
msg->msg_rxni = ni;
lnet_ni_addref_locked(ni, cpt);