From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v2] mbuf: decrease refcnt when detaching Date: Tue, 17 May 2016 15:39:55 +0200 Message-ID: <1709340.0fJkCxgyM5@xps13> References: <1463327436-6863-1-git-send-email-h.mikita89@gmail.com> <2164081.rUYNJaTDcf@xps13> <2601191342CEEE43887BDE71AB97725836B518A4@irsmsx105.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, Hiroyuki Mikita , olivier.matz@6wind.com To: "Ananyev, Konstantin" Return-path: Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by dpdk.org (Postfix) with ESMTP id 4EC5C6968 for ; Tue, 17 May 2016 15:40:09 +0200 (CEST) Received: by mail-wm0-f50.google.com with SMTP id v200so21026623wmv.1 for ; Tue, 17 May 2016 06:40:09 -0700 (PDT) In-Reply-To: <2601191342CEEE43887BDE71AB97725836B518A4@irsmsx105.ger.corp.intel.com> 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" 2016-05-17 12:59, Ananyev, Konstantin: > > > The rte_pktmbuf_detach() function should decrease refcnt on a direct > > > buffer. > > > > As you have noticed, "whenever the indirect buffer is detached, > > the reference counter on the direct buffer is decremented." > > So the current behaviour of rte_pktmbuf_detach() is buggy. > > Why not fix it without renaming? > > If you consider this behavioral bug is part of the API, we > > can fix it in a new function unattach and deprecate detach. > > But Konstantin, why do you want to keep a restore function? > > What is the need? > > I think it might be a useful functionality in some situations: > some users can attach/detach to external memory buffers (no mbufs) > and similar functionality is required. Attach to external memory buffer (raw buffer) is not currently supported. > Let say right now examples/vhost/main.c has its own pktmbuf_detach_zcp() You should look at the commit http://dpdk.org/commit/68363d85 "examples/vhost: remove the non-working zero copy code" > which is doing pretty much the same - restore original values, after detaching > mbuf from external (virtio) memory buffer. > Would be good if we'll use a standard API function here. You are welcome to implement mbuf attach to raw buffer. But it is not a requirement for this fix.