From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Wang, Xiao W" Subject: Re: [PATCH 2/2] net/virtio: support GUEST ANNOUNCE Date: Wed, 3 Jan 2018 01:43:52 +0000 Message-ID: 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> <20171205142600.GG9111@yliu-dev> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , "Bie, Tiwei" To: Yuanhan Liu Return-path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id C4F981B012 for ; Wed, 3 Jan 2018 02:44:11 +0100 (CET) In-Reply-To: <20171205142600.GG9111@yliu-dev> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Yuanhan Liu [mailto:yliu@fridaylinux.org] > Sent: Tuesday, December 5, 2017 10:26 PM > To: Wang, Xiao W > Cc: dev@dpdk.org; Bie, Tiwei > Subject: Re: [PATCH 2/2] net/virtio: support GUEST ANNOUNCE >=20 > 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 > > > 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 pac= ket > > > > 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 =3D dev->data->dev_private; > > > > + > > > > + if (hw->started =3D=3D 0) > > > > + return -1; > > > > + hw->started =3D 0; > > > > + /* > > > > + * Prevent the worker thread from touching queues to avoid condit= ion, > > > > + * 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 =3D dev->data->dev_private; > > > > + > > > > + hw->started =3D 1; > > > > +} > > > > > > However, the implementation (stop first, pause for 1ms, duplicate ano= ther > > > 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. >=20 > Thanks, I missed that. >=20 > 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? >=20 > --yliu To just invoke the tx_pkt_burst callback will be ideal. I will have a static mbuf ** pointer for rarp packets in next version, then= the tx_pkt_burst function will let rarp packet pass even if the queue is s= topped. This can avoid code duplication. BRs, Xiao