From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ananyev, Konstantin" Subject: Re: [PATCH v2] mbuf: decrease refcnt when detaching Date: Tue, 17 May 2016 12:59:46 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836B518A4@irsmsx105.ger.corp.intel.com> References: <1463327436-6863-1-git-send-email-h.mikita89@gmail.com> <1463417600-20943-1-git-send-email-h.mikita89@gmail.com> <2164081.rUYNJaTDcf@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , "olivier.matz@6wind.com" To: Thomas Monjalon , Hiroyuki Mikita Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 60F1A6A67 for ; Tue, 17 May 2016 14:59:50 +0200 (CEST) In-Reply-To: <2164081.rUYNJaTDcf@xps13> Content-Language: en-US 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" Hi Thomas, =20 > > The rte_pktmbuf_detach() function should decrease refcnt on a direct > > buffer. > > > > Signed-off-by: Hiroyuki Mikita > > --- > > v2: > > * introduced a new function rte_pktmbuf_detach2() which decrease refcnt= . >=20 > 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. Let say right now examples/vhost/main.c has its own pktmbuf_detach_zcp() which is doing pretty much the same - restore original values, after detach= ing mbuf from external (virtio) memory buffer. Would be good if we'll use a standard API function here. Konstantin =20 >=20 > Please explicit the function name for the detach operation in > doc/guides/prog_guide/mbuf_lib.rst (whatever detach2 or unattach). >=20 > > * marked rte_pktmbuf_detach() as deprecated. > > * added comments about refcnt to rte_pktmbuf_attach() and rte_pktmbuf_d= etach(). > > * checked refcnt when detaching in unit tests. > > * added this issue to release notes.