[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1415620410-4937-2-git-send-email-sathya.perla@emulex.com>
Date: Mon, 10 Nov 2014 17:23:27 +0530
From: Sathya Perla <sathya.perla@...lex.com>
To: <linux-pci@...r.kernel.org>, <netdev@...r.kernel.org>
CC: <ariel.elior@...gic.com>, <linux.nics@...el.com>,
<shahed.shaikh@...gic.com>, <ddutile@...hat.com>
Subject: [PATCH 1/4] pci: move pci_assivned_vfs() check while disabling VFs to pci sub-system
From: Vasundhara Volam <vasundhara.volam@...lex.com>
A user must not be allowed to disable VFs while they are already assigned to
a guest. This check is being made in each individual driver that implements
the sriov_configure PCI method.
This patch fixes this code duplication by moving this check to the
sriov_nuvfs_store() routine just before invoking sriov_configure() when
num_vfs is equal to 0.
Signed-off-by: Vasundhara Volam <vasundhara.volam@...lex.com>
Signed-off-by: Sathya Perla <sathya.perla@...lex.com>
---
drivers/pci/pci-sysfs.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 2c6643f..6e65b47 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -477,6 +477,11 @@ static ssize_t sriov_numvfs_store(struct device *dev,
}
if (num_vfs == 0) {
+ if (pci_vfs_assigned(pdev)) {
+ dev_warn(&pdev->dev, "Cannot disable VFs while they are assigned\n");
+ return -EBUSY;
+ }
+
/* disable VFs */
ret = pdev->driver->sriov_configure(pdev, 0);
if (ret < 0)
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists