ptl_process_id_t remote_id;
ptl_handle_md_t md_h;
+ LASSERT(conn);
+
request->rq_req_md.user_ptr = request;
switch (request->rq_type) {
request->rq_req_md.length = request->rq_reqlen;
request->rq_req_md.eventq = request_out_eq;
break;
+ case PTL_RPC_MSG_ERR:
case PTL_RPC_MSG_REPLY:
request->rq_repmsg->type = HTON__u32(request->rq_type);
request->rq_req_md.start = request->rq_repmsg;
rc = PtlPut(md_h, PTL_NOACK_REQ, remote_id, portal, 0, request->rq_xid,
0, 0);
if (rc != PTL_OK) {
- CERROR("PtlPut("LPU64", %d, "LPD64") failed: %d\n", remote_id.nid,
- portal, request->rq_xid, rc);
+ CERROR("PtlPut("LPU64", %d, "LPD64") failed: %d\n",
+ remote_id.nid, portal, request->rq_xid, rc);
PtlMDUnlink(md_h);
}
desc->bd_md.user_ptr = desc;
atomic_set (&desc->bd_source_callback_count, 2);
-
+
list_for_each_safe(tmp, next, &desc->bd_page_list) {
struct ptlrpc_bulk_page *bulk;
bulk = list_entry(tmp, struct ptlrpc_bulk_page, bp_link);
rc = PtlMDBind(desc->bd_connection->c_peer.peer_ni, desc->bd_md,
&desc->bd_md_h);
- ptlrpc_put_bulk_iov (desc, iov); /* move down to reduce latency to send */
+ ptlrpc_put_bulk_iov (desc, iov); /*move down to reduce latency to send*/
if (rc != PTL_OK) {
CERROR("PtlMDBind failed: %d\n", rc);
remote_id.nid = desc->bd_connection->c_peer.peer_nid;
remote_id.pid = 0;
- CDEBUG(D_NET, "Sending %u pages %u bytes to portal %d nid "LPX64" pid %d xid %d\n",
- desc->bd_md.niov, desc->bd_md.length,
+ CDEBUG(D_NET, "Sending %u pages %u bytes to portal %d nid "LPX64" pid "
+ "%d xid %d\n", desc->bd_md.niov, desc->bd_md.length,
desc->bd_portal, remote_id.nid, remote_id.pid, xid);
rc = PtlPut(desc->bd_md_h, PTL_ACK_REQ, remote_id,
ptl_process_id_t source_id;
ENTRY;
+ if (desc->bd_page_count > PTL_MD_MAX_IOV) {
+ CERROR("iov longer than %d pages not supported (count=%d)\n",
+ PTL_MD_MAX_IOV, desc->bd_page_count);
+ RETURN(-EINVAL);
+ }
+
iov = ptlrpc_get_bulk_iov (desc);
if (iov == NULL)
return (-ENOMEM);
desc->bd_portal, source_id, xid, 0,
PTL_UNLINK, PTL_INS_AFTER, &desc->bd_me_h);
- ptlrpc_put_bulk_iov (desc, iov);
-
if (rc != PTL_OK) {
CERROR("PtlMEAttach failed: %d\n", rc);
LBUG();
GOTO(cleanup, rc);
}
+ ptlrpc_put_bulk_iov (desc, iov);
+
CDEBUG(D_NET, "Setup bulk sink buffers: %u pages %u bytes, xid %u, "
"portal %u\n", desc->bd_md.niov, desc->bd_md.length,
xid, desc->bd_portal);
RETURN(0);
cleanup:
+ ptlrpc_put_bulk_iov (desc, iov);
ptlrpc_abort_bulk(desc);
return rc;
if (rc)
RETURN(rc);
- req->rq_repmsg->type = HTON__u32(PTL_RPC_MSG_ERR);
+ req->rq_type = PTL_RPC_MSG_ERR;
rc = ptlrpc_reply(svc, req);
RETURN(rc);
LBUG();
RETURN(EINVAL);
}
- if (request->rq_replen == 0) {
- CERROR("request->rq_replen is 0!\n");
- RETURN(EINVAL);
- }
-
- /* request->rq_repmsg is set only when the reply comes in, in
- * client_packet_callback() */
- if (request->rq_reply_md.start)
- OBD_FREE(request->rq_reply_md.start, request->rq_replen);
-
- OBD_ALLOC(repbuf, request->rq_replen);
- if (!repbuf) {
- LBUG();
- RETURN(ENOMEM);
- }
-
- // down(&request->rq_client->cli_rpc_sem);
source_id.nid = request->rq_connection->c_peer.peer_nid;
source_id.pid = PTL_PID_ANY;
- rc = PtlMEAttach(request->rq_connection->c_peer.peer_ni,
- request->rq_import->imp_client->cli_reply_portal,
- source_id, request->rq_xid, 0, PTL_UNLINK,
- PTL_INS_AFTER, &request->rq_reply_me_h);
- if (rc != PTL_OK) {
- CERROR("PtlMEAttach failed: %d\n", rc);
- LBUG();
- GOTO(cleanup, rc);
- }
-
- request->rq_reply_md.start = repbuf;
- request->rq_reply_md.length = request->rq_replen;
- request->rq_reply_md.threshold = 1;
- request->rq_reply_md.options = PTL_MD_OP_PUT;
- request->rq_reply_md.user_ptr = request;
- request->rq_reply_md.eventq = reply_in_eq;
-
- rc = PtlMDAttach(request->rq_reply_me_h, request->rq_reply_md,
- PTL_UNLINK, &request->rq_reply_md_h);
- if (rc != PTL_OK) {
- CERROR("PtlMDAttach failed: %d\n", rc);
- LBUG();
- GOTO(cleanup2, rc);
+ if (request->rq_replen != 0) {
+
+ /* request->rq_repmsg is set only when the reply comes in, in
+ * client_packet_callback() */
+ if (request->rq_reply_md.start)
+ OBD_FREE(request->rq_reply_md.start,
+ request->rq_replen);
+
+ OBD_ALLOC(repbuf, request->rq_replen);
+ if (!repbuf) {
+ LBUG();
+ RETURN(ENOMEM);
+ }
+
+ rc = PtlMEAttach(request->rq_connection->c_peer.peer_ni,
+ request->rq_import->imp_client->cli_reply_portal,
+ source_id, request->rq_xid, 0, PTL_UNLINK,
+ PTL_INS_AFTER, &request->rq_reply_me_h);
+ if (rc != PTL_OK) {
+ CERROR("PtlMEAttach failed: %d\n", rc);
+ LBUG();
+ GOTO(cleanup, rc);
+ }
+
+ request->rq_reply_md.start = repbuf;
+ request->rq_reply_md.length = request->rq_replen;
+ request->rq_reply_md.threshold = 1;
+ request->rq_reply_md.options = PTL_MD_OP_PUT;
+ request->rq_reply_md.user_ptr = request;
+ request->rq_reply_md.eventq = reply_in_eq;
+
+ rc = PtlMDAttach(request->rq_reply_me_h, request->rq_reply_md,
+ PTL_UNLINK, &request->rq_reply_md_h);
+ if (rc != PTL_OK) {
+ CERROR("PtlMDAttach failed: %d\n", rc);
+ LBUG();
+ GOTO(cleanup2, rc);
+ }
+
+ CDEBUG(D_NET, "Setup reply buffer: %u bytes, xid "LPU64
+ ", portal %u\n",
+ request->rq_replen, request->rq_xid,
+ request->rq_import->imp_client->cli_reply_portal);
}
- CDEBUG(D_NET, "Setup reply buffer: %u bytes, xid "LPU64", portal %u\n",
- request->rq_replen, request->rq_xid,
- request->rq_import->imp_client->cli_reply_portal);
-
rc = ptl_send_buf(request, request->rq_connection,
request->rq_import->imp_client->cli_request_portal);
RETURN(rc);
ptl_md_t dummy;
ptl_handle_md_t md_h;
+ LASSERT (atomic_read (&rqbd->rqbd_refcount) == 0);
+
/* Attach the leading ME on which we build the ring */
rc = PtlMEAttach(service->srv_self.peer_ni, service->srv_req_portal,
- match_id, 0, ~0,
+ match_id, 0, ~0,
PTL_UNLINK, PTL_INS_AFTER, &rqbd->rqbd_me_h);
if (rc != PTL_OK) {
CERROR("PtlMEAttach failed: %d\n", rc);
LBUG();
}
- dummy.start = rqbd->rqbd_buffer;
- dummy.length = service->srv_buf_size;
- dummy.max_offset = service->srv_buf_size;
- dummy.threshold = 1;
- dummy.options = PTL_MD_OP_PUT;
- dummy.user_ptr = rqbd;
- dummy.eventq = service->srv_eq_h;
+ dummy.start = rqbd->rqbd_buffer;
+ dummy.length = service->srv_buf_size;
+ dummy.max_size = service->srv_max_req_size;
+ dummy.threshold = PTL_MD_THRESH_INF;
+ dummy.options = PTL_MD_OP_PUT | PTL_MD_MAX_SIZE | PTL_MD_AUTO_UNLINK;
+ dummy.user_ptr = rqbd;
+ dummy.eventq = service->srv_eq_h;
+
+ atomic_inc (&service->srv_nrqbds_receiving);
+ atomic_set (&rqbd->rqbd_refcount, 1); /* 1 ref for portals */
rc = PtlMDAttach(rqbd->rqbd_me_h, dummy, PTL_UNLINK, &md_h);
if (rc != PTL_OK) {
- /* cleanup */
CERROR("PtlMDAttach failed: %d\n", rc);
LBUG();
+#warning proper cleanup required
+ PtlMEUnlink (rqbd->rqbd_me_h);
+ atomic_set (&rqbd->rqbd_refcount, 0);
+ atomic_dec (&service->srv_nrqbds_receiving);
}
}