Hi Guy,

> -----Original Message-----
> From: dev <dev-boun...@dpdk.org> On Behalf Of Guy Kaneti
> Sent: Tuesday, April 7, 2020 11:54 AM
> To: Ori Kam <or...@mellanox.com>; Jerin Jacob Kollanukkaran
> <jer...@marvell.com>; xiang.w.w...@intel.com
> Cc: dev@dpdk.org; Pavan Nikhilesh Bhagavatula
> <pbhagavat...@marvell.com>; Shahaf Shuler <shah...@mellanox.com>;
> hemant.agra...@nxp.com; Opher Reviv <op...@mellanox.com>; Alex
> Rosenbaum <al...@mellanox.com>; Dovrat Zifroni <dov...@marvell.com>;
> Prasun Kapoor <pkap...@marvell.com>; nipun.gu...@nxp.com;
> bruce.richard...@intel.com; yang.a.h...@intel.com; harry.ch...@intel.com;
> gu.ji...@zte.com.cn; shanjia...@chinatelecom.cn;
> zhangy....@chinatelecom.cn; lixin...@huachentel.com; wush...@inspur.com;
> yuying...@yxlink.com; fanchengg...@sunyainfo.com;
> davidf...@tencent.com; liuzho...@chinaunicom.cn;
> zhaoyon...@huawei.com; o...@yunify.com; j...@netgate.com;
> hongjun...@intel.com; j.bromh...@titan-ic.com; d...@ntop.org;
> f...@napatech.com; arthur...@lionic.com; Thomas Monjalon
> <tho...@monjalon.net>; Parav Pandit <pa...@mellanox.com>
> Subject: Re: [dpdk-dev] [PATCH v1 2/4] regexdev: add regex core h file
> 
> > +
> > +/**
> > + * @internal
> > + * The generic data structure associated with each RegEx device.
> > + *
> > + * Pointers to burst-oriented packet receive and transmit functions are
> > + * located at the beginning of the structure, along with the pointer to
> > + * where all the data elements for the particular device are stored in
> > +shared
> > + * memory. This split allows the function pointer and driver data to be
> > +per-
> > + * process, while the actual configuration data for the device is shared.
> > + */
> > +struct rte_regexdev {
> > +   regexdev_enqueue_t enqueue;
> > +   regexdev_dequeue_t dequeue;
> > +   const struct rte_regexdev_ops *dev_ops;
> > +   /**< Functions exported by PMD */
> > +   struct rte_device *device; /**< Backing device */ }
> > +__rte_cache_aligned;
> > +
> 
> What about a handle for the PMD private data such as
>       struct rte_eventdev_data *data;
>       /**< Pointer to device data */
> 
>       struct rte_cryptodev_data *data;
>       /**< Pointer to device data */

I was thinking about new approach. To use container of.
Meaning each PMD will create like normal its priv structure.
In this structure there will be a regex_dev member.
For example:
struct mlx5_regex_priv {
        struct rte_regex_dev regex_dev;
        //private fields
        ...
        ...
}
On registration the PMD will give the rte_regexdev the reference to the 
regex_dev.
The PMD will use container_of

This approach  hides the private data from the application,
saves malloc, a bit faster, and saves the use of references.

So a better approach 😊 also this approach is in use by the rte_device.


Reply via email to