From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: [PATCH v3 11/29] eal: generic implementation for I/O device read/write access Date: Mon, 16 Jan 2017 08:56:41 +0530 Message-ID: <20170116032640.GA6271@localhost.localdomain> References: <1482832175-27199-1-git-send-email-jerin.jacob@caviumnetworks.com> <1484212646-10338-1-git-send-email-jerin.jacob@caviumnetworks.com> <1484212646-10338-12-git-send-email-jerin.jacob@caviumnetworks.com> <2622450.7mMCSCBjjk@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: , , , , , To: Thomas Monjalon Return-path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0049.outbound.protection.outlook.com [104.47.38.49]) by dpdk.org (Postfix) with ESMTP id 48DFEFA57 for ; Mon, 16 Jan 2017 04:27:03 +0100 (CET) Content-Disposition: inline In-Reply-To: <2622450.7mMCSCBjjk@xps13> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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".