[PATCH v1 1/1] accel-config/dsa_test Add devices flow control for submission
by Tony Zhu
Add -i to input dsa device id and -d to input wq id which allows
the flow control for task submission.
Signed-off-by: Tony Zhu <tony.zhu(a)intel.com>
---
test/dsa.c | 63 +++++++++++++++++++++++++++++++++++++++++++++----
test/dsa.h | 2 +-
test/dsa_test.c | 15 +++++++++---
3 files changed, 71 insertions(+), 9 deletions(-)
diff --git a/test/dsa.c b/test/dsa.c
index ce6f6a1..83e4b4e 100644
--- a/test/dsa.c
+++ b/test/dsa.c
@@ -146,6 +146,55 @@ static struct accfg_wq *dsa_get_wq(struct dsa_context *ctx,
return NULL;
}
+static struct accfg_wq *dsa_get_wq_byid(struct dsa_context *ctx,
+ int dev_id, int wq_id)
+{
+ struct accfg_device *device;
+ struct accfg_wq *wq;
+ int rc;
+
+ accfg_device_foreach(ctx->ctx, device) {
+ enum accfg_device_state dstate;
+
+ /* Make sure that the device is enabled */
+ dstate = accfg_device_get_state(device);
+ if (dstate != ACCFG_DEVICE_ENABLED)
+ continue;
+
+ /* Match the device to the id requested */
+ if (accfg_device_get_id(device) != dev_id &&
+ dev_id != -1)
+ continue;
+
+ accfg_wq_foreach(device, wq) {
+ enum accfg_wq_state wstate;
+ enum accfg_wq_type type;
+
+ /* Get a workqueue that's enabled */
+ wstate = accfg_wq_get_state(wq);
+ if (wstate != ACCFG_WQ_ENABLED)
+ continue;
+
+ /* The wq type should be user */
+ type = accfg_wq_get_type(wq);
+ if (type != ACCFG_WQT_USER)
+ continue;
+
+ /* Make sure the wq id is correct */
+ if(wq_id != accfg_wq_get_id(wq))
+ continue;
+
+ rc = dsa_setup_wq(ctx, wq);
+ if (rc < 0)
+ return NULL;
+
+ return wq;
+ }
+ }
+
+ return NULL;
+}
+
static uint32_t bsr(uint32_t val)
{
uint32_t msb;
@@ -154,7 +203,7 @@ static uint32_t bsr(uint32_t val)
return msb - 1;
}
-int dsa_alloc(struct dsa_context *ctx, int shared)
+int dsa_alloc(struct dsa_context *ctx, int shared, int dev_id, int wq_id)
{
struct accfg_device *dev;
@@ -162,14 +211,18 @@ int dsa_alloc(struct dsa_context *ctx, int shared)
if (ctx->wq_reg)
return 0;
- ctx->wq = dsa_get_wq(ctx, -1, shared);
+ if(wq_id != -1){
+ ctx->wq = dsa_get_wq_byid(ctx, dev_id, wq_id);
+ }else{
+ ctx->wq = dsa_get_wq(ctx, dev_id, shared);
+ }
+
if (!ctx->wq) {
err("No usable wq found\n");
return -ENODEV;
}
dev = accfg_wq_get_device(ctx->wq);
-
- ctx->dedicated = !shared;
+ ctx->dedicated = accfg_wq_get_mode(ctx->wq);
ctx->wq_size = accfg_wq_get_size(ctx->wq);
ctx->wq_idx = accfg_wq_get_id(ctx->wq);
ctx->bof = accfg_wq_get_block_on_fault(ctx->wq);
@@ -182,7 +235,7 @@ int dsa_alloc(struct dsa_context *ctx, int shared)
ctx->max_xfer_bits = bsr(ctx->max_xfer_size);
info("alloc wq %d shared %d size %d addr %p batch sz %#x xfer sz %#x\n",
- ctx->wq_idx, shared, ctx->wq_size, ctx->wq_reg,
+ ctx->wq_idx, ctx->dedicated, ctx->wq_size, ctx->wq_reg,
ctx->max_batch_size, ctx->max_xfer_size);
return 0;
diff --git a/test/dsa.h b/test/dsa.h
index 5db0c02..393221b 100644
--- a/test/dsa.h
+++ b/test/dsa.h
@@ -211,7 +211,7 @@ int memcmp_pattern(const void *src, const uint64_t pattern, size_t len);
int dsa_enqcmd(struct dsa_context *ctx, struct dsa_hw_desc *hw);
struct dsa_context *dsa_init(void);
-int dsa_alloc(struct dsa_context *ctx, int shared);
+int dsa_alloc(struct dsa_context *ctx, int shared, int dev_id, int wq_id);
int alloc_task(struct dsa_context *ctx);
struct task *__alloc_task(void);
int init_task(struct task *tsk, int tflags, int opcode,
diff --git a/test/dsa_test.c b/test/dsa_test.c
index 5f7a7f1..1af4cae 100644
--- a/test/dsa_test.c
+++ b/test/dsa_test.c
@@ -23,6 +23,8 @@ static void usage(void)
"-o <opcode> ; opcode, same value as in DSA spec\n"
"-b <opcode> ; if batch opcode, opcode in the batch\n"
"-c <batch_size> ; if batch opcode, number of descriptors for batch\n"
+ "-i ; device id\n"
+ "-d ; wq number\n"
"-t <ms timeout> ; ms to wait for descs to complete\n"
"-v ; verbose\n"
"-h ; print this message\n");
@@ -105,13 +107,14 @@ int main(int argc, char *argv[])
int rc = 0;
unsigned long buf_size = DSA_TEST_SIZE;
int wq_type = SHARED;
+ int wq_id = -1;
int opcode = DSA_OPCODE_MEMMOVE;
int bopcode = DSA_OPCODE_MEMMOVE;
int tflags = TEST_FLAGS_BOF;
- int opt;
+ int opt, dev_id=-1;
unsigned int bsize = 0;
- while ((opt = getopt(argc, argv, "w:l:f:o:b:c:t:p:vh")) != -1) {
+ while ((opt = getopt(argc, argv, "w:l:f:o:b:c:i:d:t:p:vh")) != -1) {
switch (opt) {
case 'w':
wq_type = atoi(optarg);
@@ -131,6 +134,12 @@ int main(int argc, char *argv[])
case 'c':
bsize = strtoul(optarg, NULL, 0);
break;
+ case 'i':
+ dev_id = atoi(optarg);
+ break;
+ case 'd':
+ wq_id = strtoul(optarg, NULL, 0);
+ break;
case 't':
ms_timeout = strtoul(optarg, NULL, 0);
break;
@@ -150,7 +159,7 @@ int main(int argc, char *argv[])
if (dsa == NULL)
return -ENOMEM;
- rc = dsa_alloc(dsa, wq_type);
+ rc = dsa_alloc(dsa, wq_type, dev_id, wq_id);
if (rc < 0)
return -ENOMEM;
--
2.27.0
8 months, 3 weeks
[PATCH v2 1/1] accel-config:dsa_test Add no opcode operation support
by Tony Zhu
The No-op operation performs no DMA operation. Add the test support.
Signed-off-by: Tony Zhu <tony.zhu(a)intel.com>
---
test/dsa.c | 28 ++++++++++++++++++++++++++++
test/dsa.h | 5 +++++
test/dsa_test.c | 30 ++++++++++++++++++++++++++++++
test/prep.c | 28 ++++++++++++++++++++++++++++
4 files changed, 91 insertions(+)
diff --git a/test/dsa.c b/test/dsa.c
index 5396b1b..ce6f6a1 100644
--- a/test/dsa.c
+++ b/test/dsa.c
@@ -554,6 +554,34 @@ void free_batch_task(struct batch_task *btsk)
free(btsk);
}
+int dsa_wait_noop(struct dsa_context *ctx)
+{
+ struct dsa_completion_record *comp = ctx->single_task->comp;
+ int rc;
+
+ rc = 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 = ctx->single_task;
+ int ret = DSA_STATUS_OK;
+
+ tsk->dflags = IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR;
+
+ dsa_prep_noop(tsk);
+ dsa_desc_submit(ctx, tsk->desc);
+ ret = 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..5f7a7f1 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 buf_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,33 @@ 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 = alloc_task(dsa);
+ if (rc != DSA_STATUS_OK) {
+ err("noop: alloc task failed, rc=%d\n", rc);
+ goto error;
+ }
+
+ tsk = dsa->single_task;
+
+ rc = dsa_noop(dsa);
+ if (rc != DSA_STATUS_OK) {
+ err("noop failed stat %d\n", rc);
+ rc = -ENXIO;
+ break;
+ }
+
+ rc = task_result_verify(tsk, 0);
+ if (rc != 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 dsa_hw_desc *hw)
usleep(10000);
}
+void dsa_prep_noop(struct task *tsk)
+{
+ info("preparing descriptor for noop\n");
+
+ tsk->dflags = 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 = (uint64_t)(tsk->comp);
+ tsk->comp->status = 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 = IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR;
+ for (i = 0; i < btsk->task_num; i++) {
+ sub_task = &(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 = (uint64_t)(sub_task->comp);
+ sub_task->comp->status = 0;
+ }
+}
+
/* Performs no error or bound checking */
void dsa_prep_batch_memcpy(struct batch_task *btsk)
{
--
2.27.0
8 months, 3 weeks
[PATCH 1/1] accel-config:dsa_test Add no opcode operation support
by Tony Zhu
The No-op operation performs no DMA operation. Add the test support.
Signed-off-by: Tony Zhu <tony.zhu(a)intel.com>
---
test/dsa.c | 28 ++++++++++++++++++++++++++++
test/dsa.h | 5 +++++
test/dsa_test.c | 35 +++++++++++++++++++++++++++++++++++
test/prep.c | 28 ++++++++++++++++++++++++++++
4 files changed, 96 insertions(+)
diff --git a/test/dsa.c b/test/dsa.c
index 5396b1b..ce6f6a1 100644
--- a/test/dsa.c
+++ b/test/dsa.c
@@ -554,6 +554,34 @@ void free_batch_task(struct batch_task *btsk)
free(btsk);
}
+int dsa_wait_noop(struct dsa_context *ctx)
+{
+ struct dsa_completion_record *comp = ctx->single_task->comp;
+ int rc;
+
+ rc = 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 = ctx->single_task;
+ int ret = DSA_STATUS_OK;
+
+ tsk->dflags = IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR;
+
+ dsa_prep_noop(tsk);
+ dsa_desc_submit(ctx, tsk->desc);
+ ret = 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 buf_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 = alloc_task(dsa);
+ if (rc != DSA_STATUS_OK) {
+ err("noop: alloc task failed, rc=%d\n", rc);
+ goto error;
+ }
+
+ tsk = dsa->single_task;
+ rc = init_task(tsk, tflags, opcode, buf_size);
+ if (rc != DSA_STATUS_OK) {
+ err("noop: init task failed\n");
+ goto error;
+ }
+
+ rc = dsa_noop(dsa);
+ if (rc != DSA_STATUS_OK) {
+ err("noop failed stat %d\n", rc);
+ rc = -ENXIO;
+ break;
+ }
+
+ rc = task_result_verify(tsk, 0);
+ if (rc != 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 dsa_hw_desc *hw)
usleep(10000);
}
+void dsa_prep_noop(struct task *tsk)
+{
+ info("preparing descriptor for noop\n");
+
+ tsk->dflags = 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 = (uint64_t)(tsk->comp);
+ tsk->comp->status = 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 = IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR;
+ for (i = 0; i < btsk->task_num; i++) {
+ sub_task = &(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 = (uint64_t)(sub_task->comp);
+ sub_task->comp->status = 0;
+ }
+}
+
/* Performs no error or bound checking */
void dsa_prep_batch_memcpy(struct batch_task *btsk)
{
--
2.27.0
9 months
[PATCH 1/1] accel-config:dsa_test Add no opcode opertion suooport
by Tony Zhu
The No-op opertion performs no DMA opertion. Add the test support.
Signed-off-by: Tony Zhu <tony.zhu(a)intel.com>
---
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 = ctx->single_task->comp;
+ int rc;
+
+ rc = 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 = ctx->single_task;
+ int ret = DSA_STATUS_OK;
+
+ tsk->dflags = IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR;
+//if ((tsk->test_flags & TEST_FLAGS_BOF) && ctx->bof)
+// tsk->dflags |= IDXD_OP_FLAG_BOF;
+
+ dsa_prep_noop(tsk);
+ dsa_desc_submit(ctx, tsk->desc);
+ ret = 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 buf_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 = alloc_task(dsa);
+ if (rc != DSA_STATUS_OK) {
+ err("noop: alloc task failed, rc=%d\n", rc);
+ goto error;
+ }
+
+ tsk = dsa->single_task;
+ rc = init_task(tsk, tflags, opcode, buf_size);
+ if (rc != DSA_STATUS_OK) {
+ err("noop: init task failed\n");
+ goto error;
+ }
+
+ rc = dsa_noop(dsa);
+ if (rc != DSA_STATUS_OK) {
+ err("noop failed stat %d\n", rc);
+ rc = -ENXIO;
+ break;
+ }
+
+ rc = task_result_verify(tsk, 0);
+ if (rc != 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 dsa_hw_desc *hw)
usleep(10000);
}
+void dsa_prep_noop(struct task *tsk)
+{
+ info("preparing descriptor for noop\n");
+
+ tsk->dflags = 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 = (uint64_t)(tsk->comp);
+ tsk->comp->status = 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 = IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR;
+ for (i = 0; i < btsk->task_num; i++) {
+ sub_task = &(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 = (uint64_t)(sub_task->comp);
+ sub_task->comp->status = 0;
+ }
+}
+
/* Performs no error or bound checking */
void dsa_prep_batch_memcpy(struct batch_task *btsk)
{
--
2.27.0
9 months
[PATCH 0/3] accel-config/test: Split shared/dedicated wq
by ramesh.thomas@intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Shared and Dedicated wqs require different handling so split their
configuration functions. Split tests that call them into 2. Add an
option for tests to return a status indicating feature not supported
which will result in *skipped* being printed in their status. Skipping
test this way will not abort the entire unit test.
Ramesh Thomas (3):
accel-config/test: Add support for skipping tests
accel-config/test: Split config func to handle sh and ded wqs
accel-config/test: Skip shared wq config test if shm support
test/libaccfg.c | 100 +++++++++++++++++++++++++++++++++++-------------
1 file changed, 74 insertions(+), 26 deletions(-)
--
2.26.3
9 months, 1 week
[PATCH] accel-config: Add API to retrieve wq occupancy attribute
by ramesh.thomas@intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Add API to get wq occupancy
Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
accfg/lib/libaccel-config.sym | 5 +++++
accfg/lib/libaccfg.c | 12 ++++++++++++
accfg/libaccel_config.h | 1 +
3 files changed, 18 insertions(+)
diff --git a/accfg/lib/libaccel-config.sym b/accfg/lib/libaccel-config.sym
index f44a3ca..7d6b396 100644
--- a/accfg/lib/libaccel-config.sym
+++ b/accfg/lib/libaccel-config.sym
@@ -161,3 +161,8 @@ global:
accfg_ctx_get_last_error_group;
accfg_ctx_get_last_error_engine;
} LIBACCFG_9;
+
+LIBACCFG_11 {
+global:
+ accfg_wq_get_occupancy;
+} LIBACCFG_10;
diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index 5b63b62..f4fc17e 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -2033,6 +2033,18 @@ ACCFG_EXPORT uint64_t accfg_wq_get_max_transfer_size(struct accfg_wq *wq)
return wq->max_transfer_size;
}
+ACCFG_EXPORT int accfg_wq_get_occupancy(struct accfg_wq *wq)
+{
+ int dfd;
+ struct accfg_ctx *ctx = accfg_wq_get_ctx(wq);
+
+ dfd = open(wq->wq_path, O_PATH);
+ if (dfd < 0)
+ return -ENXIO;
+
+ return accfg_get_param_long(ctx, dfd, "occupancy");
+}
+
ACCFG_EXPORT int accfg_wq_get_clients(struct accfg_wq *wq)
{
struct accfg_ctx *ctx = accfg_wq_get_ctx(wq);
diff --git a/accfg/libaccel_config.h b/accfg/libaccel_config.h
index f8b9bf9..92b1da5 100644
--- a/accfg/libaccel_config.h
+++ b/accfg/libaccel_config.h
@@ -277,6 +277,7 @@ uint64_t accfg_wq_get_max_transfer_size(struct accfg_wq *wq);
int accfg_wq_get_threshold(struct accfg_wq *wq);
int accfg_wq_get_clients(struct accfg_wq *wq);
int accfg_wq_get_ats_disable(struct accfg_wq *wq);
+int accfg_wq_get_occupancy(struct accfg_wq *wq);
int accfg_wq_is_enabled(struct accfg_wq *wq);
int accfg_wq_set_size(struct accfg_wq *wq, int val);
int accfg_wq_set_priority(struct accfg_wq *wq, int val);
--
2.26.3
9 months, 2 weeks
[PATCH] accel-config: Do not fail shared wq tests if platform does not support shared wqs
by ramesh.thomas@intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
If shared wq is not supported by platform use dedicated mode to avoid
failing batch configuration tests
Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
test/libaccfg.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/test/libaccfg.c b/test/libaccfg.c
index 516adbc..a982344 100644
--- a/test/libaccfg.c
+++ b/test/libaccfg.c
@@ -244,7 +244,13 @@ static int config_wq(struct accfg_ctx *ctx, struct accfg_device *device,
{
int rc = 0;
- SET_ERR(rc, accfg_wq_set_str_mode(wq, wq_param->mode));
+ rc = accfg_wq_set_str_mode(wq, wq_param->mode);
+ if (rc == -EINVAL) {
+ fprintf(stderr, "%s shared wq not supported, configuring as dedicated\n",
+ __func__);
+ rc = accfg_wq_set_str_mode(wq, "dedicated");
+ }
+
SET_ERR(rc, accfg_wq_set_str_type(wq, wq_param->type));
SET_ERR(rc, accfg_wq_set_str_name(wq, wq_param->name));
SET_ERR(rc, accfg_wq_set_size(wq, wq_param->wq_size));
@@ -254,7 +260,7 @@ static int config_wq(struct accfg_ctx *ctx, struct accfg_device *device,
SET_ERR(rc, accfg_wq_set_max_batch_size(wq, wq_param->max_batch_size));
SET_ERR(rc, accfg_wq_set_max_transfer_size(wq,
wq_param->max_transfer_size));
- if (wq_param->threshold)
+ if (wq_param->threshold && accfg_wq_get_mode(wq) == ACCFG_WQ_SHARED)
SET_ERR(rc, accfg_wq_set_threshold(wq, wq_param->threshold));
SET_ERR(rc, accfg_wq_set_ats_disable(wq, wq_param->ats_disable));
@@ -288,7 +294,7 @@ static int check_wq(struct accfg_ctx *ctx, struct accfg_device *device,
fprintf(stderr, "%s failed on block_on_fault\n", __func__);
return -EINVAL;
}
- if (wq_param->threshold !=
+ if (accfg_wq_get_mode(wq) == ACCFG_WQ_SHARED && wq_param->threshold !=
(unsigned int)accfg_wq_get_threshold(wq)) {
fprintf(stderr, "%s failed on threshold\n", __func__);
return -EINVAL;
@@ -815,6 +821,11 @@ static int test_mdev_1swq(struct accfg_ctx *ctx)
if (rc)
return rc;
+ if (accfg_wq_get_mode(test_ctx.wq[2]) != ACCFG_WQ_SHARED) {
+ fprintf(stderr, "%s shared wq not supported\n", __func__);
+ return -EOPNOTSUPP;
+ }
+
rc = set_mdev_type(ctx, test_ctx.wq[2], test_ctx.wq_param[2]);
if (rc)
return rc;
--
2.26.3
9 months, 2 weeks
[PATCH 0/2] Add API to get wq occupancy
by ramesh.thomas@intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Adds API to get wq occupancy attribute and include in wq listing.
Ramesh Thomas (2):
accel-config: Add accfg_wq_get_occupancy API to library
accel-config: Add occupancy attribute to json wq object
accfg/lib/libaccel-config.sym | 5 +++++
accfg/lib/libaccfg.c | 2 ++
accfg/lib/private.h | 1 +
accfg/libaccel_config.h | 1 +
util/json.c | 7 +++++++
5 files changed, 16 insertions(+)
--
2.26.3
9 months, 2 weeks