From patchwork Thu Apr 8 12:37:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Herbelot X-Patchwork-Id: 90882 X-Patchwork-Delegate: ferruh.yigit@amd.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 8C576A0579; Thu, 8 Apr 2021 14:37:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75D42140F7E; Thu, 8 Apr 2021 14:37:51 +0200 (CEST) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by mails.dpdk.org (Postfix) with ESMTP id E1FE740138 for ; Thu, 8 Apr 2021 14:37:50 +0200 (CEST) Received: from localhost (unknown [10.16.0.39]) by proxy.6wind.com (Postfix) with ESMTP id C8EA891E82A; Thu, 8 Apr 2021 14:37:50 +0200 (CEST) From: Thierry Herbelot To: dev@dpdk.org Cc: Thierry Herbelot , Thomas Monjalon , Maxime Coquelin , Chenbo Xia Date: Thu, 8 Apr 2021 14:37:29 +0200 Message-Id: <20210408123729.9884-1-thierry.herbelot@6wind.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] net/virtio: fix vhost_kernel_set_owner for multi-queue devices 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 Sender: "dev" Restore the original code, where VHOST_SET_OWNER is applied to all vhostfds of the device. Fixes: 06856cabb89b0 ("net/virtio: add virtio-user ops to set owner") Cc: Maxime Coquelin Cc: Chenbo Xia Signed-off-by: Thierry Herbelot Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_user/vhost_kernel.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c index 768db55a6c1f..58e66bb7b4ae 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c @@ -101,9 +101,20 @@ vhost_kernel_ioctl(int fd, uint64_t request, void *arg) static int vhost_kernel_set_owner(struct virtio_user_dev *dev) { + int ret; + uint32_t i; struct vhost_kernel_data *data = dev->backend_data; - return vhost_kernel_ioctl(data->vhostfds[0], VHOST_SET_OWNER, NULL); + for (i = 0; i < dev->max_queue_pairs; ++i) { + if (data->vhostfds[i] < 0) + continue; + + ret = vhost_kernel_ioctl(data->vhostfds[i], VHOST_SET_OWNER, NULL); + if (ret < 0) + return ret; + } + + return 0; } static int