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 v2 2/4] accel-config: Add compatibility mode detection
Date: Thu, 11 Mar 2021 18:16:41 -0500	[thread overview]
Message-ID: <20210311231643.312090-3-ramesh.thomas@intel.com> (raw)
In-Reply-To: 20210311231643.312090-1-ramesh.thomas@intel.com

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

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

Add a flag in accfg context to store commpatibility mode. Absence of
/sys/bus/dsa/drivers/idxd indicates compatibility mode.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/lib/libaccfg.c | 4 ++++
 accfg/lib/private.h  | 1 +
 2 files changed, 5 insertions(+)

diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index 450be4f..58ad97f 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -28,6 +28,7 @@
 #include "private.h"
 
 #define MDEV_POSTFIX "mdev_supported_types"
+#define IDXD_DRIVER_BIND_PATH "/sys/bus/dsa/drivers/idxd"
 
 const char *accfg_wq_mode_str[] = {
 	[ACCFG_WQ_SHARED]	= "shared",
@@ -310,6 +311,9 @@ ACCFG_EXPORT int accfg_new(struct accfg_ctx **ctx)
 	c->refcount = 1;
 	log_init(&c->ctx, "libaccfg", "ACCFG_LOG");
 	c->timeout = 5000;
+	if (access(IDXD_DRIVER_BIND_PATH, R_OK))
+		c->compat = true;
+
 	list_head_init(&c->devices);
 
 	info(c, "ctx %p created\n", c);
diff --git a/accfg/lib/private.h b/accfg/lib/private.h
index 0fdc5d5..f407643 100644
--- a/accfg/lib/private.h
+++ b/accfg/lib/private.h
@@ -146,6 +146,7 @@ struct accfg_ctx {
 	struct list_head devices;
 	uint64_t timeout;
 	void *private_data;
+	bool compat;
 };
 
 static inline int check_udev(struct udev *udev)
-- 
2.26.2

                 reply	other threads:[~2021-03-11 23:16 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=20210311231643.312090-3-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.