[dpdk-dev] [PATCH v1 3/7] compress/octeontx: add xform and stream create support

Verma, Shally Shally.Verma at cavium.com
Wed Jun 20 08:12:26 CEST 2018



>-----Original Message-----
>From: De Lara Guarch, Pablo [mailto:pablo.de.lara.guarch at intel.com]
>Sent: 20 June 2018 03:43
>To: Verma, Shally <Shally.Verma at cavium.com>
>Cc: Trahe, Fiona <fiona.trahe at intel.com>; dev at dpdk.org; Athreya, Narayana Prasad <NarayanaPrasad.Athreya at cavium.com>;
>Challa, Mahipal <Mahipal.Challa at cavium.com>; Gupta, Ashish <Ashish.Gupta at cavium.com>; Sahu, Sunila
><Sunila.Sahu at cavium.com>
>Subject: RE: [PATCH v1 3/7] compress/octeontx: add xform and stream create support
>
>External Email
>
>> -----Original Message-----
>> From: Shally Verma [mailto:shally.verma at caviumnetworks.com]
>> Sent: Tuesday, June 5, 2018 11:35 AM
>> To: De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>
>> Cc: Trahe, Fiona <fiona.trahe at intel.com>; dev at dpdk.org;
>> pathreya at caviumnetworks.com; mchalla at caviumnetworks.com; Ashish Gupta
>> <ashish.gupta at caviumnetworks.com>; Sunila Sahu
>> <sunila.sahu at caviumnetworks.com>
>> Subject: [PATCH v1 3/7] compress/octeontx: add xform and stream create
>> support
>>
>> implement private xform and stream create ops
>>
>> Signed-off-by: Ashish Gupta <ashish.gupta at caviumnetworks.com>
>> Signed-off-by: Shally Verma <shally.verma at caviumnetworks.com>
>> Signed-off-by: Sunila Sahu <sunila.sahu at caviumnetworks.com>
>> ---
>>  drivers/compress/octeontx/zip_pmd.c | 138
>> ++++++++++++++++++++++++++++++++++++
>>  drivers/compress/octeontx/zipvf.h   |  29 ++++++++
>>  2 files changed, 167 insertions(+)
>>
>> diff --git a/drivers/compress/octeontx/zip_pmd.c
>> b/drivers/compress/octeontx/zip_pmd.c
>> index 3bb7f6896..349114626 100644
>> --- a/drivers/compress/octeontx/zip_pmd.c
>> +++ b/drivers/compress/octeontx/zip_pmd.c
>
>...
>
>> +static int
>> +zip_pmd_stream_create(struct rte_compressdev *dev,
>> +             const struct rte_comp_xform *xform, void **stream) {
>> +     int ret;
>> +     struct zip_stream *strm;
>> +
>> +     strm = rte_malloc(NULL,
>> +                     sizeof(struct zip_stream), 0);
>
>Should not this come from a mempool, as there is an option
>in the configuration for max number of sessions.
>
[Shally] We're using mempool for per-stream resources but not specifically for stream struct itself.
We, though, had thought about approach too but it turns out to be more feasible to keep it this way for now.
>
>> +     ret = zip_set_stream_parameters(dev, xform, strm);
>> +     if (ret < 0) {
>> +             ZIP_PMD_ERR("failed configure xform parameters");
>> +             rte_free(strm);
>> +             return ret;
>> +     }
>> +     *stream = strm;
>> +     return 0;
>> +}
>> +
>> +static int
>> +zip_pmd_stream_free(struct rte_compressdev *dev, void *stream) {
>> +     struct zip_vf *vf = (struct zip_vf *) (dev->data->dev_private);
>> +     struct zip_stream *z_stream;
>> +
>> +     if (stream == NULL)
>> +             return -1;
>> +
>> +     z_stream = (struct zip_stream *)stream;
>> +     rte_mempool_put_bulk(vf->zip_mp,
>> +                          (void *)&(z_stream->bufs[0]),
>> +                          MAX_BUFS_PER_STREAM);
>> +
>> +     /* Zero out the whole structure */
>> +     memset(stream, 0, sizeof(struct zip_stream));
>> +     rte_free(stream);
>
>I was expecting this stream to be put back into a mempool,
>but anyway, there is no need to reset this structure if you are freeing the memory then.
>
Thanks for review.
Shally



More information about the dev mailing list