From patchwork Tue Oct 11 02:54:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Chen X-Patchwork-Id: 117869 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7830CA0544; Tue, 11 Oct 2022 04:54:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5ADD640F19; Tue, 11 Oct 2022 04:54:43 +0200 (CEST) Received: from out28-195.mail.aliyun.com (out28-195.mail.aliyun.com [115.124.28.195]) by mails.dpdk.org (Postfix) with ESMTP id 2A27E40146 for ; Tue, 11 Oct 2022 04:54:40 +0200 (CEST) X-Alimail-AntiSpam: AC=CONTINUE; BC=0.1190512|-1; CH=green; DM=|CONTINUE|false|; DS=CONTINUE|ham_system_inform|0.0140768-0.00106618-0.984857; FP=0|0|0|0|0|-1|-1|-1; HT=ay29a033018047187; MF=chenh@yusur.tech; NM=1; PH=DS; RN=5; RT=5; SR=0; TI=SMTPD_---.PYnKecD_1665456876; Received: from hao-VirtualBox..(mailfrom:chenh@yusur.tech fp:SMTPD_---.PYnKecD_1665456876) by smtp.aliyun-inc.com; Tue, 11 Oct 2022 10:54:37 +0800 From: Hao Chen To: maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: dev@dpdk.org, houyl@yusur.tech, zy@yusur.tech Subject: [PATCH v2] vhost: enable CONFIG feature for vdpa Date: Tue, 11 Oct 2022 10:54:35 +0800 Message-Id: <20221011025435.3769-1-chenh@yusur.tech> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Enable this feature, so that libvirt or qemu can call vdpa vendor driver's ops '.get_config' through 'vhost_net_get_config' to get the mac address of the vdpa hardware without manual configuration. v1->v2: Move VHOST_USER_PROTOCOL_F_CONFIG from VHOST_USER_PROTOCOL_FEATURES to function 'rte_vhost_driver_get_protocol_features'. Signed-off-by: Hao Chen --- lib/vhost/socket.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c index a8df2d484a..df8f26a5bd 100644 --- a/lib/vhost/socket.c +++ b/lib/vhost/socket.c @@ -808,6 +808,10 @@ rte_vhost_driver_get_protocol_features(const char *path, *protocol_features = vsocket->protocol_features & vdpa_protocol_features; + /* Get the unique features of vdpa */ + if (vdpa_protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_CONFIG)) + *protocol_features |= (1ULL << VHOST_USER_PROTOCOL_F_CONFIG); + unlock_exit: pthread_mutex_unlock(&vhost_user.mutex); return ret;