From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ravi Kerur Subject: Re: [PATCH v1] Move rte_mbuf macros to common header file Date: Fri, 25 Sep 2015 19:46:47 -0700 Message-ID: References: <1443134987-24700-1-git-send-email-rkerur@gmail.com> <1443135041-24757-1-git-send-email-rkerur@gmail.com> <20150924162537.3b20ea3a@urahara> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: "dev@dpdk.org" To: Stephen Hemminger , Olivier Matz Return-path: Received: from mail-ob0-f180.google.com (mail-ob0-f180.google.com [209.85.214.180]) by dpdk.org (Postfix) with ESMTP id E20827E23 for ; Sat, 26 Sep 2015 04:46:47 +0200 (CEST) Received: by obbda8 with SMTP id da8so95209844obb.1 for ; Fri, 25 Sep 2015 19:46:47 -0700 (PDT) In-Reply-To: <20150924162537.3b20ea3a@urahara> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Sep 24, 2015 at 4:25 PM, Stephen Hemminger < stephen@networkplumber.org> wrote: > On Thu, 24 Sep 2015 15:50:41 -0700 > Ravi Kerur wrote: > > > Macros RTE_MBUF_DATA_DMA_ADDR and RTE_MBUF_DATA_DMA_ADDR_DEFAULT > > are defined in each PMD driver file. Move those macros into common > > lib/librte_mbuf/rte_mbuf.h file. All PMD drivers include rte_mbuf.h > > file directly/indirectly hence no additionl header file inclusion > > is necessary. > > > > Compiled for: > > > x86_64-native-linuxapp-clang > > > x86_64-native-linuxapp-gcc > > > i686-native-linuxapp-gcc > > > x86_64-native-bsdapp-gcc > > > x86_64-native-bsdapp-clang > > > > Tested on: > > > x86_64 Ubuntu 14.04, testpmd and 'make test' > > > FreeBSD 10.1, testpmd > > > > Signed-off-by: Ravi Kerur > > I like the idea, should have been done long ago. > > My only gripe is that you should do this as inline functions > rather than macros. Inline functions are type safe, macros are not. > Agreed. However, I see another variation of the macro, users are primarily from "app" directory and lone user from drivers/net/xenvirt/virtqueue.h #define RTE_MBUF_DATA_DMA_ADDR(mb) \ rte_pktmbuf_mtod(mb, uint64_t) #define rte_pktmbuf_mtod(m, t) rte_pktmbuf_mtod_offset(m, t, 0) #define rte_pktmbuf_mtod_offset(m, t, o) \ ((t)((char *)(m)->buf_addr + (m)->data_off + (o))) Let me know should I still go ahead and do inline variation for drivers or use above macro?