[Accel-config] [PATCH v1 3/6] accel-config: Add API to check for mdev support availability

ramesh.thomas at intel.com
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Add a function to check for mdev support availability to allow
mdev command implementations to bail out if support is not available.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/lib/libaccel-config.sym | 1 +
 accfg/lib/libaccfg.c          | 6 ++++++
 accfg/libaccel_config.h       | 1 +
 3 files changed, 8 insertions(+)

diff --git a/accfg/lib/libaccel-config.sym b/accfg/lib/libaccel-config.sym
index 00f97d5..4de2a49 100644
--- a/accfg/lib/libaccel-config.sym
+++ b/accfg/lib/libaccel-config.sym
@@ -139,4 +139,5 @@ global:
 	accfg_mdev_basenames;
 	accfg_create_mdev;
 	accfg_remove_mdev;
+	accfg_device_get_mdev_enabled;
 } LIBACCFG_6;
diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index 69f0f71..a596c90 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -1229,6 +1229,12 @@ ACCFG_EXPORT bool accfg_device_get_pasid_enabled(
 	return device->pasid_enabled;
 }
 
+ACCFG_EXPORT bool accfg_device_get_mdev_enabled(
+		struct accfg_device *device)
+{
+	return device->mdev_path != NULL;
+}
+
 ACCFG_EXPORT int accfg_device_get_errors(struct accfg_device *device,
 		struct accfg_error *error)
 {
diff --git a/accfg/libaccel_config.h b/accfg/libaccel_config.h
index 7fa3c2b..239d393 100644
--- a/accfg/libaccel_config.h
+++ b/accfg/libaccel_config.h
@@ -172,6 +172,7 @@ unsigned long accfg_device_get_op_cap(struct accfg_device *device);
 unsigned long accfg_device_get_gen_cap(struct accfg_device *device);
 unsigned int accfg_device_get_configurable(struct accfg_device *device);
 bool accfg_device_get_pasid_enabled(struct accfg_device  *device);
+bool accfg_device_get_mdev_enabled(struct accfg_device *device);
 int accfg_device_get_errors(struct accfg_device *device, struct accfg_error *error);
 enum accfg_device_state accfg_device_get_state(struct accfg_device *device);
 unsigned int accfg_device_get_max_tokens(struct accfg_device *device);
-- 
2.26.2
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.