From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 5143D29D6; Wed, 30 Aug 2017 11:13:13 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 56C5CC0587DF; Wed, 30 Aug 2017 09:13:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 56C5CC0587DF Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jfreimann@redhat.com Received: from localhost (dhcp-192-218.str.redhat.com [10.33.192.218]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E49B871E6; Wed, 30 Aug 2017 09:13:08 +0000 (UTC) Date: Wed, 30 Aug 2017 11:13:06 +0200 From: Jens Freimann To: Tiwei Bie Cc: dev@dpdk.org, yliu@fridaylinux.org, maxime.coquelin@redhat.com, stable@dpdk.org Message-ID: <20170830091306.a5whdd7xrgb4jbtn@dhcp-192-218.str.redhat.com> References: <20170829082601.30349-1-tiwei.bie@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20170829082601.30349-1-tiwei.bie@intel.com> User-Agent: NeoMutt/20170714 (1.8.3) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 30 Aug 2017 09:13:12 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH] net/virtio: fix an incorrect behavior of device stop/start X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Aug 2017 09:13:13 -0000 Hi Tiwei, On Tue, Aug 29, 2017 at 04:26:01PM +0800, Tiwei Bie wrote: >After starting a device, the driver shouldn't deliver the >packets that already existed in the device before it is >started to the applications. This patch fixes this issue >by flushing the Rx queues when starting the device. > >Fixes: a85786dc816f ("virtio: fix states handling during initialization") >Cc: stable@dpdk.org > >Signed-off-by: Tiwei Bie >--- > drivers/net/virtio/virtio_ethdev.c | 6 ++++++ > drivers/net/virtio/virtio_rxtx.c | 2 +- > drivers/net/virtio/virtqueue.c | 25 +++++++++++++++++++++++++ > drivers/net/virtio/virtqueue.h | 5 +++++ > 4 files changed, 37 insertions(+), 1 deletion(-) why don't we flush Tx queues as well? > >diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c >index e320811..6d60bc1 100644 >--- a/drivers/net/virtio/virtio_ethdev.c >+++ b/drivers/net/virtio/virtio_ethdev.c >@@ -1737,6 +1737,12 @@ virtio_dev_start(struct rte_eth_dev *dev) > } > } > >+ /* Flush the packets in Rx queues. */ >+ for (i = 0; i < dev->data->nb_rx_queues; i++) { >+ rxvq = dev->data->rx_queues[i]; >+ virtqueue_flush(rxvq->vq); >+ } >+ A little bit further down is a for loop going over rx queues calling notify. Could we flush directly before the notify and save the additional loop? regards, Jens