From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stephen@networkplumber.org>
Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com
 [209.85.220.52]) by dpdk.org (Postfix) with ESMTP id D845F8E6C
 for <dev@dpdk.org>; Tue, 20 Oct 2015 20:58:20 +0200 (CEST)
Received: by pasz6 with SMTP id z6so29197588pas.2
 for <dev@dpdk.org>; Tue, 20 Oct 2015 11:58:20 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-type:content-transfer-encoding;
 bh=JFw6Tj3ra10SyK7Ov4hUEBSsIvuEAz2Vl1JJXZNpV8g=;
 b=UBhOVoC9hVmFN4CpLPivd5iV5CBfZ8wbZO3UAH0mTU8YrSJwzeFu3xNw/0bje/pA7d
 45F7mKYRIAZewgzT5bknxdAuKlgm78tt49jl9n8Gamcm74AEd4a+ZdV/oa+z0r6VJTX3
 rQoA6CS1WU76u/Hf/9i5HLLrlLWYsGYo9uraldP+y9Hq/JEMCCF/1AMEhB529HUQZmGO
 7OEUWHgriSXn49BovKw5XXDEnHHgmtuydC3yUkgyka7fKhNno0ojMpqDhGOvuts+QJtj
 BUp20JqSenXvyugP/lNOYXz32x2mxSAqocJasWm6GDBzVffdINIJUmEWOas2OpJrifo+
 6pzQ==
X-Gm-Message-State: ALoCoQmNkVFrNuiwt8DV/9g6vMy/QVYA87lKNwaV8qoPWrdSEqXKuc/c8OyicfcGtcGAstiBm0md
X-Received: by 10.68.212.101 with SMTP id nj5mr5619488pbc.32.1445367500050;
 Tue, 20 Oct 2015 11:58:20 -0700 (PDT)
Received: from xeon-e3 (static-50-53-82-155.bvtn.or.frontiernet.net.
 [50.53.82.155])
 by smtp.gmail.com with ESMTPSA id tj2sm5097464pab.4.2015.10.20.11.58.19
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 20 Oct 2015 11:58:19 -0700 (PDT)
Date: Tue, 20 Oct 2015 11:58:29 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: Huawei Xie <huawei.xie@intel.com>
Message-ID: <20151020115829.6ac5ae23@xeon-e3>
In-Reply-To: <1445355007-4613-7-git-send-email-huawei.xie@intel.com>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
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 <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 20 Oct 2015 18:58:21 -0000

On Tue, 20 Oct 2015 23:30:06 +0800
Huawei Xie <huawei.xie@intel.com> wrote:

> +	desc_idx = (uint16_t)(vq->vq_used_cons_idx &
> +		((vq->vq_nentries >> 1) - 1));
> +	free[0] = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;
> +	nb_free = 1;
> +
> +	for (i = 1; i < VIRTIO_TX_FREE_NR; i++) {
> +		m = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;
> +		if (likely(m->pool == free[0]->pool))
> +			free[nb_free++] = m;
> +		else {
> +			rte_mempool_put_bulk(free[0]->pool, (void **)free,
> +				nb_free);
> +			free[0] = m;
> +			nb_free = 1;
> +		}
> +	}
> +
> +	rte_mempool_put_bulk(free[0]->pool, (void **)free, nb_free);

Might be better to introduce a function in rte_mbuf.h which
does this so other drivers can use same code?

rte_pktmbuf_free_bulk(pkts[], n)