From patchwork Thu Jan 29 10:30:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linhaifeng X-Patchwork-Id: 2721 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 B671A5A81; Thu, 29 Jan 2015 11:31:27 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [119.145.14.66]) by dpdk.org (Postfix) with ESMTP id E01F91F5 for ; Thu, 29 Jan 2015 11:31:23 +0100 (CET) Received: from 172.24.2.119 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BBC64015; Thu, 29 Jan 2015 18:31:20 +0800 (CST) Received: from localhost (10.177.19.115) by SZXEML429-HUB.china.huawei.com (10.82.67.184) with Microsoft SMTP Server id 14.3.158.1; Thu, 29 Jan 2015 18:30:09 +0800 From: linhaifeng To: Date: Thu, 29 Jan 2015 18:30:04 +0800 Message-ID: <1422527404-12424-1-git-send-email-haifeng.lin@huawei.com> X-Mailer: git-send-email 1.8.5.2.msysgit.0 MIME-Version: 1.0 X-Originating-IP: [10.177.19.115] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.54CA0BF8.0123, ss=1, re=0.001, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 746f0a110498999465a1c551da86475d Subject: [dpdk-dev] [PATCH] vhost: notify guest to fill buffer when there is no buffer 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" From: Linhaifeng If we found there is no buffer we should notify virtio_net to fill buffers. We use mz send buffers from VM to VM,found that the other VM stop to receive data after many hours. Signed-off-by: Linhaifeng --- lib/librte_vhost/vhost_rxtx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c index ccfd82f..013c526 100644 --- a/lib/librte_vhost/vhost_rxtx.c +++ b/lib/librte_vhost/vhost_rxtx.c @@ -87,9 +87,14 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id, /*check that we have enough buffers*/ if (unlikely(count > free_entries)) count = free_entries; - - if (count == 0) + /* If there is no buffers we should notify guest to fill. + * This is need when guest use virtio_net driver(not pmd). + */ + if (count == 0) { + if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) + eventfd_write((int)vq->kickfd, 1); return 0; + } res_end_idx = res_base_idx + count; /* vq->last_used_idx_res is atomically updated. */