Content-Type: multipart/mixed; boundary="===============1313307759120016325==" MIME-Version: 1.0 From: Dave Jiang Subject: [Accel-config] Re: [PATCH v1 1/2] accel-config: Remove cdev related code Date: Tue, 18 May 2021 08:07:04 -0700 Message-ID: In-Reply-To: 20210517215009.869180-1-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============1313307759120016325== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On 5/17/2021 2:50 PM, ramesh.thomas(a)intel.com wrote: > From: Ramesh Thomas > > cdev major/minor method of opening idxd char dev will be deprecated. > Currently even in non uacce mode the char dev is opened using the device > name at /dev/dsa that is returned by accfg_wq_get_user_dev_path() I'm concerned about backward compatibility for apps (Intel user libs) = that may still use minor/major API. Do we need to provide some sort of = backward compatibility (maybe with warnings?) until they get off this = train? Especially they have been doing releases already. > > Signed-off-by: Ramesh Thomas > --- > accfg/lib/libaccel-config.sym | 2 - > accfg/lib/libaccfg.c | 80 ----------------------------------- > accfg/lib/private.h | 2 - > accfg/libaccel_config.h | 2 - > util/json.c | 11 ----- > 5 files changed, 97 deletions(-) > > diff --git a/accfg/lib/libaccel-config.sym b/accfg/lib/libaccel-config.sym > index aecc98b..3e86274 100644 > --- a/accfg/lib/libaccel-config.sym > +++ b/accfg/lib/libaccel-config.sym > @@ -28,7 +28,6 @@ LIBACCFG_1 { > accfg_device_get_state; > accfg_device_get_max_tokens; > accfg_device_get_max_batch_size; > - accfg_device_get_cdev_major; > accfg_device_is_active; > accfg_device_get_token_limit; > accfg_device_set_token_limit; > @@ -69,7 +68,6 @@ LIBACCFG_1 { > accfg_wq_get_size; > accfg_wq_get_block_on_fault; > accfg_wq_get_state; > - accfg_wq_get_cdev_minor; > accfg_wq_get_type; > accfg_wq_get_threshold; > accfg_wq_set_size; > diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c > index 0796f08..f0f6bb2 100644 > --- a/accfg/lib/libaccfg.c > +++ b/accfg/lib/libaccfg.c > @@ -581,7 +581,6 @@ static void *add_device(void *parent, int id, const c= har *ctl_base, > "pasid_enabled"); > device->max_tokens =3D accfg_get_param_long(ctx, dfd, "max_tokens"); > device->token_limit =3D accfg_get_param_long(ctx, dfd, "token_limit"); > - device->cdev_major =3D accfg_get_param_long(ctx, dfd, "cdev_major"); > device->version =3D accfg_get_param_unsigned_llong(ctx, dfd, "version"= ); > device->device_path =3D realpath(ctl_base, NULL); > close(dfd); > @@ -727,7 +726,6 @@ static void *add_wq(void *parent, int id, const char = *wq_base, > "block_on_fault"); > wq->mode =3D accfg_get_param_str(ctx, dfd, "mode"); > wq->state =3D accfg_get_param_str(ctx, dfd, "state"); > - wq->cdev_minor =3D accfg_get_param_long(ctx, dfd, "cdev_minor"); > wq_type =3D accfg_get_param_str(ctx, dfd, "type"); > wq->name =3D accfg_get_param_str(ctx, dfd, "name"); > wq->threshold =3D accfg_get_param_long(ctx, dfd, "threshold"); > @@ -1378,12 +1376,6 @@ ACCFG_EXPORT unsigned int accfg_device_get_token_l= imit( > return device->token_limit; > } > = > -ACCFG_EXPORT unsigned int accfg_device_get_cdev_major( > - struct accfg_device *device) > -{ > - return device->cdev_major; > -} > - > ACCFG_EXPORT unsigned int accfg_device_get_version( > struct accfg_device *device) > { > @@ -1859,11 +1851,6 @@ ACCFG_EXPORT const char *accfg_wq_get_devname(stru= ct accfg_wq *wq) > return devpath_to_devname(wq->wq_path); > } > = > -ACCFG_EXPORT int accfg_wq_get_cdev_minor(struct accfg_wq *wq) > -{ > - return wq->cdev_minor; > -} > - > ACCFG_EXPORT enum accfg_wq_type accfg_wq_get_type(struct accfg_wq *wq) > { > return wq->type; > @@ -1923,68 +1910,6 @@ ACCFG_EXPORT int accfg_wq_priority_boundary(struct= accfg_wq *wq) > return 0; > } > = > -static int accfg_wq_retrieve_cdev_minor(struct accfg_wq *wq) > -{ > - struct accfg_ctx *ctx =3D accfg_wq_get_ctx(wq); > - char *path =3D wq->wq_buf; > - char buf[SYSFS_ATTR_SIZE]; > - int rc; > - > - rc =3D sprintf(wq->wq_buf, "%s/%s", wq->wq_path, "cdev_minor"); > - if (rc < 0) > - return -errno; > - > - if (sysfs_read_attr(ctx, path, buf) < 0) { > - err(ctx, "%s: retrieve cdev minor failed: '%s': %s\n", > - __func__, wq->wq_path, strerror(errno)); > - return -errno; > - } > - > - wq->cdev_minor =3D atoi(buf); > - return 0; > -} > - > -static int accfg_wq_post_enable(struct accfg_wq *wq) > -{ > - enum accfg_wq_type type; > - int rc; > - > - type =3D accfg_wq_get_type(wq); > - > - if (type =3D=3D ACCFG_WQT_USER) { > - rc =3D accfg_wq_retrieve_cdev_minor(wq); > - if (rc < 0) > - return rc; > - } > - > - return 0; > -} > - > -static int accfg_wq_post_disable(struct accfg_wq *wq) > -{ > - enum accfg_wq_type type; > - > - type =3D accfg_wq_get_type(wq); > - > - if (type =3D=3D ACCFG_WQT_USER) > - wq->cdev_minor =3D -1; > - > - return 0; > -} > - > -static int accfg_wq_control_post_processing(struct accfg_wq *wq, > - enum accfg_control_flag flag) > -{ > - if (flag =3D=3D ACCFG_WQ_ENABLE) > - return accfg_wq_post_enable(wq); > - else if (flag =3D=3D ACCFG_WQ_DISABLE) > - return accfg_wq_post_disable(wq); > - else > - return -EINVAL; > - > - return 0; > -} > - > static bool accfg_wq_state_expected(struct accfg_wq *wq, > enum accfg_control_flag flag) > { > @@ -2052,11 +1977,6 @@ static int accfg_wq_control(struct accfg_wq *wq, e= num accfg_control_flag flag, > return -ENXIO; > } > = > - /* post processing */ > - rc =3D accfg_wq_control_post_processing(wq, flag); > - if (rc < 0) > - return rc; > - > return 0; > } > = > diff --git a/accfg/lib/private.h b/accfg/lib/private.h > index 7f3162e..dc12388 100644 > --- a/accfg/lib/private.h > +++ b/accfg/lib/private.h > @@ -50,7 +50,6 @@ struct accfg_device { > int configurable; > int max_tokens; > unsigned int token_limit; > - unsigned int cdev_major; > unsigned int version; > uint64_t max_transfer_size; > uint64_t opcap; > @@ -118,7 +117,6 @@ struct accfg_wq { > int priv; > int priority; > int block_on_fault; > - int cdev_minor; > unsigned int threshold; > char *mode; > char *name; > diff --git a/accfg/libaccel_config.h b/accfg/libaccel_config.h > index 5b37790..44fb38c 100644 > --- a/accfg/libaccel_config.h > +++ b/accfg/libaccel_config.h > @@ -183,7 +183,6 @@ enum accfg_device_state accfg_device_get_state(struct= accfg_device *device); > unsigned int accfg_device_get_max_tokens(struct accfg_device *device); > unsigned int accfg_device_get_max_batch_size(struct accfg_device *devic= e); > unsigned int accfg_device_get_token_limit(struct accfg_device *device); > -unsigned int accfg_device_get_cdev_major(struct accfg_device *device); > unsigned int accfg_device_get_version(struct accfg_device *device); > int accfg_device_get_clients(struct accfg_device *device); > int accfg_device_set_token_limit(struct accfg_device *dev, int val); > @@ -258,7 +257,6 @@ int accfg_wq_get_priority(struct accfg_wq *wq); > unsigned int accfg_wq_get_priv(struct accfg_wq *wq); > int accfg_wq_get_block_on_fault(struct accfg_wq *wq); > enum accfg_wq_state accfg_wq_get_state(struct accfg_wq *wq); > -int accfg_wq_get_cdev_minor(struct accfg_wq *wq); > const char *accfg_wq_get_type_name(struct accfg_wq *wq); > enum accfg_wq_type accfg_wq_get_type(struct accfg_wq *wq); > unsigned int accfg_wq_get_max_batch_size(struct accfg_wq *wq); > diff --git a/util/json.c b/util/json.c > index 4fb43d2..d1015c3 100644 > --- a/util/json.c > +++ b/util/json.c > @@ -324,11 +324,6 @@ struct json_object *util_device_to_json(struct accfg= _device *device, > json_object_object_add(jdevice, "pasid_enabled", jobj); > } > = > - jobj =3D json_object_new_int(accfg_device_get_cdev_major(device)); > - if (!jobj) > - goto err; > - json_object_object_add(jdevice, "cdev_major", jobj); > - > jobj =3D json_object_new_int(accfg_device_get_clients(device)); > if (!jobj) > goto err; > @@ -439,12 +434,6 @@ struct json_object *util_wq_to_json(struct accfg_wq = *wq, > if (jobj) > json_object_object_add(jaccfg, "max_transfer_size", jobj); > = > - if (!(flags & UTIL_JSON_SAVE) && accfg_wq_get_cdev_minor(wq) >=3D 0) { > - jobj =3D json_object_new_int(accfg_wq_get_cdev_minor(wq)); > - if (jobj) > - json_object_object_add(jaccfg, "cdev_minor", jobj); > - } > - > jobj =3D json_object_new_string(wq_type_str[accfg_wq_get_type(wq)]); > if (jobj) > json_object_object_add(jaccfg, "type", jobj); --===============1313307759120016325==--