From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Tan, Jianfeng" Subject: Re: [PATCH v2 2/7] net/virtio_user: postpone DRIVER OK notification Date: Mon, 26 Dec 2016 06:55:16 +0000 Message-ID: References: <1480689075-66977-1-git-send-email-jianfeng.tan@intel.com> <1482477266-39199-1-git-send-email-jianfeng.tan@intel.com> <1482477266-39199-3-git-send-email-jianfeng.tan@intel.com> <20161226062719.GA19288@yliu-dev.sh.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , "Yigit, Ferruh" , "Liang, Cunming" To: Yuanhan Liu Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 0C5D73DC for ; Mon, 26 Dec 2016 07:55:19 +0100 (CET) In-Reply-To: <20161226062719.GA19288@yliu-dev.sh.intel.com> 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:yuanhan.liu@linux.intel.com] > Sent: Monday, December 26, 2016 2:27 PM > To: Tan, Jianfeng > Cc: dev@dpdk.org; Yigit, Ferruh; Liang, Cunming > Subject: Re: [PATCH v2 2/7] net/virtio_user: postpone DRIVER OK notificat= ion >=20 > On Fri, Dec 23, 2016 at 07:14:21AM +0000, Jianfeng Tan wrote: > > In driver probe phase, we obtain device information; and then virtio > > driver will initialize device and stores info, like negotiated > > features, in vhost_user layer; finally, vhost_user gets DRIVER_OK > > notification from virtio driver, and then sync with backend device. > > > > Previously, DRIVER_OK could be sent twice: 1. when ether layer invokes > > eth_device_init to initialize device; 2. when user configures it with > > different configuration from that of previous. >=20 > Yes, but that's wrong. Now only 1) will be taken. >>From code in virtio_dev_configure() as below, if hw_ip_checksum or enable_l= ro is configured, the device will be reset and re-initialized. if (rxmode->hw_ip_checksum) req_features |=3D (1ULL << VIRTIO_NET_F_GUEST_CSUM); if (rxmode->enable_lro) req_features |=3D (1ULL << VIRTIO_NET_F_GUEST_TSO4) | (1ULL << VIRTIO_NET_F_GUEST_TSO6); /* if request features changed, reinit the device */ if (req_features !=3D hw->req_guest_features) { ret =3D virtio_init_device(dev, req_features); if (ret < 0) return ret; } >=20 > > Since we can only depend on DRIVER_OK notification to sync with backend > > device, we postpone it to virtio_dev_start when everything is settled. >=20 > I don't quite understand what you were going to fix here; you don't > state it in the commit log after all. Normally, when everything is > negotiated (when DRIVER_OK is set), we should not set it again, unless > a reset has been happened. I agree that DRIVER_OK should be set only if everything is settled. Under t= he case of hw_ip_checksum or enable_lro, a reset will be sent and the devic= e will be re-initialized. So my point is that since the configuration might be changed in dev_configu= re(), why not just send DRIVER_OK after everything is done. >=20 > If you look at QEMU, qemu will simply ignore it once vhost has already > started. It does not apply here. The configuration is changed, and it cannot be igno= red. Thanks, Jianfeng >=20 > --yliu