From patchwork Tue Mar 13 21:30:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 10280881 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2ECF4601A0 for ; Tue, 13 Mar 2018 21:30:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2225E28574 for ; Tue, 13 Mar 2018 21:30:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20B772856F; Tue, 13 Mar 2018 21:30:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C635285D3 for ; Tue, 13 Mar 2018 21:30:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932574AbeCMVac (ORCPT ); Tue, 13 Mar 2018 17:30:32 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:39908 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932277AbeCMVaa (ORCPT ); Tue, 13 Mar 2018 17:30:30 -0400 Received: by mail-pl0-f65.google.com with SMTP id s13-v6so556996plq.6; Tue, 13 Mar 2018 14:30:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=qTc1wktVoS9J/ugQsWcIQPJBGh9JAXNZszzk7xjQdZI=; b=Ft+7Eu1xNbarFcDHi5riHaKNVE5GaMvj5JEhX73JYJNERd5fkQRfaWsrssE8+r7LeQ pibPymcuD4DLNIhtsY7GY3mNFniVlAsYTuJkj6DTJEs78UmgUhT7p6PD3ITX7r7kVUlW SmUvX8ulWIKLt/LYHms5CBbnKSlkoVf/x0GZVOKv2NsMeKXV1aVcOhsMH360CfSnidAi mUEpKAJbF+aP859zkCtCrcRXLHczilg9vIFnOm4Ch9zJIFZ/U9IgtI80F8/ve8tegWSS 2ZaDjfoVBoZTSzCcGswSyTLot/L+Lyabb03quo2NrspfcZXFmn7haf+VTjl4pliD890l 1Dcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=qTc1wktVoS9J/ugQsWcIQPJBGh9JAXNZszzk7xjQdZI=; b=ZmzQRbn4mbYoDs9L9dO6sD/1zGeGx5vRkr5/0EJGNfdor7lsSRiwv0uPBdV9VnIBUk EcC2HE3N09n5CsM5YPdCoUYloAEv7SO9ClU4y19O5p+yW7lsjMLMbU2GTxwy3efaeYkw Fuc12+GDw9zJVgsHsTu4sBCl8NaJYv0reaJicCrT8Js4bHrKizvnEDs/SEw4itxoWAQz /pBO+3dYQzdBq4CrusTgcckcXUvmem3U/dH8ih+8o3TKsEoIK/HhfMmY7Ct6eGKtQhhL PCy9PCsQ3zyINv7JvS7QJ8ANi05yGNMU9fq+ENc3HWumHQWizCwWfyNJ0+v52T0b7wTO 5kzQ== X-Gm-Message-State: AElRT7GxD9Sfkqi8z6avjk4WIMKLNGa88o5G7IB3c8e2+lMwYy/pTSez ojQ1wIPE5p5Y8RNal2NhlYY= X-Google-Smtp-Source: AG47ELsebVaz2uczpHI2uGQaVJ61kmw4OtJLwKeMAVosF1IAr2d5BgVVMwDg8ahcdlZLZyEnVzlh3w== X-Received: by 2002:a17:902:b901:: with SMTP id bf1-v6mr1803062plb.175.1520976629898; Tue, 13 Mar 2018 14:30:29 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id b9sm2006558pff.13.2018.03.13.14.30.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Mar 2018 14:30:29 -0700 (PDT) Subject: [pci PATCH v6 3/5] ena: Migrate over to unmanaged SR-IOV support From: Alexander Duyck To: bhelgaas@google.com, alexander.h.duyck@intel.com, linux-pci@vger.kernel.org Cc: virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org, netdev@vger.kernel.org, dan.daly@intel.com, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, keith.busch@intel.com, netanel@amazon.com, ddutile@redhat.com, mheyne@amazon.de, liang-min.wang@intel.com, mark.d.rustad@intel.com, dwmw2@infradead.org, hch@lst.de, dwmw@amazon.co.uk Date: Tue, 13 Mar 2018 14:30:28 -0700 Message-ID: <20180313212955.3553.16026.stgit@localhost.localdomain> In-Reply-To: <20180313212508.3553.65326.stgit@localhost.localdomain> References: <20180313212508.3553.65326.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alexander Duyck Instead of implementing our own version of a SR-IOV configuration stub in the ena driver we can just reuse the existing pci_sriov_configure_simple function. Signed-off-by: Alexander Duyck --- v5: Replaced call to pci_sriov_configure_unmanaged with pci_sriov_configure_simple v6: Dropped "#ifdef" checks for IOV wrapping sriov_configure definition drivers/net/ethernet/amazon/ena/ena_netdev.c | 28 +------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index 6975150d144e..6054deb1e6aa 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -3385,32 +3385,6 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } /*****************************************************************************/ -static int ena_sriov_configure(struct pci_dev *dev, int numvfs) -{ - int rc; - - if (numvfs > 0) { - rc = pci_enable_sriov(dev, numvfs); - if (rc != 0) { - dev_err(&dev->dev, - "pci_enable_sriov failed to enable: %d vfs with the error: %d\n", - numvfs, rc); - return rc; - } - - return numvfs; - } - - if (numvfs == 0) { - pci_disable_sriov(dev); - return 0; - } - - return -EINVAL; -} - -/*****************************************************************************/ -/*****************************************************************************/ /* ena_remove - Device Removal Routine * @pdev: PCI device information struct @@ -3525,7 +3499,7 @@ static int ena_resume(struct pci_dev *pdev) .suspend = ena_suspend, .resume = ena_resume, #endif - .sriov_configure = ena_sriov_configure, + .sriov_configure = pci_sriov_configure_simple, }; static int __init ena_init(void)