From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH 2/2] net/virtio: support GUEST ANNOUNCE Date: Mon, 27 Nov 2017 20:48:55 +0800 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 Cc: dev@dpdk.org To: Xiao Wang 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) Content-Disposition: inline In-Reply-To: <1511521440-57724-3-git-send-email-xiao.w.wang@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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