- /* NB we ABSOLUTELY RELY on req being zeroed, so pointers are NULL,
- * flags are reset and scalars are zero. We only set the message
- * size to non-zero if this was a successful receive. */
- req->rq_xid = ev->match_bits;
- req->rq_reqmsg = ev->mem_desc.start + ev->offset;
- if (ev->type == PTL_EVENT_PUT_END &&
- ev->ni_fail_type == PTL_NI_OK)
- req->rq_reqlen = ev->mlength;
- do_gettimeofday(&req->rq_arrival_time);
- req->rq_peer.peer_nid = ev->initiator.nid;
- req->rq_peer.peer_ni = rqbd->rqbd_srv_ni->sni_ni;
- req->rq_rqbd = rqbd;
-
- spin_lock_irqsave (&service->srv_lock, flags);
+ ptlrpc_srv_req_init(req);
+ /* NB we ABSOLUTELY RELY on req being zeroed, so pointers are NULL,
+ * flags are reset and scalars are zero. We only set the message
+ * size to non-zero if this was a successful receive. */
+ req->rq_xid = ev->match_bits;
+ req->rq_reqbuf = ev->md.start + ev->offset;
+ if (ev->type == LNET_EVENT_PUT && ev->status == 0)
+ req->rq_reqdata_len = ev->mlength;
+ ktime_get_real_ts64(&req->rq_arrival_time);
+ /* Multi-Rail: keep track of both initiator and source NID. */
+ req->rq_peer = ev->initiator;
+ req->rq_source = ev->source;
+ req->rq_self = ev->target.nid;
+ req->rq_rqbd = rqbd;
+ req->rq_phase = RQ_PHASE_NEW;
+ if (ev->type == LNET_EVENT_PUT)
+ CDEBUG(D_INFO, "incoming req@%p x%llu msgsize %u\n",
+ req, req->rq_xid, ev->mlength);
+
+ CDEBUG(D_RPCTRACE, "peer: %s (source: %s)\n",
+ libcfs_id2str(req->rq_peer), libcfs_id2str(req->rq_source));
+
+ spin_lock(&svcpt->scp_lock);
+
+ ptlrpc_req_add_history(svcpt, req);
+
+ if (ev->unlinked) {
+ svcpt->scp_nrqbds_posted--;
+ CDEBUG(D_INFO, "Buffer complete: %d buffers still posted\n",
+ svcpt->scp_nrqbds_posted);
+
+ /* Normally, don't complain about 0 buffers posted; LNET won't
+ * drop incoming reqs since we set the portal lazy */
+ if (test_req_buffer_pressure &&
+ ev->type != LNET_EVENT_UNLINK &&
+ svcpt->scp_nrqbds_posted == 0)
+ CWARN("All %s request buffers busy\n",
+ service->srv_name);