Content-Type: multipart/mixed; boundary="===============9008254470597590374==" MIME-Version: 1.0 From: Dave Jiang Subject: [Accel-config] Re: [PATCH 1/1] accel-config:dsa_test Add no opcode opertion suooport Date: Wed, 25 Aug 2021 08:51:30 -0700 Message-ID: In-Reply-To: 20210825082003.3047833-1-tony.zhu@intel.com To: accel-config@lists.01.org List-ID: --===============9008254470597590374== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On 8/25/2021 1:20 AM, Tony Zhu wrote: subject: accel-config: dsa_test: Add noop opcode test support > The No-op opertion performs no DMA opertion. Add the test support. The NOOP operation performs a dummy DMA operation that does not initiate = a transfer. > > Signed-off-by: Tony Zhu > --- > test/dsa.c | 30 ++++++++++++++++++++++++++++++ > test/dsa.h | 5 +++++ > test/dsa_test.c | 35 +++++++++++++++++++++++++++++++++++ > test/prep.c | 28 ++++++++++++++++++++++++++++ > 4 files changed, 98 insertions(+) > > diff --git a/test/dsa.c b/test/dsa.c > index 5396b1b..5fb9721 100644 > --- a/test/dsa.c > +++ b/test/dsa.c > @@ -554,6 +554,36 @@ void free_batch_task(struct batch_task *btsk) > free(btsk); > } > = > +int dsa_wait_noop(struct dsa_context *ctx) > +{ > + struct dsa_completion_record *comp =3D ctx->single_task->comp; > + int rc; > + > + rc =3D dsa_wait_on_desc_timeout(comp, ms_timeout); > + if (rc < 0) { > + err("noop desc timeout\n"); > + return DSA_STATUS_TIMEOUT; > + } > + > + return DSA_STATUS_OK; > +} > + > +int dsa_noop(struct dsa_context *ctx) > +{ > + struct task *tsk =3D ctx->single_task; > + int ret =3D DSA_STATUS_OK; > + > + tsk->dflags =3D IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR; > +//if ((tsk->test_flags & TEST_FLAGS_BOF) && ctx->bof) > +// tsk->dflags |=3D IDXD_OP_FLAG_BOF; Remove since commented out? > + > + dsa_prep_noop(tsk); > + dsa_desc_submit(ctx, tsk->desc); > + ret =3D dsa_wait_noop(ctx); > + > + return ret; > +} > + > int dsa_wait_batch(struct dsa_context *ctx) > { > int rc; > diff --git a/test/dsa.h b/test/dsa.h > index 4e3cddc..5db0c02 100644 > --- a/test/dsa.h > +++ b/test/dsa.h > @@ -217,6 +217,9 @@ struct task *__alloc_task(void); > int init_task(struct task *tsk, int tflags, int opcode, > unsigned long xfer_size); > = > +int dsa_noop(struct dsa_context *ctx); > +int dsa_wait_noop(struct dsa_context *ctx); > + > int dsa_memcpy(struct dsa_context *ctx); > int dsa_wait_memcpy(struct dsa_context *ctx); > = > @@ -232,6 +235,7 @@ int dsa_wait_compval(struct dsa_context *ctx); > int dsa_dualcast(struct dsa_context *ctx); > int dsa_wait_dualcast(struct dsa_context *ctx); > = > +void dsa_prep_noop(struct task *tsk); > void dsa_prep_memcpy(struct task *tsk); > void dsa_reprep_memcpy(struct dsa_context *ctx); > void dsa_prep_memfill(struct task *tsk); > @@ -256,6 +260,7 @@ int init_batch_task(struct batch_task *btsk, int task= _num, int tflags, > int opcode, unsigned long xfer_size, unsigned long dflags); > = > void dsa_prep_batch(struct batch_task *btsk, unsigned long desc_flags); > +void dsa_prep_batch_noop(struct batch_task *btsk); > void dsa_prep_batch_memcpy(struct batch_task *btsk); > void dsa_prep_batch_memfill(struct batch_task *btsk); > void dsa_prep_batch_compare(struct batch_task *btsk); > diff --git a/test/dsa_test.c b/test/dsa_test.c > index 90be118..916c0da 100644 > --- a/test/dsa_test.c > +++ b/test/dsa_test.c > @@ -58,6 +58,9 @@ static int test_batch(struct dsa_context *ctx, size_t b= uf_size, > return rc; > = > switch (bopcode) { > + case DSA_OPCODE_NOOP: > + dsa_prep_batch_noop(ctx->batch_task); > + break; > case DSA_OPCODE_MEMMOVE: > dsa_prep_batch_memcpy(ctx->batch_task); > break; > @@ -157,6 +160,38 @@ int main(int argc, char *argv[]) > } > = > switch (opcode) { > + case DSA_OPCODE_NOOP: { > + struct task *tsk; > + > + info("noop: len %#lx tflags %#x\n", buf_size, tflags); > + > + rc =3D alloc_task(dsa); > + if (rc !=3D DSA_STATUS_OK) { > + err("noop: alloc task failed, rc=3D%d\n", rc); > + goto error; > + } > + > + tsk =3D dsa->single_task; > + rc =3D init_task(tsk, tflags, opcode, buf_size); > + if (rc !=3D DSA_STATUS_OK) { > + err("noop: init task failed\n"); > + goto error; > + } > + > + rc =3D dsa_noop(dsa); > + if (rc !=3D DSA_STATUS_OK) { > + err("noop failed stat %d\n", rc); > + rc =3D -ENXIO; > + break; > + } > + > + rc =3D task_result_verify(tsk, 0); > + if (rc !=3D DSA_STATUS_OK) > + goto error; > + > + break; > + } > + > case DSA_OPCODE_BATCH: > if (bsize > dsa->max_batch_size || bsize < 2) { > err("invalid num descs: %d\n", bsize); > diff --git a/test/prep.c b/test/prep.c > index bb06626..f22f190 100644 > --- a/test/prep.c > +++ b/test/prep.c > @@ -30,6 +30,17 @@ void dsa_desc_submit(struct dsa_context *ctx, struct d= sa_hw_desc *hw) > usleep(10000); > } > = > +void dsa_prep_noop(struct task *tsk) > +{ > + info("preparing descriptor for noop\n"); > + > + tsk->dflags =3D IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR; > + dsa_prep_desc_common(tsk->desc, tsk->opcode, (uint64_t)(tsk->dst1), > + (uint64_t)(tsk->src1), 0, tsk->dflags); > + tsk->desc->completion_addr =3D (uint64_t)(tsk->comp); > + tsk->comp->status =3D 0; > +} > + > void dsa_prep_memcpy(struct task *tsk) > { > info("preparing descriptor for memcpy\n"); > @@ -63,6 +74,23 @@ void dsa_reprep_memcpy(struct dsa_context *ctx) > dsa_desc_submit(ctx, hw); > } > = > +void dsa_prep_batch_noop(struct batch_task *btsk) > +{ > + int i; > + struct task *sub_task; > + > + uint32_t dflags =3D IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR; > + for (i =3D 0; i < btsk->task_num; i++) { > + sub_task =3D &(btsk->sub_tasks[i]); > + dsa_prep_desc_common(sub_task->desc, sub_task->opcode, > + (uint64_t)(sub_task->dst1), > + (uint64_t)(sub_task->src1), > + 0, dflags); > + sub_task->desc->completion_addr =3D (uint64_t)(sub_task->comp); > + sub_task->comp->status =3D 0; > + } > +} > + > /* Performs no error or bound checking */ > void dsa_prep_batch_memcpy(struct batch_task *btsk) > { --===============9008254470597590374==--