Content-Type: multipart/mixed; boundary="===============9159360624713690102==" MIME-Version: 1.0 From: Dave Jiang Subject: [Accel-config] Re: [PATCH v1 2/4] accel-config: Add compatibility mode detection Date: Thu, 11 Mar 2021 11:24:06 -0700 Message-ID: <6e37e008-5284-846d-2b90-7f73a6128ef6@intel.com> In-Reply-To: 20210311180323.307205-3-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============9159360624713690102== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On 3/11/2021 11:03 AM, ramesh.thomas(a)intel.com wrote: > From: Ramesh Thomas > > 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 > --- > accfg/lib/libaccfg.c | 5 +++++ > accfg/lib/private.h | 1 + > 2 files changed, 6 insertions(+) > > diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c > index 450be4f..25d783c 100644 > --- a/accfg/lib/libaccfg.c > +++ b/accfg/lib/libaccfg.c > @@ -28,6 +28,8 @@ > #include "private.h" > = > #define MDEV_POSTFIX "mdev_supported_types" > +#define IDXD_DRIVER_PATH "/sys/bus/dsa/drivers/" > +#define IDXD_DRIVER_PORTAL "idxd" Portal is actually a device term. We have portal drivers for the WQ but = not the device. Maybe IDXD_DRIVER_BIND_PATH? > = > const char *accfg_wq_mode_str[] =3D { > [ACCFG_WQ_SHARED] =3D "shared", > @@ -310,6 +312,9 @@ ACCFG_EXPORT int accfg_new(struct accfg_ctx **ctx) > c->refcount =3D 1; > log_init(&c->ctx, "libaccfg", "ACCFG_LOG"); > c->timeout =3D 5000; > + if (access(IDXD_DRIVER_PATH IDXD_DRIVER_PORTAL, R_OK)) I think you want to detect /sys/bus/dsa/drivers/dsa to be in compat = mode? If COMPAT is turned off, /sys/bus/dsa/drivers/dsa would not exist. > + c->compat =3D 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) --===============9159360624713690102==--