From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 402C38E74 for ; Mon, 16 May 2016 02:05:49 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 15 May 2016 17:05:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,625,1455004800"; d="scan'208";a="104303838" Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by fmsmga004.fm.intel.com with ESMTP; 15 May 2016 17:05:48 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.130]) by IRSMSX151.ger.corp.intel.com ([169.254.4.7]) with mapi id 14.03.0248.002; Mon, 16 May 2016 01:05:45 +0100 From: "Ananyev, Konstantin" To: Hiroyuki Mikita , "olivier.matz@6wind.com" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] mbuf: decrease refcnt when detaching Thread-Index: AQHRrsGVKDrl7AtDt0q3TC/7GwfELp+6rwIg Date: Mon, 16 May 2016 00:05:44 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836B50F15@irsmsx105.ger.corp.intel.com> References: <1463327436-6863-1-git-send-email-h.mikita89@gmail.com> In-Reply-To: <1463327436-6863-1-git-send-email-h.mikita89@gmail.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] 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: Mon, 16 May 2016 00:05:49 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hiroyuki Mikita > Sent: Sunday, May 15, 2016 4:51 PM > To: olivier.matz@6wind.com > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] mbuf: decrease refcnt when detaching >=20 > The rte_pktmbuf_detach() function should decrease refcnt on a direct > buffer. Hmm, why is that? What's wrong with the current approach? Konstantin >=20 > Signed-off-by: Hiroyuki Mikita > --- > lib/librte_mbuf/rte_mbuf.h | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > index 529debb..3b117ca 100644 > --- a/lib/librte_mbuf/rte_mbuf.h > +++ b/lib/librte_mbuf/rte_mbuf.h > @@ -1468,9 +1468,11 @@ static inline void rte_pktmbuf_attach(struct rte_m= buf *mi, struct rte_mbuf *m) > */ > static inline void rte_pktmbuf_detach(struct rte_mbuf *m) > { > + struct rte_mbuf *md =3D rte_mbuf_from_indirect(m); > struct rte_mempool *mp =3D m->pool; > uint32_t mbuf_size, buf_len, priv_size; >=20 > + rte_mbuf_refcnt_update(md, -1); > priv_size =3D rte_pktmbuf_priv_size(mp); > mbuf_size =3D sizeof(struct rte_mbuf) + priv_size; > buf_len =3D rte_pktmbuf_data_room_size(mp); > @@ -1498,7 +1500,7 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m) > if (RTE_MBUF_INDIRECT(m)) { > struct rte_mbuf *md =3D rte_mbuf_from_indirect(m); > rte_pktmbuf_detach(m); > - if (rte_mbuf_refcnt_update(md, -1) =3D=3D 0) > + if (rte_mbuf_refcnt_read(md) =3D=3D 0) > __rte_mbuf_raw_free(md); > } > return m; > -- > 1.9.1