All of lore.kernel.org
 help / color / mirror / Atom feed
From: ramesh.thomas at intel.com
To: accel-config@lists.01.org
Subject: [Accel-config] [PATCH v1 6/6] accel-config: Disable mdev operations if mdev support unavailable
Date: Sat, 23 Jan 2021 00:35:42 -0500	[thread overview]
Message-ID: <20210123053542.615622-7-ramesh.thomas@intel.com> (raw)
In-Reply-To: 20210123053542.615622-1-ramesh.thomas@intel.com

[-- Attachment #1: Type: text/plain, Size: 2706 bytes --]

From: Ramesh Thomas <ramesh.thomas(a)intel.com>

If idxd_mdev module is not found disable mdev tests and operations.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 test/libaccfg.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/test/libaccfg.c b/test/libaccfg.c
index 031b7fa..0ff43ca 100644
--- a/test/libaccfg.c
+++ b/test/libaccfg.c
@@ -34,6 +34,8 @@
 #define PORTAL_SIZE	4096
 #define BUF_SIZE	4096
 
+static bool mdev_disabled;
+
 struct accfg_wq_ctx {
 	int major;
 	int minor;
@@ -491,12 +493,14 @@ static int device_test_reset(struct accfg_ctx *ctx, const char *dev_name,
 	/* make sure device is disabled before configuration */
 	if (accfg_device_is_active(device)) {
 
-		/* Remove all mdevs */
-		uuid_clear(uuid);
-		rc = accfg_remove_mdev(device, uuid);
-		if (rc && !forced) {
-			fprintf(stderr, "mdev removal failed\n");
-			return rc;
+		if (!mdev_disabled) {
+			/* Remove all mdevs */
+			uuid_clear(uuid);
+			rc = accfg_remove_mdev(device, uuid);
+			if (rc && !forced) {
+				fprintf(stderr, "mdev removal failed\n");
+				return rc;
+			}
 		}
 
 		/* make sure each wq is disabled */
@@ -1008,6 +1012,7 @@ struct _test_case {
 	do_test_fn test_fn;
 	char *desc;
 	bool enabled;
+	bool mdev;
 };
 
 static struct _test_case test_cases[] = {
@@ -1015,26 +1020,31 @@ static struct _test_case test_cases[] = {
 		.test_fn = test_config,
 		.desc = "set and get configurations",
 		.enabled = true,
+		.mdev = false,
 	},
 	{
 		.test_fn = test_max_wq_size,
 		.desc = "max wq size",
 		.enabled = true,
+		.mdev = false,
 	},
 	{
 		.test_fn = test_wq_boundary_conditions,
 		.desc = "wq boundary conditions",
 		.enabled = true,
+		.mdev = false,
 	},
 	{
 		.test_fn = test_mdev_1swq,
 		.desc = "1swq type mdev creation and removal",
 		.enabled = true,
+		.mdev = true,
 	},
 	{
 		.test_fn = test_mdev_1dwq,
 		.desc = "1dwq type mdev creation and removal",
 		.enabled = true,
+		.mdev = true,
 	},
 };
 
@@ -1070,6 +1080,7 @@ static int idxd_kmod_init(struct kmod_ctx **ctx, struct kmod_module **mod,
 	if (rc < 0) {
 		kmod_module_unref(*mdev_mod);
 		*mdev_mod = NULL;
+		mdev_disabled = true;
 	}
 	rc = kmod_module_get_initstate(*mod);
 	if (rc == -ENOENT)
@@ -1130,6 +1141,10 @@ int test_libaccfg(int loglevel, struct accfg_test *test,
 			fprintf(stderr, "\naccfg-test%d *disabled*\n", i);
 			continue;
 		}
+
+		if (test_cases[i].mdev && mdev_disabled)
+			continue;
+
 		printf("\nRunning accfg-test%d: %s\n", i, test_cases[i].desc);
 		err = test_cases[i].test_fn(ctx);
 		if (err < 0) {
-- 
2.26.2

                 reply	other threads:[~2021-01-23  5:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210123053542.615622-7-ramesh.thomas@intel.com \
    --to=accel-config@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.