From patchwork Fri Mar 20 03:54:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linhaifeng X-Patchwork-Id: 4080 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 43A4758F1; Fri, 20 Mar 2015 04:55:42 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [119.145.14.66]) by dpdk.org (Postfix) with ESMTP id 296745683 for ; Fri, 20 Mar 2015 04:55:38 +0100 (CET) Received: from 172.24.2.119 (EHLO szxeml432-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BDJ90396; Fri, 20 Mar 2015 11:55:35 +0800 (CST) Received: from localhost (10.177.19.115) by szxeml432-hub.china.huawei.com (10.82.67.209) with Microsoft SMTP Server id 14.3.158.1; Fri, 20 Mar 2015 11:54:06 +0800 From: linhaifeng To: Date: Fri, 20 Mar 2015 11:54:02 +0800 Message-ID: <1426823642-27360-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.0A020206.550B9A37.0132, 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: fe58b2b5acdda8fc90f30863130967f8 Subject: [dpdk-dev] [PATCH] lib/librte_vhost:fix can't send packet anymore after mempool is full again 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 When failed to malloc buffer from mempool we just update last_used_idx but not used->idx so after many times vhost thought have handle all packets but virtio_net thought vhost have not handle all packets and will not update avail->idx. Signed-off-by: Linhaifeng --- lib/librte_vhost/vhost_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c index 535c7a1..93a8fff 100644 --- a/lib/librte_vhost/vhost_rxtx.c +++ b/lib/librte_vhost/vhost_rxtx.c @@ -609,7 +609,7 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id, if (unlikely(m == NULL)) { RTE_LOG(ERR, VHOST_DATA, "Failed to allocate memory for mbuf.\n"); - return entry_success; + goto finish; } seg_offset = 0; seg_avail = m->buf_len - RTE_PKTMBUF_HEADROOM; @@ -721,6 +721,7 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id, entry_success++; } +finish: rte_compiler_barrier(); vq->used->idx += entry_success; /* Kick guest if required. */