[Accel-config] [PATCH 4/5] accel-config: Add ats_disable unit test
Xiaochen Shen <xiaochen.shen at intel.com>
| Newsgroups | dev.linux.lists.accel-config |
|---|---|
| Message-ID | <[email protected]> |
Add ats_disable to wq parameters for config test.
Signed-off-by: Xiaochen Shen <xiaochen.shen(a)intel.com>
---
test/dsa.c | 1 +
test/dsa.h | 1 +
test/libaccfg.c | 12 ++++++++++++
3 files changed, 14 insertions(+)
diff --git a/test/dsa.c b/test/dsa.c
index 70eda30..1844175 100644
--- a/test/dsa.c
+++ b/test/dsa.c
@@ -179,6 +179,7 @@ int dsa_alloc(struct dsa_context *ctx, int shared)
ctx->bof = accfg_wq_get_block_on_fault(ctx->wq);
ctx->wq_max_batch_size = accfg_wq_get_max_batch_size(ctx->wq);
ctx->wq_max_xfer_size = accfg_wq_get_max_transfer_size(ctx->wq);
+ ctx->ats_disable = accfg_wq_get_ats_disable(ctx->wq);
ctx->max_batch_size = accfg_device_get_max_batch_size(dev);
ctx->max_xfer_size = accfg_device_get_max_transfer_size(dev);
diff --git a/test/dsa.h b/test/dsa.h
index b99ec44..6941025 100644
--- a/test/dsa.h
+++ b/test/dsa.h
@@ -85,6 +85,7 @@ struct dsa_context {
int bof;
unsigned int wq_max_batch_size;
unsigned long wq_max_xfer_size;
+ int ats_disable;
int is_batch;
union {
diff --git a/test/libaccfg.c b/test/libaccfg.c
index 0ff43ca..708aeba 100644
--- a/test/libaccfg.c
+++ b/test/libaccfg.c
@@ -84,6 +84,7 @@ static struct wq_parameters wq00_param = {
.threshold = 15,
.max_batch_size = 1,
.max_transfer_size = 1,
+ .ats_disable = 0,
.mode = "shared",
.type = "user",
.name = "myapp1"
@@ -96,6 +97,7 @@ static struct wq_parameters wq01_param = {
.block_on_fault = 0,
.max_batch_size = (1 << 4),
.max_transfer_size = (1l << 16),
+ .ats_disable = 0,
.mode = "dedicated",
.type = "user",
.name = "myapp2"
@@ -110,6 +112,7 @@ static struct wq_parameters wq02_param = {
.threshold = 8,
.max_batch_size = (1 << 8),
.max_transfer_size = (1l << 30),
+ .ats_disable = 0,
.mode = "shared",
.type = "user",
.name = "guest1"
@@ -122,6 +125,7 @@ static struct wq_parameters wq03_param = {
.block_on_fault = 0,
.max_batch_size = (1 << 9),
.max_transfer_size = (1l << 31),
+ .ats_disable = 0,
.mode = "dedicated",
.type = "user",
.name = "guest2"
@@ -138,6 +142,7 @@ static struct wq_parameters wq12_param = {
.threshold = 50,
.max_batch_size = 1,
.max_transfer_size = 1,
+ .ats_disable = 0,
.mode = "shared",
.type = "user",
.name = "myapp3"
@@ -151,6 +156,7 @@ static struct wq_parameters wq13_param = {
.threshold = 50,
.max_batch_size = 1,
.max_transfer_size = 1,
+ .ats_disable = 0,
.mode = "shared",
.type = "user",
.name = "myapp3"
@@ -164,6 +170,7 @@ static struct wq_parameters wq14_param = {
.threshold = 50,
.max_batch_size = 1,
.max_transfer_size = 1,
+ .ats_disable = 0,
.mode = "shared",
.type = "user",
.name = "myapp3"
@@ -352,6 +359,7 @@ static int config_wq(struct accfg_ctx *ctx, int dev_id, int wq_id,
accfg_wq_set_block_on_fault(wq, wq_param.block_on_fault);
accfg_wq_set_max_batch_size(wq, wq_param.max_batch_size);
accfg_wq_set_max_transfer_size(wq, wq_param.max_transfer_size);
+ accfg_wq_set_ats_disable(wq, wq_param.ats_disable);
if (wq_param.threshold)
accfg_wq_set_threshold(wq, wq_param.threshold);
}
@@ -413,6 +421,10 @@ static int check_wq(struct accfg_ctx *ctx, int dev_id, int wq_id,
fprintf(stderr, "check wq failed on wq name\n");
return -EINVAL;
}
+ if (wq_param.ats_disable != accfg_wq_get_ats_disable(wq)) {
+ fprintf(stderr, "check_wq failed on ats_disable\n");
+ return -EINVAL;
+ }
}
}
--
1.8.3.1