Skip to content
This repository has been archived by the owner on Dec 2, 2021. It is now read-only.

CART-0000 rpc: add RPC enqueue #403

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cart/crt_internal_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ struct crt_opc_info {
coi_reset_timer:1; /* reset timer on timeout */

crt_rpc_cb_t coi_rpc_cb;
crt_rpc_cb_t coi_rpc_enq;
struct crt_corpc_ops *coi_co_ops;

/* Sizes/offset used when buffers are part of the same allocation
Expand Down
5 changes: 3 additions & 2 deletions src/cart/crt_register.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ crt_opc_lookup(struct crt_opc_map *map, crt_opcode_t opc, int locked)
static int
crt_opc_reg(struct crt_opc_info *opc_info, crt_opcode_t opc, uint32_t flags,
struct crt_req_format *crf, crt_rpc_cb_t rpc_cb,
struct crt_corpc_ops *co_ops)
crt_rpc_cb_t rpc_enq, struct crt_corpc_ops *co_ops)
{
size_t size_in = 0;
size_t size_out = 0;
Expand All @@ -262,6 +262,7 @@ crt_opc_reg(struct crt_opc_info *opc_info, crt_opcode_t opc, uint32_t flags,
opc_info->coi_opc = opc;
opc_info->coi_crf = crf;
opc_info->coi_proc_init = 1;
opc_info->coi_rpc_enq = rpc_enq;
if (rpc_cb != NULL) {
opc_info->coi_rpc_cb = rpc_cb;
opc_info->coi_rpccb_init = 1;
Expand Down Expand Up @@ -327,7 +328,7 @@ crt_opc_reg_internal(struct crt_opc_info *opc_info, crt_opcode_t opc,

reg_opc:
rc = crt_opc_reg(opc_info, opc, prf->prf_flags, crf, prf->prf_hdlr,
prf->prf_co_ops);
prf->prf_enq, prf->prf_co_ops);
if (rc != 0)
D_ERROR("rpc (opc: %#x) register failed, rc: %d.\n", opc, rc);

Expand Down
5 changes: 5 additions & 0 deletions src/cart/crt_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,11 @@ crt_rpc_common_hdlr(struct crt_rpc_priv *rpc_priv)
if (!rpc_priv->crp_opc_info->coi_no_reply)
rpc_priv->crp_reply_pending = 1;

if (rpc_priv->crp_opc_info->coi_rpc_enq) {
rpc_priv->crp_opc_info->coi_rpc_enq(&rpc_priv->crp_pub);
goto out;
}

if (crt_rpc_cb_customized(crt_ctx, &rpc_priv->crp_pub)) {
rc = crt_ctx->cc_rpc_cb((crt_context_t)crt_ctx,
&rpc_priv->crp_pub,
Expand Down
1 change: 1 addition & 0 deletions src/include/cart/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ struct crt_proto_rpc_format {
struct crt_req_format *prf_req_fmt;
/** the RPC hander on the server side */
crt_rpc_cb_t prf_hdlr;
crt_rpc_cb_t prf_enq;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working on a patch to enqueue requests in 'cc_rpc_cb', and the request queue is managed by scheduler.

/** aggregation function for co-rpc */
struct crt_corpc_ops *prf_co_ops;
/**
Expand Down