linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sathya Perla <sathya.perla@emulex.com>
To: <linux-pci@vger.kernel.org>, <netdev@vger.kernel.org>
Cc: <ariel.elior@qlogic.com>, <linux.nics@intel.com>,
	<shahed.shaikh@qlogic.com>, <ddutile@redhat.com>
Subject: [PATCH 1/4] pci: move pci_assivned_vfs() check while disabling VFs to pci sub-system
Date: Mon, 10 Nov 2014 17:23:27 +0530	[thread overview]
Message-ID: <1415620410-4937-2-git-send-email-sathya.perla@emulex.com> (raw)
In-Reply-To: <1415620410-4937-1-git-send-email-sathya.perla@emulex.com>

From: Vasundhara Volam <vasundhara.volam@emulex.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@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.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


  reply	other threads:[~2014-11-10 11:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-10 11:53 [PATCH 0/4] move pci_assivned_vfs() check (while disabling VFs) to pci sub-system Sathya Perla
2014-11-10 11:53 ` Sathya Perla [this message]
2014-11-10 11:53 ` [PATCH 2/4] bnx2x: remove pci_assigned_vfs() check while disabling VFs Sathya Perla
2014-11-10 11:53 ` [PATCH 3/4] i40e: " Sathya Perla
2014-11-11 13:52   ` Jeff Kirsher
2014-11-10 11:53 ` [PATCH 4/4] qlcnic: " Sathya Perla
2014-11-11 19:09 ` [PATCH 0/4] move pci_assivned_vfs() check (while disabling VFs) to pci sub-system Don Dutile
2014-11-11 20:39   ` Alex Williamson
2014-11-13  7:04     ` Sathya Perla
2014-11-13 21:36       ` Don Dutile
2014-11-20 22:21 ` Bjorn Helgaas
2014-11-20 22:42   ` [linux-nics] " Jeff Kirsher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415620410-4937-2-git-send-email-sathya.perla@emulex.com \
    --to=sathya.perla@emulex.com \
    --cc=ariel.elior@qlogic.com \
    --cc=ddutile@redhat.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux.nics@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=shahed.shaikh@qlogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).