From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 7005F8DB4 for ; Wed, 23 Sep 2015 10:41:37 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 23 Sep 2015 01:41:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,577,1437462000"; d="scan'208";a="811201705" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.60]) by orsmga002.jf.intel.com with ESMTP; 23 Sep 2015 01:41:35 -0700 Date: Wed, 23 Sep 2015 16:43:46 +0800 From: Yuanhan Liu To: "Michael S. Tsirkin" Message-ID: <20150923084346.GH2339@yliu-dev.sh.intel.com> References: <1442589061-19225-1-git-send-email-yuanhan.liu@linux.intel.com> <1442589061-19225-6-git-send-email-yuanhan.liu@linux.intel.com> <20150920123021-mutt-send-email-mst@redhat.com> <20150921022252.GO2339@yliu-dev.sh.intel.com> <20150921120117-mutt-send-email-mst@redhat.com> <20150922022122.GR2339@yliu-dev.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150922022122.GR2339@yliu-dev.sh.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v5 resend 05/12] vhost: add VHOST_USER_SET_VRING_ENABLE message 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: Wed, 23 Sep 2015 08:41:37 -0000 On Tue, Sep 22, 2015 at 10:21:22AM +0800, Yuanhan Liu wrote: > On Mon, Sep 21, 2015 at 12:02:20PM +0300, Michael S. Tsirkin wrote: > > On Mon, Sep 21, 2015 at 10:22:52AM +0800, Yuanhan Liu wrote: > > > On Sun, Sep 20, 2015 at 12:37:35PM +0300, Michael S. Tsirkin wrote: > > > > On Fri, Sep 18, 2015 at 11:10:54PM +0800, Yuanhan Liu wrote: > > > > > From: Changchun Ouyang > > > > > > > > > > This message is used to enable/disable a specific vring queue pair. > > > > > The first queue pair is enabled by default. > > > > > > > > > > Signed-off-by: Changchun Ouyang > > > > > Signed-off-by: Yuanhan Liu > > > > > --- > > > [snip...] > > > > > void > > > > > user_destroy_device(struct vhost_device_ctx ctx) > > > > > { > > > > > > > > It might be a good idea to flush any packets being processed > > > > on relevant cores at this point. > > > > > > They are offloaded to the application (examples/vhost/vhost-switch in > > > this case). > > > > > > user_destroy_device will invoke the application's "destroy_device()" > > > callback in the end, which, in our case, will set "remove" flag. The > > > core worker will then drain and free the RX queue and free TX queue > > > once the "remove" flag is set. > > > > > > --yliu > > > > > > Oh, I really meant user_set_vring_enable. > > Will a per-vring callback help then? > > We may prototype the callback to "vring_state_changed(dev, vring_index)" It should be "vring_state_changed(dev, vring_index, enable)". > so that the application could either, as you suggested, flushes any packets > haven't been processed yet, or simply drops them. After putting more thoughts on that, I guess it's also necessary to inform the application that before receiving an "enabled" state for a specific vring, we should never use it for data transferring, as we just enable one queue pair by default. And I think we could do both in vring_state_changed() callback. Michael, what do you think of it? --yliu