[dpdk-dev] [PATCH v3 11/29] eal: generic implementation for I/O device read/write access

Bruce Richardson bruce.richardson at intel.com
Mon Jan 16 12:01:28 CET 2017


On Mon, Jan 16, 2017 at 08:56:41AM +0530, Jerin Jacob wrote:
> On Sun, Jan 15, 2017 at 10:29:42PM +0100, Thomas Monjalon wrote:
> > 2017-01-12 14:47, Jerin Jacob:
> > > +#define rte_read8_relaxed(addr) \
> > > +	({ uint8_t __v = *(const volatile uint8_t *)addr; __v; })
> > 
> > Why do you prefer a macro over an inline function?
> 
> In this case, I thought of avoiding any compiler behavior changes when
> adding the new EAL APIs. Earlier, drivers were using direct pointer
> dereference in code, I thought of using the macro to just substitute that to avoid
> any performance regression due to this change for easy patchset acceptance.
> 
> IMO, One line macros are OK and for this specific case Linux also uses
> readl/writel as macros.
> 
> Having said that, If you think it needs to be changed to "static inline", I
> am fine with that. Let me know.
> 

My preference too is to go with static inline functions over macros
whenever possible.

/Bruce

> > It won't provide the same "debuggability".


More information about the dev mailing list