Message ID | 1426823642-27360-1-git-send-email-haifeng.lin@huawei.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> 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 <dev@dpdk.org>; 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 <haifeng.lin@huawei.com> To: <dev@dpdk.org> 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 Content-Type: text/plain 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 <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Linhaifeng
March 20, 2015, 3:54 a.m. UTC
From: Linhaifeng <haifeng.lin@huawei.com> 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 <haifeng.lin@huawei.com> --- lib/librte_vhost/vhost_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On 2015/3/20 11:54, linhaifeng wrote: > From: Linhaifeng <haifeng.lin@huawei.com> > > 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 <haifeng.lin@huawei.com> > --- > 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; or use 'break' replace of 'goto' ? > } > 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. */ >
> -----Original Message----- > From: Linhaifeng [mailto:haifeng.lin@huawei.com] > Sent: Friday, March 20, 2015 2:36 PM > To: dev@dpdk.org > Cc: Ouyang, Changchun; Xie, Huawei > Subject: Re: [PATCH] lib/librte_vhost:fix can't send packet anymore after > mempool is full again > > > > On 2015/3/20 11:54, linhaifeng wrote: > > From: Linhaifeng <haifeng.lin@huawei.com> > > > > 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 <haifeng.lin@huawei.com> > > --- > > 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; > > or use 'break' replace of 'goto' ? Make sense, I can review if you make a v2 patch Thanks Changchun
Hi, changchun & xie I have modify the path with your suggestions.Please review. Thank you. On 2015/3/20 15:28, Ouyang, Changchun wrote: > > >> -----Original Message----- >> From: Linhaifeng [mailto:haifeng.lin@huawei.com] >> Sent: Friday, March 20, 2015 2:36 PM >> To: dev@dpdk.org >> Cc: Ouyang, Changchun; Xie, Huawei >> Subject: Re: [PATCH] lib/librte_vhost:fix can't send packet anymore after >> mempool is full again >> >> >> >> On 2015/3/20 11:54, linhaifeng wrote: >>> From: Linhaifeng <haifeng.lin@huawei.com> >>> >>> 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 <haifeng.lin@huawei.com> >>> --- >>> 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; >> >> or use 'break' replace of 'goto' ? > > Make sense, I can review if you make a v2 patch > Thanks > Changchun > > > >
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. */