From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 1E4471B1B6 for ; Mon, 27 Nov 2017 13:49:12 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 8B3C620505; Mon, 27 Nov 2017 07:49:11 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Mon, 27 Nov 2017 07:49:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=DigsNqgtwLKn/TIHbBTD49IVra2aOAC2ExsRCE0ZRys=; b=DopuzNQM tr4GS59FaTMW3/Se763gfGcgh0dxcwJBdLx/TYzqdvV0Pp2bxD4g92hGO2VwWD2G uYXt5Cp4stT4WlY2ANSu6sCxKj7HIyNftSCyqJOkMP537uuUN9UY8iOQcGO6j2m2 CZkWjzTzhvMBwAeKvf3NGB/8itnCZ9gIPjyYebXxXIO2B62QjrCWGqKwU/rJ5GOT o3flkc9RurxMl0zbU81xLVqa0hLHaGgCXzdl2z4wn+1NY/UEJ3Vw/Odagvzz6BqD 5rYU68EjB40bg7rariFLKk8dYyv4YwA7jGtdx6ybHBbyEqARFEGk3Ex010ZQdKEg FfcNvbM1wnVlrA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=DigsNqgtwLKn/TIHbBTD49IVra2aO AC2ExsRCE0ZRys=; b=BfGIyehLKFqQ0twk8VmV2rRxZMn7g5Mevt9DSIIBhETPo 1quMigfkpLoDiUveVwCjmDERqMMdc4y9MPhDgVxSOdFJ+IYgIg4V9uB7i8WISTXp 1BHLNAGjIV0GipwD+p1vDRtUbq70KoeEocK7RgncOYCcg8qVJzF1zRHfteX/XDiJ 469p8BekwOGcca24w99ym3lbHv2XyOfoNQvE9qbwd3ei5jD1tyNEMG8OZOCWHJtr L+blfiZjmCjQb74slluw4UYG00fHgn1KYAW+kG7GDadBrFEJ7WHv45blxI7/xaoc oxkA4BnDxJV6QPq/ldxMzyl81Z3f4DIJD5/KgY9/w== X-ME-Sender: Received: from yliu-home (unknown [180.158.62.82]) by mail.messagingengine.com (Postfix) with ESMTPA id 96BFA24009; Mon, 27 Nov 2017 07:49:10 -0500 (EST) Date: Mon, 27 Nov 2017 20:48:55 +0800 From: Yuanhan Liu To: Xiao Wang Cc: dev@dpdk.org Message-ID: <20171127124855.GB23415@yliu-home> References: <1511521440-57724-1-git-send-email-xiao.w.wang@intel.com> <1511521440-57724-3-git-send-email-xiao.w.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1511521440-57724-3-git-send-email-xiao.w.wang@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-dev] [PATCH 2/2] net/virtio: support GUEST ANNOUNCE 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: Mon, 27 Nov 2017 12:49:12 -0000 On Fri, Nov 24, 2017 at 03:04:00AM -0800, Xiao Wang wrote: > When live migration is done, for the backup VM, either the virtio > frontend or the vhost backend needs to send out gratuitous RARP packet > to announce its new network location. > > This patch enables VIRTIO_NET_F_GUEST_ANNOUNCE feature to support live > migration scenario where the vhost backend doesn't have the ability to > generate RARP packet. Yes, it's a feature good to have. > +static int > +virtio_dev_pause(struct rte_eth_dev *dev) > +{ > + struct virtio_hw *hw = dev->data->dev_private; > + > + if (hw->started == 0) > + return -1; > + hw->started = 0; > + /* > + * Prevent the worker thread from touching queues to avoid condition, > + * 1 ms should be enough for the ongoing Tx function to finish. > + */ > + rte_delay_ms(1); > + return 0; > +} > + > +static void > +virtio_dev_resume(struct rte_eth_dev *dev) > +{ > + struct virtio_hw *hw = dev->data->dev_private; > + > + hw->started = 1; > +} However, the implementation (stop first, pause for 1ms, duplicate another Tx function, resume) doesn't seem elegant. You probably could try something like DPDK vhost does: - set a flag when S_ANNOUCE is received - inject a pkt when such flag is set in the xmit function You then should be able to get rid of all of above stuffs. --yliu