From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v2 0/2] Removal of RTE_MBUF_REFCNT Date: Mon, 23 Feb 2015 19:36:46 +0100 Message-ID: <10033845.zAL0UFbZ4z@xps13> References: <1424102913-18944-1-git-send-email-sergio.gonzalez.monroy@intel.com> <1424257383-4177-1-git-send-email-sergio.gonzalez.monroy@intel.com> <2601191342CEEE43887BDE71AB977258213EF713@irsmsx105.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev-VfR2kkLFssw@public.gmane.org To: "Gonzalez Monroy, Sergio" Return-path: In-Reply-To: <2601191342CEEE43887BDE71AB977258213EF713-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" > > This patch tries to remove the RTE_MBUF_REFCNT config options and dependencies > > by introducing a new mbuf flag IND_ATTACHED_MBUF that would indicate when the mbuf > > is an indirect attached mbuf, to differentiate between indirect mbufs and mbufs > > with external memory buffers (ie. vhost zero copy). > > > > Previous discussion: > > http://dpdk.org/ml/archives/dev/2014-October/007127.html > > > > Currently for mbufs with refcnt, we cannot free mbufs with external memory > > buffers (ie. vhost zero copy), as they are recognized as indirect > > attached mbufs and therefore we free the direct mbuf it points to, > > resulting in an error in the case of external memory buffers. > > > > We solve the issue by introducing the IND_ATTACHED_MBUF flag, which indicates > > that the mbuf is an indirect attached mbuf pointing to another mbuf. > > When we free an mbuf, we only free the direct mbuf if the flag is set. > > Freeing an mbuf with external buffer is the same as freeing a non attached mbuf. > > The flag is set during attach and clear on detach. > > > > So in the case of vhost zero copy where we have mbufs with external > > buffers, by default we just free the mbuf and it is up to the user to deal with > > the external buffer. > > > > v2: > > - Add missing parenthesis to RTE_MBUF_INDIRECT macro > > > > Sergio Gonzalez Monroy (2): > > mbuf: Introduce IND_ATTACHED_MBUF flag > > Remove RTE_MBUF_REFCNT references > > Acked-by: Konstantin Ananyev Applied, thanks