From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yliu@fridaylinux.org>
Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com
 [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 712BA1D8E
 for <dev@dpdk.org>; Tue,  5 Dec 2017 15:26:05 +0100 (CET)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 03974213FC;
 Tue,  5 Dec 2017 09:26:05 -0500 (EST)
Received: from frontend1 ([10.202.2.160])
 by compute1.internal (MEProxy); Tue, 05 Dec 2017 09:26:05 -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=wzusBcJpyKICD1czRFsYIWs5JoLBYTf9Bcljj4e2puo=; b=XIVAa46l
 OtTbNfuhWKQFy0n105qHgenK2uRtyehv/+kwIz8bxSwi5gBfL8TInX79kqSTNvR8
 EuV2ScCVbxPlZYlm0ZTBIQX4vXoW0+9WCuf0PpS6oc8CmkJi+XaH5TRFsmnDwYi3
 cQpxet9q5DLf7m6YTz4AGZBzDELKuGdeDaFF16tHIRYtjXioCyCPLBB71+TiV4p3
 OzydzTZFlW01RcWNtNsi9qUhd1LKA23KAAYigbR8k4Ddv3XJE1orwp8YwE2/0FQS
 kYqL26wnw7129w7Vz4rlfYLTsdNY7t2M/YLcZUtLPHzEseYqm2dFgZlNnipJCkWy
 oied+q3hSJAYOg==
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=wzusBcJpyKICD1czRFsYIWs5JoLBY
 Tf9Bcljj4e2puo=; b=qj0JRz7nA4CID3gSoFtFLzfURGYUsK76+VHk7Cw9vNuJR
 zMShWN6c4paRLw466o/wZm4VSXT90bzmDA3oMEfFf8fU8yZ3KYw0whDaeIwaDVHg
 lARbywOCg7mV6Ix8GX8cl9Oc2XDFAKL1lvFwYdMeEQLoLp/RBPclf7Ak0N1lANrG
 +TBVUSKu3ABiY8eFjOIBD41MNBL1+1vxiizqEfpD6z6QLOWFlw5KJMUQ0le1PC8Y
 I9Ry3j0TSVo1HfcRHnJ17DcvWhqtLTdoEBri7eDSlPTg+jeJ8nIX9f9/wAvTbidQ
 TYlvMP3AUUt56iVD9a1YuXMJuQOwZcMlfLYuXFrOw==
X-ME-Sender: <xms:fKwmWjrLKkvK8WH1VwGWsf3oq9zY0wiYWDiWpGvOeBGH6Fl4Gpuszg>
Received: from yliu-dev (unknown [180.158.55.119])
 by mail.messagingengine.com (Postfix) with ESMTPA id A60017E56E;
 Tue,  5 Dec 2017 09:26:03 -0500 (EST)
Date: Tue, 5 Dec 2017 22:26:00 +0800
From: Yuanhan Liu <yliu@fridaylinux.org>
To: "Wang, Xiao W" <xiao.w.wang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Bie, Tiwei" <tiwei.bie@intel.com>
Message-ID: <20171205142600.GG9111@yliu-dev>
References: <1511521440-57724-1-git-send-email-xiao.w.wang@intel.com>
 <1511521440-57724-3-git-send-email-xiao.w.wang@intel.com>
 <20171127124855.GB23415@yliu-home>
 <B7F2E978279D1D49A3034B7786DACF406F7FB929@SHSMSX101.ccr.corp.intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <B7F2E978279D1D49A3034B7786DACF406F7FB929@SHSMSX101.ccr.corp.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 <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 05 Dec 2017 14:26:05 -0000

On Thu, Nov 30, 2017 at 02:41:12AM +0000, Wang, Xiao W wrote:
> 
> 
> > -----Original Message-----
> > From: Yuanhan Liu [mailto:yliu@fridaylinux.org]
> > Sent: Monday, November 27, 2017 8:49 PM
> > To: Wang, Xiao W <xiao.w.wang@intel.com>
> > Cc: dev@dpdk.org
> > Subject: Re: [PATCH 2/2] net/virtio: support GUEST ANNOUNCE
> > 
> > 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
> 
> The difference is that the virtio port may just receive packet, without xmit.

Thanks, I missed that.

However, you really should not add a duplicate function. It adds more
maintain effort. I think you probably could just invoke the tx_pkt_burst
callback directly. You have stopped the device after all. What's the
necessary to duplicate it?

	--yliu