From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 9CC3A1B00B; Wed, 9 May 2018 11:49:38 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 May 2018 02:49:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,381,1520924400"; d="scan'208";a="47872779" Received: from dpdk9.bj.intel.com ([172.16.182.183]) by FMSMGA003.fm.intel.com with ESMTP; 09 May 2018 02:49:35 -0700 From: zhiyong.yang@intel.com To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, lei.a.yao@intel.com, stable@dpdk.org, Zhiyong Yang Date: Wed, 9 May 2018 17:49:36 +0800 Message-Id: <20180509094936.62796-1-zhiyong.yang@intel.com> X-Mailer: git-send-email 2.14.3 Subject: [dpdk-stable] [PATCH] net/virtio-user: fix multiple queues fail in server mode X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2018 09:49:39 -0000 This patch fixes multiple queues failure when virtio-user works in server mode. Fixes: bd8f50a45d0f ("net/virtio-user: support server mode") Cc: stable@dpdk.org Signed-off-by: Zhiyong Yang --- drivers/net/virtio/virtio_user/vhost_user.c | 3 +++ drivers/net/virtio/virtio_user/virtio_user_dev.c | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c index a6df97a00..a9e53d7b5 100644 --- a/drivers/net/virtio/virtio_user/vhost_user.c +++ b/drivers/net/virtio/virtio_user/vhost_user.c @@ -263,6 +263,9 @@ vhost_user_sock(struct virtio_user_dev *dev, PMD_DRV_LOG(INFO, "%s", vhost_msg_strings[req]); + if (vhostfd < 0) + return -1; + msg.request = req; msg.flags = VHOST_USER_VERSION; msg.size = 0; diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 38b8bc90d..e988dc3f4 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -126,6 +126,10 @@ virtio_user_start_device(struct virtio_user_dev *dev) features &= ~(1ull << VIRTIO_NET_F_MAC); /* Strip VIRTIO_NET_F_CTRL_VQ, as devices do not really need to know */ features &= ~(1ull << VIRTIO_NET_F_CTRL_VQ); + /* Also disable features which depend on VIRTIO_NET_F_CTRL_VQ */ + features &= ~(1ull << VIRTIO_NET_F_CTRL_RX); + features &= ~(1ull << VIRTIO_NET_F_CTRL_VLAN); + features &= ~(1ull << VIRTIO_NET_F_CTRL_MAC_ADDR); features &= ~(1ull << VIRTIO_NET_F_STATUS); ret = dev->ops->send_request(dev, VHOST_USER_SET_FEATURES, &features); if (ret < 0) @@ -488,6 +492,11 @@ virtio_user_handle_ctrl_msg(struct virtio_user_dev *dev, struct vring *vring, queues = *(uint16_t *)(uintptr_t)vring->desc[idx_data].addr; status = virtio_user_handle_mq(dev, queues); } + /* Server mode can't enable queue pairs if vhostfd is not connected, + * we suppose that status always returns 0 in this case. + * / + if (dev->is_server && dev->vhostfd < 0) + status = 0; /* Update status */ *(virtio_net_ctrl_ack *)(uintptr_t)vring->desc[idx_status].addr = status; -- 2.14.3