From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 79D12A04A3; Mon, 4 Nov 2019 03:34:44 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C9613374E; Mon, 4 Nov 2019 03:34:43 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 23F9D3576 for ; Mon, 4 Nov 2019 03:34:41 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Nov 2019 18:34:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,265,1569308400"; d="scan'208";a="204473347" Received: from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.142]) by orsmga003.jf.intel.com with ESMTP; 03 Nov 2019 18:34:39 -0800 From: Marvin Liu To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com, amorenoz@redhat.com Cc: dev@dpdk.org, Marvin Liu Date: Mon, 4 Nov 2019 18:13:22 +0800 Message-Id: <20191104101322.53017-1-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191030145602.1948-1-yong.liu@intel.com> References: <20191030145602.1948-1-yong.liu@intel.com> Subject: [dpdk-dev] [PATCH v4] vhost: fix vhost user virtqueue not accessible X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Log feature is disabled in vhost user, so that log address was invalid when checking. Check whether log address is valid can work around it. Log address should also be translated in packed ring virtqueue. Fixes: 04cfc7fdbfca ("vhost: translate incoming log address to gpa") Signed-off-by: Marvin Liu --- lib/librte_vhost/vhost_user.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 61ef699ac..09e241305 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -641,11 +641,21 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index) struct vhost_vring_addr *addr = &vq->ring_addrs; uint64_t len, expected_len; + if (addr->flags & (1 << VHOST_VRING_F_LOG)) { + vq->log_guest_addr = + translate_log_addr(dev, vq, addr->log_guest_addr); + if (vq->log_guest_addr == 0) { + RTE_LOG(DEBUG, VHOST_CONFIG, + "(%d) failed to map log_guest_addr.\n", + dev->vid); + return dev; + } + } + if (vq_is_packed(dev)) { len = sizeof(struct vring_packed_desc) * vq->size; vq->desc_packed = (struct vring_packed_desc *)(uintptr_t) ring_addr_to_vva(dev, vq, addr->desc_user_addr, &len); - vq->log_guest_addr = 0; if (vq->desc_packed == NULL || len != sizeof(struct vring_packed_desc) * vq->size) { @@ -741,14 +751,6 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index) vq->last_avail_idx = vq->used->idx; } - vq->log_guest_addr = - translate_log_addr(dev, vq, addr->log_guest_addr); - if (vq->log_guest_addr == 0) { - RTE_LOG(DEBUG, VHOST_CONFIG, - "(%d) failed to map log_guest_addr .\n", - dev->vid); - return dev; - } vq->access_ok = 1; VHOST_LOG_DEBUG(VHOST_CONFIG, "(%d) mapped address desc: %p\n", -- 2.17.1