From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 456185A72 for ; Fri, 18 Dec 2015 06:20:53 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 17 Dec 2015 21:20:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,444,1444719600"; d="scan'208";a="863637171" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by fmsmga001.fm.intel.com with ESMTP; 17 Dec 2015 21:20:51 -0800 Date: Fri, 18 Dec 2015 13:21:22 +0800 From: Yuanhan Liu To: Stephen Hemminger Message-ID: <20151218052122.GK29571@yliu-dev.sh.intel.com> References: <1450049754-33635-1-git-send-email-huawei.xie@intel.com> <1450055682-51953-1-git-send-email-huawei.xie@intel.com> <1450055682-51953-2-git-send-email-huawei.xie@intel.com> <20151217210114.534a7561@xeon-e3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151217210114.534a7561@xeon-e3> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v2 1/2] mbuf: provide rte_pktmbuf_alloc_bulk API 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: Fri, 18 Dec 2015 05:20:53 -0000 On Thu, Dec 17, 2015 at 09:01:14PM -0800, Stephen Hemminger wrote: ... > > + > > + switch (count % 4) { > > + while (idx != count) { > > + case 0: > > + RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(mbufs[idx]) == 0); > > + rte_mbuf_refcnt_set(mbufs[idx], 1); > > + rte_pktmbuf_reset(mbufs[idx]); > > + idx++; > > + case 3: > > + RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(mbufs[idx]) == 0); > > + rte_mbuf_refcnt_set(mbufs[idx], 1); > > + rte_pktmbuf_reset(mbufs[idx]); > > + idx++; > > + case 2: > > + RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(mbufs[idx]) == 0); > > + rte_mbuf_refcnt_set(mbufs[idx], 1); > > + rte_pktmbuf_reset(mbufs[idx]); > > + idx++; > > + case 1: > > + RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(mbufs[idx]) == 0); > > + rte_mbuf_refcnt_set(mbufs[idx], 1); > > + rte_pktmbuf_reset(mbufs[idx]); > > + idx++; > > + } > > + } > > + return 0; > > +} > > This is weird. Why not just use Duff's device in a more normal manner. Duff's device; interesting and good to know. Thanks. --yliu