From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Tan, Jianfeng" Subject: Re: [PATCH 4/5] net/virtio-user: add lsc support with vhost-user adapter Date: Mon, 27 Mar 2017 01:51:13 +0000 Message-ID: References: <1488563803-87754-1-git-send-email-jianfeng.tan@intel.com> <1488563803-87754-5-git-send-email-jianfeng.tan@intel.com> <20170317082912.GI18844@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" , "david.marchand@6wind.com" To: Yuanhan Liu Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id E230DF957 for ; Mon, 27 Mar 2017 03:51:16 +0200 (CEST) In-Reply-To: <20170317082912.GI18844@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: Friday, March 17, 2017 4:29 PM > To: Tan, Jianfeng > Cc: dev@dpdk.org; david.marchand@6wind.com > Subject: Re: [PATCH 4/5] net/virtio-user: add lsc support with vhost-user > adapter >=20 > On Fri, Mar 03, 2017 at 05:56:42PM +0000, Jianfeng Tan wrote: > > So far, virtio-user with vhost-user as the backend can only support > > client mode. So when vhost user backend is down, i.e., unix socket > > connection is broken and cannot be re-connected. We will force the > > link state to be down. > > > > Signed-off-by: Jianfeng Tan > > static void > > virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, > > void *dst, int length) > > @@ -63,8 +77,27 @@ virtio_user_read_dev_config(struct virtio_hw *hw, > size_t offset, > > return; > > } > > > > - if (offset =3D=3D offsetof(struct virtio_net_config, status)) > > + if (offset =3D=3D offsetof(struct virtio_net_config, status)) { > > + char buf[128]; > > + > > + if (dev->vhostfd >=3D 0) { > > + int flags; > > + int r; > > + > > + flags =3D fcntl(dev->vhostfd, F_GETFL); > > + fcntl(dev->vhostfd, F_SETFL, flags | O_NONBLOCK); > > + r =3D recv(dev->vhostfd, buf, 128, 0); >=20 > I think you need specify flag MSG_PEEK, to not consume the data if > there any? Thanks for catching this issue, I'll fix it in next version. Thanks, Jianfeng