[Accel-config] [PATCH v2 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 | 9 +++++++++
 3 files changed, 11 insertions(+)

diff --git a/test/dsa.c b/test/dsa.c
index 65ce807..d8dd081 100644
--- a/test/dsa.c
+++ b/test/dsa.c
@@ -175,6 +175,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 b301593..4dac780 100644
--- a/test/dsa.h
+++ b/test/dsa.h
@@ -86,6 +86,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 93229c6..0dea193 100644
--- a/test/libaccfg.c
+++ b/test/libaccfg.c
@@ -68,6 +68,7 @@ static struct wq_parameters wq00_param = {
 	.threshold = 15,
 	.max_batch_size = 16,
 	.max_transfer_size = 16,
+	.ats_disable = 0,
 	.mode = "shared",
 	.type = "user",
 	.name = "myapp1"
@@ -80,6 +81,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"
@@ -93,6 +95,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 = "mdev",
 	.name = "guest1"
@@ -105,6 +108,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 = "mdev",
 	.name = "guest2"
@@ -243,6 +247,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));
+	SET_ERR(rc, accfg_wq_set_ats_disable(wq, wq_param->ats_disable));
 	if (wq_param->threshold)
 		SET_ERR(rc, accfg_wq_set_threshold(wq, wq_param->threshold));
 
@@ -291,6 +296,10 @@ static int check_wq(struct accfg_ctx *ctx, struct accfg_device *device,
 		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;
+	}
 
 	return 0;
 }
-- 
1.8.3.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.