From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6ABADA0548; Fri, 23 Apr 2021 14:25:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4D27E410EB; Fri, 23 Apr 2021 14:25:53 +0200 (CEST) Received: from proxy.6wind.com (host.78.145.23.62.rev.coltfrance.com [62.23.145.78]) by mails.dpdk.org (Postfix) with ESMTP id A683B410D8; Fri, 23 Apr 2021 14:25:51 +0200 (CEST) Received: from localhost (unknown [10.16.0.39]) by proxy.6wind.com (Postfix) with ESMTP id 8AF8593FF51; Fri, 23 Apr 2021 14:25:51 +0200 (CEST) From: Thierry Herbelot To: dev@dpdk.org Cc: Thierry Herbelot , Thomas Monjalon , Maxime Coquelin , Chenbo Xia , stable@dpdk.org Date: Fri, 23 Apr 2021 14:25:15 +0200 Message-Id: <20210423122515.31078-1-thierry.herbelot@6wind.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/virtio: fix kernel set memory table 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_MEM_TABLE is applied to all vhostfds of the device. Fixes: 539d910c9c768 ("net/virtio: add virtio-user memory tables ops") Cc: stable@dpdk.org Signed-off-by: Thierry Herbelot --- drivers/net/virtio/virtio_user/vhost_kernel.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c index 58e66bb7b4ae..ad46f10a9300 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c @@ -206,6 +206,7 @@ add_memseg_list(const struct rte_memseg_list *msl, void *arg) static int vhost_kernel_set_memory_table(struct virtio_user_dev *dev) { + uint32_t i; struct vhost_kernel_data *data = dev->backend_data; struct vhost_memory_kernel *vm; int ret; @@ -227,9 +228,14 @@ vhost_kernel_set_memory_table(struct virtio_user_dev *dev) if (ret < 0) goto err_free; - ret = vhost_kernel_ioctl(data->vhostfds[0], VHOST_SET_MEM_TABLE, vm); - if (ret < 0) - goto err_free; + for (i = 0; i < dev->max_queue_pairs; ++i) { + if (data->vhostfds[i] < 0) + continue; + + ret = vhost_kernel_ioctl(data->vhostfds[i], VHOST_SET_MEM_TABLE, vm); + if (ret < 0) + goto err_free; + } free(vm); -- 2.29.2