From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30FB9C433B4 for ; Mon, 19 Apr 2021 03:17:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11E5761077 for ; Mon, 19 Apr 2021 03:17:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237434AbhDSDSX (ORCPT ); Sun, 18 Apr 2021 23:18:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34164 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237333AbhDSDSV (ORCPT ); Sun, 18 Apr 2021 23:18:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618802272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kqu7b/R1y+iNn3LQCUv3CxvSNt0vkP4D2ZFqD/1uXRc=; b=IxWSyDOMJVwQqOYMVmdEIaPDly0hX/iA3MWk6/udM0uML7QlZvnut2yJFHM1QUSCDTDh1X UEqBqyY0L4qWAjJk+FzHDL6kPxbdn4Ikh6124UdmNAWjm1U8PD/CtzMdPzkdsc2Ap2p0pQ A8r+uqENDA8qnePVRHFDHRo0yJpmzCs= 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-327-yl9jzV4EMmCooe1ydXK_hg-1; Sun, 18 Apr 2021 23:17:50 -0400 X-MC-Unique: yl9jzV4EMmCooe1ydXK_hg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 741A5100A605; Mon, 19 Apr 2021 03:17:49 +0000 (UTC) Received: from wangxiaodeMacBook-Air.local (ovpn-12-157.pek2.redhat.com [10.72.12.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13C0519C66; Mon, 19 Apr 2021 03:17:41 +0000 (UTC) Subject: Re: [PATCH V3 3/3] vDPA/ifcvf: get_config_size should return dev specific config size To: Zhu Lingshan , mst@redhat.com, lulu@redhat.com, sgarzare@redhat.com Cc: virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210416071628.4984-1-lingshan.zhu@intel.com> <20210416071628.4984-4-lingshan.zhu@intel.com> From: Jason Wang Message-ID: Date: Mon, 19 Apr 2021 11:17:40 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <20210416071628.4984-4-lingshan.zhu@intel.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ÔÚ 2021/4/16 ÏÂÎç3:16, Zhu Lingshan дµÀ: > get_config_size() should return the size based on the decected > device type. > > Signed-off-by: Zhu Lingshan Acked-by: Jason Wang > --- > drivers/vdpa/ifcvf/ifcvf_main.c | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c > index 376b2014916a..3b6f7862dbb8 100644 > --- a/drivers/vdpa/ifcvf/ifcvf_main.c > +++ b/drivers/vdpa/ifcvf/ifcvf_main.c > @@ -356,7 +356,24 @@ static u32 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev) > > static size_t ifcvf_vdpa_get_config_size(struct vdpa_device *vdpa_dev) > { > - return sizeof(struct virtio_net_config); > + struct ifcvf_adapter *adapter = vdpa_to_adapter(vdpa_dev); > + struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); > + struct pci_dev *pdev = adapter->pdev; > + size_t size; > + > + switch (vf->dev_type) { > + case VIRTIO_ID_NET: > + size = sizeof(struct virtio_net_config); > + break; > + case VIRTIO_ID_BLOCK: > + size = sizeof(struct virtio_blk_config); > + break; > + default: > + size = 0; > + IFCVF_ERR(pdev, "VIRTIO ID %u not supported\n", vf->dev_type); > + } > + > + return size; > } > > static void ifcvf_vdpa_get_config(struct vdpa_device *vdpa_dev,