Re: [PATCH 4/5] net/virtio-user: add lsc support with vhost-user adapter
From: Tan, Jianfeng <hidden>
Date: 2017-03-27 01:51:16
-----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 On Fri, Mar 03, 2017 at 05:56:42PM +0000, Jianfeng Tan wrote:quoted
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 <redacted> 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,quoted
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