[PATCH v3] accel-config/libaccel-config: Add IAX support
by ramesh.thomas@intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Add Intel Analytics Accelerator support.
Changes in v3:
- include v2 change in json object creation
Changes in v2:
- block on fault is available for IAX
Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
---
accfg/config.c | 10 ++++++++++
accfg/lib/libaccfg.c | 3 +++
accfg/libaccel_config.h | 1 +
accfg/list.c | 31 +++++++++++++++++++------------
util/json.c | 6 ++++--
5 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/accfg/config.c b/accfg/config.c
index 3887873..d36f1d9 100644
--- a/accfg/config.c
+++ b/accfg/config.c
@@ -296,6 +296,10 @@ static int group_json_set_val(struct accfg_group *group,
json_object *jobj, char *key)
{
int rc, i;
+ struct accfg_device *dev = NULL;
+
+ if (group)
+ dev = accfg_group_get_device(group);
if (!group || !jobj || !key)
return -EINVAL;
@@ -311,6 +315,12 @@ static int group_json_set_val(struct accfg_group *group,
|| (val < 0))
return -EINVAL;
+ if ((accfg_device_get_type(dev) == ACCFG_DEVICE_IAX)
+ && ((!strcmp(group_table[i].name, "tokens_reserved"))
+ || (!strcmp(group_table[i].name, "use_token_limit"))
+ || (!strcmp(group_table[i].name, "tokens_allowed")))) {
+ return 0;
+ }
if (group_table[i].is_writable &&
!group_table[i].is_writable(group,
val))
diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index 70553f7..cd9da42 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -39,6 +39,7 @@ static int filename_prefix_len;
ACCFG_EXPORT char *accfg_basenames[] = {
[ACCFG_DEVICE_DSA] = "dsa",
+ [ACCFG_DEVICE_IAX] = "iax",
NULL
};
@@ -397,6 +398,8 @@ static int device_parse_type(struct accfg_device *device)
if (!strcmp(device->device_type_str, "dsa"))
device->type = ACCFG_DEVICE_DSA;
+ else if (!strcmp(device->device_type_str, "iax"))
+ device->type = ACCFG_DEVICE_IAX;
else
device->type = ACCFG_DEVICE_TYPE_UNKNOWN;
diff --git a/accfg/libaccel_config.h b/accfg/libaccel_config.h
index 392188e..f85670c 100644
--- a/accfg/libaccel_config.h
+++ b/accfg/libaccel_config.h
@@ -31,6 +31,7 @@ extern "C" {
/* no need to save device state */
enum accfg_device_type {
ACCFG_DEVICE_DSA = 0,
+ ACCFG_DEVICE_IAX = 1,
ACCFG_DEVICE_TYPE_UNKNOWN = -1,
};
diff --git a/accfg/list.c b/accfg/list.c
index dfaac1f..c22da41 100644
--- a/accfg/list.c
+++ b/accfg/list.c
@@ -54,6 +54,10 @@ static struct json_object *group_to_json(struct accfg_group *group,
{
struct json_object *jgroup = json_object_new_object();
struct json_object *jobj = NULL;
+ struct accfg_device *dev = NULL;
+
+ if (group)
+ dev = accfg_group_get_device(group);
if (!jgroup)
return NULL;
@@ -67,20 +71,23 @@ static struct json_object *group_to_json(struct accfg_group *group,
if (!jobj)
goto err;
- json_object_object_add(jgroup, "tokens_reserved", jobj);
- jobj = json_object_new_int(accfg_group_get_use_token_limit(group));
- if (!jobj)
- goto err;
+ if (accfg_device_get_type(dev) != ACCFG_DEVICE_IAX) {
+ json_object_object_add(jgroup, "tokens_reserved", jobj);
+ jobj = json_object_new_int(accfg_group_get_use_token_limit(group));
+ if (!jobj)
+ goto err;
- json_object_object_add(jgroup, "use_token_limit", jobj);
- jobj = json_object_new_int(accfg_group_get_tokens_allowed(group));
- if (!jobj)
- goto err;
+ json_object_object_add(jgroup, "use_token_limit", jobj);
+ jobj = json_object_new_int(accfg_group_get_tokens_allowed(group));
+ if (!jobj)
+ goto err;
- json_object_object_add(jgroup, "tokens_allowed", jobj);
- jobj = json_object_new_int(accfg_group_get_traffic_class_a(group));
- if (!jobj)
- goto err;
+ json_object_object_add(jgroup, "tokens_allowed", jobj);
+ jobj = json_object_new_int(accfg_group_get_traffic_class_a(
+ group));
+ if (!jobj)
+ goto err;
+ }
json_object_object_add(jgroup, "traffic_class_a", jobj);
jobj = json_object_new_int(accfg_group_get_traffic_class_b(
diff --git a/util/json.c b/util/json.c
index 3bf8950..6f4b4d1 100644
--- a/util/json.c
+++ b/util/json.c
@@ -178,7 +178,8 @@ struct json_object *util_device_to_json(struct accfg_device *device,
jobj = json_object_new_int(accfg_device_get_token_limit(device));
if (!jobj)
goto err;
- json_object_object_add(jdevice, "token_limit", jobj);
+ if (accfg_device_get_type(device) != ACCFG_DEVICE_IAX)
+ json_object_object_add(jdevice, "token_limit", jobj);
if (flags & UTIL_JSON_SAVE) {
free(error);
@@ -277,7 +278,8 @@ struct json_object *util_device_to_json(struct accfg_device *device,
jobj = json_object_new_int(accfg_device_get_max_tokens(device));
if (!jobj)
goto err;
- json_object_object_add(jdevice, "max_tokens", jobj);
+ if (accfg_device_get_type(device) != ACCFG_DEVICE_IAX)
+ json_object_object_add(jdevice, "max_tokens", jobj);
ulong_val = accfg_device_get_max_batch_size(device);
if (ulong_val > 0) {
--
2.26.2
2 months, 1 week
[PATCH v2] accel-config/libaccel-config: Add IAX support
by ramesh.thomas@intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Add Intel Analytics Accelerator support.
Changes in v2:
- block on fault is available for IAX
Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
---
accfg/config.c | 10 ++++++++++
accfg/lib/libaccfg.c | 3 +++
accfg/libaccel_config.h | 1 +
accfg/list.c | 31 +++++++++++++++++++------------
util/json.c | 16 ++++++++++++----
5 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/accfg/config.c b/accfg/config.c
index 3887873..d36f1d9 100644
--- a/accfg/config.c
+++ b/accfg/config.c
@@ -296,6 +296,10 @@ static int group_json_set_val(struct accfg_group *group,
json_object *jobj, char *key)
{
int rc, i;
+ struct accfg_device *dev = NULL;
+
+ if (group)
+ dev = accfg_group_get_device(group);
if (!group || !jobj || !key)
return -EINVAL;
@@ -311,6 +315,12 @@ static int group_json_set_val(struct accfg_group *group,
|| (val < 0))
return -EINVAL;
+ if ((accfg_device_get_type(dev) == ACCFG_DEVICE_IAX)
+ && ((!strcmp(group_table[i].name, "tokens_reserved"))
+ || (!strcmp(group_table[i].name, "use_token_limit"))
+ || (!strcmp(group_table[i].name, "tokens_allowed")))) {
+ return 0;
+ }
if (group_table[i].is_writable &&
!group_table[i].is_writable(group,
val))
diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index 70553f7..cd9da42 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -39,6 +39,7 @@ static int filename_prefix_len;
ACCFG_EXPORT char *accfg_basenames[] = {
[ACCFG_DEVICE_DSA] = "dsa",
+ [ACCFG_DEVICE_IAX] = "iax",
NULL
};
@@ -397,6 +398,8 @@ static int device_parse_type(struct accfg_device *device)
if (!strcmp(device->device_type_str, "dsa"))
device->type = ACCFG_DEVICE_DSA;
+ else if (!strcmp(device->device_type_str, "iax"))
+ device->type = ACCFG_DEVICE_IAX;
else
device->type = ACCFG_DEVICE_TYPE_UNKNOWN;
diff --git a/accfg/libaccel_config.h b/accfg/libaccel_config.h
index 392188e..f85670c 100644
--- a/accfg/libaccel_config.h
+++ b/accfg/libaccel_config.h
@@ -31,6 +31,7 @@ extern "C" {
/* no need to save device state */
enum accfg_device_type {
ACCFG_DEVICE_DSA = 0,
+ ACCFG_DEVICE_IAX = 1,
ACCFG_DEVICE_TYPE_UNKNOWN = -1,
};
diff --git a/accfg/list.c b/accfg/list.c
index dfaac1f..c22da41 100644
--- a/accfg/list.c
+++ b/accfg/list.c
@@ -54,6 +54,10 @@ static struct json_object *group_to_json(struct accfg_group *group,
{
struct json_object *jgroup = json_object_new_object();
struct json_object *jobj = NULL;
+ struct accfg_device *dev = NULL;
+
+ if (group)
+ dev = accfg_group_get_device(group);
if (!jgroup)
return NULL;
@@ -67,20 +71,23 @@ static struct json_object *group_to_json(struct accfg_group *group,
if (!jobj)
goto err;
- json_object_object_add(jgroup, "tokens_reserved", jobj);
- jobj = json_object_new_int(accfg_group_get_use_token_limit(group));
- if (!jobj)
- goto err;
+ if (accfg_device_get_type(dev) != ACCFG_DEVICE_IAX) {
+ json_object_object_add(jgroup, "tokens_reserved", jobj);
+ jobj = json_object_new_int(accfg_group_get_use_token_limit(group));
+ if (!jobj)
+ goto err;
- json_object_object_add(jgroup, "use_token_limit", jobj);
- jobj = json_object_new_int(accfg_group_get_tokens_allowed(group));
- if (!jobj)
- goto err;
+ json_object_object_add(jgroup, "use_token_limit", jobj);
+ jobj = json_object_new_int(accfg_group_get_tokens_allowed(group));
+ if (!jobj)
+ goto err;
- json_object_object_add(jgroup, "tokens_allowed", jobj);
- jobj = json_object_new_int(accfg_group_get_traffic_class_a(group));
- if (!jobj)
- goto err;
+ json_object_object_add(jgroup, "tokens_allowed", jobj);
+ jobj = json_object_new_int(accfg_group_get_traffic_class_a(
+ group));
+ if (!jobj)
+ goto err;
+ }
json_object_object_add(jgroup, "traffic_class_a", jobj);
jobj = json_object_new_int(accfg_group_get_traffic_class_b(
diff --git a/util/json.c b/util/json.c
index 3bf8950..bb3ee88 100644
--- a/util/json.c
+++ b/util/json.c
@@ -178,7 +178,8 @@ struct json_object *util_device_to_json(struct accfg_device *device,
jobj = json_object_new_int(accfg_device_get_token_limit(device));
if (!jobj)
goto err;
- json_object_object_add(jdevice, "token_limit", jobj);
+ if (accfg_device_get_type(device) != ACCFG_DEVICE_IAX)
+ json_object_object_add(jdevice, "token_limit", jobj);
if (flags & UTIL_JSON_SAVE) {
free(error);
@@ -277,7 +278,8 @@ struct json_object *util_device_to_json(struct accfg_device *device,
jobj = json_object_new_int(accfg_device_get_max_tokens(device));
if (!jobj)
goto err;
- json_object_object_add(jdevice, "max_tokens", jobj);
+ if (accfg_device_get_type(device) != ACCFG_DEVICE_IAX)
+ json_object_object_add(jdevice, "max_tokens", jobj);
ulong_val = accfg_device_get_max_batch_size(device);
if (ulong_val > 0) {
@@ -353,8 +355,12 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,
unsigned long size = ULLONG_MAX;
enum accfg_wq_mode wq_mode;
enum accfg_wq_state wq_state;
+ struct accfg_device *dev = NULL;
int int_val;
+ if (wq)
+ dev = accfg_wq_get_device(wq);
+
if (!jaccfg)
return NULL;
@@ -396,8 +402,10 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,
}
jobj = json_object_new_int(accfg_wq_get_block_on_fault(wq));
- if (jobj)
- json_object_object_add(jaccfg, "block_on_fault", jobj);
+ if (jobj) {
+ if (accfg_device_get_type(dev) != ACCFG_DEVICE_IAX)
+ json_object_object_add(jaccfg, "block_on_fault", jobj);
+ }
jobj = json_object_new_int(accfg_wq_get_max_batch_size(wq));
if (jobj)
--
2.26.2
2 months, 1 week
[PATCH v1] accel-config/libaccel-config: Add IAX support
by ramesh.thomas@intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Add Intel Analytics Accelerator support.
Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
---
accfg/config.c | 18 ++++++++++++++++++
accfg/lib/libaccfg.c | 3 +++
accfg/libaccel_config.h | 1 +
accfg/list.c | 31 +++++++++++++++++++------------
util/json.c | 16 ++++++++++++----
5 files changed, 53 insertions(+), 16 deletions(-)
diff --git a/accfg/config.c b/accfg/config.c
index 3887873..c0d9333 100644
--- a/accfg/config.c
+++ b/accfg/config.c
@@ -234,6 +234,10 @@ static int device_json_set_val(struct accfg_device *dev, json_object *jobj,
static int wq_json_set_val(struct accfg_wq *wq, json_object *jobj, char *key)
{
int rc, i;
+ struct accfg_device *dev = NULL;
+
+ if (wq)
+ dev = accfg_wq_get_device(wq);
if (!wq || !jobj || !key)
return -EINVAL;
@@ -249,6 +253,10 @@ static int wq_json_set_val(struct accfg_wq *wq, json_object *jobj, char *key)
if ((val == 0) && (errno == EINVAL))
return -errno;
+ if ((accfg_device_get_type(dev) == ACCFG_DEVICE_IAX)
+ && (!strcmp(wq_table[i].name, "block_on_fault"))) {
+ return 0;
+ }
if (wq_table[i].is_writable &&
!wq_table[i].is_writable(wq, val))
return 0;
@@ -296,6 +304,10 @@ static int group_json_set_val(struct accfg_group *group,
json_object *jobj, char *key)
{
int rc, i;
+ struct accfg_device *dev = NULL;
+
+ if (group)
+ dev = accfg_group_get_device(group);
if (!group || !jobj || !key)
return -EINVAL;
@@ -311,6 +323,12 @@ static int group_json_set_val(struct accfg_group *group,
|| (val < 0))
return -EINVAL;
+ if ((accfg_device_get_type(dev) == ACCFG_DEVICE_IAX)
+ && ((!strcmp(group_table[i].name, "tokens_reserved"))
+ || (!strcmp(group_table[i].name, "use_token_limit"))
+ || (!strcmp(group_table[i].name, "tokens_allowed")))) {
+ return 0;
+ }
if (group_table[i].is_writable &&
!group_table[i].is_writable(group,
val))
diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index 70553f7..cd9da42 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -39,6 +39,7 @@ static int filename_prefix_len;
ACCFG_EXPORT char *accfg_basenames[] = {
[ACCFG_DEVICE_DSA] = "dsa",
+ [ACCFG_DEVICE_IAX] = "iax",
NULL
};
@@ -397,6 +398,8 @@ static int device_parse_type(struct accfg_device *device)
if (!strcmp(device->device_type_str, "dsa"))
device->type = ACCFG_DEVICE_DSA;
+ else if (!strcmp(device->device_type_str, "iax"))
+ device->type = ACCFG_DEVICE_IAX;
else
device->type = ACCFG_DEVICE_TYPE_UNKNOWN;
diff --git a/accfg/libaccel_config.h b/accfg/libaccel_config.h
index 392188e..f85670c 100644
--- a/accfg/libaccel_config.h
+++ b/accfg/libaccel_config.h
@@ -31,6 +31,7 @@ extern "C" {
/* no need to save device state */
enum accfg_device_type {
ACCFG_DEVICE_DSA = 0,
+ ACCFG_DEVICE_IAX = 1,
ACCFG_DEVICE_TYPE_UNKNOWN = -1,
};
diff --git a/accfg/list.c b/accfg/list.c
index dfaac1f..c22da41 100644
--- a/accfg/list.c
+++ b/accfg/list.c
@@ -54,6 +54,10 @@ static struct json_object *group_to_json(struct accfg_group *group,
{
struct json_object *jgroup = json_object_new_object();
struct json_object *jobj = NULL;
+ struct accfg_device *dev = NULL;
+
+ if (group)
+ dev = accfg_group_get_device(group);
if (!jgroup)
return NULL;
@@ -67,20 +71,23 @@ static struct json_object *group_to_json(struct accfg_group *group,
if (!jobj)
goto err;
- json_object_object_add(jgroup, "tokens_reserved", jobj);
- jobj = json_object_new_int(accfg_group_get_use_token_limit(group));
- if (!jobj)
- goto err;
+ if (accfg_device_get_type(dev) != ACCFG_DEVICE_IAX) {
+ json_object_object_add(jgroup, "tokens_reserved", jobj);
+ jobj = json_object_new_int(accfg_group_get_use_token_limit(group));
+ if (!jobj)
+ goto err;
- json_object_object_add(jgroup, "use_token_limit", jobj);
- jobj = json_object_new_int(accfg_group_get_tokens_allowed(group));
- if (!jobj)
- goto err;
+ json_object_object_add(jgroup, "use_token_limit", jobj);
+ jobj = json_object_new_int(accfg_group_get_tokens_allowed(group));
+ if (!jobj)
+ goto err;
- json_object_object_add(jgroup, "tokens_allowed", jobj);
- jobj = json_object_new_int(accfg_group_get_traffic_class_a(group));
- if (!jobj)
- goto err;
+ json_object_object_add(jgroup, "tokens_allowed", jobj);
+ jobj = json_object_new_int(accfg_group_get_traffic_class_a(
+ group));
+ if (!jobj)
+ goto err;
+ }
json_object_object_add(jgroup, "traffic_class_a", jobj);
jobj = json_object_new_int(accfg_group_get_traffic_class_b(
diff --git a/util/json.c b/util/json.c
index 3bf8950..bb3ee88 100644
--- a/util/json.c
+++ b/util/json.c
@@ -178,7 +178,8 @@ struct json_object *util_device_to_json(struct accfg_device *device,
jobj = json_object_new_int(accfg_device_get_token_limit(device));
if (!jobj)
goto err;
- json_object_object_add(jdevice, "token_limit", jobj);
+ if (accfg_device_get_type(device) != ACCFG_DEVICE_IAX)
+ json_object_object_add(jdevice, "token_limit", jobj);
if (flags & UTIL_JSON_SAVE) {
free(error);
@@ -277,7 +278,8 @@ struct json_object *util_device_to_json(struct accfg_device *device,
jobj = json_object_new_int(accfg_device_get_max_tokens(device));
if (!jobj)
goto err;
- json_object_object_add(jdevice, "max_tokens", jobj);
+ if (accfg_device_get_type(device) != ACCFG_DEVICE_IAX)
+ json_object_object_add(jdevice, "max_tokens", jobj);
ulong_val = accfg_device_get_max_batch_size(device);
if (ulong_val > 0) {
@@ -353,8 +355,12 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,
unsigned long size = ULLONG_MAX;
enum accfg_wq_mode wq_mode;
enum accfg_wq_state wq_state;
+ struct accfg_device *dev = NULL;
int int_val;
+ if (wq)
+ dev = accfg_wq_get_device(wq);
+
if (!jaccfg)
return NULL;
@@ -396,8 +402,10 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,
}
jobj = json_object_new_int(accfg_wq_get_block_on_fault(wq));
- if (jobj)
- json_object_object_add(jaccfg, "block_on_fault", jobj);
+ if (jobj) {
+ if (accfg_device_get_type(dev) != ACCFG_DEVICE_IAX)
+ json_object_object_add(jaccfg, "block_on_fault", jobj);
+ }
jobj = json_object_new_int(accfg_wq_get_max_batch_size(wq));
if (jobj)
--
2.26.2
2 months, 1 week
[PATCH v1] accel-config: Remove uuid type mdev support
by ramesh.thomas@intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
mdev implementation will be redesigned to support new mdev
types added by driver. Current implementation of wq based uuid
type mdev implementation is obsolete for now and is removed
here.
Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
accfg/lib/libaccel-config.sym | 5 -
accfg/lib/libaccfg.c | 322 +---------------------------------
accfg/lib/private.h | 8 -
accfg/libaccel_config.h | 13 +-
accfg/mdev.c | 160 -----------------
test/README.md | 39 ----
test/libaccfg.c | 192 +-------------------
util/json.c | 23 +--
8 files changed, 8 insertions(+), 754 deletions(-)
diff --git a/accfg/lib/libaccel-config.sym b/accfg/lib/libaccel-config.sym
index 9768d42..471e06a 100644
--- a/accfg/lib/libaccel-config.sym
+++ b/accfg/lib/libaccel-config.sym
@@ -59,8 +59,6 @@ LIBACCFG_1 {
accfg_device_wq_get_by_id;
accfg_wq_get_first;
accfg_wq_get_next;
- accfg_wq_first_uuid;
- accfg_wq_next_uuid;
accfg_wq_get_ctx;
accfg_wq_get_device;
accfg_wq_get_group;
@@ -76,7 +74,6 @@ LIBACCFG_1 {
accfg_wq_get_cdev_minor;
accfg_wq_get_type;
accfg_wq_get_threshold;
- accfg_wq_get_uuid;
accfg_wq_set_size;
accfg_wq_set_priority;
accfg_wq_set_group_id;
@@ -89,8 +86,6 @@ LIBACCFG_1 {
accfg_wq_disable;
accfg_wq_priority_boundary;
accfg_wq_size_boundary;
- accfg_wq_create_mdev;
- accfg_wq_remove_mdev;
accfg_engine_get_first;
accfg_engine_get_next;
accfg_engine_get_ctx;
diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index d55a246..70553f7 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -513,8 +513,6 @@ static int wq_parse_type(struct accfg_wq *wq, char *wq_type)
wq->type = ACCFG_WQT_KERNEL;
else if (strcmp(ptype, "user") == 0)
wq->type = ACCFG_WQT_USER;
- else if (strcmp(ptype, "mdev") == 0)
- wq->type = ACCFG_WQT_MDEV;
else
wq->type = ACCFG_WQT_NONE;
@@ -523,52 +521,6 @@ static int wq_parse_type(struct accfg_wq *wq, char *wq_type)
return 0;
}
-static int uuid_entry_add(struct accfg_ctx *ctx, struct accfg_wq *wq, int dfd)
-{
- struct accfg_wq_uuid *wq_uuid;
- char *read_uuid = NULL;
- FILE *uuid_fd;
- ssize_t nread;
- size_t len = 0;
- int fd;
-
- /* pull uuid entry and add the uuid in sysfs */
- fd = openat(dfd, "uuid", O_RDONLY);
- if (fd == -1)
- return -errno;
-
- uuid_fd = fdopen(fd, "r");
- if (!uuid_fd) {
- err(ctx, "fopen of uuid path for wq failed: %s\n",
- strerror(errno));
- close(fd);
- return -errno;
- }
-
- while ((nread = getline(&read_uuid,
- &len, uuid_fd) != -1)) {
- /* add '\0' to terminate the read_uuid */
- read_uuid[UUID_STR_LEN - 1] = '\0';
- wq_uuid = calloc(1, sizeof(struct accfg_wq_uuid));
- if (!wq_uuid) {
- err(ctx, "allocation of wq_uuid failed\n");
- close(fd);
- return -ENOMEM;
- }
-
- if (uuid_parse(read_uuid, wq_uuid->uuid) != 0) {
- err(ctx, "uuid_parse failed: %s\n",
- strerror(errno));
- close(fd);
- free(wq_uuid);
- return -ENOMEM;
- }
- list_add_tail(&wq->uuid_list, &wq_uuid->list);
- }
-
- return 0;
-}
-
static void *add_wq(void *parent, int id, const char *wq_base,
char *dev_prefix)
{
@@ -579,7 +531,7 @@ static void *add_wq(void *parent, int id, const char *wq_base,
char *path;
char *wq_base_string;
unsigned long device_id, wq_id;
- int dfd, ret = 0;
+ int dfd;
char *wq_type;
if (!device)
@@ -605,7 +557,6 @@ static void *add_wq(void *parent, int id, const char *wq_base,
return NULL;
}
- list_head_init(&wq->uuid_list);
wq_base_string = strdup(wq_base);
if (!wq_base_string) {
err(ctx, "conversion of wq_base_string failed\n");
@@ -639,13 +590,6 @@ static void *add_wq(void *parent, int id, const char *wq_base,
wq_parse_type(wq, wq_type);
free(wq_type);
- /* parse uuid only in mdeve wq type */
- if (wq->type == ACCFG_WQT_MDEV) {
- ret = uuid_entry_add(ctx, wq, dfd);
- if (ret < 0)
- goto err_wq;
- }
-
close(dfd);
wq->wq_path = strdup(wq_base);
if (!wq->wq_path) {
@@ -1944,10 +1888,6 @@ ACCFG_EXPORT int accfg_wq_set_str_##field( \
return -errno; \
} \
} \
- if (!strcmp(#field, "mode") && !list_empty(&wq->uuid_list)) { \
- err(ctx, "change wq mode in mdev is not allowed\n"); \
- return -errno; \
- } \
if (sysfs_write_attr(ctx, path, buf) < 0) { \
err(ctx, "%s: write failed: %s\n", \
accfg_wq_get_devname(wq), \
@@ -2025,266 +1965,6 @@ ACCFG_EXPORT int accfg_wq_set_mode(struct accfg_wq *wq,
return accfg_wq_set_str_mode(wq, accfg_wq_mode_str[wq_mode]);
}
-static char *accfg_wq_get_pcie_path(struct accfg_wq *wq)
-{
- char *buf, *dup_string;
- struct accfg_device *dev = accfg_wq_get_device(wq);
- struct accfg_ctx *ctx = accfg_wq_get_ctx(wq);
-
- dup_string = strdup(dev->device_path);
- if (!dup_string) {
- err(ctx, "duplicating device path failed\n");
- return NULL;
- }
-
- buf = basename(dirname(dup_string));
- buf = strdup(buf);
- if (!buf) {
- err(ctx, "duplicate basename failed\n");
- return NULL;
- }
-
- free(dup_string);
-
- return buf;
-}
-
-ACCFG_EXPORT uuid_t *accfg_wq_first_uuid(struct accfg_wq *wq)
-{
- struct accfg_wq_uuid *wq_uuid;
-
- wq_uuid = list_top(&wq->uuid_list, struct accfg_wq_uuid, list);
- wq->iter = wq_uuid;
-
- return (uuid_t *)wq_uuid->uuid;
-}
-
-ACCFG_EXPORT uuid_t *accfg_wq_next_uuid(struct accfg_wq *wq)
-{
- struct accfg_wq_uuid *wq_uuid;
-
- if (!wq->iter)
- return NULL;
- wq_uuid = list_next(&wq->uuid_list, wq->iter, list);
- if (!wq_uuid)
- return NULL;
- wq->iter = wq_uuid;
-
- return (uuid_t *)wq_uuid->uuid;
-}
-
-ACCFG_EXPORT int accfg_wq_create_mdev(struct accfg_wq *wq, uuid_t uuid)
-{
- char *pcie_path;
- char *mdev_create_path;
- char *wq_uuid_path;
- struct accfg_ctx *ctx = accfg_wq_get_ctx(wq);
- struct accfg_wq_uuid *wq_uuid, *entry, *next;
- char uuid_string[UUID_STR_LEN];
- int rc = 0;
-
- uuid_clear(uuid);
- wq_uuid = calloc(1, sizeof(struct accfg_wq_uuid));
- if (!wq_uuid) {
- err(ctx, "allocation of wq_uuid failed\n");
- return -ENOMEM;
- }
-
- /* generate uuid */
- uuid_generate(wq_uuid->uuid);
-
- /* extract pcie path name by parsing symbolic link */
- pcie_path = accfg_wq_get_pcie_path(wq);
- if (!pcie_path) {
- err(ctx, "getting pcie path failed\n");
- free(wq_uuid);
- return -ENOMEM;
- }
-
- /* create mdev via sysfs using uuid */
- mdev_create_path = malloc(PATH_MAX);
- if (!mdev_create_path) {
- err(ctx, "malloc of mdev_create_path failed\n");
- rc = -ENOMEM;
- goto create_err;
- }
-
- wq_uuid_path = malloc(PATH_MAX);
- if (!wq_uuid_path) {
- err(ctx, "malloc of wq_uuid_path failed\n");
- rc = -ENOMEM;
- goto wq_err;
- }
-
- /* convert uuid into string format */
- uuid_unparse(wq_uuid->uuid, uuid_string);
-
- list_for_each_safe(&wq->uuid_list, entry, next, list) {
- if (uuid_compare(wq_uuid->uuid, entry->uuid) == 0) {
- err(ctx, "uuid %s already exists for wq %s\n",
- uuid_string,
- accfg_wq_get_devname(wq));
- rc = -EINVAL;
- goto out_err;
- }
- }
-
- /* add uuid onto linked list if it does not exist */
- list_add_tail(&wq->uuid_list, &wq_uuid->list);
-
- /* write uuid to wq/uuid */
- if (sprintf(wq_uuid_path, "%s/%s", wq->wq_path, "uuid") < 0) {
- err(ctx, "create wq_uuid_path failed with %s\n",
- strerror(errno));
- rc = -errno;
- goto out_err;
- }
-
- rc = sysfs_write_attr(ctx, wq_uuid_path, uuid_string);
- if (rc < 0) {
- err(ctx, "write uuid into wq/uuid failed: %d\n", rc);
- goto out_err;
- }
-
- /* create mdev via sysfs using uuid */
- if (sprintf(mdev_create_path, "%s/%s/%s/idxd-wq/create", MDEV_BUS, pcie_path,
- MDEV_POSTFIX) < 0) {
- err(ctx, "create mdev_create_path failed with %s\n",
- strerror(errno));
- rc = -errno;
- goto out_err;
- }
-
- rc = sysfs_write_attr(ctx, mdev_create_path, uuid_string);
- if (rc < 0) {
- err(ctx, "create mdev failed %d\n", rc);
- goto out_err;
- }
-
- uuid_copy(uuid, wq_uuid->uuid);
- free(wq_uuid_path);
- free(pcie_path);
- free(mdev_create_path);
- return 0;
- out_err:
- free(wq_uuid_path);
- wq_err:
- free(mdev_create_path);
- create_err:
- free(pcie_path);
-
- free(wq_uuid);
- return rc;
-}
-
-static int accfg_wq_uuid_remove(struct accfg_wq *wq, uuid_t uuid)
-{
- struct accfg_ctx *ctx = accfg_wq_get_ctx(wq);
- char *wq_uuid_path;
- char *mdev_remove_path;
- char uuid_str[UUID_STR_LEN];
- int rc = 0;
-
- uuid_unparse(uuid, uuid_str);
-
- /* write 1 into /remove to remove it */
- mdev_remove_path = malloc(PATH_MAX);
- if (!mdev_remove_path) {
- err(ctx, "malloc of mdev_remove_path failed\n");
- return -ENOMEM;
- }
-
- if (sprintf(mdev_remove_path, "%s/%s/%s",
- MDEV_PREFIX, uuid_str, "remove") < 0) {
- err(ctx, "mdev_remove_path creation failed with %s\n",
- strerror(errno));
- free(mdev_remove_path);
- rc = -errno;
- goto err_remove_path;
- }
-
- rc = sysfs_write_attr(ctx, mdev_remove_path, "1");
- if (rc < 0) {
- err(ctx, "remove mdev when write 1 failed with %d\n", rc);
- goto err_remove_path;
- }
-
- /* write same uuid into sysfs to remove it */
- wq_uuid_path = malloc(PATH_MAX);
- if (!wq_uuid_path) {
- err(ctx, "malloc of wq_uuid_path failed\n");
- rc = -ENOMEM;
- goto err_remove_path;
- }
-
- /* write uuid to wq/uuid */
- if (sprintf(wq_uuid_path, "%s/%s", wq->wq_path, "uuid") < 0) {
- err(ctx, "remove wq_uuid_path failed with %s\n",
- strerror(errno));
- rc = -errno;
- goto err_uuid_path;
- }
-
- rc = sysfs_write_attr(ctx, wq_uuid_path, uuid_str);
- if (rc < 0) {
- err(ctx, "write uuid into wq/uuid failed with %d\n", rc);
- goto err_uuid_path;
- }
-
- err_uuid_path:
- free(wq_uuid_path);
- err_remove_path:
- free(mdev_remove_path);
-
- return rc;
-}
-
-ACCFG_EXPORT int accfg_wq_remove_mdev(struct accfg_wq *wq, uuid_t uuid)
-{
- struct accfg_wq_uuid *entry, *next;
- struct accfg_ctx *ctx = accfg_wq_get_ctx(wq);
- uuid_t uuid_zero;
- int rc;
-
- /* generate null uuid */
- uuid_generate(uuid_zero);
- uuid_clear(uuid_zero);
-
- /* If user writes null, erase entire list. */
- if (uuid_compare(uuid, uuid_zero) == 0) {
- list_for_each_safe(&wq->uuid_list, entry, next, list) {
- rc = accfg_wq_uuid_remove(wq, entry->uuid);
- if (rc != 0) {
- err(ctx, "remove uuid failed: %d\n", rc);
- return rc;
- }
-
- list_del(&entry->list);
- free(entry);
- wq->uuids--;
- }
- return 0;
- }
-
- /* If uuid already exists, remove the old uuid. */
- list_for_each_safe(&wq->uuid_list, entry, next, list) {
- if (uuid_compare(uuid, entry->uuid) == 0) {
- list_del(&entry->list);
- wq->uuids--;
- rc = accfg_wq_uuid_remove(wq, entry->uuid);
- free(entry);
- if (rc != 0) {
- err(ctx, "remove uuid failed: %d\n", rc);
- return rc;
- }
- return 0;
- }
- }
-
- err(ctx, "could not find matched uuid\n");
- return -EINVAL;
-}
-
ACCFG_EXPORT struct accfg_engine *accfg_engine_get_first(
struct accfg_device *device)
{
diff --git a/accfg/lib/private.h b/accfg/lib/private.h
index 399c601..f38ff23 100644
--- a/accfg/lib/private.h
+++ b/accfg/lib/private.h
@@ -97,8 +97,6 @@ struct accfg_wq {
struct accfg_device *device;
struct accfg_group *group;
struct list_node list;
- struct list_head uuid_list;
- struct accfg_wq_uuid *iter;
char *wq_path;
char *wq_buf;
int id, buf_len;
@@ -111,7 +109,6 @@ struct accfg_wq {
int priority;
int block_on_fault;
int cdev_minor;
- int uuids;
unsigned int threshold;
char *mode;
char *name;
@@ -121,11 +118,6 @@ struct accfg_wq {
unsigned long max_transfer_size;
};
-struct accfg_wq_uuid {
- uuid_t uuid;
- struct list_node list;
-};
-
#define ACCFG_EXPORT __attribute__ ((visibility("default")))
/**
diff --git a/accfg/libaccel_config.h b/accfg/libaccel_config.h
index 706b371..392188e 100644
--- a/accfg/libaccel_config.h
+++ b/accfg/libaccel_config.h
@@ -56,8 +56,7 @@ enum accfg_wq_state {
enum accfg_wq_type {
ACCFG_WQT_NONE = 0,
ACCFG_WQT_KERNEL,
- ACCFG_WQT_USER,
- ACCFG_WQT_MDEV,
+ ACCFG_WQT_USER
};
enum accfg_control_flag {
@@ -98,7 +97,6 @@ struct wq_parameters {
const char *mode;
const char *type;
const char *name;
- const char *uuid_str;
};
struct engine_parameters {
@@ -210,8 +208,6 @@ int accfg_group_set_traffic_class_b(struct accfg_group *group, int val);
struct accfg_wq;
struct accfg_wq *accfg_wq_get_first(struct accfg_device *device);
struct accfg_wq *accfg_wq_get_next(struct accfg_wq *wq);
-uuid_t *accfg_wq_first_uuid(struct accfg_wq *wq);
-uuid_t *accfg_wq_next_uuid(struct accfg_wq *wq);
#define accfg_wq_foreach(device, wq) \
@@ -219,11 +215,6 @@ uuid_t *accfg_wq_next_uuid(struct accfg_wq *wq);
wq != NULL; \
wq = accfg_wq_get_next(wq))
-#define accfg_wq_uuid_foreach(wq, uuid) \
- for (uuid = accfg_wq_first_uuid(wq); \
- uuid != NULL; \
- uuid = accfg_wq_next_uuid(wq))
-
struct accfg_ctx *accfg_wq_get_ctx(struct accfg_wq *wq);
struct accfg_device *accfg_wq_get_device(struct accfg_wq *wq);
struct accfg_group *accfg_wq_get_group(struct accfg_wq *wq);
@@ -261,8 +252,6 @@ int accfg_wq_enable(struct accfg_wq *wq);
int accfg_wq_disable(struct accfg_wq *wq, bool force);
int accfg_wq_priority_boundary(struct accfg_wq *wq);
int accfg_wq_size_boundary(struct accfg_device *device, int wq_num);
-int accfg_wq_create_mdev(struct accfg_wq *wq, uuid_t uuid);
-int accfg_wq_remove_mdev(struct accfg_wq *wq, uuid_t uuid);
/* libaccfg function for engine */
struct accfg_engine;
diff --git a/accfg/mdev.c b/accfg/mdev.c
index 0744a46..56c5c68 100644
--- a/accfg/mdev.c
+++ b/accfg/mdev.c
@@ -21,172 +21,12 @@
#include <sys/stat.h>
#include <accfg.h>
-static struct wq_parameters wq_param;
-
int cmd_create_mdev(int argc, const char **argv, void *ctx)
{
- int i = 0;
- unsigned int dev_id = 0, wq_id = 0;
- const char *const u[] = {
- "accfg create-mdev <wq name>",
- NULL
- };
- uuid_t uuid;
- char uuid_str[UUID_STR_LEN];
-
- argc = parse_options(argc, argv, NULL, u, 0);
-
- if (argc == 0)
- fprintf(stderr, "specify a wq name to create mdev\n");
-
- for (i = 0; i < argc; i++) {
- struct accfg_device *device;
- struct accfg_wq *wq;
- char dev_name[MAX_DEV_LEN], wq_name[MAX_DEV_LEN];
- enum accfg_wq_state wq_state;
- int rc = 0;
-
- /* walk through wq */
- if (strstr(argv[i], "wq") != NULL) {
- if (sscanf(argv[i], "%[^/]/wq%u.%u",
- dev_name, &dev_id, &wq_id) != 3) {
- fprintf(stderr, "'%s' is not a valid wq name\n",
- argv[i]);
- return -EINVAL;
- }
- }
-
- if (!accfg_device_type_validate(dev_name))
- return -EINVAL;
-
- rc = sprintf(wq_name, "wq%u.%u", dev_id, wq_id);
- if (rc < 0)
- return rc;
-
- accfg_device_foreach(ctx, device) {
- if (!util_device_filter(device, dev_name))
- continue;
-
- accfg_wq_foreach(device, wq) {
- if (!util_wq_filter(wq, wq_name))
- continue;
-
- wq_state = accfg_wq_get_state(wq);
- if (wq_state == ACCFG_WQ_DISABLED
- || wq_state == ACCFG_WQ_QUIESCING) {
- fprintf(stderr,
- "wq in wrong mode: %d\n",
- wq_state);
- return -ENXIO;
- }
-
- rc = accfg_wq_create_mdev(wq, uuid);
- if (rc != 0)
- return rc;
- uuid_unparse(uuid, uuid_str);
- printf("%s attached to %s\n",
- uuid_str,
- accfg_wq_get_devname(wq));
- }
- }
- }
-
return 0;
}
int cmd_remove_mdev(int argc, const char **argv, void *ctx)
{
- int i = 0;
- unsigned int dev_id = 0, wq_id = 0;
-
- const struct option options[] = {
- OPT_STRING('u', "uuid", &wq_param.uuid_str, "uuid",
- "specify uuid to be removed"),
- OPT_END(),
- };
-
- const char *const u[] = {
- "accfg remove-mdev <device name>/<wq name> [<uuid>] to remove single uuid",
- "accfg remove-mdev <device name>/<wq name> to removel all uuid for this wq",
- NULL
- };
-
- argc = parse_options(argc, argv, options, u, 0);
-
- if (argc == 0)
- fprintf(stderr, "specify a wq name to clear uuid\n");
- else {
- for (i = 0; i < argc; i++) {
- if (strcmp(argv[i], "all") == 0) {
- argv[0] = "all";
- argc = 1;
- break;
- }
- }
- }
-
- for (i = 0; i < argc; i++) {
- struct accfg_device *device;
- struct accfg_wq *wq;
- char dev_name[MAX_DEV_LEN], wq_name[MAX_DEV_LEN];
- uuid_t uuid, uuid_zero;
- enum accfg_wq_state wq_state;
- int rc = 0;
-
- /* walk through wq */
- if (strstr(argv[i], "wq") != NULL) {
- if (sscanf(argv[i], "%[^/]/wq%u.%u",
- dev_name, &dev_id, &wq_id) != 3) {
- fprintf(stderr,
- "'%s' is not a valid wq name\n",
- argv[i]);
- return -EINVAL;
- }
- }
-
- if (!accfg_device_type_validate(dev_name))
- return -EINVAL;
-
- rc = sprintf(wq_name, "wq%u.%u", dev_id, wq_id);
- if (rc < 0)
- return rc;
-
- accfg_device_foreach(ctx, device) {
- if (!util_device_filter(device, dev_name))
- continue;
-
- accfg_wq_foreach(device, wq) {
- if (!util_wq_filter(wq, wq_name))
- continue;
-
- wq_state = accfg_wq_get_state(wq);
- if (wq_state == ACCFG_WQ_DISABLED
- || wq_state == ACCFG_WQ_QUIESCING) {
- fprintf(stderr,
- "wq in wrong mode: %d\n",
- wq_state);
- return -ENXIO;
- }
-
- if (wq_param.uuid_str) {
- uuid_parse(wq_param.uuid_str,
- uuid);
- rc = accfg_wq_remove_mdev(wq,
- uuid);
- if (rc != 0)
- return rc;
- } else {
- /* generate null uuid */
- uuid_generate(uuid_zero);
- uuid_clear(uuid_zero);
- rc = accfg_wq_remove_mdev(wq,
- uuid_zero);
- if (rc != 0)
- return rc;
- }
- }
- }
- }
-
return 0;
}
diff --git a/test/README.md b/test/README.md
index c5b783b..6e88098 100644
--- a/test/README.md
+++ b/test/README.md
@@ -63,45 +63,6 @@ configure wq1.2
configure wq1.3
configure wq1.4
test 1: set large wq to exceed max total size in dsa passed successfully
-wq not enabled
-uuid 7a0dca6f-02fe-4cd3-a7ee-9a767883dc08 successfully attached to wq0.2
-uuid d6a87782-8736-4166-aba3-c6580269f186 successfully attached to wq0.2
-uuid 4d0758a3-7ff1-42ec-9979-ba046a1f5722 successfully attached to wq0.2
-uuid c0aa9cd2-3d9d-4cf9-a085-f5bb0f1e9fe0 successfully attached to wq0.2
-uuid 57a5e7a6-cd7d-4fdb-b764-dc0b5fceb047 successfully attached to wq0.2
-successfully removed the saved uuid c0aa9cd2-3d9d-4cf9-a085-f5bb0f1e9fe0 in wq
-successfully removed the rest uuid in shared wq
-wq0.0 is disabled already
-wq0.1 is disabled already
-wq0.3 is disabled already
-wq0.4 is disabled already
-wq0.5 is disabled already
-wq0.6 is disabled already
-wq0.7 is disabled already
-test 2: test the create-mdev and remove-mdev on shared wq passed successfully
-configure device 0
-configure group0.0
-configure wq0.0
-configure engine0.0
-configure engine0.1
-configure group0.1
-configure wq0.1
-configure wq0.2
-configure wq0.3
-configure engine0.2
-configure engine0.3
-wq not enabled
-uuid 97fc3e6a-9cb3-46d7-93e6-7b64ebb0d0dd successfully attached to wq0.3
-successfully removed the saved uuid 97fc3e6a-9cb3-46d7-93e6-7b64ebb0d0dd in wq
-wq0.0 is disabled already
-wq0.1 is disabled already
-wq0.2 is disabled already
-wq0.3 is disabled already
-wq0.4 is disabled already
-wq0.5 is disabled already
-wq0.6 is disabled already
-wq0.7 is disabled already
-test 3: test the create-mdev and remove-mdev on dedicated wq passed successfully
test-libaccfg: PASS
SUCCESS!
```
diff --git a/test/libaccfg.c b/test/libaccfg.c
index 5f4cb31..aef877a 100644
--- a/test/libaccfg.c
+++ b/test/libaccfg.c
@@ -109,7 +109,7 @@ static struct wq_parameters wq02_param = {
.max_batch_size = (1 << 8),
.max_transfer_size = (1l << 30),
.mode = "shared",
- .type = "mdev",
+ .type = "user",
.name = "guest1"
};
@@ -121,7 +121,7 @@ static struct wq_parameters wq03_param = {
.max_batch_size = (1 << 9),
.max_transfer_size = (1l << 31),
.mode = "dedicated",
- .type = "mdev",
+ .type = "user",
.name = "guest2"
};
@@ -765,123 +765,6 @@ static int wq_bounds_test(struct accfg_ctx *ctx, const char *dev_name)
return 0;
}
-static int test_enable_wq(struct accfg_device *device, struct accfg_wq *wq)
-{
- int rc = 0;
- enum accfg_wq_state wq_state;
- const char *wq_name;
-
- if (!accfg_device_is_active(device)) {
- rc = accfg_device_enable(device);
- if (rc < 0) {
- fprintf(stderr, "device_enable failed\n");
- return rc;
- }
- }
-
- wq_state = accfg_wq_get_state(wq);
- wq_name = accfg_wq_get_devname(wq);
-
- if (wq_state == ACCFG_WQ_ENABLED) {
- fprintf(stderr, "wq %s is already enabled\n", wq_name);
- return rc;
- }
-
- rc = accfg_wq_enable(wq);
- if (rc < 0) {
- fprintf(stderr, "wq_enable of %s failed", wq_name);
- return rc;
- }
-
- return 0;
-}
-
-static int mdev_test(struct accfg_ctx *ctx, struct accfg_device *device,
- struct accfg_wq *wq)
-{
- enum accfg_wq_mode wq_mode;
- int rc, i = 0, iterations = 1;
- uuid_t uuid, uuid_zero, saved_uuid;
- char uuid_str[UUID_STR_LEN];
-
- wq_mode = accfg_wq_get_mode(wq);
- if (wq_mode != ACCFG_WQ_SHARED && wq_mode != ACCFG_WQ_DEDICATED)
- return -ENXIO;
-
- if (wq_mode == ACCFG_WQ_SHARED)
- iterations = 5;
-
- /* For shared wq, we can create multiple uuid */
- for (i = 0; i < iterations; i++) {
- rc = accfg_wq_create_mdev(wq, uuid);
- if (rc != 0)
- return rc;
-
- if (i == 3 || wq_mode == ACCFG_WQ_DEDICATED)
- uuid_copy(saved_uuid, uuid);
-
- uuid_unparse(uuid, uuid_str);
- printf("uuid %s successfully attached to %s\n", uuid_str,
- accfg_wq_get_devname(wq));
- }
-
- /* Remove the saved uuid first */
- rc = accfg_wq_remove_mdev(wq, saved_uuid);
- if (rc != 0)
- return rc;
-
- uuid_unparse(saved_uuid, uuid_str);
- printf("successfully removed the saved uuid %s in wq\n", uuid_str);
-
- /* Remove all rest of the uuid */
- if (wq_mode == ACCFG_WQ_SHARED) {
- uuid_clear(uuid_zero);
- rc = accfg_wq_remove_mdev(wq, uuid_zero);
- if (rc != 0)
- return rc;
- printf("successfully removed the rest uuid in shared wq\n");
- }
-
- return 0;
-}
-
-static int dsa_mdev_test(struct accfg_ctx *ctx, const char *wq_name,
- const char *dev_name)
-{
- int rc;
- struct accfg_device *device;
- struct accfg_wq *wq;
- enum accfg_wq_state wq_state;
-
- accfg_device_foreach(ctx, device) {
- if (strcmp(accfg_device_get_devname(device), dev_name))
- continue;
-
- if (!accfg_device_type_validate(dev_name))
- return -EINVAL;
-
- accfg_wq_foreach(device, wq) {
- if (strcmp(accfg_wq_get_devname(wq), wq_name))
- continue;
-
- wq_state = accfg_wq_get_state(wq);
- if (wq_state == ACCFG_WQ_DISABLED
- || wq_state == ACCFG_WQ_QUIESCING)
- fprintf(stderr, "wq not enabled\n");
-
- rc = test_enable_wq(device, wq);
- if (rc != 0)
- return rc;
-
- rc = mdev_test(ctx, device, wq);
- if (rc < 0)
- return rc;
- }
- }
-
- return 0;
-}
-
/* test the set and get libaccfg functions for all components in dsa0 */
static int do_test0(struct accfg_ctx *ctx)
{
@@ -935,71 +818,8 @@ static int do_test1(struct accfg_ctx *ctx)
return 0;
}
-/* test the create-mdev and remove-mdev on shared wq */
-static int do_test2(struct accfg_ctx *ctx)
-{
- int rc = 0;
-
- rc = device_test_reset(ctx, "dsa0");
- if (rc != 0)
- return rc;
-
- rc = config_device(ctx, 0, device0_param, "dsa0");
- if (rc != 0) {
- fprintf(stderr, "config device dsa0 failed\n");
- return rc;
- }
-
- rc = config_wq(ctx, 0, 2, wq02_param, "dsa0");
- if (rc != 0) {
- fprintf(stderr, "config wq wq0.2 failed\n");
- return rc;
- }
-
- rc = dsa_mdev_test(ctx, "wq0.2", "dsa0");
- if (rc != 0) {
- fprintf(stderr, "test 2: test the create-mdev and remove-mdev on shared wq failed\n");
- return rc;
- }
-
- rc = device_test_reset(ctx, "dsa0");
- if (rc != 0)
- return rc;
-
- fprintf(stderr, "test 2: test the create-mdev and remove-mdev on shared wq passed successfully\n");
- return 0;
-}
-
-/* test the create-mdev and remove-mdev on dedicated wq */
-static int do_test3(struct accfg_ctx *ctx)
-{
- int rc = 0;
-
- rc = device_test_reset(ctx, "dsa0");
- if (rc != 0)
- return rc;
-
- /* set configuration of each attribute */
- rc = set_config(ctx, "dsa0");
- if (rc != 0)
- return rc;
-
- rc = dsa_mdev_test(ctx, "wq0.3", "dsa0");
- if (rc != 0) {
- fprintf(stderr, "test 3: test the create-mdev and remove-mdev on dedicated wq failed\n");
- return rc;
- }
-
- rc = device_test_reset(ctx, "dsa0");
- if (rc != 0)
- return rc;
-
- fprintf(stderr, "test 3: test the create-mdev and remove-mdev on dedicated wq passed successfully\n");
- return 0;
-}
-
/* test the boundary conditions for wq max_batch_size and max_transfer_size */
-static int do_test4(struct accfg_ctx *ctx)
+static int do_test2(struct accfg_ctx *ctx)
{
int rc = 0;
@@ -1009,7 +829,7 @@ static int do_test4(struct accfg_ctx *ctx)
rc = wq_bounds_test(ctx, "dsa0");
if (rc != 0) {
- fprintf(stderr, "test 4: wq boundary conditions test failed\n");
+ fprintf(stderr, "test 2: wq boundary conditions test failed\n");
return rc;
}
@@ -1017,7 +837,7 @@ static int do_test4(struct accfg_ctx *ctx)
if (rc != 0)
return rc;
- fprintf(stderr, "test 4: wq boundary conditions test passed successfully\n");
+ fprintf(stderr, "test 2: wq boundary conditions test passed successfully\n");
return 0;
}
@@ -1025,9 +845,7 @@ typedef int (*do_test_fn)(struct accfg_ctx *ctx);
static do_test_fn do_test[] = {
do_test0,
do_test1,
- do_test4,
do_test2,
- do_test3
};
static int idxd_kmod_init(struct kmod_ctx **ctx, struct kmod_module **mod,
diff --git a/util/json.c b/util/json.c
index c858fc3..3bf8950 100644
--- a/util/json.c
+++ b/util/json.c
@@ -20,8 +20,7 @@
static const char *wq_type_str[] = {
"none",
"kernel",
- "user",
- "mdev"
+ "user"
};
/* adapted from mdadm::human_size_brief() */
@@ -354,9 +353,6 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,
unsigned long size = ULLONG_MAX;
enum accfg_wq_mode wq_mode;
enum accfg_wq_state wq_state;
- const uuid_t *wq_uuid;
- struct json_object *json_uuid;
- char uuid_string[UUID_STR_LEN];
int int_val;
if (!jaccfg)
@@ -430,7 +426,6 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,
json_object_object_add(jaccfg, "threshold", jobj);
if (!(flags & UTIL_JSON_SAVE)) {
- int uuid_found = 0;
switch (wq_state) {
case ACCFG_WQ_DISABLED:
@@ -450,22 +445,6 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,
if (jobj)
json_object_object_add(jaccfg, "state", jobj);
- /* UUID can't be programmed through config file */
- jobj = json_object_new_array();
- accfg_wq_uuid_foreach(wq, wq_uuid) {
- uuid_unparse(*wq_uuid, uuid_string);
- json_uuid = json_object_new_string(uuid_string);
- if (json_uuid)
- json_object_array_add(jobj, json_uuid);
- else
- break;
- uuid_found++;
- }
- if (uuid_found)
- json_object_object_add(jaccfg, "uuid", jobj);
- else
- json_object_put(jobj);
-
jobj = json_object_new_int(accfg_wq_get_clients(wq));
if (jobj)
json_object_object_add(jaccfg, "clients", jobj);
--
2.26.2
2 months, 1 week