> -----Original Message-----
> From: Trahe, Fiona [mailto:fiona.tr...@intel.com]
> Sent: 24 November 2017 22:26
> To: dev@dpdk.org; Verma, Shally <shally.ve...@cavium.com>
> Cc: Challa, Mahipal <mahipal.cha...@cavium.com>; Athreya, Narayana
> Prasad <narayanaprasad.athr...@cavium.com>;
> pablo.de.lara.gua...@intel.com; fiona.tr...@intel.com
> Subject: [RFC v2] lib: add compressdev API
> 
> compressdev API
> 
> Signed-off-by: Trahe, Fiona <fiona.tr...@intel.com>
> ---

//snip//

> +unsigned int
> +rte_compressdev_get_header_session_size(void)
> +{
> +     /*
> +      * Header contains pointers to the private data
> +      * of all registered drivers
> +      */
> +     return (sizeof(void *) * nb_drivers);
> +}
> +
> +unsigned int
> +rte_compressdev_get_private_session_size(uint8_t dev_id)
> +{
> +     struct rte_compressdev *dev;
> +     unsigned int header_size = sizeof(void *) * nb_drivers;
> +     unsigned int priv_sess_size;
> +
> +     if (!rte_compressdev_pmd_is_valid_dev(dev_id))
> +             return 0;
> +
> +     dev = rte_compressdev_pmd_get_dev(dev_id);
> +
> +     if (*dev->dev_ops->session_get_size == NULL)
> +             return 0;
> +
> +     priv_sess_size = (*dev->dev_ops->session_get_size)(dev);
> +
> +     /*
> +      * If size is less than session header size,
> +      * return the latter, as this guarantees that
> +      * sessionless operations will work
> +      */

[Shally] believe this comment need an edit

> +     if (priv_sess_size < header_size)
> +             return header_size;
> +
> +     return priv_sess_size;

[Shally] This doesn't return header_size inclusive which is fine as per API 
definition. So should application call 
rte_compressdev_get_header_session_size() in case it want to know header_size 
overhead per session and allocate pool with elt_size = sess_header_size + 
dev_priv_sz?

> +
> +}
//snip//

Thanks
Shally

Reply via email to