From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [119.145.14.65]) by dpdk.org (Postfix) with ESMTP id 5950A1F7 for ; Sat, 21 Mar 2015 03:25:32 +0100 (CET) Received: from 172.24.2.119 (EHLO szxeml433-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CIT98136; Sat, 21 Mar 2015 10:25:30 +0800 (CST) Received: from [127.0.0.1] (10.177.19.115) by szxeml433-hub.china.huawei.com (10.82.67.210) with Microsoft SMTP Server id 14.3.158.1; Sat, 21 Mar 2015 10:25:28 +0800 Message-ID: <550CD696.8070100@huawei.com> Date: Sat, 21 Mar 2015 10:25:26 +0800 From: Linhaifeng User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: "Xie, Huawei" , "dev@dpdk.org" References: <1426848383-15764-1-git-send-email-haifeng.lin@huawei.com> In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.19.115] X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH] lib/librte_pmd_virtio fix can't receive packets after rx_q is empty 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: Sat, 21 Mar 2015 02:25:33 -0000 On 2015/3/21 0:54, Xie, Huawei wrote: > On 3/20/2015 6:47 PM, linhaifeng wrote: >> From: Linhaifeng >> >> If failed to alloc mbuf ring_size times the rx_q may be empty and can't >> receive any packets forever because nb_used is 0 forever. > Agreed. In current implementation, once VQ becomes empty, we have no > chance to refill it again. > The simple fix is, receive one and then refill one as other PMDs. Need "Receive one and then refill one" also have this problem.If refill also failed the VQ would be empty too. > to consider which is best strategy in terms of performance in future. > How did you find this? through code review or real workload? >> so we should try to refill when nb_used is 0.After otherone free mbuf >> we can restart to receive packets. >> >> Signed-off-by: Linhaifeng >> --- >> lib/librte_pmd_virtio/virtio_rxtx.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c >> index 1d74b34..5c7e0cd 100644 >> --- a/lib/librte_pmd_virtio/virtio_rxtx.c >> +++ b/lib/librte_pmd_virtio/virtio_rxtx.c >> @@ -495,7 +495,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) >> num = num - ((rxvq->vq_used_cons_idx + num) % DESC_PER_CACHELINE); >> >> if (num == 0) >> - return 0; >> + goto refill; >> >> num = virtqueue_dequeue_burst_rx(rxvq, rcv_pkts, len, num); >> PMD_RX_LOG(DEBUG, "used:%d dequeue:%d", nb_used, num); >> @@ -536,6 +536,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) >> >> rxvq->packets += nb_rx; >> >> +refill: >> /* Allocate new mbuf for the used descriptor */ >> error = ENOSPC; >> while (likely(!virtqueue_full(rxvq))) { > > > -- Regards, Haifeng