From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id C3E15685B for ; Thu, 4 Sep 2014 08:30:34 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 03 Sep 2014 23:35:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,464,1406617200"; d="scan'208";a="594370834" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 03 Sep 2014 23:35:10 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s846Z8TB013752; Thu, 4 Sep 2014 14:35:08 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id s846Z6Fw015759; Thu, 4 Sep 2014 14:35:08 +0800 Received: (from couyang@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s846Z1vK015755; Thu, 4 Sep 2014 14:35:01 +0800 From: Ouyang Changchun To: dev@dpdk.org Date: Thu, 4 Sep 2014 14:34:59 +0800 Message-Id: <1409812499-15656-1-git-send-email-changchun.ouyang@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] virtio: Fix vring entry number issue 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, 04 Sep 2014 06:30:35 -0000 Fix one issue in virtio TX: it needs one more vring entry to hold the virtio header when transmitting packets, it is used later to determine whether to free more entries from used vring. Signed-off-by: Changchun Ouyang Reviewed-by: Huawei Xie Tested-by: Jingguo Fu --- lib/librte_pmd_virtio/virtio_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c index 0b10108..b1c189c 100644 --- a/lib/librte_pmd_virtio/virtio_rxtx.c +++ b/lib/librte_pmd_virtio/virtio_rxtx.c @@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) num = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ? nb_used : VIRTIO_MBUF_BURST_SZ); while (nb_tx < nb_pkts) { - int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt; + /* Need one more entry for virtio header. */ + int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt + 1; int deq_cnt = RTE_MIN(need, (int)num); num -= (deq_cnt > 0) ? deq_cnt : 0; -- 1.8.4.2