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 1/5] accel-config: Support new driver changes in kernel ver 5.10
Date: Tue, 08 Dec 2020 15:36:43 -0500	[thread overview]
Message-ID: <20201208203647.343395-2-ramesh.thomas@intel.com> (raw)
In-Reply-To: 20201208203647.343395-1-ramesh.thomas@intel.com

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

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

New driver ver 1.0 in kernl 5.10 has changed the format of
mdev type name. Add changes in library to read the new type names
while scanning for and creation of mdevs.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/lib/libaccfg.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index b003644..eda6b45 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -416,18 +416,10 @@ static int device_parse_type(struct accfg_device *device)
 static int mdev_str_to_type(char *mdev_type_str)
 {
 	char **b;
-	char *s;
-	int l, i;
-
-	s = strchr(mdev_type_str, '-');
-	if (!s)
-		s = mdev_type_str;
-	else
-		s++;
-	l = (int) (strchrnul(s, '-') - s);
+	int i;
 
 	for (b = accfg_mdev_basenames, i = 0; *b != NULL; b++, i++)
-		if (!strncmp(*b, s, l))
+		if (strstr(mdev_type_str, *b))
 			return i;
 
 	return ACCFG_MDEV_TYPE_UNKNOWN;
@@ -1002,6 +994,7 @@ ACCFG_EXPORT int accfg_create_mdev(struct accfg_device *device,
 	struct accfg_device_mdev *mdev;
 	char uuid_str[UUID_STR_LEN];
 	char mdev_path[PATH_MAX];
+	unsigned int version;
 	int rc;
 
 	if (type >= ACCFG_MDEV_TYPE_UNKNOWN || type < 0)
@@ -1016,8 +1009,10 @@ ACCFG_EXPORT int accfg_create_mdev(struct accfg_device *device,
 	mdev->type = type;
 
 	uuid_unparse(mdev->uuid, uuid_str);
-	sprintf(mdev_path, "%s/%s/idxd-%s/create", device->mdev_path,
-			MDEV_POSTFIX, accfg_mdev_basenames[type]);
+	version = device->version  >> 8;
+	sprintf(mdev_path, "%s/%s/idxd-%s-%s-v%d/create", device->mdev_path,
+			MDEV_POSTFIX, device->device_type_str,
+			accfg_mdev_basenames[type], version);
 	rc = sysfs_write_attr(ctx, mdev_path, uuid_str);
 	if (rc < 0) {
 		err(ctx, "create mdev failed %d\n", rc);
-- 
2.26.2

                 reply	other threads:[~2020-12-08 20:36 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=20201208203647.343395-2-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.