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 621192BF3 for ; Tue, 30 Aug 2016 12:44:02 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP; 30 Aug 2016 03:44:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,255,1470726000"; d="scan'208";a="2722999" Received: from unknown (HELO dpdk5.sh.intel.com) ([10.239.129.118]) by orsmga004.jf.intel.com with ESMTP; 30 Aug 2016 03:44:00 -0700 From: Zhihong Wang To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, yuanhan.liu@linux.intel.com, thomas.monjalon@6wind.com, Zhihong Wang Date: Mon, 29 Aug 2016 23:36:02 -0400 Message-Id: <1472528164-54296-5-git-send-email-zhihong.wang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472528164-54296-1-git-send-email-zhihong.wang@intel.com> References: <1471319402-112998-1-git-send-email-zhihong.wang@intel.com> <1472528164-54296-1-git-send-email-zhihong.wang@intel.com> Subject: [dpdk-dev] [PATCH v4 4/6] vhost: add desc prefetch 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: Tue, 30 Aug 2016 10:44:02 -0000 This patch adds descriptor prefetch to hide cache access latency. Signed-off-by: Zhihong Wang --- lib/librte_vhost/vhost_rxtx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c index 629e8ae..927896c 100644 --- a/lib/librte_vhost/vhost_rxtx.c +++ b/lib/librte_vhost/vhost_rxtx.c @@ -304,6 +304,12 @@ rte_vhost_enqueue_burst(int vid, uint16_t queue_id, /* start enqueuing packets 1 by 1 */ avail_idx = *((volatile uint16_t *)&vq->avail->idx); while (pkt_left && avail_idx != vq->last_used_idx) { + /* prefetch the next desc */ + if (pkt_left > 1 && avail_idx != vq->last_used_idx + 1) + rte_prefetch0(&vq->desc[vq->avail->ring[ + (vq->last_used_idx + 1) & + (vq->size - 1)]]); + if (enqueue_packet(dev, vq, avail_idx, pkts[pkt_idx], is_mrg_rxbuf)) break; -- 2.7.4