From patchwork Mon Mar 12 17:23: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: 10276817 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 E76B8603B5 for ; Mon, 12 Mar 2018 17:24:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4769285A4 for ; Mon, 12 Mar 2018 17:24:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C847A286A4; Mon, 12 Mar 2018 17:24:35 +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 595F5285A4 for ; Mon, 12 Mar 2018 17:24:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932386AbeCLRXf (ORCPT ); Mon, 12 Mar 2018 13:23:35 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:46848 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932525AbeCLRXd (ORCPT ); Mon, 12 Mar 2018 13:23:33 -0400 Received: by mail-pg0-f66.google.com with SMTP id r26so6769922pgv.13; Mon, 12 Mar 2018 10:23:33 -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=yPOrNFIaknCHLL4ErcPDEjpH2V2R0WMcQsgm9ohgL6g=; b=LQBKFcfPAktY2h0QRvVEn35P13m+VsK66BNmJN56Z9mD9v1BRGudbRdtjhs2aMu2Er +D+zhcZ4hFFKS6C98QFA/sXkjQnZNRBxZoTwF1An/eoe3cBt84QiLjaZZDCOayXG8hAG K3DpIUdq7sR0D2jH4vxWpYDL4x03ptG5LelQc1twBw68LADXz1+RV3dt2ErWV0NFx1GM y22hfnFOvaB6GUPi0EVUdZeTxuxscfj1vDzX7o5h3qAN0Hk/MTgqnpgkU7EzfbZtTo2v BJZ5H3XskrMPJQ15vagoKK7wRa4hs2s8prHbyhBQq1G+XV5c4L5Y6auDFEQvWOqZB8wo oZmQ== 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=yPOrNFIaknCHLL4ErcPDEjpH2V2R0WMcQsgm9ohgL6g=; b=nimsck0IyAeTCAAnK7l8HyPXl6ClnozhJbEdeB5pdbDs0nS/serWR1k7Zv5bzBTRfs uPZlHaxdUiFXjozRNp3SawuTQ7B4zlG/BJeZ2gaY2a8cOPhZWHoyIphkgWAzA8ALeHFI zI3PQMVRSSOVv2hrs4Tee+OVoWilok7eYkD8+S9sDvBucLc43CUZTROpWQR78o9P+WeQ 3bLNja/T3gd3MnR1J9Lgcb8vUih3/NBoqPy3mIFyboLIsxoND9dao7W4ut6QcC+RvUpj Lqk/z2Udp2Ih8Vj6aGkRvPE8Z89zdl17TIk4w8cmXyr27Vsyqakw7YaNVzWHKVURkf73 j/1Q== X-Gm-Message-State: AElRT7EmQ2E822FEmJMhHZR7kOHsS2jJrC1EhMYa6pFslAKOFDYlTv0O /sZ39z+IjSrGlnZc+VQuC3o= X-Google-Smtp-Source: AG47ELvLzWh5t9/4BuH9FJ4+iXSzwWqTa8RWGDqm05YAlDt8iZaQB21LuWu51EH5nXmV9aF1xzE3Yw== X-Received: by 10.98.159.85 with SMTP id g82mr8697827pfe.15.1520875412841; Mon, 12 Mar 2018 10:23:32 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id e125sm14282564pgc.76.2018.03.12.10.23.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Mar 2018 10:23:32 -0700 (PDT) Subject: [pci PATCH v5 3/4] 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, mheyne@amazon.de, liang-min.wang@intel.com, mark.d.rustad@intel.com, dwmw2@infradead.org, hch@lst.de, dwmw@amazon.co.uk Date: Mon, 12 Mar 2018 10:23:28 -0700 Message-ID: <20180312172309.3487.76690.stgit@localhost.localdomain> In-Reply-To: <20180312171813.3487.94803.stgit@localhost.localdomain> References: <20180312171813.3487.94803.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 drivers/net/ethernet/amazon/ena/ena_netdev.c | 30 +++----------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index 6975150d144e..868069363bdd 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,9 @@ static int ena_resume(struct pci_dev *pdev) .suspend = ena_suspend, .resume = ena_resume, #endif - .sriov_configure = ena_sriov_configure, +#ifdef CONFIG_PCI_IOV + .sriov_configure = pci_sriov_configure_simple, +#endif }; static int __init ena_init(void)