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 80851152A for ; Fri, 4 Nov 2016 09:25:54 +0100 (CET) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A674FC0567B3; Fri, 4 Nov 2016 08:25:53 +0000 (UTC) Received: from [10.36.4.213] (vpn1-4-213.ams2.redhat.com [10.36.4.213]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uA48PpMc008128 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 4 Nov 2016 04:25:52 -0400 To: Yuanhan Liu , dev@dpdk.org References: <1478189400-14606-1-git-send-email-yuanhan.liu@linux.intel.com> <1478189400-14606-5-git-send-email-yuanhan.liu@linux.intel.com> Cc: Ilya Maximets From: Maxime Coquelin Message-ID: Date: Fri, 4 Nov 2016 09:25:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1478189400-14606-5-git-send-email-yuanhan.liu@linux.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 04 Nov 2016 08:25:54 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH 4/8] net/virtio: allocate queue at init stage 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: Fri, 04 Nov 2016 08:25:54 -0000 On 11/03/2016 05:09 PM, Yuanhan Liu wrote: > Queue allocation should be done once, since the queue related info (such > as vring addreess) will only be informed to the vhost-user backend once > without virtio device reset. > > That means, if you allocate queues again after the vhost-user negotiation, > the vhost-user backend will not be informed any more. Leading to a state > that the vring info mismatches between virtio PMD driver and vhost-backend: > the driver switches to the new address has just been allocated, while the > vhost-backend still sticks to the old address has been assigned in the init > stage. > > Unfortunately, that is exactly how the virtio driver is coded so far: queue > allocation is done at queue_setup stage (when rte_eth_tx/rx_queue_setup is > invoked). This is wrong, because queue_setup can be invoked several times. > For example, > > $ start_testpmd.sh ... --txq=1 --rxq=1 ... > > port stop 0 > > port config all txq 1 # just trigger the queue_setup callback again > > port config all rxq 1 > > port start 0 > > The right way to do is allocate the queues in the init stage, so that the > vring info could be persistent with the vhost-user backend. > > Besides that, we should allocate max_queue pairs the device supports, but > not nr queue pairs firstly configured, to make following case work. > > $ start_testpmd.sh ... --txq=1 --rxq=1 ... > > port stop 0 > > port config all txq 2 > > port config all rxq 2 > > port start 0 > > Signed-off-by: Yuanhan Liu > --- > drivers/net/virtio/virtio_ethdev.c | 105 +++++++++++++++++++++++-------------- > drivers/net/virtio/virtio_ethdev.h | 8 --- > drivers/net/virtio/virtio_pci.h | 2 + > drivers/net/virtio/virtio_rxtx.c | 38 +++++++------- > 4 files changed, 85 insertions(+), 68 deletions(-) > Reviewed-by: Maxime Coquelin Thanks, Maxime