From patchwork Fri May 28 13:20:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Herbelot X-Patchwork-Id: 93541 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 BAB21A0547; Fri, 28 May 2021 15:20:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AC3B540698; Fri, 28 May 2021 15:20:56 +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 3397D40040; Fri, 28 May 2021 15:20:55 +0200 (CEST) Received: from localhost (unknown [10.16.0.39]) by proxy.6wind.com (Postfix) with ESMTP id 15C549C32A5; Fri, 28 May 2021 15:20:55 +0200 (CEST) From: Thierry Herbelot To: dev@dpdk.org Cc: Thierry Herbelot , Thomas Monjalon , stable@dpdk.org, Maxime Coquelin , Chenbo Xia Date: Fri, 28 May 2021 15:20:38 +0200 Message-Id: <20210528132038.26464-1-thierry.herbelot@6wind.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] net/virtio: fix kernel set features 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_FEATURES is applied to all vhostfds of the device. Fixes: cc0151b34dee ("net/virtio: add virtio-user features ops") Cc: stable@dpdk.org 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 ad46f10a9300..d65f89e1fc16 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c @@ -158,6 +158,8 @@ static int vhost_kernel_set_features(struct virtio_user_dev *dev, uint64_t features) { struct vhost_kernel_data *data = dev->backend_data; + uint32_t i; + int ret; /* We don't need memory protection here */ features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM); @@ -166,7 +168,16 @@ vhost_kernel_set_features(struct virtio_user_dev *dev, uint64_t features) features &= ~VHOST_KERNEL_HOST_OFFLOADS_MASK; features &= ~(1ULL << VIRTIO_NET_F_MQ); - return vhost_kernel_ioctl(data->vhostfds[0], VHOST_SET_FEATURES, &features); + for (i = 0; i < dev->max_queue_pairs; ++i) { + if (data->vhostfds[i] < 0) + continue; + + ret = vhost_kernel_ioctl(data->vhostfds[i], VHOST_SET_FEATURES, &features); + if (ret < 0) + return ret; + } + + return 0; } static int