From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 17 May 2016 05:59:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,324,1459839600"; d="scan'208";a="978719955" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga002.jf.intel.com with ESMTP; 17 May 2016 05:59:48 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.130]) by IRSMSX154.ger.corp.intel.com ([169.254.12.222]) with mapi id 14.03.0248.002; Tue, 17 May 2016 13:59:46 +0100 From: "Ananyev, Konstantin" To: Thomas Monjalon , Hiroyuki Mikita CC: "dev@dpdk.org" , "olivier.matz@6wind.com" Thread-Topic: [dpdk-dev] [PATCH v2] mbuf: decrease refcnt when detaching Thread-Index: AQHRr5OGTZbJUl8op0mwi7XajqfNVp+9A3aAgAATOoA= 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> In-Reply-To: <2164081.rUYNJaTDcf@xps13> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] mbuf: decrease refcnt when detaching 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: Tue, 17 May 2016 12:59:50 -0000 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.