From patchwork Mon Sep 21 08:16:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huawei Xie X-Patchwork-Id: 7104 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 8DC3C2A07; Mon, 21 Sep 2015 10:16:24 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 09D2F11C5 for ; Mon, 21 Sep 2015 10:16:22 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 21 Sep 2015 01:16:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,566,1437462000"; d="scan'208";a="565578808" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 21 Sep 2015 01:16:20 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t8L8GI5X010526; Mon, 21 Sep 2015 16:16:18 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t8L8GGcc005290; Mon, 21 Sep 2015 16:16:18 +0800 Received: (from hxie5@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t8L8GFf9005264; Mon, 21 Sep 2015 16:16:15 +0800 From: Huawei Xie To: dev@dpdk.org Date: Mon, 21 Sep 2015 16:16:14 +0800 Message-Id: <1442823374-5233-1-git-send-email-huawei.xie@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] vhost: vhost injects interrupts to guest for each packet 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In merge-able RX path, vhost injects interrupts to guest for each packet. This should degrade performance a lot. This patch fixes this issue by injecting one interrupt for a batch of packets. Signed-off-by: Huawei Xie Acked-by: Jianfeng Tan --- lib/librte_vhost/vhost_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c index 0d07338..9d3165a 100644 --- a/lib/librte_vhost/vhost_rxtx.c +++ b/lib/librte_vhost/vhost_rxtx.c @@ -496,7 +496,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id, "to get enough desc from " "vring\n", dev->device_fh); - return pkt_idx; + goto merge_rx_exit; } else { update_secure_len(vq, res_cur_idx, &secure_len, &vec_idx); res_cur_idx++; @@ -523,7 +523,10 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id, *(volatile uint16_t *)&vq->used->idx += entry_success; vq->last_used_idx = res_cur_idx; + } +merge_rx_exit: + if (likely(pkt_idx)) { /* flush used->idx update before we read avail->flags. */ rte_mb(); @@ -532,7 +535,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id, eventfd_write((int)vq->callfd, 1); } - return count; + return pkt_idx; } uint16_t