From patchwork Thu Mar 8 19:03:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 10268705 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 D17336037E for ; Thu, 8 Mar 2018 19:05:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C19E229A97 for ; Thu, 8 Mar 2018 19:05:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B342029A99; Thu, 8 Mar 2018 19:05:03 +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 32DD929A97 for ; Thu, 8 Mar 2018 19:05:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755696AbeCHTD7 (ORCPT ); Thu, 8 Mar 2018 14:03:59 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:54102 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752173AbeCHTD4 (ORCPT ); Thu, 8 Mar 2018 14:03:56 -0500 Received: by mail-it0-f66.google.com with SMTP id w63so8864641ita.3; Thu, 08 Mar 2018 11:03:56 -0800 (PST) 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=9Y6oDAvHJlfS0Xa1fnoGFygeBb0OpuRExdEw30SHGg0=; b=tsx7b0sZntOFi0YQew5eqj9m8qLu1DJ4oxgOqT0D1z9ZLe4mjK/VYrIfl0iGTEKKKY uQ6D+TW8vzzTDPBvoDbtqIDh3ON8p38iyEBdp+OLZcBUlFh4x03ln4dy/gcbYbPSPh7D x5Mj/zj5Jk1VBbUj/65LHi6gFJcVsKumcb2sP5T3IYZ1kaVu0S0ay6s5uoOxyhsBiRse UvWfP2oGiDvUn7KkeV1dv8nSaSaH9ey9m+RnYaYRIdYWYVE2sP8gZwEIX1iE3alHqUsk RJWue7ggL2wySeqHEJSfmpBSKee3uOP4+bOMvZq4D7HT6Vnq/Do0aRB2WWKEF5XDbtOT LFdw== 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=9Y6oDAvHJlfS0Xa1fnoGFygeBb0OpuRExdEw30SHGg0=; b=YWnONhsa6j6IPsWxMXB7vxyrU834yfNCF55czvC9fBcgjH5HlIozBdpqI1dxx0I9nR Fy9kcewtWWc19t2pGsN6sc+cU5w3hN/DsMkY6kIpa6r5Zjz2TAL48i4BQL2eMf4eS1tl Ooy7z12jz2wVWuAEPs3LFdtx55MKhLeq7za3nk+DboBADDgH94NvHfYACEocbeAQJNF8 O0dIv4IVWJSe5NIHPS5o7m2zLyHKdkZ4IlooB4xb8ln/5J74V+0IP4hRTNCEdSc56cq5 P8WKdd0kPsmti1+m8wUqtXXH1RBCHGq9eVV9wN7E0IuTDJa8TumNO7p6SS4hFtVQsxes YS1A== X-Gm-Message-State: AElRT7EGVHXh7obbD4PVbCC2Vrja5vNXlTx9d5mqAfp7pZqHS5YkBTRv 43Q9DN4T4fTIoqmpBTD4HSU= X-Google-Smtp-Source: AG47ELu0SrT4yoxxuJL7upyjez3F1Vqw2UL41COPTSIHwTrSEuTZ+Mabpc3AFOTv321iLEGNk+Ug6A== X-Received: by 10.36.118.79 with SMTP id z76mr27743309itb.10.1520535835907; Thu, 08 Mar 2018 11:03:55 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id v76sm11386557itb.41.2018.03.08.11.03.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Mar 2018 11:03:55 -0800 (PST) Subject: [pci PATCH v4 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: Thu, 08 Mar 2018 11:03:53 -0800 Message-ID: <20180308190349.5433.8420.stgit@localhost.localdomain> In-Reply-To: <20180308185507.5433.98830.stgit@localhost.localdomain> References: <20180308185507.5433.98830.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_unmanaged function. Signed-off-by: Alexander Duyck --- 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..fa708dd86c96 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_unmanaged, +#endif }; static int __init ena_init(void)