#include <linux/obd_support.h>
#include <linux/lustre_net.h>
#include <linux/lustre_lib.h>
+#include <linux/obd.h>
extern ptl_handle_eq_t request_out_eq, reply_in_eq, reply_out_eq,
bulk_source_eq, bulk_sink_eq;
-static ptl_process_id_t local_id = {PTL_NID_ANY, PTL_PID_ANY};
static int ptl_send_buf(struct ptlrpc_request *request,
struct ptlrpc_connection *conn, int portal)
remote_id.nid = conn->c_peer.peer_nid;
remote_id.pid = 0;
- CDEBUG(D_NET, "Sending %d bytes to portal %d, xid %Ld\n",
+ CDEBUG(D_NET, "Sending %d bytes to portal %d, xid "LPD64"\n",
request->rq_req_md.length, portal, request->rq_xid);
if (!portal)
rc = PtlPut(md_h, PTL_NOACK_REQ, remote_id, portal, 0, request->rq_xid,
0, 0);
if (rc != PTL_OK) {
- CERROR("PtlPut(%Lu, %d, %Ld) failed: %d\n", remote_id.nid,
+ CERROR("PtlPut("LPU64", %d, "LPD64") failed: %d\n", remote_id.nid,
portal, request->rq_xid, rc);
PtlMDUnlink(md_h);
}
desc->bd_md.options = PTL_MD_OP_PUT | PTL_MD_IOV;
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);
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 %Lx pid %d xid %d\n",
+ 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,
desc->bd_portal, 0, xid, 0, 0);
if (rc != PTL_OK) {
- CERROR("PtlPut(%Lu, %d, %d) failed: %d\n",
+ CERROR("PtlPut("LPU64", %d, %d) failed: %d\n",
remote_id.nid, desc->bd_portal, xid, rc);
PtlMDUnlink(desc->bd_md_h);
LBUG();
int rc;
__u32 xid = 0;
struct iovec *iov;
+ ptl_process_id_t source_id;
ENTRY;
iov = ptlrpc_get_bulk_iov (desc);
LASSERT (desc->bd_md.niov == desc->bd_page_count);
LASSERT (desc->bd_md.niov != 0);
+ source_id.nid = desc->bd_connection->c_peer.peer_nid;
+ source_id.pid = PTL_PID_ANY;
+
rc = PtlMEAttach(desc->bd_connection->c_peer.peer_ni,
- desc->bd_portal, local_id, xid, 0,
+ desc->bd_portal, source_id, xid, 0,
PTL_UNLINK, PTL_INS_AFTER, &desc->bd_me_h);
ptlrpc_put_bulk_iov (desc, iov);
{
int rc;
char *repbuf;
+ ptl_process_id_t source_id;
ENTRY;
// 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,
- local_id, request->rq_xid, 0, PTL_UNLINK,
+ 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);
GOTO(cleanup2, rc);
}
- CDEBUG(D_NET, "Setup reply buffer: %u bytes, xid %Lu, portal %u\n",
+ 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);
return rc;
}
-void ptlrpc_link_svc_me(struct ptlrpc_service *service, int i)
+void ptlrpc_link_svc_me(struct ptlrpc_request_buffer_desc *rqbd)
{
+ struct ptlrpc_service *service = rqbd->rqbd_service;
+ static ptl_process_id_t match_id = {PTL_NID_ANY, PTL_PID_ANY};
int rc;
ptl_md_t dummy;
ptl_handle_md_t md_h;
/* Attach the leading ME on which we build the ring */
rc = PtlMEAttach(service->srv_self.peer_ni, service->srv_req_portal,
- local_id, 0, ~0, PTL_RETAIN, PTL_INS_BEFORE,
- &(service->srv_me_h[i]));
+ match_id, 0, ~0,
+ PTL_UNLINK, PTL_INS_AFTER, &rqbd->rqbd_me_h);
if (rc != PTL_OK) {
CERROR("PtlMEAttach failed: %d\n", rc);
LBUG();
}
- if (service->srv_ref_count[i])
- LBUG();
-
- dummy.start = service->srv_buf[i];
+ dummy.start = rqbd->rqbd_buffer;
dummy.length = service->srv_buf_size;
dummy.max_offset = service->srv_buf_size;
- dummy.threshold = PTL_MD_THRESH_INF;
- dummy.options = PTL_MD_OP_PUT | PTL_MD_AUTO_UNLINK;
- dummy.user_ptr = service;
+ dummy.threshold = 1;
+ dummy.options = PTL_MD_OP_PUT;
+ dummy.user_ptr = rqbd;
dummy.eventq = service->srv_eq_h;
- dummy.max_offset = service->srv_buf_size;
- rc = PtlMDAttach(service->srv_me_h[i], dummy, PTL_UNLINK, &md_h);
+ rc = PtlMDAttach(rqbd->rqbd_me_h, dummy, PTL_UNLINK, &md_h);
if (rc != PTL_OK) {
/* cleanup */
CERROR("PtlMDAttach failed: %d\n", rc);
LBUG();
}
}
-
-/* ptl_handled_rpc() should be called by the sleeping process once
- * it finishes processing an event. This ensures the ref count is
- * decremented and that the rpc ring buffer cycles properly.
- */
-int ptl_handled_rpc(struct ptlrpc_service *service, void *start)
-{
- int index;
-
- spin_lock(&service->srv_lock);
- for (index = 0; index < service->srv_ring_length; index++)
- if (service->srv_buf[index] == start)
- break;
-
- if (index == service->srv_ring_length)
- LBUG();
-
- CDEBUG(D_INFO, "MD index=%d Ref Count=%d\n", index,
- service->srv_ref_count[index]);
- service->srv_ref_count[index]--;
-
- if (service->srv_ref_count[index] < 0)
- LBUG();
-
- if (service->srv_ref_count[index] == 0 &&
- !ptl_is_valid_handle(&(service->srv_me_h[index]))) {
- CDEBUG(D_NET, "relinking %d\n", index);
- ptlrpc_link_svc_me(service, index);
- }
-
- spin_unlock(&service->srv_lock);
- return 0;
-}