From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 30AD4A0350;
	Mon, 29 Jun 2020 16:08:51 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 0168E1BF82;
	Mon, 29 Jun 2020 16:08:44 +0200 (CEST)
Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])
 by dpdk.org (Postfix) with ESMTP id 164B91BF7B
 for <dev@dpdk.org>; Mon, 29 Jun 2020 16:08:41 +0200 (CEST)
Received: from Internal Mail-Server by MTLPINE1 (envelope-from
 matan@mellanox.com) with SMTP; 29 Jun 2020 17:08:39 +0300
Received: from pegasus25.mtr.labs.mlnx. (pegasus25.mtr.labs.mlnx
 [10.210.16.10])
 by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05TE8RgP029797;
 Mon, 29 Jun 2020 17:08:39 +0300
From: Matan Azrad <matan@mellanox.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: dev@dpdk.org, Xiao Wang <xiao.w.wang@intel.com>
Date: Mon, 29 Jun 2020 14:08:17 +0000
Message-Id: <1593439701-136089-3-git-send-email-matan@mellanox.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1593439701-136089-1-git-send-email-matan@mellanox.com>
References: <1593092298-52257-1-git-send-email-matan@mellanox.com>
 <1593439701-136089-1-git-send-email-matan@mellanox.com>
Subject: [dpdk-dev] [PATCH v3 2/6] vhost: skip access lock when vDPA is
	configured
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

No need to take access lock in the vhost-user message handler when
vDPA driver controls all the data-path of the vhost device.

It allows the vDPA set_vring_state operation callback to configure
guest notifications.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
---
 lib/librte_vhost/vhost_user.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 4e1af91..8d8050b 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2690,8 +2690,10 @@ typedef int (*vhost_message_handler_t)(struct virtio_net **pdev,
 	case VHOST_USER_SEND_RARP:
 	case VHOST_USER_NET_SET_MTU:
 	case VHOST_USER_SET_SLAVE_REQ_FD:
-		vhost_user_lock_all_queue_pairs(dev);
-		unlock_required = 1;
+		if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
+			vhost_user_lock_all_queue_pairs(dev);
+			unlock_required = 1;
+		}
 		break;
 	default:
 		break;
-- 
1.8.3.1