Content-Type: multipart/mixed; boundary="===============1320369768919819094==" MIME-Version: 1.0 From: Ramesh Thomas Subject: [Accel-config] Re: [PATCH v5 03/10] accel-config: Add completion record size setup for accfg_device Date: Wed, 13 Apr 2022 10:11:57 -0700 Message-ID: <682fa506-6b05-0183-1cbe-71afc21af6c6@intel.com> In-Reply-To: 20220413022731.3017348-4-li4.zhang@intel.com To: accel-config@lists.01.org List-ID: --===============1320369768919819094== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable You missed or misunderstood my earlier comment in this patch. I am = adding it here and additional ones. On 4/12/2022 7:27 PM, Li Zhang wrote: > DSA and IAA test need to get completion record size for allocating > and dumping completion record. DSA completion record is 32 bytes > while IAA completion record is 64 bytes. So add compl_size field > in struct accfg_device for using by DSA and IAA test code. > = > Signed-off-by: Li Zhang > Reviewed-by: Dave Jiang > Reviewed-by: Ramesh Thomas > --- > accfg/lib/libaccfg.c | 8 ++++++++ > accfg/lib/private.h | 1 + > accfg/libaccel_config.h | 5 +++++ > 3 files changed, 14 insertions(+) > = > diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c > index 8d883b1..4821c04 100644 > --- a/accfg/lib/libaccfg.c > +++ b/accfg/lib/libaccfg.c > @@ -540,6 +540,14 @@ static int device_parse_type(struct accfg_device *de= vice) > for (b =3D accfg_basenames, i =3D 0; *b !=3D NULL; b++, i++) { > if (!strcmp(device->device_type_str, *b)) { > device->type =3D i; > + > + if (device->type =3D=3D ACCFG_DEVICE_DSA) > + device->compl_size =3D ACCFG_DEVICE_COMPL_SIZE_DSA; > + else if (device->type =3D=3D ACCFG_DEVICE_IAX) > + device->compl_size =3D ACCFG_DEVICE_COMPL_SIZE_IAX; > + else > + return -ENODEV; > + You can create an array similar to accfg_basenames but not public and = then assign the associated value for the type as follows unsigned int accfg_device_compl_size[] =3D { [ACCFG_DEVICE_DSA] =3D 32, [ACCFG_DEVICE_IAX] =3D 64, }; After the type is determined, it can be used to index into this array device->compl_size =3D accfg_device_compl_size[device->type]; > return 0; > } > } > diff --git a/accfg/lib/private.h b/accfg/lib/private.h > index f88044c..773aba2 100644 > --- a/accfg/lib/private.h > +++ b/accfg/lib/private.h > @@ -46,6 +46,7 @@ struct accfg_device { > int numa_node; > int ims_size; > int max_batch_size; > + int compl_size; The API is returning unsigned int so make this unsigned > int configurable; > int max_read_buffers; > unsigned int read_buffer_limit; > diff --git a/accfg/libaccel_config.h b/accfg/libaccel_config.h > index 9e952a7..ef7c8ae 100644 > --- a/accfg/libaccel_config.h > +++ b/accfg/libaccel_config.h > @@ -45,6 +45,11 @@ enum accfg_device_state { > ACCFG_DEVICE_UNKNOWN =3D -1, > }; > = > +enum accfg_device_compl_size { > + ACCFG_DEVICE_COMPL_SIZE_DSA =3D 32, > + ACCFG_DEVICE_COMPL_SIZE_IAX =3D 64, > +}; > + This enum is not required. > enum accfg_wq_mode { > ACCFG_WQ_SHARED =3D 0, > ACCFG_WQ_DEDICATED, --===============1320369768919819094==--