[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 04:26:41 CET 2017


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.

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


More information about the dev mailing list