[dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API

Zapolski, MarcinX A marcinx.a.zapolski at intel.com
Mon Sep 9 11:01:25 CEST 2019


> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Friday, September 6, 2019 7:24 PM
> To: Zapolski, MarcinX A <marcinx.a.zapolski at intel.com>
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> structures from public API
> 
> On Fri,  6 Sep 2019 15:18:11 +0200
> Marcin Zapolski <marcinx.a.zapolski at intel.com> wrote:
> 
> > +RTE_INIT(rte_eth_dev_init)
> > +{
> > +	int i;
> > +
> > +	for (i = 0; i < RTE_MAX_ETHPORTS; i++)
> > +		rte_eth_dev_functions[i] =
> > +			(struct rte_eth_dev_fcns *)(&rte_eth_devices[i]);
> 
> Casts are error prone. Is it possible to use container_of instead of direct cast.
I could if I had a pointer to struct rte_eth_dev_functions and needed to get struct rte_eth_dev which is a container structure in this case. But I could use offsetof instead.


More information about the dev mailing list