From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by dpdk.org (Postfix) with ESMTP id 7A1F18E58 for ; Wed, 30 Sep 2015 21:11:46 +0200 (CEST) Received: by oiev17 with SMTP id v17so28110171oie.1 for ; Wed, 30 Sep 2015 12:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=BMCXloGRfLzP3uSmj8Gg8Rxi2tm7Cl0sEGBXho1hMYI=; b=ujOD+BScYYKzN8Ph3cBgjdpDRIS35fhQRT257S48wcMBQhH7HbMBi7rACxOPV5kAqM tIS0jZbacm0jFGnNFArhjmITqykGCMOBqUT+4dhUAdAkYcha/Mjo46vZWOj+orWL6Wb0 X78RiiFXcZ2zX3ggbNbMEyIyR6WUXOruFuJbCGZLiCuDU2t4CEGGK0moemOj9AH3+Me/ 31D4q7jYX52Qs2EmIqydty7+VUibS9f75KRXL9KANDd2Ljb/bZgDX8En3AShuvyUoRXN z/05HIIPbEz8UVuWowM9M9EccAqoJgk7VXPfEMuqhFD1rM2l+2sR4GZOYD/gjIpHpK0C hXAw== MIME-Version: 1.0 X-Received: by 10.202.102.15 with SMTP id a15mr3295927oic.96.1443640305925; Wed, 30 Sep 2015 12:11:45 -0700 (PDT) Received: by 10.202.65.5 with HTTP; Wed, 30 Sep 2015 12:11:45 -0700 (PDT) In-Reply-To: <2601191342CEEE43887BDE71AB97725836AA1491@irsmsx105.ger.corp.intel.com> References: <1443134987-24700-1-git-send-email-rkerur@gmail.com> <1443135041-24757-1-git-send-email-rkerur@gmail.com> <20150924162537.3b20ea3a@urahara> <2601191342CEEE43887BDE71AB97725836AA1491@irsmsx105.ger.corp.intel.com> Date: Wed, 30 Sep 2015 12:11:45 -0700 Message-ID: From: Ravi Kerur To: "Ananyev, Konstantin" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v1] Move rte_mbuf macros to common header file X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 19:11:46 -0000 Thanks Konstantin. I will send out v2 shortly. On Tue, Sep 29, 2015 at 2:55 AM, Ananyev, Konstantin < konstantin.ananyev@intel.com> wrote: > > Hi Ravi, > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ravi Kerur > > Sent: Saturday, September 26, 2015 3:47 AM > > To: Stephen Hemminger; Olivier Matz > > Cc: dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH v1] Move rte_mbuf macros to common header > file > > > > 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) > > > As I can see, it is used only in one place inside xenvirt: > > drivers/net/xenvirt/virtqueue.h: start_dp[idx].addr = > RTE_MBUF_DATA_DMA_ADDR(cookie); > > So we probably can remove that macro definition here and use > rte_pktmbuf_mtod(mb, uint64_t) directly. > > Konstantin > > > > > #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? >