From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============6410641375915978967==" MIME-Version: 1.0 From: ramesh.thomas at intel.com 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 Message-ID: <20201208203647.343395-2-ramesh.thomas@intel.com> In-Reply-To: 20201208203647.343395-1-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============6410641375915978967== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Ramesh Thomas 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 --- 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 *dev= ice) static int mdev_str_to_type(char *mdev_type_str) { char **b; - char *s; - int l, i; - - s =3D strchr(mdev_type_str, '-'); - if (!s) - s =3D mdev_type_str; - else - s++; - l =3D (int) (strchrnul(s, '-') - s); + int i; = for (b =3D accfg_mdev_basenames, i =3D 0; *b !=3D 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 >=3D ACCFG_MDEV_TYPE_UNKNOWN || type < 0) @@ -1016,8 +1009,10 @@ ACCFG_EXPORT int accfg_create_mdev(struct accfg_devi= ce *device, mdev->type =3D 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 =3D 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 =3D sysfs_write_attr(ctx, mdev_path, uuid_str); if (rc < 0) { err(ctx, "create mdev failed %d\n", rc); -- = 2.26.2 --===============6410641375915978967==--