Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2133505pxb; Sun, 18 Apr 2021 20:20:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+1ogwI3SzCmEQUWxK2IVumt+ItNQkWRLvQNUQ2njIpYSTLv2ffF6EIcIFWrIOV4MpCQd+ X-Received: by 2002:a17:906:254f:: with SMTP id j15mr20055716ejb.344.1618802402537; Sun, 18 Apr 2021 20:20:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618802402; cv=none; d=google.com; s=arc-20160816; b=BLUhiJpNu8J3Yg1VGHoowfzk4+9vYhcloD0dsgc44G9rt79M/BlXg4SoCzM+unnqCK 8bGANnFWdBUVVDSSrK8JuJ3O6SCJqyhGcthF0tu0U6xKcEfMgBRLMZZ9RnPEqun7RXuS 4KMgJaR8LTauC9Q72KeIAxihcfDvuHWyuec0OyfQKiOExcQ+60bjW265t388YuU+Cd9X SnOD/hWd1LDn4xSh0jSKKSCnyoiqAX9G8iJ+gsykX9JJxtO7aB2jg8zR5yOCmWiNfmJW LFOzuvCTzCtyLNgya0cFuQiPoKsq0vQb7D//gDunSZWzb0DYh7utkdxO6LKCo90YYC/g p4og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature; bh=kqu7b/R1y+iNn3LQCUv3CxvSNt0vkP4D2ZFqD/1uXRc=; b=Ux0pEzSYP2KRGZUHwin74I33dlNqyQCkmv2Nh47Us98bSsVQm/g07AXN/5gK+fbv1Y NN5kuxW3Y/GDuGNg7HcW0QEsTqDG6QQvi5FOfH3XqqGY+z8sphyhsw5WMqunWSWOcp+o S+mgKZ0TZf11kPoc0Yc4BJiV8v2sbT2TRrtvi50mDikc3xJ35zeECPZeasEf+w/zfI9h FSWp1ytbVIWoM8j758dHeIdvniuUARWoxnCbMYIypY4q0SW9TUCWV408R8+/p4oQNbLN zQus6TB/a8ywTmQR2mEV9g27ftHd9LKRu2wr8r4BnGelHW51OcglXS+geW5FJXAvSj54 zzWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IxWSyDOM; 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 p5si4502433ejl.31.2021.04.18.20.19.39; Sun, 18 Apr 2021 20:20:02 -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=IxWSyDOM; 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 S237427AbhDSDSW (ORCPT + 99 others); Sun, 18 Apr 2021 23:18:22 -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,