From patchwork Thu Mar 15 18:43:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander H Duyck X-Patchwork-Id: 886400 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NK3Mx1B5"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 402HY73m5Kz9sVc for ; Fri, 16 Mar 2018 05:43:39 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752846AbeCOSn1 (ORCPT ); Thu, 15 Mar 2018 14:43:27 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:42449 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751492AbeCOSnX (ORCPT ); Thu, 15 Mar 2018 14:43:23 -0400 Received: by mail-pl0-f68.google.com with SMTP id w15-v6so4310538plq.9; Thu, 15 Mar 2018 11:43:23 -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=TEK7dPkTHqB0InxJgaJl6IL0oelo9Pewrxa6mpabK9c=; b=NK3Mx1B50X++EEeY91jd0gMSGtqtkE6Loes6ICvP81GW+VUT4ZVBMfLZfez1kZ0YCI Gvjvdqlu7cSEpJkzv29THHsdVL8tOaA4kBmYsiyQKzrFV3c37hYO5wDkjJBVTseu1OYS 3cZDGxXvs81wLntKbN+QHFhHNuPfKaDXhJITbQi7WJ1QfRpnyi7VrNWr2A2XkeFZDV4o nhxoqyGL1u2tcjmnlqrQ48pm9gCdXlvtjnpuDHG086seHpSzpOIuA6laj5LYGvWEgx2s Yt8p3m+gV/4b1J6oc0pRbUcZ8VIt0uOgj3uGyX+nTp0eA76XUbZmKGMylV6NvukBtmfP Y5gg== 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=TEK7dPkTHqB0InxJgaJl6IL0oelo9Pewrxa6mpabK9c=; b=gmuoGD6FK8JS8STa696e9AbwPHKXyatwHql48FI273CVooyY1AsmmJ3dfmNPXleYKB R90e62DsFLUJ39gLfe+vW33JdEtluK6r1Gtw9rdDZ0Lwm6iZngh1HdZVpRhWG2SmWyDT LzBwch+DuMYcVIgjYvVs6CeTbz4etUNfuiruu7cqpytVcPJyLpyB9LCzjf4OaqZIYxwK WtSc5flx2DAEm1zITHIpRCs/nUqKz31f/9TjckozUYBFbS5UXM10RKV/dxtj3hAVa3LX 9O/uO9VDf5C0X3gxq1yJpOeqq3UwGOZZj9INbEXKqn8wddCnuoqqnPgwxUd/0Fjw8yRz LYIA== X-Gm-Message-State: AElRT7F1fTFSp6uN2bqyxk2BuMhA1MS7XZsXerTYIeC/hT2CKLb202Wq +B+UALbiqwCKpMfXbtQ+mUo= X-Google-Smtp-Source: AG47ELu0y4WpigheX3hANdffs0jN0zLhlkC7vKRNkiQbUgmiD4rQWuPEsqxMLfGG1uvZvc/SjGE41g== X-Received: by 2002:a17:902:858c:: with SMTP id e12-v6mr9314736plo.39.1521139403045; Thu, 15 Mar 2018 11:43:23 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id c15sm11616649pfm.114.2018.03.15.11.43.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 11:43:22 -0700 (PDT) Subject: [pci PATCH v7 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: Thu, 15 Mar 2018 11:43:21 -0700 Message-ID: <20180315184248.3102.16810.stgit@localhost.localdomain> In-Reply-To: <20180315183449.3102.64791.stgit@localhost.localdomain> References: <20180315183449.3102.64791.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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 v7: No change 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)