Skip to contentSkip to conversation

accel-config/test: Call uacce API to get wq file descriptor

PATCH In review ramesh.thomas at intel.com 2 participants 2 messages Apr 6, 2021

lore
Share & tools
lore

ramesh.thomas at intel.com

#0 lore raw

PATCH v2 1/1 accel-config/test: Call uacce API to get wq file descriptor

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

Char dev major/minor method of getting file descriptor is being replaced by uacce interface. Replace calls to char dev API with new API to open uacce device.

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>

---
V2:
Call the changed API name to get user device path

 test/dsa.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
test/dsa.c +7 -11
index 602bfb8..65ce807 100644
@@ -69,19 +69,15 @@ struct dsa_context *dsa_init(void)
 
 static int dsa_setup_wq(struct dsa_context *ctx, struct accfg_wq *wq)
 {
-	struct accfg_device *dev;
-	int major, minor;
-	char path[1024];
+	char path[PATH_MAX];
+	int rc;
 
-	dev = accfg_wq_get_device(wq);
-	major = accfg_device_get_cdev_major(dev);
-	if (major < 0)
-		return -ENODEV;
-	minor = accfg_wq_get_cdev_minor(wq);
-	if (minor < 0)
-		return -ENODEV;
+	rc = accfg_wq_get_user_dev_path(wq, path, PATH_MAX);
+	if (rc) {
+		fprintf(stderr, "Error getting uacce device path\n");
+		return rc;
+	}
 
-	sprintf(path, "/dev/char/%u:%u", major, minor);
 	ctx->fd = open(path, O_RDWR);
 	if (ctx->fd < 0) {
 		perror("open");
Signature · 1 line
2.26.3
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · ramesh.thomas(a)intel.com

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

Char dev major/minor method of getting file descriptor is being replaced by uacce interface. Replace calls to char dev API with new API to open uacce device.

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
Reviewed-by Dave Jiang <dave.jiang(a)intel.com>
Quoted 38 lines

---
V2:
Call the changed API name to get user device path

  test/dsa.c | 18 +++++++-----------
  1 file changed, 7 insertions(+), 11 deletions(-)
test/dsa.c +7 -11
index 602bfb8..65ce807 100644
@@ -69,19 +69,15 @@ struct dsa_context *dsa_init(void)
 
  static int dsa_setup_wq(struct dsa_context *ctx, struct accfg_wq *wq)
  {
-	struct accfg_device *dev;
-	int major, minor;
-	char path[1024];
+	char path[PATH_MAX];
+	int rc;
 
-	dev = accfg_wq_get_device(wq);
-	major = accfg_device_get_cdev_major(dev);
-	if (major < 0)
-		return -ENODEV;
-	minor = accfg_wq_get_cdev_minor(wq);
-	if (minor < 0)
-		return -ENODEV;
+	rc = accfg_wq_get_user_dev_path(wq, path, PATH_MAX);
+	if (rc) {
+		fprintf(stderr, "Error getting uacce device path\n");
+		return rc;
+	}
 
-	sprintf(path, "/dev/char/%u:%u", major, minor);
  	ctx->fd = open(path, O_RDWR);
  	if (ctx->fd < 0) {
  		perror("open");