[dpdk-dev] [PATCH 4/5] net/virtio-user: add lsc support with vhost-user adapter

Tan, Jianfeng jianfeng.tan at intel.com
Mon Mar 27 03:51:13 CEST 2017



> -----Original Message-----
> From: Yuanhan Liu [mailto:yuanhan.liu at linux.intel.com]
> Sent: Friday, March 17, 2017 4:29 PM
> To: Tan, Jianfeng
> Cc: dev at dpdk.org; david.marchand at 6wind.com
> Subject: Re: [PATCH 4/5] net/virtio-user: add lsc support with vhost-user
> adapter
> 
> 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 <jianfeng.tan at intel.com>
> >  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 == offsetof(struct virtio_net_config, status))
> > +	if (offset == offsetof(struct virtio_net_config, status)) {
> > +		char buf[128];
> > +
> > +		if (dev->vhostfd >= 0) {
> > +			int flags;
> > +			int r;
> > +
> > +			flags = fcntl(dev->vhostfd, F_GETFL);
> > +			fcntl(dev->vhostfd, F_SETFL, flags | O_NONBLOCK);
> > +			r = recv(dev->vhostfd, buf, 128, 0);
> 
> 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


More information about the dev mailing list