Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4699659imm; Wed, 30 May 2018 10:12:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL3PSZ25xQiPRZww85lMEhuQsaMwo4t7+Tlss5xDVQe72+Ssf3LroYi+47BU+fJW5oyGv+h X-Received: by 2002:a63:6e4f:: with SMTP id j76-v6mr2823030pgc.16.1527700363078; Wed, 30 May 2018 10:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527700363; cv=none; d=google.com; s=arc-20160816; b=Mlq5kwVbvliyPGktdf3Ru1zldw//OgNmp759RLIhpgNOHICgM2IiqjOhlXYS0rNj48 TDX0VtuWhiejZlN/b8j/CM+DrczhI8gaXlegEcCd/KHaMO5VaXK0OSoTtuYvi66uMbF3 Wtgj/s3OdFI6JkQZdbL41ebhaHahNUqaEFsKpz3K3cLwxVhrXKnyXx2DQ4e/jdO7/0Yz OTVSsNUVZpug4x/22MyNyZFAnNMZv6ifVMDCSFYoGfqvdvOzNeZAD2k2XCCWppf0IRZy R+ftMAYeqvVqoclnc1j/TscqGPN2PnGIL54SRQhp3a3WJlWbAVtaQ5d2ehusA18cLWDY DLHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:arc-authentication-results; bh=5DSQBf6r7wkkOxitiRM4yapnZipIvHQR4pZwoMbGGhw=; b=E4Z3uqVFZmCqf57bnaHeZNRQ6CUG/PZiodRo7qPOuNd3dLzQlD3b9/htUOFWGfKwLb dHVxe5+zC/7KxbyQH30RJ3+p64Lkxg9QWTat+pdX3h+JbdHbGdksWwZ+XjIClcsW61c/ fziXuSfvg949Nx+62LdJvFdy3DQemKGsHFmHEoUSWZSXBbK2fcTGuKT5adcTchsXgMtz A0VQjCixURYDUJd28RbC0I8cdOXuo2GaeM7nPvjtf3RXEUgodsFujbrerxNZpy+gt/hO fW1cNYBewsWrVSw4rnMMRSfnwyjfDbrlq7cdexUPMArgpruOXtDg81XDHFOVpXOL9gKL d/SQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9-v6si34413657pli.427.2018.05.30.10.12.26; Wed, 30 May 2018 10:12:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753617AbeE3RLy (ORCPT + 99 others); Wed, 30 May 2018 13:11:54 -0400 Received: from mga06.intel.com ([134.134.136.31]:32074 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752980AbeE3RLv (ORCPT ); Wed, 30 May 2018 13:11:51 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 May 2018 10:11:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,461,1520924400"; d="asc'?scan'208";a="59864784" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by fmsmga001.fm.intel.com with ESMTP; 30 May 2018 10:11:50 -0700 Received: from orsmsx101.amr.corp.intel.com ([169.254.8.86]) by ORSMSX103.amr.corp.intel.com ([169.254.5.63]) with mapi id 14.03.0319.002; Wed, 30 May 2018 10:11:49 -0700 From: "Rustad, Mark D" To: "Duyck, Alexander H" CC: "mst@redhat.com" , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "virtio-dev@lists.oasis-open.org" , "Daly, Dan" , "Bie, Tiwei" , "linux-pci@vger.kernel.org" , "bhelgaas@google.com" , "Liang, Cunming" , "Wang, Zhihong" Subject: Re: [PATCH] virtio_pci: support enabling VFs Thread-Topic: [PATCH] virtio_pci: support enabling VFs Thread-Index: AQHT+DJkllI7MbkD40qnnyH4gxudsqRI78oAgAAC8ICAAATBAA== Date: Wed, 30 May 2018 17:11:37 +0000 Message-ID: <5063D90B-7955-4F1E-85A2-D8AFD661ACB7@intel.com> References: <20180530085521.26583-1-tiwei.bie@intel.com> <20180530192010-mutt-send-email-mst@kernel.org> <414C18B1-30FA-4AC0-B47D-F0FBF9832737@intel.com> <1527699273.29907.2.camel@intel.com> In-Reply-To: <1527699273.29907.2.camel@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.233.80.164] Content-Type: multipart/signed; boundary="Apple-Mail=_79A5F5B5-3E24-4259-A6B1-321A0585332D"; protocol="application/pgp-signature"; micalg=pgp-sha256 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Apple-Mail=_79A5F5B5-3E24-4259-A6B1-321A0585332D Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii; delsp=yes; format=flowed On May 30, 2018, at 9:54 AM, Duyck, Alexander H wrote: > On Wed, 2018-05-30 at 09:44 -0700, Rustad, Mark D wrote: >> On May 30, 2018, at 9:22 AM, Michael S. Tsirkin wrote: >> >>>> +static int virtio_pci_sriov_configure(struct pci_dev *pci_dev, int >>>> num_vfs) >>>> +{ >>>> + struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); >>>> + struct virtio_device *vdev = &vp_dev->vdev; >>>> + int (*sriov_configure)(struct pci_dev *pci_dev, int num_vfs); >>>> + >>>> + if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK)) >>>> + return -EBUSY; >>>> + >>>> + if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV)) >>>> + return -EINVAL; >>>> + >>>> + sriov_configure = pci_sriov_configure_simple; >>>> + if (sriov_configure == NULL) >>>> + return -ENOENT; >>> >>> BTW what is all this trickery in aid of? >> >> When SR-IOV support is not compiled into the kernel, >> pci_sriov_configure_simple is #defined as NULL. This allows it to compile >> in that case, even though there is utterly no way for it to be called in >> that case. It is an alternative to #ifs in the code. > > Why even have the call though? I would wrap all of this in an #ifdef > and strip it out since you couldn't support SR-IOV if it isn't present > in the kernel anyway. I am inclined to agree. In this case, the presence of #ifdefs I think would be clearer. As written, someone will want to get rid of the pointer only to create a build problem when SR-IOV is not configured. -- Mark Rustad, Networking Division, Intel Corporation --Apple-Mail=_79A5F5B5-3E24-4259-A6B1-321A0585332D Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEE6ug8b0Wg+ULmnksNPA7/547j7m4FAlsO20gACgkQPA7/547j 7m6sgA//aFVQG9ccnLqmx0UcGSLODSICO8nOjKH5F9TnF3JLAawh9D23rjyqdZvC MwKssNOkMklZO9i5/2oYs4OaA2Y/prT1ocHZjL5q7gmU8kZIDSJZkbwb83M2p4ov Cq7EHKmoBJssyHPiRG92KCRBpx2df9eIHW0X+FeoWvjTIVcLg2B7D+4hE+u7HsFJ xMDsOCDYUAEI1RK8+IhaLpwFxjUsQGTW152Kg6vY+92JCVcm1U50bywJeyX81i7s eJMOmDFDuwtZbKe59IYQuEHZVTWf/2A4Pgx1tddfzNdpGIhB8+1UQjSBakOqpE2Q b/8CgGNP6MO+qsoy1RX/y/0Gnhr5zKSffDRt0neTmZ77FHltFoZSlshMPEfSpRGH 4SM/HO77OPq29gFVq2Hd5v2h4SAELExSuwIyyU2nFkyPFIR0F3UxZ5lccdAQSuzt /6zaame34yhQdeQuD457GKinAQX+c6sEPaztYN/jVqtPkv3TiJOPS5sMaWtb4Rwk PT8EkC/BtIyO1gsLcrNwrzZAQKmkq7OajiD8dtwboGN0uPTKm7/eTB3A/UdKB+XL BU5wg8Hw6uL/dsjFvkqBZYml88bDPKqz2TjnqS/MI6oJdPsZI68IlHaSvQHK1HPU hnnBQfDp878SQrSsA+mWe+eHc/YIj87DM/A/eVBLfTor5pnUcJM= =oOs9 -----END PGP SIGNATURE----- --Apple-Mail=_79A5F5B5-3E24-4259-A6B1-321A0585332D--