Lines Matching refs:rpc

52 #include "rpc.h"
236 #define srpc_client_rpc_size(rpc) \
237 offsetof(srpc_client_rpc_t, crpc_bulk.bk_iovs[(rpc)->crpc_bulk.bk_niov])
239 #define srpc_client_rpc_addref(rpc) \
242 (rpc), libcfs_id2str((rpc)->crpc_dest), \
243 atomic_read(&(rpc)->crpc_refcount)); \
244 LASSERT(atomic_read(&(rpc)->crpc_refcount) > 0); \
245 atomic_inc(&(rpc)->crpc_refcount); \
248 #define srpc_client_rpc_decref(rpc) \
251 (rpc), libcfs_id2str((rpc)->crpc_dest), \
252 atomic_read(&(rpc)->crpc_refcount)); \
253 LASSERT(atomic_read(&(rpc)->crpc_refcount) > 0); \
254 if (atomic_dec_and_test(&(rpc)->crpc_refcount)) \
255 srpc_destroy_client_rpc(rpc); \
258 #define srpc_event_pending(rpc) ((rpc)->crpc_bulkev.ev_fired == 0 || \
259 (rpc)->crpc_reqstev.ev_fired == 0 || \
260 (rpc)->crpc_replyev.ev_fired == 0)
357 srpc_client_rpc_t **rpc); /* prep a tests rpc */
359 srpc_client_rpc_t *rpc); /* done a test rpc */
417 int nblk, int blklen, srpc_client_rpc_t **rpc);
418 void sfw_abort_rpc(srpc_client_rpc_t *rpc);
419 void sfw_post_rpc(srpc_client_rpc_t *rpc);
420 void sfw_client_rpc_done(srpc_client_rpc_t *rpc);
422 void sfw_free_pages(srpc_server_rpc_t *rpc);
424 int sfw_alloc_pages(srpc_server_rpc_t *rpc, int cpt, int npages, int len,
433 void srpc_post_rpc(srpc_client_rpc_t *rpc);
434 void srpc_abort_rpc(srpc_client_rpc_t *rpc, int why);
439 int srpc_send_reply(srpc_server_rpc_t *rpc);
502 srpc_destroy_client_rpc (srpc_client_rpc_t *rpc)
504 LASSERT (rpc != NULL);
505 LASSERT (!srpc_event_pending(rpc));
506 LASSERT (atomic_read(&rpc->crpc_refcount) == 0);
508 if (rpc->crpc_fini == NULL) {
509 LIBCFS_FREE(rpc, srpc_client_rpc_size(rpc));
511 (*rpc->crpc_fini) (rpc);
518 srpc_init_client_rpc (srpc_client_rpc_t *rpc, lnet_process_id_t peer,
525 memset(rpc, 0, offsetof(srpc_client_rpc_t,
528 INIT_LIST_HEAD(&rpc->crpc_list);
529 swi_init_workitem(&rpc->crpc_wi, rpc, srpc_send_rpc,
531 spin_lock_init(&rpc->crpc_lock);
532 atomic_set(&rpc->crpc_refcount, 1); /* 1 ref for caller */
534 rpc->crpc_dest = peer;
535 rpc->crpc_priv = priv;
536 rpc->crpc_service = service;
537 rpc->crpc_bulk.bk_len = bulklen;
538 rpc->crpc_bulk.bk_niov = nbulkiov;
539 rpc->crpc_done = rpc_done;
540 rpc->crpc_fini = rpc_fini;
541 LNetInvalidateHandle(&rpc->crpc_reqstmdh);
542 LNetInvalidateHandle(&rpc->crpc_replymdh);
543 LNetInvalidateHandle(&rpc->crpc_bulk.bk_mdh);
546 rpc->crpc_bulkev.ev_fired =
547 rpc->crpc_reqstev.ev_fired =
548 rpc->crpc_replyev.ev_fired = 1;
550 rpc->crpc_reqstmsg.msg_magic = SRPC_MSG_MAGIC;
551 rpc->crpc_reqstmsg.msg_version = SRPC_MSG_VERSION;
552 rpc->crpc_reqstmsg.msg_type = srpc_service2request(service);