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 8D457A32A2 for ; Fri, 25 Oct 2019 10:40:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1EBCC1C10B; Fri, 25 Oct 2019 10:40:56 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 167C21C0CD for ; Fri, 25 Oct 2019 10:40:53 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2019 01:40:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,228,1569308400"; d="scan'208";a="282199870" Received: from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.142]) by orsmga001.jf.intel.com with ESMTP; 25 Oct 2019 01:40:51 -0700 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: Sat, 26 Oct 2019 00:20:42 +0800 Message-Id: <20191025162042.71687-1-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] vhost: fix vhost user virtqueue not accessable 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. Add feature bit check can skip useless address check. Fixes: 04cfc7fdbfca ("vhost: translate incoming log address to gpa") Signed-off-by: Marvin Liu --- lib/librte_vhost/vhost_user.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 61ef699ac..0407fdc29 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -741,13 +741,15 @@ 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; + if (dev->features & (1ULL << VHOST_F_LOG_ALL)) { + 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; -- 2.17.1