From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by dpdk.org (Postfix) with ESMTP id F2EB96942 for ; Wed, 25 Mar 2015 18:04:06 +0100 (CET) Received: by wibgn9 with SMTP id gn9so48562444wib.1 for ; Wed, 25 Mar 2015 10:04:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=lR68nE8Ge/gBAzcn7RYWZp2ElZto1WCgft4sGa4Pw5Q=; b=gK/SnmYXxFKQIoRIjswgyNI91TayxBtj4dlay1zcJw/ZBN00IikrdCltXLAp+Aqrlr J/nTEHiOJ8M5SpFibUx9t4SZYLhiZvYkzRSlsXhABSzLSo0Kq2hyENMFrMUI2j8Q2klH TW/D4QJ+EmcE4zBndpFrKhskCec53GzLBD4e7srGzsFIcnlwjRL1vLPs7MQ1gFv7Emzl crT53hRXXvGotI2jhtAQ25ts6F8XBWKfoPTWFyAfKtTJ3cqDNgrNKMOTZAmU9tbXVTs2 mCfA8JAKZzPz2xB6A5IA/qnAS8dEWLutYmXOnJHv434xFUnkcQ0dv+Qu90b7cNXiKQxK hnCA== X-Gm-Message-State: ALoCoQnz2ax85HgU0l/f7E9Swaj5Z9R3NXK9ZXzX8P4EVhJCUhmNsdL4TZqGwa9WWxEaxifL41HD X-Received: by 10.180.90.106 with SMTP id bv10mr37989754wib.4.1427303046754; Wed, 25 Mar 2015 10:04:06 -0700 (PDT) Received: from [10.16.0.195] (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id wo10sm4527431wjb.35.2015.03.25.10.04.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Mar 2015 10:04:06 -0700 (PDT) Message-ID: <5512EA87.1020707@6wind.com> Date: Wed, 25 Mar 2015 18:04:07 +0100 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0 MIME-Version: 1.0 To: Zoltan Kiss , dev@dpdk.org, dev@openvswitch.org References: <5511A1F0.40605@linaro.org> In-Reply-To: <5511A1F0.40605@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] ovs-dpdk: placing the metadata 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, 25 Mar 2015 17:04:07 -0000 Hi Zoltan, On 03/24/2015 06:42 PM, Zoltan Kiss wrote: > Hi, > > I've noticed in lib/netdev-dpdk.c that __rte_pktmbuf_init() stores the > packet metadata right after "struct rte_mbuf", and before the buffer data: > > /* start of buffer is just after mbuf structure */ > m->buf_addr = (char *)m + sizeof(struct dp_packet); > > (struct dp_packet has the rte_mbuf as first member if DPDK enabled) > > However, lib/librte_mbuf/rte_mbuf.h seems to codify that the buffer > should start right after the rte_mbuf: > > /** > * Given the buf_addr returns the pointer to corresponding mbuf. > */ > #define RTE_MBUF_FROM_BADDR(ba) (((struct rte_mbuf *)(ba)) - 1) > > /** > * Given the pointer to mbuf returns an address where it's buf_addr > * should point to. > */ > #define RTE_MBUF_TO_BADDR(mb) (((struct rte_mbuf *)(mb)) + 1) > > These macros are used for attaching/detaching mbuf's to each other. This > is the way the code retrieves the direct buffer from an indirect one, > and vica versa. I think if we want to keep the metadata feature (which I > guess is quite important), we need to add a pointer to rte_mbuf, which > helps the direct and indirect structs to find each other. Something like: > > struct rte_mbuf *attach; /**< Points to the other buffer if this > one > is (in)direct. Otherwise NULL. */ > > What do you think? I've just sent a patch that should fix this issue. http://dpdk.org/ml/archives/dev/2015-March/015722.html Let me know if you have any comment on it. Regards, Olivier