Received: by 2002:a9a:45c2:0:b029:115:3f2f:b9e1 with SMTP id r2csp851524lko; Mon, 5 Jul 2021 00:21:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHIBsSIVNwYOHmX/CfohckyZsrLJJZva7Pf9fMP8lN6z3+8o28f8gd/nFvwxPH8jwQ84eA X-Received: by 2002:a92:cda5:: with SMTP id g5mr9708485ild.117.1625469717407; Mon, 05 Jul 2021 00:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625469717; cv=none; d=google.com; s=arc-20160816; b=i8MLSipYAd84eS2veG8gHr2C75ZD8N/QGUrAoEmKJiXu1lHd15BVAZ+O3pHspb3HbD X3LwOlRlANf1CAR2XbWlzs9FD4xA15v5scZQCspLXGIlcXZOQfyVClUrfGnuqMK5YBlU pQuEiaDGwBqy1TKYbvW0F0LyftzVAiTJWp8y1tCupM73QAcvL6T672UPulst5A97PvMV evYSWwOujU5gV8MhevRU5G4yJMsXnryxzyRaRWIYA3lZwCxI40AjaVVW32hOxUgSwJXU N0Nm0kQbgx4mInabXJi7hPqwGP6ivlSEIFxdTdnoE7NSm2Io36RiYnoaxD6vt2+tapQq k6BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AsZSFMJJkoJGWjbavb6OT4THQJwUV8GZhfv+a3hztGw=; b=qCMrMTaoCrBv436eWON3S74Rb4E2PbS3W4zBuKmQTfsm2Rwda8T5oCd7eXJKy+HAeB xI5bhYZ6Urz4h6WVAr63yJig/yQwoX1tG5zrWcr7qrHa4Zs4jzrAClXMdwiL2SvTUoWL rpG9MJfiLEehoVnv083+aJbih4MqLRMIC8/DhJAa3OUUs0XxbIvMDko//pSZQWGWXJgx WL0K4m4zlj1G1YJdp6+oRtFU01hAzlBgEcPGLOJEPp87Thr3N3iYK8Z+fGOEPW4ifdNl bYWZVuBaFSg0QISfhHOWjy6iq91A7swnoHgYemG5hraNYnhbtO44NLNH6pewFpU5yEWq 8KeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BuG0yfRk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w16si4100084jal.57.2021.07.05.00.21.45; Mon, 05 Jul 2021 00:21:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BuG0yfRk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230001AbhGEHWH (ORCPT + 99 others); Mon, 5 Jul 2021 03:22:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23604 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229939AbhGEHWG (ORCPT ); Mon, 5 Jul 2021 03:22:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625469570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AsZSFMJJkoJGWjbavb6OT4THQJwUV8GZhfv+a3hztGw=; b=BuG0yfRk291+TgiriLkxeTmUyY+11wK33rjA0oA/mooeOKlR0qDaMlLXvXcsSDm3//cuKK hm0ablxOxmjtZYlqv9mDAxO4k6FAWHjiTqMEn+c1IM6C5VUHdfucmEsf42dVHLg20/Mi0i OL6DYagAcuXJ373kP6VLED/tIguj8PI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-92-88fkwEcTN6ymt989fu6u9Q-1; Mon, 05 Jul 2021 03:19:28 -0400 X-MC-Unique: 88fkwEcTN6ymt989fu6u9Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B913E79EDC; Mon, 5 Jul 2021 07:19:27 +0000 (UTC) Received: from localhost.localdomain (ovpn-13-21.pek2.redhat.com [10.72.13.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id E95D85D9FC; Mon, 5 Jul 2021 07:19:23 +0000 (UTC) From: Jason Wang To: mst@redhat.com, jasowang@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: netdev@vger.kernel.org, xieyongji@bytedance.com, stefanha@redhat.com Subject: [PATCH 2/2] vdpa: vp_vdpa: don't use hard-coded maximum virtqueue size Date: Mon, 5 Jul 2021 15:19:10 +0800 Message-Id: <20210705071910.31965-2-jasowang@redhat.com> In-Reply-To: <20210705071910.31965-1-jasowang@redhat.com> References: <20210705071910.31965-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch switch to read virtqueue size from the capability instead of depending on the hardcoded value. This allows the per virtqueue size could be advertised. Signed-off-by: Jason Wang --- drivers/vdpa/virtio_pci/vp_vdpa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c index 2926641fb586..198f7076e4d9 100644 --- a/drivers/vdpa/virtio_pci/vp_vdpa.c +++ b/drivers/vdpa/virtio_pci/vp_vdpa.c @@ -18,7 +18,6 @@ #include #include -#define VP_VDPA_QUEUE_MAX 256 #define VP_VDPA_DRIVER_NAME "vp_vdpa" #define VP_VDPA_NAME_SIZE 256 @@ -197,7 +196,10 @@ static void vp_vdpa_set_status(struct vdpa_device *vdpa, u8 status) static u16 vp_vdpa_get_vq_num_max(struct vdpa_device *vdpa, u16 qid) { - return VP_VDPA_QUEUE_MAX; + struct vp_vdpa *vp_vdpa = vdpa_to_vp(vdpa); + struct virtio_pci_modern_device *mdev = &vp_vdpa->mdev; + + return vp_modern_get_queue_size(mdev, qid); } static int vp_vdpa_get_vq_state(struct vdpa_device *vdpa, u16 qid, -- 2.25.1