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

Jerin Jacob jerin.jacob at caviumnetworks.com
Mon Jan 16 12:17:24 CET 2017


On Mon, Jan 16, 2017 at 11:01:28AM +0000, Bruce Richardson wrote:
> 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.

OK. I will change to static inline then

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


More information about the dev mailing list