From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 072BE938C for ; Thu, 22 Oct 2015 07:44:10 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 21 Oct 2015 22:43:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,180,1444719600"; d="scan'208";a="816734826" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga001.fm.intel.com with ESMTP; 21 Oct 2015 22:43:57 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 21 Oct 2015 22:43:57 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 21 Oct 2015 22:43:56 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.96]) by shsmsx102.ccr.corp.intel.com ([169.254.2.253]) with mapi id 14.03.0248.002; Thu, 22 Oct 2015 13:43:55 +0800 From: "Xie, Huawei" To: Stephen Hemminger Thread-Topic: [PATCH v3 6/7] virtio: simple tx routine Thread-Index: AdEMjKLtJ/y2O0i1R0GlxBVw3cL6qA== Date: Thu, 22 Oct 2015 05:43:54 +0000 Message-ID: References: <1443537953-23917-1-git-send-email-huawei.xie@intel.com> <1445355007-4613-1-git-send-email-huawei.xie@intel.com> <1445355007-4613-7-git-send-email-huawei.xie@intel.com> <20151020115829.6ac5ae23@xeon-e3> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v3 6/7] virtio: simple tx routine 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, 22 Oct 2015 05:44:11 -0000 On 10/21/2015 2:58 AM, Stephen Hemminger wrote:=0A= > On Tue, 20 Oct 2015 23:30:06 +0800=0A= > Huawei Xie wrote:=0A= >=0A= >> + desc_idx =3D (uint16_t)(vq->vq_used_cons_idx &=0A= >> + ((vq->vq_nentries >> 1) - 1));=0A= >> + free[0] =3D (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;=0A= >> + nb_free =3D 1;=0A= >> +=0A= >> + for (i =3D 1; i < VIRTIO_TX_FREE_NR; i++) {=0A= >> + m =3D (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;=0A= >> + if (likely(m->pool =3D=3D free[0]->pool))=0A= >> + free[nb_free++] =3D m;=0A= >> + else {=0A= >> + rte_mempool_put_bulk(free[0]->pool, (void **)free,=0A= >> + nb_free);=0A= >> + free[0] =3D m;=0A= >> + nb_free =3D 1;=0A= >> + }=0A= >> + }=0A= >> +=0A= >> + rte_mempool_put_bulk(free[0]->pool, (void **)free, nb_free);=0A= > Might be better to introduce a function in rte_mbuf.h which=0A= > does this so other drivers can use same code?=0A= >=0A= > rte_pktmbuf_free_bulk(pkts[], n)=0A= Agree. It would be good to have a generic rte_pktmbuf_free(/alloc)_bulk.=0A= Several other drivers and future vhost patches also use the same logic.=0A= I prefer to implement this later as this is API change.=0A= =0A=