* The LNet API provides two data movement operations: LNetPut()
* and LNetGet().
* @{ */
-int LNetPut(lnet_nid_t self,
- struct lnet_handle_md md_in,
- enum lnet_ack_req ack_req_in,
- struct lnet_process_id target_in,
- unsigned int portal_in,
- __u64 match_bits_in,
- unsigned int offset_in,
- __u64 hdr_data_in);
+int LNetPut(struct lnet_nid *self,
+ struct lnet_handle_md md_in,
+ enum lnet_ack_req ack_req_in,
+ struct lnet_processid *target_in,
+ unsigned int portal_in,
+ __u64 match_bits_in,
+ unsigned int offset_in,
+ __u64 hdr_data_in);
int LNetGet(lnet_nid_t self,
struct lnet_handle_md md_in,
* \see struct lnet_event::hdr_data and lnet_event_kind_t.
*/
int
-LNetPut(lnet_nid_t self4, struct lnet_handle_md mdh, enum lnet_ack_req ack,
- struct lnet_process_id target4, unsigned int portal,
+LNetPut(struct lnet_nid *self, struct lnet_handle_md mdh, enum lnet_ack_req ack,
+ struct lnet_processid *target, unsigned int portal,
__u64 match_bits, unsigned int offset,
__u64 hdr_data)
{
struct lnet_libmd *md;
int cpt;
int rc;
- struct lnet_processid target;
struct lnet_rsp_tracker *rspt = NULL;
- struct lnet_nid self;
LASSERT(the_lnet.ln_refcount > 0);
- lnet_nid4_to_nid(self4, &self);
- lnet_nid4_to_nid(target4.nid, &target.nid);
- target.pid = target4.pid;
-
if (!list_empty(&the_lnet.ln_test_peers) && /* normally we don't */
- fail_peer(&target.nid, 1)) { /* shall we now? */
+ fail_peer(&target->nid, 1)) { /* shall we now? */
CERROR("Dropping PUT to %s: simulated failure\n",
- libcfs_id2str(target4));
+ libcfs_idstr(target));
return -EIO;
}
msg = lnet_msg_alloc();
if (msg == NULL) {
CERROR("Dropping PUT to %s: ENOMEM on struct lnet_msg\n",
- libcfs_id2str(target4));
+ libcfs_idstr(target));
return -ENOMEM;
}
msg->msg_vmflush = !!(current->flags & PF_MEMALLOC);
rspt = lnet_rspt_alloc(cpt);
if (!rspt) {
CERROR("Dropping PUT to %s: ENOMEM on response tracker\n",
- libcfs_id2str(target4));
+ libcfs_idstr(target));
return -ENOMEM;
}
INIT_LIST_HEAD(&rspt->rspt_on_list);
md = lnet_handle2md(&mdh);
if (md == NULL || md->md_threshold == 0 || md->md_me != NULL) {
CERROR("Dropping PUT (%llu:%d:%s): MD (%d) invalid\n",
- match_bits, portal, libcfs_id2str(target4),
+ match_bits, portal, libcfs_idstr(target),
md == NULL ? -1 : md->md_threshold);
if (md != NULL && md->md_me != NULL)
CERROR("Source MD also attached to portal %d\n",
return -ENOENT;
}
- CDEBUG(D_NET, "%s -> %s\n", __func__, libcfs_id2str(target4));
+ CDEBUG(D_NET, "%s -> %s\n", __func__, libcfs_idstr(target));
lnet_msg_attach_md(msg, md, 0, 0);
- lnet_prep_send(msg, LNET_MSG_PUT, &target, 0, md->md_length);
+ lnet_prep_send(msg, LNET_MSG_PUT, target, 0, md->md_length);
msg->msg_hdr.msg.put.match_bits = cpu_to_le64(match_bits);
msg->msg_hdr.msg.put.ptl_index = cpu_to_le32(portal);
CFS_FAIL_ONCE))
rc = -EIO;
else
- rc = lnet_send(&self, msg, NULL);
+ rc = lnet_send(self, msg, NULL);
if (rc != 0) {
CNETERR("Error sending PUT to %s: %d\n",
- libcfs_id2str(target4), rc);
+ libcfs_idstr(target), rc);
msg->msg_no_resend = true;
lnet_finalize(msg, rc);
}
__must_hold(&lp->lp_lock)
{
struct lnet_ping_buffer *pbuf;
- struct lnet_process_id id;
+ struct lnet_processid id;
struct lnet_md md;
int cpt;
int rc;
lnet_peer_addref_locked(lp);
id.pid = LNET_PID_LUSTRE;
if (!LNET_NID_IS_ANY(&lp->lp_disc_dst_nid))
- id.nid = lnet_nid_to_nid4(&lp->lp_disc_dst_nid);
+ id.nid = lp->lp_disc_dst_nid;
else
- id.nid = lnet_nid_to_nid4(&lp->lp_primary_nid);
+ id.nid = lp->lp_primary_nid;
lnet_net_unlock(cpt);
- rc = LNetPut(lnet_nid_to_nid4(&lp->lp_disc_src_nid), lp->lp_push_mdh,
- LNET_ACK_REQ, id, LNET_RESERVED_PORTAL,
+ rc = LNetPut(&lp->lp_disc_src_nid, lp->lp_push_mdh,
+ LNET_ACK_REQ, &id, LNET_RESERVED_PORTAL,
LNET_PROTO_PING_MATCHBITS, 0, 0);
/*
static int
srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len,
- int options, struct lnet_process_id peer,
- lnet_nid_t self, struct lnet_handle_md *mdh,
+ int options, struct lnet_process_id peer4,
+ lnet_nid_t self4, struct lnet_handle_md *mdh,
struct srpc_event *ev)
{
int rc;
struct lnet_md md;
+ struct lnet_nid self;
+ struct lnet_processid peer;
+
+ lnet_nid4_to_nid(self4, &self);
+ lnet_pid4_to_pid(peer4, &peer);
md.user_ptr = ev;
md.start = buf;
* buffers...
*/
if ((options & LNET_MD_OP_PUT) != 0) {
- rc = LNetPut(self, *mdh, LNET_NOACK_REQ, peer,
+ rc = LNetPut(&self, *mdh, LNET_NOACK_REQ, &peer,
portal, matchbits, 0, 0);
} else {
LASSERT((options & LNET_MD_OP_GET) != 0);
- rc = LNetGet(self, *mdh, peer, portal, matchbits, 0, false);
+ rc = LNetGet(self4, *mdh, peer4, portal, matchbits, 0, false);
}
if (rc != 0) {
CERROR("LNet%s(%s, %d, %lld) failed: %d\n",
((options & LNET_MD_OP_PUT) != 0) ? "Put" : "Get",
- libcfs_id2str(peer), portal, matchbits, rc);
+ libcfs_id2str(peer4), portal, matchbits, rc);
/* The forthcoming unlink event will complete this operation
* with failure, so fall through and return success here.
} else {
CDEBUG(D_NET,
"Posted active RDMA: peer %s, portal %u, matchbits %#llx\n",
- libcfs_id2str(peer), portal, matchbits);
+ libcfs_id2str(peer4), portal, matchbits);
}
return 0;
}
*/
static int ptl_send_buf(struct lnet_handle_md *mdh, void *base, int len,
enum lnet_ack_req ack, struct ptlrpc_cb_id *cbid,
- lnet_nid_t self, struct lnet_process_id peer_id,
+ lnet_nid_t self4, struct lnet_process_id peer_id4,
int portal, __u64 xid, unsigned int offset,
struct lnet_handle_md *bulk_cookie)
{
- int rc;
- struct lnet_md md;
+ int rc;
+ struct lnet_md md;
+ struct lnet_nid self;
+ struct lnet_processid peer_id;
ENTRY;
- LASSERT (portal != 0);
- CDEBUG (D_INFO, "peer_id %s\n", libcfs_id2str(peer_id));
+ lnet_nid4_to_nid(self4, &self);
+ lnet_pid4_to_pid(peer_id4, &peer_id);
+
+ LASSERT(portal != 0);
+ CDEBUG(D_INFO, "peer_id %s\n", libcfs_id2str(peer_id4));
md.start = base;
md.length = len;
md.threshold = (ack == LNET_ACK_REQ) ? 2 : 1;
percpu_ref_get(&ptlrpc_pending);
- rc = LNetPut(self, *mdh, ack,
- peer_id, portal, xid, offset, 0);
+ rc = LNetPut(&self, *mdh, ack,
+ &peer_id, portal, xid, offset, 0);
if (unlikely(rc != 0)) {
int rc2;
/* We're going to get an UNLINK event when I unlink below,
* which will complete just like any other failed send, so
* I fall through and return success here! */
CERROR("LNetPut(%s, %d, %lld) failed: %d\n",
- libcfs_id2str(peer_id), portal, xid, rc);
+ libcfs_id2str(peer_id4), portal, xid, rc);
rc2 = LNetMDUnlink(*mdh);
LASSERTF(rc2 == 0, "rc2 = %d\n", rc2);
}
*/
int ptlrpc_start_bulk_transfer(struct ptlrpc_bulk_desc *desc)
{
- struct obd_export *exp = desc->bd_export;
- lnet_nid_t self_nid;
- struct lnet_process_id peer_id;
- int rc = 0;
- __u64 mbits;
- int posted_md;
- int total_md;
- struct lnet_md md;
+ struct obd_export *exp = desc->bd_export;
+ lnet_nid_t self_nid4;
+ struct lnet_nid self_nid;
+ struct lnet_process_id peer_id4;
+ struct lnet_processid peer_id;
+ int rc = 0;
+ __u64 mbits;
+ int posted_md;
+ int total_md;
+ struct lnet_md md;
ENTRY;
if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_BULK_PUT_NET))
* request, so they are based on the route taken by the
* message.
*/
- self_nid = desc->bd_req->rq_self;
- peer_id = desc->bd_req->rq_source;
+ self_nid4 = desc->bd_req->rq_self;
+ peer_id4 = desc->bd_req->rq_source;
+ lnet_nid4_to_nid(self_nid4, &self_nid);
+ lnet_pid4_to_pid(peer_id4, &peer_id);
/* NB total length may be 0 for a read past EOF, so we send 0
* length bulks, since the client expects bulk events.
/* Network is about to get at the memory */
if (ptlrpc_is_bulk_put_source(desc->bd_type))
- rc = LNetPut(self_nid, desc->bd_mds[posted_md],
- LNET_ACK_REQ, peer_id,
+ rc = LNetPut(&self_nid, desc->bd_mds[posted_md],
+ LNET_ACK_REQ, &peer_id,
desc->bd_portal, mbits, 0, 0);
else
- rc = LNetGet(self_nid, desc->bd_mds[posted_md],
- peer_id, desc->bd_portal, mbits, 0, false);
+ rc = LNetGet(self_nid4, desc->bd_mds[posted_md],
+ peer_id4, desc->bd_portal,
+ mbits, 0, false);
posted_md++;
if (rc != 0) {
CERROR("%s: failed bulk transfer with %s:%u x%llu: "
"rc = %d\n", exp->exp_obd->obd_name,
- libcfs_id2str(peer_id), desc->bd_portal,
+ libcfs_id2str(peer_id4), desc->bd_portal,
mbits, rc);
break;
}
CDEBUG(D_NET, "Transferring %u pages %u bytes via portal %d "
"id %s mbits %#llx-%#llx\n", desc->bd_iov_count,
- desc->bd_nob, desc->bd_portal, libcfs_id2str(peer_id),
+ desc->bd_nob, desc->bd_portal, libcfs_id2str(peer_id4),
mbits - posted_md, mbits - 1);
RETURN(0);