Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4673302imm; Wed, 30 May 2018 09:45:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIqfn6NyFxcmiQr4qlrj2Suld9J2iaiFZqjYqZtD58w6wQUAFas+fXrUbKCFnHvRG7zzmDo X-Received: by 2002:a17:902:4c88:: with SMTP id b8-v6mr3476051ple.285.1527698717840; Wed, 30 May 2018 09:45:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527698717; cv=none; d=google.com; s=arc-20160816; b=dnJm6XgJX56zX5nFP9UOxiJiBnSY7rQC11xzkRLrAd7ThwRC10GIn0RQc5AmqlCPZy ZEoeF/JWxS1aARNGyTqkJbGQhfhNOO+f25flTc9igpNRodH58JmFgpJl4n8WHVzESbpk hPK9Y8qLkEHzMF5TyWUhCLEyCSe1XqQZiDZt0Qp2rLfmDM/Tluv3bfTYHUDv/VuMtBOZ c18V1ur7JDpUL9mRH3s+ET3xA7uRqgqF0/4Okzk9DSgWTNi6nqDzCiRl/Yi8F1dSrO/S /WwFPR58X8WFzwqyuW8mzCjz71CpMl2ZfNwd7G4z50QiXNZ6K9Q/xHseHnTZY/vM8vg/ w2zw== 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=cnjl8QcaoJlxnwle322mv5NBGv4MAggSJCCjjy5gQhA=; b=JHoyoNr6d7aPfLdPJO+JWOO28nkV2j312mdzyOqncR5RLWfwOETS+x+pqk7bspylrL 7LosnlV72oE8z/l3uYOOLxlSoJZMmJ8/PIztawdYejw9Q6yzAAw8SPSSRSSGdRJkGQMg il9BfbUM31iqbNkKPXc3AE6EnPvptJ72MAPwKkzhbXEv+8UcMUO7esl/1qyMYDhZt2K0 LJUPUfCzTmy9QdkQ4s53ys3KsGNqADrb47fyD5vRApA9UY8ztat2HeC5YG5q2q3FR7o1 OwKW2zImROiZNvpho1dwhf2OAACI25nOS9gnMf48eWTUzYCAMQdgHXNc2Ihnrf7R+24j sQ1A== 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 a8-v6si35953893plm.121.2018.05.30.09.45.03; Wed, 30 May 2018 09:45:17 -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 S1753982AbeE3QoO (ORCPT + 99 others); Wed, 30 May 2018 12:44:14 -0400 Received: from mga17.intel.com ([192.55.52.151]:42031 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753805AbeE3QoJ (ORCPT ); Wed, 30 May 2018 12:44:09 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 May 2018 09:44:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,461,1520924400"; d="asc'?scan'208";a="62936535" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by orsmga002.jf.intel.com with ESMTP; 30 May 2018 09:44:07 -0700 Received: from orsmsx162.amr.corp.intel.com (10.22.240.85) by ORSMSX103.amr.corp.intel.com (10.22.225.130) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 30 May 2018 09:44:07 -0700 Received: from orsmsx101.amr.corp.intel.com ([169.254.8.86]) by ORSMSX162.amr.corp.intel.com ([169.254.3.196]) with mapi id 14.03.0319.002; Wed, 30 May 2018 09:44:07 -0700 From: "Rustad, Mark D" To: "Michael S. Tsirkin" CC: "Bie, Tiwei" , Bjorn Helgaas , "virtualization@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "virtio-dev@lists.oasis-open.org" , "linux-pci@vger.kernel.org" , "Daly, Dan" , "Duyck, Alexander H" , "Liang, Cunming" , "Wang, Zhihong" Subject: Re: [PATCH] virtio_pci: support enabling VFs Thread-Topic: [PATCH] virtio_pci: support enabling VFs Thread-Index: AQHT+DJkllI7MbkD40qnnyH4gxudsqRI78oA Date: Wed, 30 May 2018 16:44:07 +0000 Message-ID: <414C18B1-30FA-4AC0-B47D-F0FBF9832737@intel.com> References: <20180530085521.26583-1-tiwei.bie@intel.com> <20180530192010-mutt-send-email-mst@kernel.org> In-Reply-To: <20180530192010-mutt-send-email-mst@kernel.org> 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=_FB4DAD04-C672-49EE-BC0F-E8F33D4948E7"; 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=_FB4DAD04-C672-49EE-BC0F-E8F33D4948E7 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii; delsp=yes; format=flowed 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. -- Mark Rustad, Networking Division, Intel Corporation --Apple-Mail=_FB4DAD04-C672-49EE-BC0F-E8F33D4948E7 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/547j7m4FAlsO1NQACgkQPA7/547j 7m7fOBAApqkdKjNkDMyc4Fo/KLviVZCiv3VXJ6ftdR6iQcJPCj4fBJQkHYcs9hoH FUc4GIuo6hFl84OgsbvVDfCQFg0yaO+rZp2lSNjTrEQ+By6Oh4vXe6wCPcu7/sDE IDFR04g3U5dm/HohkQbbcNW/Um/CcBLdHgmJXWpsifNr8j+Au3SafiFbalfv7UFr WUSGPKwCPzGJoGYIia824sWkUI/HdGRrhvxXefnq3DSObrxxX+Hj7lqxgfg7r8c7 CfZ0NmeykKIyuGLHZLyKhOispM3cw9145QiquP8tHVnvxUTqrYNhzMiSZTYqsBY2 VQSGCf+paHgFPIKqJIZpNIAN/A3YKynFZA+qq8XrDr5AT5UA9HrLbe8fheooamV5 r21k4+05AIwDOTV1AlYMHdpzUTNs8SLe5mwNL+4RpvQlKV3Kptv2NFzv13fmSPEo SHcRexSpBP4eSxVOIhW3j64M4aY7vg5MQshD+geqhgA4wVpb6Wqct3GHdnxqSoEt z5wQrQD8jB8glt8HpIrWzMDyp774QKYnqlpddA6U9keUYP1NS5iNMzbCdT2/TZIx s266G3ckoi0E5qs72bEgYSyd2g4yvmLl7vZ+FWJqpypFUE4Dj7cbGXlBu4Ib8haq IZBRPVopLACSRpAl2exZXwnT41mvznompRSHxigfe79w64JHwgM= =kV9d -----END PGP SIGNATURE----- --Apple-Mail=_FB4DAD04-C672-49EE-BC0F-E8F33D4948E7--