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 A41CE28BF for ; Thu, 9 Jun 2016 17:45:26 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 09 Jun 2016 08:45:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,445,1459839600"; d="scan'208";a="824924548" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga003.jf.intel.com with ESMTP; 09 Jun 2016 08:45:24 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.51]) by IRSMSX102.ger.corp.intel.com ([169.254.2.10]) with mapi id 14.03.0248.002; Thu, 9 Jun 2016 16:45:23 +0100 From: "Ananyev, Konstantin" To: Thomas Monjalon CC: "dev@dpdk.org" , Olivier Matz , Adrien Mazarguil , "Zhang, Helin" Thread-Topic: [dpdk-dev] [PATCH] mbuf: remove inconsistent assert statements Thread-Index: AQHRwWBHlYh+pJQko0aMG2e1V0BGOZ/fXbUQgAAQ/oCAABYKAIAAAzyAgAAD14CAAB8nYIABB64AgABWcxCAACpLgIAAEuAw Date: Thu, 9 Jun 2016 15:45:23 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836B6DA64@irsmsx105.ger.corp.intel.com> References: <1465374688-11729-1-git-send-email-adrien.mazarguil@6wind.com> <57591EEA.9040807@6wind.com> <2601191342CEEE43887BDE71AB97725836B6D90C@irsmsx105.ger.corp.intel.com> <11387408.tmVAJa3yAF@xps13> In-Reply-To: <11387408.tmVAJa3yAF@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.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] mbuf: remove inconsistent assert statements 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: Thu, 09 Jun 2016 15:45:27 -0000 > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Thursday, June 09, 2016 4:28 PM > To: Ananyev, Konstantin > Cc: dev@dpdk.org; Olivier Matz; Adrien Mazarguil; Zhang, Helin > Subject: Re: [dpdk-dev] [PATCH] mbuf: remove inconsistent assert statemen= ts >=20 > 2016-06-09 13:21, Ananyev, Konstantin: > > From: Olivier Matz [mailto:olivier.matz@6wind.com] > > > Today: > > > > > > /* allowed */ > > > m =3D rte_pktmbuf_alloc(); > > > rte_pktmbuf_free(m); > > > > > > /* not allowed */ > > > m =3D rte_mbuf_raw_alloc(); > > > __rte_mbuf_raw_free(m); > > > > > > /* we should do instead (strange): */ > > > m =3D rte_mbuf_raw_alloc(); > > > rte_pktmbuf_free(m); > > > > > > What I suggest to have: > > > > > > /* allowed, no change */ > > > m =3D rte_pktmbuf_alloc(); > > > rte_pktmbuf_free(m); > > > > > > /* allowed, these functions would be symetrical */ > > > m =3D rte_mbuf_raw_alloc(); > > > rte_mbuf_raw_free(m); > > > > > > /* not allowed, m->refcnt is uninitialized */ > > > m =3D rte_mbuf_raw_alloc(); > > > rte_pktmbuf_free(m); > > > > Hmm, and what it will buy us (except of symmetry)? >=20 > API consistency is important. > It is a matter of making our users confident in DPDK. >=20 > I would not like to use a library where I need to check in the doc > for each function because I don't remember and I'm not confident > that the function fish() do some fishing or hunting. As you remember, the whole story started when people used 'internal mbuf function' inside their code and then figured out that it doesn't work as they expect :) But as I said, if everyone are that desperate about symmetry,=20 we can just create a new public function: void rte_mbuf_raw_free(stuct rte_mbuf *m) { if (rte_mbuf_refcnt_update(m, -1) =3D=3D 0) __rte_mbuf_raw_free(m); } That would be 'symmetric' to rte_mbuf_raw_alloc(), and all three combinations above would be allowed. Konstantin